diff options
Diffstat (limited to 'examples')
| -rw-r--r-- | examples/demo/demo.odin | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/examples/demo/demo.odin b/examples/demo/demo.odin index 1a4b48037..b1aa4e12d 100644 --- a/examples/demo/demo.odin +++ b/examples/demo/demo.odin @@ -814,6 +814,21 @@ bit_set_type :: proc() { y |= {1, 4, 2}; assert(2 in y); } + { + Letters :: bit_set['A'..'Z']; + a := Letters{'A', 'B'}; + b := Letters{'A', 'B', 'C', 'D', 'F'}; + c := Letters{'A', 'B'}; + + + assert(a <= b); // 'a' is a subset of 'b' + assert(b >= a); // 'b' is a superset of 'a' + assert(a < b); // 'a' is a strict subset of 'b' + assert(b > a); // 'b' is a strict superset of 'a' + + assert(!(a < c)); // 'a' is a not strict subset of 'c' + assert(!(c > a)); // 'c' is a not strict superset of 'a' + } } diverging_procedures :: proc() { |