Skip to content

Commit

Permalink
[2_2] add blackbox_test
Browse files Browse the repository at this point in the history
  • Loading branch information
Yuanmxc committed Aug 7, 2023
1 parent 724e1df commit 7318d53
Showing 1 changed file with 26 additions and 31 deletions.
57 changes: 26 additions & 31 deletions tests/Kernel/Abstractions/blackbox_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,22 +14,25 @@
#include "doctest/doctest.h"
#include "string.hpp"

blackbox box0;
blackbox box1 = close_box<SI> (-2147483648);
blackbox box2 = close_box<SN> (2147483647);
blackbox box3 = close_box<HI> (32767);
blackbox box4 = close_box<HN> (-32768);
blackbox box5 = close_box<QI> (-128);
blackbox box6 = close_box<QN> (255);
blackbox box7 = close_box<DI> (LLONG_MAX);
blackbox box8 = close_box<DN> (ULLONG_MAX);
blackbox box9 = close_box<pointer> (0);
blackbox box01= close_box<SI> (1);
blackbox box02= close_box<SN> (1);
blackbox box03= close_box<HI> (1);
blackbox box06= close_box<QN> (1);
blackbox box11= close_box<SI> (-2147483648);
blackbox box22= close_box<SN> (2147483647);
blackbox box33= close_box<HI> (32767);

TEST_CASE ("test for get_type()") {
blackbox box0;
blackbox box1 = close_box<SI> (-2147483648);
blackbox box2 = close_box<SN> (2147483647);
blackbox box3 = close_box<HI> (32767);
blackbox box4 = close_box<HN> (-32768);
blackbox box5 = close_box<QI> (-128);
blackbox box6 = close_box<QN> (255);
blackbox box7 = close_box<DI> (LLONG_MAX);
blackbox box8 = close_box<DN> (ULLONG_MAX);
blackbox box9 = close_box<pointer> (0);
blackbox box01= close_box<SI> (1);
blackbox box02= close_box<SN> (1);
blackbox box03= close_box<HI> (1);
blackbox box06= close_box<QN> (255);
CHECK_EQ (box0->get_type () == 0, true);
CHECK_EQ (box1->get_type () == -9, true);
CHECK_EQ (box2->get_type () == -8, true);
CHECK_EQ (box3->get_type () == -7, true);
Expand All @@ -42,25 +45,17 @@ TEST_CASE ("test for get_type()") {
}

TEST_CASE ("test for equal(), operator== and operator!=") {
blackbox box0;
blackbox box1 = close_box<SI> (-2147483648);
blackbox box2 = close_box<SN> (2147483647);
blackbox box3 = close_box<HI> (32767);
blackbox box6 = close_box<QN> (255);
blackbox box01= close_box<SI> (1);
blackbox box02= close_box<SN> (1);
blackbox box03= close_box<HI> (1);
blackbox box06= close_box<QN> (255);

CHECK_EQ (box0 == box0, true);
CHECK_EQ (box1 == box0, true);
CHECK_EQ (box1 == box01, true);
CHECK_EQ (box2 == box02, true);
CHECK_EQ (box3 == box03, true);
CHECK_EQ (box6 == box06, true);
CHECK_EQ (box1 == box11, true);
CHECK_EQ (box2 == box22, true);
CHECK_EQ (box3 == box33, true);

CHECK_EQ (box1 != box2, true);
CHECK_EQ (box2 != box03, true);
CHECK_EQ (box3 != box06, true);
CHECK_EQ (box2 != box02, true);
CHECK_EQ (box3 != box03, true);
CHECK_EQ (box01 != box02, true);
CHECK_EQ (box6 != box06, true);
}

TEST_CASE ("") {}
Expand Down

0 comments on commit 7318d53

Please sign in to comment.