Home / Resource / Unit tests SystemC model with GTest

Unit tests SystemC model with GTest

Base on Google Test, we build a template framework for unit tests systemc model.

About some information Google Test, you can refer here

By using this framework, you can do unit tests for your model and ensure quality for your product.

After download, follow the steps below.

Step 1: Copy your source code to sample folder

Step 2: Open VS solution FreeSourceC_DevEnv_SystemC.sln

Step 3: add the code (from sample folder ) to Models in FreeSource_Bench

(ex: or_gate.cpp and or_gate.h)

Step 4: add include Directory for your source code

   FreeSource_Bench property -> VC++ Directories -> Include Directories

Step 5: Modify UnitTest.cpp

   use macro TEST(test_case_name, test_name) to make your test case.

Note: OR_GATE model is an example model. You can delete it if you want.

We use OR_GATE for example model.

It has 3 ports :

A: input port

B: input port

Q: output port ( = A| B)

In a simple example, we make 2 test cases to do unit tests for OR_GATE.

  • Check initialize for the output port. We expected the initialized value is false
  • Check operation ( output value is changed when the input value is changed )

 

Download Project (VS2015):

Google Drive 1

__FreeSourceC.com__

About admin

Check Also

[ SC Tutorial ] 3. SystemC Data types

SystemC có một số kiểu dữ liệu được xác định trước để hỗ trợ các …

Leave a Reply

Your email address will not be published. Required fields are marked *