reworkes test infrastructure and tests
This commit is contained in:
32
tests/ordered_semaphore/test.cpp
Normal file
32
tests/ordered_semaphore/test.cpp
Normal file
@@ -0,0 +1,32 @@
|
||||
#define SC_INCLUDE_DYNAMIC_PROCESSES
|
||||
#include <scc/ordered_semaphore.h>
|
||||
#include <scc/utilities.h>
|
||||
#include <factory.h>
|
||||
#include <catch2/catch_all.hpp>
|
||||
#include <systemc>
|
||||
|
||||
using namespace sc_core;
|
||||
|
||||
class top: public sc_core::sc_module {
|
||||
public:
|
||||
scc::ordered_semaphore sem{"sem", 2};
|
||||
scc::ordered_semaphore_t<2> sem_t{"sem_t"};
|
||||
};
|
||||
|
||||
factory::add<top> tb;
|
||||
|
||||
TEST_CASE("simple ordered_semaphore test", "[SCC][ordered_semaphore]") {
|
||||
|
||||
auto& dut = factory::get<top>();
|
||||
auto run1 = sc_spawn([&dut](){
|
||||
dut.sem.wait();
|
||||
dut.sem_t.wait();
|
||||
dut.sem.set_capacity(4);
|
||||
dut.sem_t.set_capacity(4);
|
||||
dut.sem_t.post();
|
||||
dut.sem.post();
|
||||
});
|
||||
|
||||
sc_start(1_ns);
|
||||
REQUIRE(run1.terminated());
|
||||
}
|
Reference in New Issue
Block a user