Changeset 2446


Ignore:
Timestamp:
Feb 19, 2013, 11:41:34 AM (7 years ago)
Author:
sam
Message:

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/test/unit/map.cpp

    r2216 r2446  
    5858        LOLUNIT_ASSERT(map.HasKey(2));
    5959    }
     60
     61    LOLUNIT_TEST(StringMap)
     62    {
     63        Map<char const *, int> map;
     64
     65        map["foo"] = 42;
     66        map["bar"] = 12;
     67        map["baz"] = 2;
     68
     69        int foo = map["foo"];
     70        int bar = map["bar"];
     71        int baz = map["baz"];
     72
     73        LOLUNIT_ASSERT_EQUAL(42, foo);
     74        LOLUNIT_ASSERT_EQUAL(12, bar);
     75        LOLUNIT_ASSERT_EQUAL(2, baz);
     76    }
    6077};
    6178
Note: See TracChangeset for help on using the changeset viewer.