1 #include <gtest/gtest.h>
2 #include <Unittests/unittests_common.hh>
10 class OpenMeshSRBinary :
public testing::Test {
15 virtual void SetUp() {
21 virtual void TearDown() {
40 TEST_F(OpenMeshSRBinary, CheckStringSwap) {
41 std::string testString =
"OpenMesh String";
42 std::stringstream stream(
"");
44 std::stringstream stream2(
"");
46 std::string res2 = stream2.str();
47 std::string res = stream.str();
49 stream.read((
char*)&len,2);
51 stream2.read( (
char*)&len2,2);
53 EXPECT_EQ(len2,testString.length());
54 EXPECT_EQ(len,(testString.length()>>8)|(testString.length()<<8));
61 TEST_F(OpenMeshSRBinary, StringStoreRestore) {
64 std::string testString =
"OpenMesh String";
65 std::stringstream stream(
"");
67 std::stringstream stream2(
"");
71 std::string restored1, restored2;
75 EXPECT_EQ(restored1.length(), restored2.length());
76 EXPECT_EQ(restored1.length(), testString.length());
77 for(
size_t i = 0 ; i < testString.length() ; ++i)
79 EXPECT_EQ(restored1[i] , testString[i]);
80 EXPECT_EQ(restored2[i] , testString[i]);