diff options
author | Lars Thorsen <[email protected]> | 2016-06-15 13:18:21 +0200 |
---|---|---|
committer | Lars Thorsen <[email protected]> | 2016-06-17 07:51:01 +0200 |
commit | aee581679e2a61e819950e793d3977b340dec70b (patch) | |
tree | 227c0627090b5404dad1c04d34b3deb458c08803 /lib/orber/test/cdrlib_SUITE.erl | |
parent | d29526af250bb33a702556bb91cda136324b5b8c (diff) | |
download | otp-aee581679e2a61e819950e793d3977b340dec70b.tar.gz otp-aee581679e2a61e819950e793d3977b340dec70b.tar.bz2 otp-aee581679e2a61e819950e793d3977b340dec70b.zip |
[orber] Update the test suites to follow the new style
Diffstat (limited to 'lib/orber/test/cdrlib_SUITE.erl')
-rw-r--r-- | lib/orber/test/cdrlib_SUITE.erl | 182 |
1 files changed, 78 insertions, 104 deletions
diff --git a/lib/orber/test/cdrlib_SUITE.erl b/lib/orber/test/cdrlib_SUITE.erl index e3482d11bd..93adc861c5 100644 --- a/lib/orber/test/cdrlib_SUITE.erl +++ b/lib/orber/test/cdrlib_SUITE.erl @@ -28,7 +28,7 @@ -include_lib("common_test/include/ct.hrl"). --define(default_timeout, ?t:minutes(3)). +-define(default_timeout, test_server:minutes(3)). %%----------------------------------------------------------------- %% External exports @@ -73,12 +73,12 @@ end_per_group(_GroupName, Config) -> %%----------------------------------------------------------------- init_per_testcase(_Case, Config) -> - ?line Dog=test_server:timetrap(?default_timeout), + Dog=test_server:timetrap(?default_timeout), [{watchdog, Dog}|Config]. end_per_testcase(_Case, Config) -> - Dog = ?config(watchdog, Config), + Dog = proplists:get_value(watchdog, Config), test_server:timetrap_cancel(Dog), ok. @@ -86,8 +86,6 @@ end_per_testcase(_Case, Config) -> %% Test Case: short integer test %% Description: %%----------------------------------------------------------------- -short(doc) -> ["Description", "more description"]; -short(suite) -> []; short(_) -> short_big_loop([-32768, -4040, -1, 0, 4040, 32767]), short_little_loop([-32768, -4040, -1, 0, 4040, 32767]), @@ -96,16 +94,16 @@ short(_) -> short_big_loop([]) -> ok; short_big_loop([X |List]) -> - ?line [CodedType] = cdrlib:enc_short(X, []), - ?line {X, <<>>} = cdrlib:dec_short(big, CodedType), + [CodedType] = cdrlib:enc_short(X, []), + {X, <<>>} = cdrlib:dec_short(big, CodedType), short_big_loop(List), ok. short_little_loop([]) -> ok; short_little_loop([X |List]) -> - ?line CodedType = enc_short_little(X, []), - ?line {X, <<>>} = cdrlib:dec_short(little, CodedType), + CodedType = enc_short_little(X, []), + {X, <<>>} = cdrlib:dec_short(little, CodedType), short_little_loop(List), ok. @@ -113,16 +111,14 @@ enc_short_little(X, Message) -> list_to_binary([(X) band 16#ff, ((X) bsr 8) band 16#ff | Message]). bad_short() -> - ?line {'EXCEPTION', _} = (catch cdrlib:enc_short('atom', [])), - ?line [CodedType] = cdrlib:enc_char($a, []), - ?line {'EXIT', _} = (catch cdrlib:dec_short(big, CodedType)), + {'EXCEPTION', _} = (catch cdrlib:enc_short('atom', [])), + [CodedType] = cdrlib:enc_char($a, []), + {'EXIT', _} = (catch cdrlib:dec_short(big, CodedType)), ok. %%----------------------------------------------------------------- %% Test Case: unsigned short integer test %% Description: %%----------------------------------------------------------------- -ushort(doc) -> ["Description", "more description"]; -ushort(suite) -> []; ushort(_) -> ushort_big_loop([0, 4040, 65535]), ushort_little_loop([0, 4040, 65535]), @@ -131,16 +127,16 @@ ushort(_) -> ushort_big_loop([]) -> ok; ushort_big_loop([X |List]) -> - ?line [CodedType] = cdrlib:enc_unsigned_short(X, []), - ?line {X, <<>>} = cdrlib:dec_unsigned_short(big, CodedType), + [CodedType] = cdrlib:enc_unsigned_short(X, []), + {X, <<>>} = cdrlib:dec_unsigned_short(big, CodedType), ushort_big_loop(List), ok. ushort_little_loop([]) -> ok; ushort_little_loop([X |List]) -> - ?line CodedType = enc_ushort_little(X, []), - ?line {X, <<>>} = cdrlib:dec_unsigned_short(little, CodedType), + CodedType = enc_ushort_little(X, []), + {X, <<>>} = cdrlib:dec_unsigned_short(little, CodedType), ushort_little_loop(List), ok. @@ -153,8 +149,6 @@ bad_ushort() -> %% Test Case: long integer test %% Description: %%----------------------------------------------------------------- -long(doc) -> ["Description", "more description"]; -long(suite) -> []; long(_) -> long_big_loop([-2147483648, -40404040, -32768, -4040, -1, 0, 4040, 32767, 40404040, 2147483647]), @@ -166,16 +160,16 @@ long(_) -> long_big_loop([]) -> ok; long_big_loop([X |List]) -> - ?line [CodedType] = cdrlib:enc_long(X, []), - ?line {X, <<>>} = cdrlib:dec_long(big, CodedType), + [CodedType] = cdrlib:enc_long(X, []), + {X, <<>>} = cdrlib:dec_long(big, CodedType), long_big_loop(List), ok. long_little_loop([]) -> ok; long_little_loop([X |List]) -> - ?line CodedType = enc_long_little(X, []), - ?line {X, <<>>} = cdrlib:dec_long(little, CodedType), + CodedType = enc_long_little(X, []), + {X, <<>>} = cdrlib:dec_long(little, CodedType), long_little_loop(List), ok. @@ -190,8 +184,6 @@ bad_long() -> %% Test Case: unsigned long integer test %% Description: %%----------------------------------------------------------------- -ulong(doc) -> ["Description", "more description"]; -ulong(suite) -> []; ulong(_) -> ulong_big_loop([0, 4040, 65535, 40404040, 2147483647, 4294967295]), ulong_little_loop([0, 4040, 65535, 40404040, 2147483647, 4294967295]), @@ -201,16 +193,16 @@ ulong(_) -> ulong_big_loop([]) -> ok; ulong_big_loop([X |List]) -> - ?line [CodedType] = cdrlib:enc_unsigned_long(X, []), - ?line {X, <<>>} = cdrlib:dec_unsigned_long(big, CodedType), + [CodedType] = cdrlib:enc_unsigned_long(X, []), + {X, <<>>} = cdrlib:dec_unsigned_long(big, CodedType), ulong_big_loop(List), ok. ulong_little_loop([]) -> ok; ulong_little_loop([X |List]) -> - ?line CodedType = enc_ulong_little(X, []), - ?line {X, <<>>} = cdrlib:dec_unsigned_long(little, CodedType), + CodedType = enc_ulong_little(X, []), + {X, <<>>} = cdrlib:dec_unsigned_long(little, CodedType), ulong_little_loop(List), ok. @@ -226,8 +218,6 @@ bad_ulong() -> %% Test Case: long integer test %% Description: %%----------------------------------------------------------------- -longlong(doc) -> ["Description", "more description"]; -longlong(suite) -> []; longlong(_) -> longlong_big_loop([-2147483648, -40404040, -32768, -4040, -1, 0, 4040, 32767, 40404040, 2147483647]), @@ -239,16 +229,16 @@ longlong(_) -> longlong_big_loop([]) -> ok; longlong_big_loop([X |List]) -> - ?line [CodedType] = cdrlib:enc_longlong(X, []), - ?line {X, <<>>} = cdrlib:dec_longlong(big, CodedType), + [CodedType] = cdrlib:enc_longlong(X, []), + {X, <<>>} = cdrlib:dec_longlong(big, CodedType), longlong_big_loop(List), ok. longlong_little_loop([]) -> ok; longlong_little_loop([X |List]) -> - ?line CodedType = enc_longlong_little(X, []), - ?line {X, <<>>} = cdrlib:dec_longlong(little, CodedType), + CodedType = enc_longlong_little(X, []), + {X, <<>>} = cdrlib:dec_longlong(little, CodedType), longlong_little_loop(List), ok. @@ -264,8 +254,6 @@ bad_longlong() -> %% Test Case: unsigned long integer test %% Description: %%----------------------------------------------------------------- -ulonglong(doc) -> ["Description", "more description"]; -ulonglong(suite) -> []; ulonglong(_) -> ulonglong_big_loop([0, 4040, 65535, 40404040, 2147483647, 4294967295]), ulonglong_little_loop([0, 4040, 65535, 40404040, 2147483647, 4294967295]), @@ -275,16 +263,16 @@ ulonglong(_) -> ulonglong_big_loop([]) -> ok; ulonglong_big_loop([X |List]) -> - ?line [CodedType] = cdrlib:enc_unsigned_longlong(X, []), - ?line {X, <<>>} = cdrlib:dec_unsigned_longlong(big, CodedType), + [CodedType] = cdrlib:enc_unsigned_longlong(X, []), + {X, <<>>} = cdrlib:dec_unsigned_longlong(big, CodedType), ulonglong_big_loop(List), ok. ulonglong_little_loop([]) -> ok; ulonglong_little_loop([X |List]) -> - ?line CodedType = enc_ulonglong_little(X, []), - ?line {X, <<>>} = cdrlib:dec_unsigned_longlong(little, CodedType), + CodedType = enc_ulonglong_little(X, []), + {X, <<>>} = cdrlib:dec_unsigned_longlong(little, CodedType), ulonglong_little_loop(List), ok. @@ -302,47 +290,41 @@ bad_ulonglong() -> %% Test Case: boolean test %% Description: %%----------------------------------------------------------------- -boolean(doc) -> ["Description", "more description"]; -boolean(suite) -> []; boolean(_) -> - ?line [CodedTrue] = cdrlib:enc_bool('true', []), - ?line {'true', <<>>} = cdrlib:dec_bool(CodedTrue), - ?line [CodedFalse] = cdrlib:enc_bool('false', []), - ?line {'false', <<>>} = cdrlib:dec_bool(CodedFalse), + [CodedTrue] = cdrlib:enc_bool('true', []), + {'true', <<>>} = cdrlib:dec_bool(CodedTrue), + [CodedFalse] = cdrlib:enc_bool('false', []), + {'false', <<>>} = cdrlib:dec_bool(CodedFalse), ok. %%----------------------------------------------------------------- %% Test Case: character test %% Description: %%----------------------------------------------------------------- -character(doc) -> ["Description", "more description"]; -character(suite) -> []; character(_) -> - ?line [Coded_0] = cdrlib:enc_char($0, []), - ?line {$0, <<>>} = cdrlib:dec_char(Coded_0), - ?line [Coded_a] = cdrlib:enc_char($a, []), - ?line {$a, <<>>} = cdrlib:dec_char(Coded_a), - ?line [Coded_Z] = cdrlib:enc_char($Z, []), - ?line {$Z, <<>>} = cdrlib:dec_char(Coded_Z), - ?line [Coded_dollar] = cdrlib:enc_char($$, []), - ?line {$$, <<>>} = cdrlib:dec_char(Coded_dollar), + [Coded_0] = cdrlib:enc_char($0, []), + {$0, <<>>} = cdrlib:dec_char(Coded_0), + [Coded_a] = cdrlib:enc_char($a, []), + {$a, <<>>} = cdrlib:dec_char(Coded_a), + [Coded_Z] = cdrlib:enc_char($Z, []), + {$Z, <<>>} = cdrlib:dec_char(Coded_Z), + [Coded_dollar] = cdrlib:enc_char($$, []), + {$$, <<>>} = cdrlib:dec_char(Coded_dollar), ok. %%----------------------------------------------------------------- %% Test Case: octet test %% Description: %%----------------------------------------------------------------- -octet(doc) -> ["Description", "more description"]; -octet(suite) -> []; octet(_) -> - ?line [Coded_ff] = cdrlib:enc_octet(16#ff, []), - ?line {16#ff, <<>>} = cdrlib:dec_octet(Coded_ff), - ?line [Coded_00] = cdrlib:enc_octet(16#00, []), - ?line {16#00, <<>>} = cdrlib:dec_octet(Coded_00), - ?line [Coded_5a] = cdrlib:enc_octet(16#5a, []), - ?line {16#5a, <<>>} = cdrlib:dec_octet(Coded_5a), - ?line [Coded_48] = cdrlib:enc_octet(16#48, []), - ?line {16#48, <<>>} = cdrlib:dec_octet(Coded_48), + [Coded_ff] = cdrlib:enc_octet(16#ff, []), + {16#ff, <<>>} = cdrlib:dec_octet(Coded_ff), + [Coded_00] = cdrlib:enc_octet(16#00, []), + {16#00, <<>>} = cdrlib:dec_octet(Coded_00), + [Coded_5a] = cdrlib:enc_octet(16#5a, []), + {16#5a, <<>>} = cdrlib:dec_octet(Coded_5a), + [Coded_48] = cdrlib:enc_octet(16#48, []), + {16#48, <<>>} = cdrlib:dec_octet(Coded_48), ok. @@ -351,8 +333,6 @@ octet(_) -> %% Test Case: float test %% Description: %%----------------------------------------------------------------- -float(doc) -> ["Description", "more description"]; -float(suite) -> []; float(_) -> G = 16#7fffff / 16#800000 + 1.0, H1 = math:pow(2, 127), @@ -368,18 +348,18 @@ float(_) -> float_big_loop([]) -> ok; float_big_loop([X |List]) -> - ?line [CodedType] = cdrlib:enc_float(X, []), - ?line {Y, <<>>} = cdrlib:dec_float(big, CodedType), - ?line float_comp(X,Y), + [CodedType] = cdrlib:enc_float(X, []), + {Y, <<>>} = cdrlib:dec_float(big, CodedType), + float_comp(X,Y), float_big_loop(List), ok. float_little_loop([]) -> ok; float_little_loop([X |List]) -> - ?line [CodedType] = enc_float_little(X, []), - ?line {Y, <<>>} = cdrlib:dec_float(little, CodedType), - ?line float_comp(X,Y), + [CodedType] = enc_float_little(X, []), + {Y, <<>>} = cdrlib:dec_float(little, CodedType), + float_comp(X,Y), float_little_loop(List), ok. @@ -388,8 +368,8 @@ float_comp(X,Y) when X == 0.0, Y == 0.0 -> float_comp(X,Y) -> Div = abs(Y) / abs(X), %% io:format("~p~n", [float_to_list(Div)]), - ?line true = (Div < 1.0000001), - ?line true = (Div > 0.9999999), + true = (Div < 1.0000001), + true = (Div > 0.9999999), ok. enc_float_little(X, Message) -> @@ -399,8 +379,6 @@ enc_float_little(X, Message) -> %% Test Case: double test %% Description: %%----------------------------------------------------------------- -double(doc) -> ["Description", "more description"]; -double(suite) -> []; double(_) -> F = 16#0fffffffffffff / 16#10000000000000 + 1.0, E1 = math:pow(2, 1023), @@ -423,18 +401,18 @@ double(_) -> double_big_loop([]) -> ok; double_big_loop([X |List]) -> - ?line [CodedType] = cdrlib:enc_double(X, []), - ?line {Y, <<>>} = cdrlib:dec_double(big, CodedType), - ?line double_comp(X,Y), + [CodedType] = cdrlib:enc_double(X, []), + {Y, <<>>} = cdrlib:dec_double(big, CodedType), + double_comp(X,Y), double_big_loop(List), ok. double_little_loop([]) -> ok; double_little_loop([X |List]) -> - ?line [CodedType] = enc_double_little(X, []), - ?line {Y, <<>>} = cdrlib:dec_double(little, CodedType), - ?line double_comp(X,Y), + [CodedType] = enc_double_little(X, []), + {Y, <<>>} = cdrlib:dec_double(little, CodedType), + double_comp(X,Y), double_little_loop(List), ok. @@ -446,12 +424,10 @@ double_comp(X,Y) when X == 0.0, Y == 0.0 -> double_comp(X,Y) -> Div = abs(Y) / abs(X), %% io:format("~p~n", [float_to_list(Div)]), - ?line true = (Div < 1.00000000000001), - ?line true = (Div > 0.99999999999999), + true = (Div < 1.00000000000001), + true = (Div > 0.99999999999999), ok. -double_should_be_ok(doc) -> ["Description", "more description"]; -double_should_be_ok(suite) -> []; double_should_be_ok(_) -> F = 16#0fffffffffffff / 16#10000000000000 + 1.0, E1 = math:pow(2, 1024), % erlang can't handle this. @@ -466,29 +442,27 @@ double_should_be_ok(_) -> %% Test Case: enum test %% Description: %%----------------------------------------------------------------- -enum(doc) -> ["Description", "more description"]; -enum(suite) -> []; enum(_) -> enum_big(), enum_little(), ok. enum_big() -> - ?line [Coded_a] = cdrlib:enc_enum(a,[a,b,c],[]), - ?line {a, <<>>} = cdrlib:dec_enum(big, ["a","b","c"], Coded_a), - ?line [Coded_b] = cdrlib:enc_enum(b,[a,b,c],[]), - ?line {b, <<>>} = cdrlib:dec_enum(big, ["a","b","c"], Coded_b), - ?line [Coded_c] = cdrlib:enc_enum(c,[a,b,c],[]), - ?line {c, <<>>} = cdrlib:dec_enum(big, ["a","b","c"], Coded_c), + [Coded_a] = cdrlib:enc_enum(a,[a,b,c],[]), + {a, <<>>} = cdrlib:dec_enum(big, ["a","b","c"], Coded_a), + [Coded_b] = cdrlib:enc_enum(b,[a,b,c],[]), + {b, <<>>} = cdrlib:dec_enum(big, ["a","b","c"], Coded_b), + [Coded_c] = cdrlib:enc_enum(c,[a,b,c],[]), + {c, <<>>} = cdrlib:dec_enum(big, ["a","b","c"], Coded_c), ok. enum_little() -> - ?line Coded_a = enc_r_enum(a,[a,b,c],[]), - ?line {a, <<>>} = cdrlib:dec_enum(little, ["a","b","c"], Coded_a), - ?line Coded_b = enc_r_enum(b,[a,b,c],[]), - ?line {b, <<>>} = cdrlib:dec_enum(little, ["a","b","c"], Coded_b), - ?line Coded_c = enc_r_enum(c,[a,b,c],[]), - ?line {c, <<>>} = cdrlib:dec_enum(little, ["a","b","c"], Coded_c), + Coded_a = enc_r_enum(a,[a,b,c],[]), + {a, <<>>} = cdrlib:dec_enum(little, ["a","b","c"], Coded_a), + Coded_b = enc_r_enum(b,[a,b,c],[]), + {b, <<>>} = cdrlib:dec_enum(little, ["a","b","c"], Coded_b), + Coded_c = enc_r_enum(c,[a,b,c],[]), + {c, <<>>} = cdrlib:dec_enum(little, ["a","b","c"], Coded_c), ok. enc_r_enum(Enum, ElemList, Message) -> |