mirror of
https://github.com/13hannes11/UU_la_parallel_programming_practical_assignments.git
synced 2024-09-04 00:50:58 +02:00
add node test
This commit is contained in:
@@ -6,10 +6,14 @@ FetchContent_Declare(
|
|||||||
)
|
)
|
||||||
FetchContent_MakeAvailable(googletest)
|
FetchContent_MakeAvailable(googletest)
|
||||||
|
|
||||||
|
add_executable(node_unit_test Node_test.cpp)
|
||||||
|
target_link_libraries(node_unit_test PUBLIC gtest gtest_main)
|
||||||
|
target_link_libraries(node_unit_test PUBLIC sets)
|
||||||
|
add_test(NodeTest node_unit_test)
|
||||||
|
|
||||||
add_executable(fine_unit_test FineSet_test.cpp)
|
add_executable(fine_unit_test FineSet_test.cpp)
|
||||||
target_link_libraries(fine_unit_test PUBLIC gtest gtest_main)
|
target_link_libraries(fine_unit_test PUBLIC gtest gtest_main)
|
||||||
target_link_libraries(fine_unit_test PUBLIC sets)
|
target_link_libraries(fine_unit_test PUBLIC sets)
|
||||||
|
|
||||||
add_test(FineSetTest fine_unit_test)
|
add_test(FineSetTest fine_unit_test)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
24
Assignment_2/test/Node_test.cpp
Normal file
24
Assignment_2/test/Node_test.cpp
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
#include <gtest/gtest.h>
|
||||||
|
|
||||||
|
#include <lib/Node.h>
|
||||||
|
|
||||||
|
TEST(NodeTest, DummyNode) {
|
||||||
|
Node * n = Node::Dummy();
|
||||||
|
ASSERT_FALSE(n->is_smaller_than(std::numeric_limits<int>::max()));
|
||||||
|
ASSERT_FALSE(n->is_smaller_than(std::numeric_limits<int>::min()));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
TEST(NodeTest, LockingUnlockingNode) {
|
||||||
|
Node * n = new Node(1);
|
||||||
|
n->lock();
|
||||||
|
n->unlock();
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST(NodeTest, ChainingNode) {
|
||||||
|
Node* first = Node::Dummy();
|
||||||
|
Node* last = Node::Dummy();
|
||||||
|
first->next = last;
|
||||||
|
ASSERT_TRUE(first->next == last);
|
||||||
|
}
|
||||||
|
|
||||||
Reference in New Issue
Block a user