MCPcopy Create free account
hub / github.com/GothenburgBitFactory/taskwarrior / TEST_NAME

Function TEST_NAME

test/variant_nomatch_test.cpp:37–297  ·  view source on GitHub ↗

///////////////////////////////////////////////////////////////////////////

Source from the content-addressed store, hash-verified

35
36////////////////////////////////////////////////////////////////////////////////
37int TEST_NAME(int, char**) {
38 UnitTest t(120);
39
40 Task task;
41
42 Variant vs0("untrue"); // !~ true
43 Variant vs1(8421); // !~ 42
44 Variant vs2(3.14159); // !~ 3.14
45 Variant vs3("foolish"); // !~ foo
46
47 Variant v0(true);
48 Variant v1(42);
49 Variant v2(3.14);
50 Variant v3("foo");
51 Variant v4(1234567890, Variant::type_date);
52 Variant v5(1200, Variant::type_duration);
53
54 // Interesting cases.
55 Variant vs00 = vs0.operator_nomatch(v0, task);
56 t.is(vs00.type(), Variant::type_boolean, "untrue !~ true --> boolean");
57 t.is(vs00.get_bool(), false, "untrue !~ true --> false");
58
59 Variant vs01 = vs0.operator_nomatch(v1, task);
60 t.is(vs01.type(), Variant::type_boolean, "untrue !~ 42 --> boolean");
61 t.is(vs01.get_bool(), true, "untrue !~ 42 --> true");
62
63 Variant vs02 = vs0.operator_nomatch(v2, task);
64 t.is(vs02.type(), Variant::type_boolean, "untrue !~ 3.14 --> boolean");
65 t.is(vs02.get_bool(), true, "untrue !~ 3.14 --> true");
66
67 Variant vs03 = vs0.operator_nomatch(v3, task);
68 t.is(vs03.type(), Variant::type_boolean, "untrue !~ 'foo' --> boolean");
69 t.is(vs03.get_bool(), true, "untrue !~ 'foo' --> true");
70
71 Variant vs04 = vs0.operator_nomatch(v4, task);
72 t.is(vs04.type(), Variant::type_boolean, "untrue !~ 1234567890 --> boolean");
73 t.is(vs04.get_bool(), true, "untrue !~ 1234567890 --> true");
74
75 Variant vs05 = vs0.operator_nomatch(v5, task);
76 t.is(vs05.type(), Variant::type_boolean, "untrue !~ 1200 --> boolean");
77 t.is(vs05.get_bool(), true, "untrue !~ 1200 --> true");
78
79 Variant vs10 = vs1.operator_nomatch(v0, task);
80 t.is(vs10.type(), Variant::type_boolean, "8421 !~ true --> boolean");
81 t.is(vs10.get_bool(), true, "8421 !~ true --> true");
82
83 Variant vs11 = vs1.operator_nomatch(v1, task);
84 t.is(vs11.type(), Variant::type_boolean, "8421 !~ 42 --> boolean");
85 t.is(vs11.get_bool(), false, "8421 !~ 42 --> false");
86
87 Variant vs12 = vs1.operator_nomatch(v2, task);
88 t.is(vs12.type(), Variant::type_boolean, "8421 !~ 3.14 --> boolean");
89 t.is(vs12.get_bool(), true, "8421 !~ 3.14 --> true");
90
91 Variant vs13 = vs1.operator_nomatch(v3, task);
92 t.is(vs13.type(), Variant::type_boolean, "8421 !~ 'foo' --> boolean");
93 t.is(vs13.get_bool(), true, "8421 !~ 'foo' --> true");
94

Callers

nothing calls this directly

Calls 4

operator_nomatchMethod · 0.80
isMethod · 0.80
typeMethod · 0.80
get_boolMethod · 0.80

Tested by

no test coverage detected