@@ -110,80 +110,6 @@ TEST(RandomTest, OperatorEquals) {
110110}
111111
112112
113- TEST (RandomTest, SerializationDeserialization) {
114- // test serialization/deserialization
115- Random r1 (862973 );
116- for (int i = 0 ; i < 100 ; i++)
117- r1.getUInt32 ();
118-
119- EXPECT_EQ (r1.getUInt32 (), 2276275187u ) << " Before serialization must be same" ;
120- // serialize
121- std::stringstream ostream;
122- ostream << r1;
123-
124- // print out serialization for debugging
125- std::string x (ostream.str ());
126- // NTA_INFO << "random serialize string: '" << x << "'";
127- // Serialization should be deterministic and platform independent
128- const std::string expectedString = " random-v2 862973 101 endrandom-v2 " ;
129- EXPECT_EQ (expectedString, x) << " De/serialization" ;
130-
131- // deserialize into r2
132- std::string s (ostream.str ());
133- std::stringstream ss (s);
134- Random r2;
135- ss >> r2;
136-
137- // r1 and r2 should be identical
138- EXPECT_EQ (r1, r2) << " load from serialization" ;
139- EXPECT_EQ (r2.getUInt32 (), 3537119063u ) << " Deserialized is not deterministic" ;
140- r1.getUInt32 (); // move the same number of steps
141-
142- UInt32 v1, v2;
143- for (int i = 0 ; i < 100 ; i++) {
144- v1 = r1.getUInt32 ();
145- v2 = r2.getUInt32 ();
146- EXPECT_EQ (v1, v2) << " serialization" ;
147- }
148- }
149-
150-
151- TEST (RandomTest, testSerialization2) {
152- const UInt n=1000 ;
153- Random r1 (7 );
154- Random r2;
155-
156- htm::Timer testTimer;
157- testTimer.start ();
158- for (UInt i = 0 ; i < n; ++i) {
159- r1.getUInt32 ();
160-
161- // Serialize
162- ofstream os (" random3.stream" , ofstream::binary);
163- os << r1;
164- os.flush ();
165- os.close ();
166-
167- // Deserialize
168- ifstream is (" random3.stream" , ifstream::binary);
169- is >> r2;
170- is.close ();
171-
172- // Test
173- ASSERT_EQ (r1.getUInt32 (), r2.getUInt32 ());
174- ASSERT_EQ (r1.getUInt32 (), r2.getUInt32 ());
175- ASSERT_EQ (r1.getUInt32 (), r2.getUInt32 ());
176- ASSERT_EQ (r1.getUInt32 (), r2.getUInt32 ());
177- ASSERT_EQ (r1.getUInt32 (), r2.getUInt32 ());
178- }
179- testTimer.stop ();
180-
181- remove (" random3.stream" );
182-
183- cout << " Random serialization: " << testTimer.getElapsed () << endl;
184- }
185-
186-
187113TEST (RandomTest, testSerialization_ar) {
188114 // test serialization/deserialization
189115 const UInt SEED = 862973u ;
@@ -233,28 +159,6 @@ TEST(RandomTest, ReturnInCorrectRange) {
233159 }
234160}
235161
236- /*
237- TEST(RandomTest, getUInt64) {
238- // tests for getUInt64
239- Random r1(1);
240- ASSERT_EQ(2469588189546311528u, r1.getUInt64())
241- << "check getUInt64, seed 1, first call";
242- ASSERT_EQ(2516265689700432462u, r1.getUInt64())
243- << "check getUInt64, seed 1, second call";
244-
245- Random r2(2);
246- ASSERT_EQ(16668552215174154828u, r2.getUInt64())
247- << "check getUInt64, seed 2, first call";
248- EXPECT_EQ(15684088468973760345u, r2.getUInt64())
249- << "check getUInt64, seed 2, second call";
250-
251- Random r3(7464235991977222558);
252- EXPECT_EQ(8035066300482877360u, r3.getUInt64())
253- << "check getUInt64, big seed, first call";
254- EXPECT_EQ(623784303608610892u, r3.getUInt64())
255- << "check getUInt64, big seed, second call";
256- }
257- */
258162
259163TEST (RandomTest, getUInt32) {
260164 // tests for getUInt32
0 commit comments