MCPcopy Create free account
hub / github.com/andreasfertig/cppinsights / main

Function main

tests/FoldExpressionTest.cpp:49–74  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

47constexpr auto comma(Args... args) { return (... , args); }
48
49int main()
50{
51 static_assert(6 == plus(1,2,3));
52 static_assert(1 == minus(6,2,3));
53 static_assert(18 == times(3,2,3));
54 static_assert(3 == div(18,2,3));
55 static_assert(0 == mod(18,4,2));
56 static_assert(0b00'011 == bitwiseXOr(0b11'101, 0b11'010, 0b00'100));
57 static_assert(0b00'010 == bitwiseAnd(0b11'010, 0b11'010, 0b00'010));
58 static_assert(0b11'111 == bitwiseOr(0b11'001, 0b11'010, 0b00'100));
59
60// =
61
62 static_assert(false == lt(1,2,0));
63 static_assert(false == gt(1,2,1));
64
65
66 static_assert(false == logicalAnd(true, true, true, false));
67 static_assert(true == logicalOr(true, true, true, false));
68
69 static_assert(4 == comma(1,2,3,4));
70
71 // Verify that we do not introduce parens here.
72 int x = 4;
73 x /= 2;
74}
75

Callers

nothing calls this directly

Calls 13

plusFunction · 0.85
minusFunction · 0.85
timesFunction · 0.85
divFunction · 0.85
modFunction · 0.85
bitwiseXOrFunction · 0.85
bitwiseAndFunction · 0.85
bitwiseOrFunction · 0.85
ltFunction · 0.85
gtFunction · 0.85
logicalAndFunction · 0.85
logicalOrFunction · 0.85

Tested by

no test coverage detected