From b5fc92b5377e3effe4410348f4199316b88fba7f Mon Sep 17 00:00:00 2001 From: Adrian Kummerlaender Date: Tue, 20 Jan 2015 16:55:07 +0100 Subject: Added basic boolean logic operations --- test.cc | 67 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 63 insertions(+), 4 deletions(-) (limited to 'test.cc') diff --git a/test.cc b/test.cc index 19c279c..37f83b7 100644 --- a/test.cc +++ b/test.cc @@ -1,5 +1,6 @@ #include "type.h" #include "operation/math.h" +#include "operation/logic.h" #include "conditional/if.h" #include "list/cons.h" @@ -48,7 +49,7 @@ static_assert( static_assert( std::is_same< tav::Int<3>, - tav::Add, tav::Int<2>> + tav::Add, tav::Int<2>>::type >::value, "(+ 1 2) != 3" ); @@ -56,7 +57,7 @@ static_assert( static_assert( std::is_same< tav::Int<4>, - tav::Substract, tav::Int<6>> + tav::Substract, tav::Int<6>>::type >::value, "(- 10 6) != 4" ); @@ -64,7 +65,7 @@ static_assert( static_assert( std::is_same< tav::Int<42>, - tav::Multiply, tav::Int<21>> + tav::Multiply, tav::Int<21>>::type >::value, "(* 2 21) != 42" ); @@ -72,11 +73,69 @@ static_assert( static_assert( std::is_same< tav::Int<5>, - tav::Divide, tav::Int<2>> + tav::Divide, tav::Int<2>>::type >::value, "(/ 10 2) != 42" ); +// logic + +static_assert( + std::is_same< + tav::Boolean, + tav::And, tav::Boolean>::type + >::value, + "(and #t #t) != #t" +); + +static_assert( + std::is_same< + tav::Boolean, + tav::And, tav::Boolean>::type + >::value, + "(and #f #t) != #f" +); + +static_assert( + std::is_same< + tav::Boolean, + tav::Or, tav::Boolean>::type + >::value, + "(or #t #t) != #t" +); + +static_assert( + std::is_same< + tav::Boolean, + tav::Or, tav::Boolean>::type + >::value, + "(or #f #t) != #t" +); + +static_assert( + std::is_same< + tav::Boolean, + tav::Or, tav::Boolean>::type + >::value, + "(or #f #f) != #f" +); + +static_assert( + std::is_same< + tav::Boolean, + tav::Xor, tav::Boolean>::type + >::value, + "(xor #f #t) != #t" +); + +static_assert( + std::is_same< + tav::Boolean, + tav::Xor, tav::Boolean>::type + >::value, + "(xor #t #t) != #f" +); + // conditionals static_assert( -- cgit v1.2.3