DEFINE_TEST() { const char* two = "2"; typedef mock_registrar<const G42CORE_TEST_NS detail::test_part_base_common*> registrar; test_part_mock_with_id t1(two); registrar::add(&t1); { auto test_part_sequences(G42CORE_TEST_NS detail::test_parts_combiner::combine(registrar::range())); VERIFY(1 == test_part_sequences.size()); auto i = test_part_sequences.begin(); VERIFY(std::string((*i).first) == std::string((*((*i).second.begin()))->test_id())); } test_part_mock_with_id t2("1"); registrar::add(&t2); { auto test_part_sequences(G42CORE_TEST_NS detail::test_parts_combiner::combine(registrar::range())); VERIFY(2 == test_part_sequences.size()); for(auto i = test_part_sequences.begin(); i != test_part_sequences.end(); ++i) { VERIFY((*i).second.size() == 1); VERIFY(std::string((*i).first) == std::string((*((*i).second.begin()))->test_id())); } } test_part_mock_with_id t3(two); registrar::add(&t3); verify_test_part_sequences<registrar>(2); const char* three = "3"; test_part_mock_with_id t3a(three); registrar::add(&t3a); test_part_mock_with_id t3b(three); registrar::add(&t3b); test_part_mock_with_id t3c(three); registrar::add(&t3c); verify_test_part_sequences<registrar>(3); }
void test_constructors() { cout << "test_constructors" << endl; sc_time t1; cout << t1 << endl; sc_time t2a( 0, SC_SEC ); cout << t2a << endl; sc_time t2b( 1.2345, SC_NS ); cout << t2b << endl; sc_time t2c( 1.2341, SC_NS ); cout << t2c << endl; sc_time t2d( 1, SC_FS ); cout << t2d << endl; sc_time t2e( -1.2345, SC_NS ); cout << t2e << endl; sc_time t2f( -1.2341, SC_NS ); cout << t2f << endl; char v1 = 1; signed char v2 = 2; unsigned char v3 = 3; short v4 = 4; unsigned short v5 = 5; int v6 = 6; unsigned int v7 = 7; long v8 = 8; unsigned long v9 = 9; float v10 = 10; double v11 = 11; sc_time t2g( v1, SC_NS ); cout << t2g << endl; sc_time t2h( v2, SC_NS ); cout << t2h << endl; sc_time t2i( v3, SC_NS ); cout << t2i << endl; sc_time t2j( v4, SC_NS ); cout << t2j << endl; sc_time t2k( v5, SC_NS ); cout << t2k << endl; sc_time t2l( v6, SC_NS ); cout << t2l << endl; sc_time t2m( v7, SC_NS ); cout << t2m << endl; sc_time t2n( v8, SC_NS ); cout << t2n << endl; sc_time t2o( v9, SC_NS ); cout << t2o << endl; sc_time t2p( v10, SC_NS ); cout << t2p << endl; sc_time t2q( v11, SC_NS ); cout << t2q << endl; sc_time t3a( 0, SC_SEC ); cout << t3a << endl; sc_time t3b( 1.2341, true ); cout << t3b << endl; sc_time t3c( 1.2345, true ); cout << t3c << endl; sc_time t3d( -1.2341, true ); cout << t3d << endl; sc_time t3e( -1.2345, true ); cout << t3e << endl; sc_time t3f( 1.2345, false ); cout << t3f << endl; sc_time t3g( 1.5432, false ); cout << t3g << endl; sc_time t3h( -1.2345, false ); cout << t3h << endl; sc_time t3i( -1.5432, false ); cout << t3i << endl; #if !defined( _MSC_VER ) sc_time t4a( 0ull, true ); cout << t4a << endl; sc_time t4b( 25ull, true ); cout << t4b << endl; sc_time t4c( 25ull, false ); cout << t4c << endl; #else sc_time t4a( 0ui64, true ); cout << t4a << endl; sc_time t4b( 25ui64, true ); cout << t4b << endl; sc_time t4c( 25ui64, false ); cout << t4c << endl; #endif sc_time t5( t4c ); cout << t5 << endl; }