-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathInCoVariTest.cpp
More file actions
51 lines (39 loc) · 1.89 KB
/
Copy pathInCoVariTest.cpp
File metadata and controls
51 lines (39 loc) · 1.89 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#include "CoExVari.hpp"
#include "InCoVari.hpp"
#include "InCoList.hpp"
#include <type_traits> // static testing
#include <UnitTest++/UnitTest++.h> // dynamic testing
using namespace std;
using namespace vmp;
SUITE(InCoVari) {
// A struct without "static const bool value".
struct no_value {};
TEST(ShortCircuitOr) {
// Validation of short-circuit compilation using type without "value"
static_assert(or_sc<true_type, no_value>::value, "Or short-circuit should obviate second value requirement when first is true");
// Idempotent
static_assert(!or_sc<>::value, "Or zero arguments is idempotent, which is false");
// Identity vector
static_assert(or_sc<true_type>::value, "Or of one argument is identity");
static_assert(!or_sc<false_type>::value, "Or of one argument is identity");
// Logic matrix
static_assert(or_sc<true_type, true_type>::value, "T || T == T");
static_assert(or_sc<false_type, true_type>::value, "F || T == T");
static_assert(or_sc<true_type, false_type>::value, "T || F == T");
static_assert(!or_sc<false_type, false_type>::value, "F || F == F");
}
TEST(ShortCircuitAnd) {
// Validation of short-circuit compilation using type without "value"
static_assert(!and_sc<false_type, no_value>::value, "Short-circuit and should skip obviate second value requirement when first is false");
// Idempotent
static_assert(and_sc<>::value, "And zero arguments is idempotent, which is true");
// Identity vector
static_assert(and_sc<true_type>::value, "And of one argument is identity");
static_assert(!and_sc<false_type>::value, "And of one argument is identity");
// Logic matrix
static_assert(and_sc<true_type, true_type>::value, "T && T == T");
static_assert(!and_sc<false_type, true_type>::value, "F && T == F");
static_assert(!and_sc<true_type, false_type>::value, "T && F == F");
static_assert(!and_sc<false_type, false_type>::value, "F && F == F");
}
}