diff options
author | Gabe Black <gabeblack@google.com> | 2018-05-24 01:37:55 -0700 |
---|---|---|
committer | Gabe Black <gabeblack@google.com> | 2018-08-08 10:09:54 +0000 |
commit | 16fa8d7cc8c92f5ab879e4cf9c6c0bbb3567860f (patch) | |
tree | 7b6faaacb4574a555e561534aa4a8508c0624c32 /src/systemc/tests/systemc/datatypes/int/string_conversion/test03/test03.cpp | |
parent | 7235d3b5211d0ba8f528d930a4c1e7ad62eec51a (diff) | |
download | gem5-16fa8d7cc8c92f5ab879e4cf9c6c0bbb3567860f.tar.xz |
systemc: Import tests from the Accellera systemc distribution.
Change-Id: Iad76b398949a55d768a34d027a2d8e3739953da6
Reviewed-on: https://gem5-review.googlesource.com/10845
Reviewed-by: Giacomo Travaglini <giacomo.travaglini@arm.com>
Maintainer: Gabe Black <gabeblack@google.com>
Diffstat (limited to 'src/systemc/tests/systemc/datatypes/int/string_conversion/test03/test03.cpp')
-rw-r--r-- | src/systemc/tests/systemc/datatypes/int/string_conversion/test03/test03.cpp | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/src/systemc/tests/systemc/datatypes/int/string_conversion/test03/test03.cpp b/src/systemc/tests/systemc/datatypes/int/string_conversion/test03/test03.cpp new file mode 100644 index 000000000..a075ba525 --- /dev/null +++ b/src/systemc/tests/systemc/datatypes/int/string_conversion/test03/test03.cpp @@ -0,0 +1,43 @@ +#include "systemc.h" + +inline void flags_value() +{ + ios::fmtflags flags = cout.flags(); + cout << hex << flags << dec << endl; + if ( sc_io_show_base(cout) ) cout << "showbase" << endl; +} + +#define TEST(BASE) \ +{ \ + BASE x; \ + cout << endl << #BASE << endl; \ + for ( i = 0; i < 256; i++ ) \ + { \ + x = i; \ + cout << " "; \ + cout << std::noshowbase; \ + cout << dec << " d: " << x; \ + cout << oct << " o: " << x; \ + cout << hex << " x: " << x; \ + cout << std::showbase; \ + cout << dec << " d: " << x; \ + cout << oct << " o: " << x; \ + cout << hex << " x: " << x; \ + cout << endl; \ + } \ +} +int sc_main(int argc, char* argv[]) +{ + int i; + sc_biguint<8> x; + + TEST(sc_bigint<8>) + TEST(sc_biguint<8>) + TEST(sc_int<8>) + TEST(sc_uint<8>) + TEST(sc_lv<8>) + TEST(sc_bv<8>) + cerr << "Program completed" << endl; + + return 0; +} |