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/compliance_1666/test207 | |
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/compliance_1666/test207')
-rw-r--r-- | src/systemc/tests/systemc/compliance_1666/test207/golden/test207.log | 4 | ||||
-rw-r--r-- | src/systemc/tests/systemc/compliance_1666/test207/test207.cpp | 67 |
2 files changed, 71 insertions, 0 deletions
diff --git a/src/systemc/tests/systemc/compliance_1666/test207/golden/test207.log b/src/systemc/tests/systemc/compliance_1666/test207/golden/test207.log new file mode 100644 index 000000000..d1a84db9a --- /dev/null +++ b/src/systemc/tests/systemc/compliance_1666/test207/golden/test207.log @@ -0,0 +1,4 @@ +SystemC Simulation +Should be silent... + +Success diff --git a/src/systemc/tests/systemc/compliance_1666/test207/test207.cpp b/src/systemc/tests/systemc/compliance_1666/test207/test207.cpp new file mode 100644 index 000000000..76910ef84 --- /dev/null +++ b/src/systemc/tests/systemc/compliance_1666/test207/test207.cpp @@ -0,0 +1,67 @@ +#include <systemc> +using namespace sc_core; +using namespace sc_dt; +using std::cout; +using std::endl; + +// 7) "event_queue" + +void check_form_of_suffix(std::string s) +{ + std::string charset = "0123456789"; + while (!s.empty()) + { + sc_assert(s[0] == '_'); + s = s.substr(1); + sc_assert(!s.empty()); + do + { + sc_assert(charset.find(s[0]) < charset.size()); + s = s.substr(1); + } while (!s.empty() && (s[0] != '_')); + } +} + +SC_MODULE(M) +{ + SC_CTOR(M) + { + SC_THREAD(T); + } + void T() + { + } +}; + +struct Top: sc_module +{ + sc_event_queue eq; + M *m; + Top(sc_module_name) + { + m = new M("m"); + + std::string s = eq.basename(); + sc_assert (s.substr(0,11) == "event_queue"); + sc_assert (s.size() > 11); + check_form_of_suffix(s.substr(11)); + + s = eq.name(); + sc_assert (s.substr(0,15) == "top.event_queue"); + sc_assert (s.size() > 15); + check_form_of_suffix(s.substr(15)); + + sc_assert (std::string(eq.kind()) == "sc_event_queue"); + } +}; + +int sc_main(int argc, char* argv[]) +{ + cout << "Should be silent..." << endl; + + Top top("top"); + sc_start(); + + cout << endl << "Success" << endl; + return 0; +} |