|
@@ -21,10 +21,12 @@ package("pyincpp")
|
|
|
#include <cassert>
|
|
|
using namespace pyincpp;
|
|
|
void test() {
|
|
|
- Map<String, List<Integer>> map = {{"first", {123, 456}}, {"second", {789}}, {"second", {0}}, {"third", {"12345678987654321", 5}}};
|
|
|
- assert(map.size() == 3);
|
|
|
- assert(map.keys() == Set<String>({"first", "second", "third"}));
|
|
|
- assert(map["third"][-1].factorial() == 120);
|
|
|
+ Dict<Str, List<Int>> dict = {{"first", {"123", "456"}}, {"second", {"789"}}, {"third", {"12345678987654321", "5"}}};
|
|
|
+ std::ostringstream oss;
|
|
|
+ oss << dict;
|
|
|
+ assert(oss.str() == "{\"first\": [123, 456], \"second\": [789], \"third\": [12345678987654321, 5]}");
|
|
|
+ assert(dict.keys() == Set<Str>{"first", "second", "third"});
|
|
|
+ assert(dict["third"][-1].factorial() == 120);
|
|
|
}
|
|
|
]]}, {configs = {languages = "c++20"}, includes = "pyincpp/pyincpp.hpp"}))
|
|
|
end)
|