File tree Expand file tree Collapse file tree 5 files changed +36
-2
lines changed Expand file tree Collapse file tree 5 files changed +36
-2
lines changed Original file line number Diff line number Diff line change @@ -35,3 +35,9 @@ add_executable(variable_test ../tests/variable_test.cpp)
35
35
target_include_directories (variable_test PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} )
36
36
target_link_libraries (variable_test tests_main )
37
37
target_compile_definitions (variable_test PUBLIC UNIX )
38
+
39
+ # tuple_binding_test target
40
+ add_executable (tuple_binding_test ../tests/tuple_binding_test.cpp )
41
+ target_include_directories (tuple_binding_test PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} )
42
+ target_link_libraries (tuple_binding_test tests_main )
43
+ target_compile_definitions (tuple_binding_test PUBLIC UNIX )
Original file line number Diff line number Diff line change @@ -20,6 +20,8 @@ namespace datalog
20
20
21
21
using namespace std ;
22
22
23
+ // High-level API functions
24
+
23
25
/* *
24
26
* @brief create a new variable
25
27
*
@@ -57,6 +59,8 @@ void deleteVar(Variable<T> *v)
57
59
delete v;
58
60
}
59
61
62
+ // TODO: all functions below here to be refactored into separate files
63
+
60
64
template <typename T>
61
65
bool bind (const T &a, const T &b)
62
66
{
Original file line number Diff line number Diff line change 5
5
6
6
namespace datalog {
7
7
8
+ // TODO: reify the concept of a tuple of values and pointers to Variables
9
+
8
10
/* *
9
11
* @brief unbind a variable
10
12
*
@@ -18,7 +20,7 @@ void unbind(Variable<T> *t)
18
20
}
19
21
20
22
/* *
21
- * @brief unbind no-operation for types that are not variables
23
+ * @brief unbind no-operation for types that are not variables (i.e. values)
22
24
*
23
25
* @tparam T
24
26
* @param t
Original file line number Diff line number Diff line change 1
1
#! /bin/bash
2
2
set -e
3
3
../build/types_test
4
- ../build/variable_test
4
+ ../build/variable_test
5
+ ../build/tuple_binding_test
Original file line number Diff line number Diff line change
1
+ #include " catch.hpp"
2
+ #include " Datalog.h"
3
+
4
+ using namespace datalog ;
5
+ using namespace std ;
6
+
7
+ bool unbindTest ()
8
+ {
9
+ auto v = var<int >();
10
+ v->bind (3 );
11
+ tuple<decltype (v), int > t{v, 3 };
12
+ v->unbind ();
13
+ bool returnVal = !get<0 >(t)->isBound ();
14
+ deleteVar (v);
15
+ return returnVal;
16
+ }
17
+
18
+ TEST_CASE (" tuple binding test" , " [tuple-binding]" )
19
+ {
20
+ REQUIRE (unbindTest ());
21
+ }
You can’t perform that action at this time.
0 commit comments