Created
June 6, 2013 17:16
-
-
Save lambday/5723187 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| TEST(Serialization, Ascii_scaler_equal_FLOAT64) | |
| { | |
| float64_t a=1.7126587125; | |
| TSGDataType type(CT_SCALAR, ST_NONE, PT_FLOAT64); | |
| TParameter* param1=new TParameter(&type, &a, "param1", ""); | |
| TParameter* param2=new TParameter(&type, NULL, "param2", ""); | |
| const char* filename="float64_param.txt"; | |
| // save parameter to an ascii file | |
| CSerializableAsciiFile *file=new CSerializableAsciiFile(filename, 'w'); | |
| param1->save(file); | |
| file->close(); | |
| SG_UNREF(file); | |
| // load parameter from an ascii file | |
| file=new CSerializableAsciiFile(filename, 'r'); | |
| param2->load(file); | |
| file->close(); | |
| SG_UNREF(file); | |
| // check for equality | |
| float64_t accuracy=0.1; | |
| EXPECT_TRUE(param1->equals(param2, accuracy)); | |
| delete param1; | |
| delete param2; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment