THRIFT-4270 Generate Erlang mapping functions for const maps and lists
Client: Erlang
Patch: David Hull <david.hull@openx.com>
This closes #1320
diff --git a/lib/erl/test/test_const.erl b/lib/erl/test/test_const.erl
index ed0cf03..627777b 100644
--- a/lib/erl/test/test_const.erl
+++ b/lib/erl/test/test_const.erl
@@ -31,4 +31,24 @@
{struct, _} = constants_demo_types:struct_info('consts_Blah'),
ok.
+const_map_test() ->
+ ?assertEqual(233, constants_demo_constants:gen_map(35532)),
+ ?assertError(function_clause, constants_demo_constants:gen_map(0)),
+
+ ?assertEqual(853, constants_demo_constants:gen_map(43523, default)),
+ ?assertEqual(default, constants_demo_constants:gen_map(10110, default)),
+
+ ?assertEqual(98325, constants_demo_constants:gen_map2("lkjsdf")),
+ ?assertError(function_clause, constants_demo_constants:gen_map2("nonexist")),
+
+ ?assertEqual(233, constants_demo_constants:gen_map2("hello", 321)),
+ ?assertEqual(321, constants_demo_constants:gen_map2("goodbye", 321)).
+
+const_list_test() ->
+ ?assertEqual(23598352, constants_demo_constants:gen_list(2)),
+ ?assertError(function_clause, constants_demo_constants:gen_list(0)),
+
+ ?assertEqual(3253523, constants_demo_constants:gen_list(3, default)),
+ ?assertEqual(default, constants_demo_constants:gen_list(10, default)).
+
-endif. %% TEST