mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 12:01:16 +00:00
Added std::collections::enummap.
This commit is contained in:
committed by
Christoffer Lerno
parent
1035de3b36
commit
549e1b6029
29
test/unit/stdlib/collections/enummap.c3
Normal file
29
test/unit/stdlib/collections/enummap.c3
Normal file
@@ -0,0 +1,29 @@
|
||||
module enummap_test @test;
|
||||
import std::collections::enummap;
|
||||
|
||||
enum FooEnum
|
||||
{
|
||||
ONE,
|
||||
TWO,
|
||||
THREE,
|
||||
}
|
||||
|
||||
typedef FooEnumMap = EnumMap<FooEnum, uint>;
|
||||
|
||||
fn void! enums()
|
||||
{
|
||||
FooEnumMap nm;
|
||||
nm.set(ONE, 1);
|
||||
nm.set(TWO, 2);
|
||||
nm.set(THREE, 3);
|
||||
|
||||
assert(nm[FooEnum.ONE] == 1);
|
||||
assert(nm[FooEnum.TWO] == 2);
|
||||
assert(nm[FooEnum.THREE] == 3);
|
||||
|
||||
nm.init(0);
|
||||
|
||||
assert(nm[FooEnum.ONE] == 0);
|
||||
assert(nm[FooEnum.TWO] == 0);
|
||||
assert(nm[FooEnum.THREE] == 0);
|
||||
}
|
||||
Reference in New Issue
Block a user