瀏覽代碼

test: add unit tests for maps using C strings as keys.

legacy
Sam Hocevar sam 13 年之前
父節點
當前提交
75a39b691e
共有 1 個檔案被更改,包括 17 行新增0 行删除
  1. +17
    -0
      test/unit/map.cpp

+ 17
- 0
test/unit/map.cpp 查看文件

@@ -57,6 +57,23 @@ LOLUNIT_FIXTURE(MapTest)
LOLUNIT_ASSERT(!map.HasKey(1));
LOLUNIT_ASSERT(map.HasKey(2));
}

LOLUNIT_TEST(StringMap)
{
Map<char const *, int> map;

map["foo"] = 42;
map["bar"] = 12;
map["baz"] = 2;

int foo = map["foo"];
int bar = map["bar"];
int baz = map["baz"];

LOLUNIT_ASSERT_EQUAL(42, foo);
LOLUNIT_ASSERT_EQUAL(12, bar);
LOLUNIT_ASSERT_EQUAL(2, baz);
}
};

} /* namespace lol */


Loading…
取消
儲存