utest.cpp
Go to the documentation of this file.
00001 /*
00002  * utest.cpp
00003  *
00004  *  Created on: Oct 19, 2010
00005  *      Author: erublee
00006  */
00007 
00008 // Bring in my package's API, which is what I'm testing
00009 #include "pano_core/ModelFitter.h"
00010 // Bring in gtest
00011 #include <gtest/gtest.h>
00012 
00013 #include <iostream>
00014 #include <vector>
00015 using namespace cv;
00016 using namespace pano;
00017 using namespace std;
00018 // Declare a test
00019 TEST(FitterResultTestSuite, Serialization)
00020 {
00021 
00022   FitterResult result;
00023   FileStorage fs("filenode_empty.yml", FileStorage::WRITE);
00024   fs << "result";
00025   result.serialize(fs);
00026   fs.release();
00027 
00028   FitterResult de_result;
00029   fs = FileStorage("filenode_empty.yml", FileStorage::READ);
00030 
00031   de_result.deserialize(fs["result"]);
00032   fs.release();
00033 
00034   vector<Mat> mats(3);
00035   mats[0] = Mat::eye(3, 3, CV_32FC1);
00036   mats[1] = Mat::ones(4, 1, CV_32FC1);
00037   mats[2] = Mat::zeros(Size(4, 4), CV_8U);
00038   result = FitterResult(mats, true, CV_PI, 12.0, vector<unsigned char> (), 20);
00039 
00040   fs = FileStorage("filenode_filled.yml", FileStorage::WRITE);
00041   fs << "result";
00042   result.serialize(fs);
00043   fs.release();
00044 
00045   fs = FileStorage("filenode_filled.yml", FileStorage::READ);
00046   de_result.deserialize(fs["result"]);
00047   fs.release();
00048 
00049   fs = FileStorage("filenode_filled_deserialed.yml", FileStorage::WRITE);
00050   fs << "result";
00051   de_result.serialize(fs);
00052   fs.release();
00053 }
00054 
00055 // Run all the tests that were declared with TEST()
00056 int main(int argc, char **argv)
00057 {
00058   testing::InitGoogleTest(&argc, argv);
00059   return RUN_ALL_TESTS();
00060 }


pano_core
Author(s): Ethan Rublee
autogenerated on Wed Aug 26 2015 16:34:01