-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
82 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
/* | ||
* @file blackbox_test.cpp | ||
* @author yuanmxc | ||
* @date 2023-8-7 | ||
* | ||
* Copyright (c) Year Company Name. All rights reserved. | ||
* | ||
* @brief A test for blackbox. | ||
*/ | ||
|
||
#define DOCTEST_CONFIG_IMPLEMENT_WITH_MAIN | ||
|
||
#include "blackbox.hpp" | ||
#include "doctest/doctest.h" | ||
#include "string.hpp" | ||
|
||
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); | ||
CHECK_EQ (box4->get_type () == -6, true); | ||
CHECK_EQ (box5->get_type () == -5, true); | ||
CHECK_EQ (box6->get_type () == -4, true); | ||
CHECK_EQ (box7->get_type () == -3, true); | ||
CHECK_EQ (box8->get_type () == -2, true); | ||
CHECK_EQ (box9->get_type () == -1, true); | ||
} | ||
|
||
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 != box2, true); | ||
CHECK_EQ (box2 != box03, true); | ||
CHECK_EQ (box3 != box06, true); | ||
} | ||
|
||
TEST_CASE ("") {} | ||
|
||
TEST_CASE ("test ") {} | ||
|
||
TEST_CASE ("test") {} | ||
|
||
TEST_CASE ("test") {} | ||
|
||
TEST_CASE ("test") {} | ||
|
||
TEST_CASE ("test") {} | ||
|
||
TEST_CASE ("test") {} | ||
|
||
TEST_CASE ("test") {} | ||
|
||
TEST_CASE ("test") {} |