25 #ifndef WIOTOOLS_TEST_H
26 #define WIOTOOLS_TEST_H
31 #include <cxxtest/TestSuite.h>
33 #include "../WIOTools.h"
48 TS_ASSERT_EQUALS( x, 1 );
49 x = switchByteOrder( x );
50 TS_ASSERT_EQUALS( x, 16777216 );
51 x = switchByteOrder( x );
52 TS_ASSERT_EQUALS( x, 1 );
60 double x = 3.141592653589793238462643383279502884197169399375105820974;
62 x = switchByteOrder( x );
63 TS_ASSERT_DIFFERS( x, original );
64 x = switchByteOrder( x );
65 TS_ASSERT_EQUALS( x, original );
74 TS_ASSERT_EQUALS( switchByteOrder( x ), x );
83 uint32_t x[] = { 1, 16777216 };
84 switchByteOrderOfArray( x, 2 );
85 TS_ASSERT_EQUALS( x[0], 16777216 );
86 TS_ASSERT_EQUALS( x[1], 1 );
94 std::string expected =
"Hello Pansen!\r\n";
95 std::string actual = readFileIntoString( boost::filesystem::path( W_FIXTURE_PATH +
"hello.world" ) );
96 TS_ASSERT_EQUALS( expected, actual );
104 std::string content =
"Hello Pansen!\r\n";
105 boost::filesystem::path fpath = tempFilename();
106 writeStringIntoFile( fpath, content );
108 std::ifstream input( fpath.string().c_str() );
110 actual.assign( ( std::istreambuf_iterator< char >( input ) ), std::istreambuf_iterator< char >() );
112 TS_ASSERT_EQUALS( content, actual );
113 TS_ASSERT( boost::filesystem::exists( fpath ) );
114 boost::filesystem::remove( fpath );