Lolly 1.4.27
Loading...
Searching...
No Matches
Functions
hashtree_test.cpp File Reference
#include "a_lolly_test.hpp"
#include "hashtree.hpp"
#include "string.hpp"
#include <string>
Include dependency graph for hashtree_test.cpp:

Go to the source code of this file.

Functions

 TEST_CASE ("Test the add_child function")
 
 TEST_CASE ("Test the contains function")
 
 TEST_CASE ("add_new_child function")
 
 TEST_CASE ("set_label and get_label function")
 
 TEST_CASE ("Test the N and is_nil functions")
 

Function Documentation

◆ TEST_CASE() [1/5]

TEST_CASE ( "Test the add_child function" )

Definition at line 6 of file hashtree_test.cpp.

6 {
8 string a ("one");
9 string b ("two");
10 hashtree<int, string> child1 (string ("one"));
11 hashtree<int, string> child2 (string ("two"));
12 hashtree<int, string> child3 (string ("three"));
13 t->add_child (1, child1);
14 t->add_child (2, child2);
15
16 CHECK (N (child1) == 0);
17 CHECK (N (child2) == 0);
18 CHECK (N (t) == 2);
19
20 child1->add_child (3, child3);
21
22 CHECK (N (child1) == 1);
23 CHECK (N (child2) == 0);
24 CHECK_EQ (N (t) == 3, false);
25 CHECK_EQ (N (t) == 2, true);
26}
int N(array< T > a)
Get the length of the array.
Definition array.hpp:170
blackbox b[13]
blackbox t[13]
The list class represents a linked list.
Definition list.hpp:48

◆ TEST_CASE() [2/5]

TEST_CASE ( "Test the contains function" )

Definition at line 28 of file hashtree_test.cpp.

28 {
30
31 string a ("one");
32 string b ("two");
33
34 hashtree<int, string> child1 (string ("one"));
35 hashtree<int, string> child2 (string ("two"));
36 t->add_child (1, child1);
37 t->add_child (2, child2);
38 CHECK (t->contains (1));
39 CHECK (t->contains (2));
40 CHECK (!t->contains (3));
41}

◆ TEST_CASE() [3/5]

TEST_CASE ( "add_new_child function" )

Definition at line 43 of file hashtree_test.cpp.

43 {
45
46 string a ("one");
47 string b ("two");
48
49 hashtree<int, string> child1 (string ("one"));
50 hashtree<int, string> child2 (string ("two"));
51 t->add_child (1, child1);
52 t->add_child (2, child2);
53 t->add_new_child (3);
54 CHECK_EQ (N (child2) == 3, false);
55 CHECK (t->contains (3));
56}

◆ TEST_CASE() [4/5]

TEST_CASE ( "set_label and get_label function" )

Definition at line 58 of file hashtree_test.cpp.

58 {
60 t->set_label ("root");
61 CHECK_EQ (t->get_label () == "root", true);
62}

◆ TEST_CASE() [5/5]

TEST_CASE ( "Test the N and is_nil functions" )

Definition at line 64 of file hashtree_test.cpp.

64 {
66 CHECK_EQ (is_nil (nil_tree), false);
67}
bool is_nil(blackbox x)
Definition blackbox.hpp:29