diff options
Diffstat (limited to 'lib/compiler/test/bs_construct_SUITE.erl')
-rw-r--r-- | lib/compiler/test/bs_construct_SUITE.erl | 180 |
1 files changed, 90 insertions, 90 deletions
diff --git a/lib/compiler/test/bs_construct_SUITE.erl b/lib/compiler/test/bs_construct_SUITE.erl index e24b3f0315..d94e870e21 100644 --- a/lib/compiler/test/bs_construct_SUITE.erl +++ b/lib/compiler/test/bs_construct_SUITE.erl @@ -85,7 +85,7 @@ id(I) -> I. -define(T(B, L), {B, ??B, L}). -define(N(B), {B, ??B, unknown}). --define(FAIL(Expr), ?line {'EXIT',{badarg,_}} = (catch Expr)). +-define(FAIL(Expr), {'EXIT',{badarg,_}} = (catch Expr)). l(I_13, I_big1, I_16, Bin) -> [ @@ -260,15 +260,15 @@ equal_lists(A, B, R) -> end. test1(Config) when is_list(Config) -> - ?line I_13 = i(13), - ?line I_big1 = big(1), - ?line I_16 = i(16), - ?line Bin = i(<<16#A5,16#5A,16#C3>>), - ?line Vars = lists:sort([{'I_13',I_13}, - {'I_big1',I_big1}, - {'I_16',I_16}, - {'Bin',Bin}]), - ?line lists:foreach(fun one_test/1, eval_list(l(I_13, I_big1, I_16, Bin), Vars)). + I_13 = i(13), + I_big1 = big(1), + I_16 = i(16), + Bin = i(<<16#A5,16#5A,16#C3>>), + Vars = lists:sort([{'I_13',I_13}, + {'I_big1',I_big1}, + {'I_16',I_16}, + {'Bin',Bin}]), + lists:foreach(fun one_test/1, eval_list(l(I_13, I_big1, I_16, Bin), Vars)). fail(Config) when is_list(Config) -> I_minus_777 = i(-777), @@ -277,68 +277,68 @@ fail(Config) when is_list(Config) -> %% One negative field size, but the sum of field sizes will be 1 byte. %% Make sure that we reject that properly. - ?line {'EXIT',{badarg,_}} = (catch <<I_minus_777:2048/unit:8, - 57:I_minus_2047/unit:8>>), + {'EXIT',{badarg,_}} = (catch <<I_minus_777:2048/unit:8, + 57:I_minus_2047/unit:8>>), %% Same thing, but use literals. - ?line {'EXIT',{badarg,_}} = (catch <<I_minus_777:2048/unit:8, - 57:(-2047)/unit:8>>), + {'EXIT',{badarg,_}} = (catch <<I_minus_777:2048/unit:8, + 57:(-2047)/unit:8>>), %% Not numbers. - ?line {'EXIT',{badarg,_}} = (catch <<45:(i(not_a_number))>>), - ?line {'EXIT',{badarg,_}} = (catch <<13:8,45:(i(not_a_number))>>), + {'EXIT',{badarg,_}} = (catch <<45:(i(not_a_number))>>), + {'EXIT',{badarg,_}} = (catch <<13:8,45:(i(not_a_number))>>), %% Unaligned sizes. BadSz = i(7), Bitstr = i(<<42:17>>), - ?line {'EXIT',{badarg,_}} = (catch <<Bitstr:4/binary>>), - ?line {'EXIT',{badarg,_}} = (catch <<Bitstr:BadSz/binary>>), + {'EXIT',{badarg,_}} = (catch <<Bitstr:4/binary>>), + {'EXIT',{badarg,_}} = (catch <<Bitstr:BadSz/binary>>), - ?line [] = [X || {X} <- [], X == <<Bitstr:BadSz/binary>>], - ?line [] = [X || {X} <- [], X == <<Bitstr:4/binary>>], + [] = [X || {X} <- [], X == <<Bitstr:BadSz/binary>>], + [] = [X || {X} <- [], X == <<Bitstr:4/binary>>], %% Literals with incorrect type. - ?line {'EXIT',{badarg,_}} = (catch <<42.0/integer>>), - ?line {'EXIT',{badarg,_}} = (catch <<42/binary>>), - ?line {'EXIT',{badarg,_}} = (catch <<an_atom/integer>>), + {'EXIT',{badarg,_}} = (catch <<42.0/integer>>), + {'EXIT',{badarg,_}} = (catch <<42/binary>>), + {'EXIT',{badarg,_}} = (catch <<an_atom/integer>>), ok. float_bin(Config) when is_list(Config) -> %% Some more coverage. - ?line {<<1,2,3>>,7.0} = float_bin_1(4), + {<<1,2,3>>,7.0} = float_bin_1(4), F = 42.0, - ?line <<42,0,0,0,0,0,0,69,64>> = <<(id(42)),F/little-float>>, + <<42,0,0,0,0,0,0,69,64>> = <<(id(42)),F/little-float>>, ok. float_bin_1(F) -> {<<1,2,3>>,F+3.0}. in_guard(Config) when is_list(Config) -> - ?line 1 = in_guard_1(<<16#74ad:16>>, 16#e95, 5), - ?line 2 = in_guard_1(<<16#3A,16#F7,"hello">>, 16#3AF7, <<"hello">>), - ?line 3 = in_guard_1(<<16#FBCD:14,3.1415/float,3:2>>, 16#FBCD, 3.1415), - ?line 3 = in_guard_1(<<16#FBCD:14,3/float,3:2>>, 16#FBCD, 3), - ?line 3 = in_guard_1(<<16#FBCD:14,(2 bsl 226)/float,3:2>>, 16#FBCD, 2 bsl 226), - ?line nope = in_guard_1(<<1>>, 42, b), - ?line nope = in_guard_1(<<1>>, a, b), - ?line nope = in_guard_1(<<1,2>>, 1, 1), - ?line nope = in_guard_1(<<4,5>>, 1, 2.71), - ?line nope = in_guard_1(<<4,5>>, 1, <<12,13>>), - - ?line 1 = in_guard_2(<<0,56>>, 7, blurf), - ?line 2 = in_guard_2(<<1,255>>, 511, blurf), - ?line 3 = in_guard_2(<<0,3>>, 0, blurf), - ?line 4 = in_guard_2(<<>>, 1, {<<7:16>>}), - ?line nope = in_guard_2(<<4,5>>, 1, blurf), - - ?line 42 = in_guard_3(<<1,2,3,42>>, <<1,2,3>>), - ?line 42 = in_guard_3(<<1,2,3,42>>, <<1,2,3>>), - ?line nope = in_guard_3(<<>>, <<>>), - - ?line ok = in_guard_4(<<15:4>>, 255), - ?line nope = in_guard_4(<<15:8>>, 255), + 1 = in_guard_1(<<16#74ad:16>>, 16#e95, 5), + 2 = in_guard_1(<<16#3A,16#F7,"hello">>, 16#3AF7, <<"hello">>), + 3 = in_guard_1(<<16#FBCD:14,3.1415/float,3:2>>, 16#FBCD, 3.1415), + 3 = in_guard_1(<<16#FBCD:14,3/float,3:2>>, 16#FBCD, 3), + 3 = in_guard_1(<<16#FBCD:14,(2 bsl 226)/float,3:2>>, 16#FBCD, 2 bsl 226), + nope = in_guard_1(<<1>>, 42, b), + nope = in_guard_1(<<1>>, a, b), + nope = in_guard_1(<<1,2>>, 1, 1), + nope = in_guard_1(<<4,5>>, 1, 2.71), + nope = in_guard_1(<<4,5>>, 1, <<12,13>>), + + 1 = in_guard_2(<<0,56>>, 7, blurf), + 2 = in_guard_2(<<1,255>>, 511, blurf), + 3 = in_guard_2(<<0,3>>, 0, blurf), + 4 = in_guard_2(<<>>, 1, {<<7:16>>}), + nope = in_guard_2(<<4,5>>, 1, blurf), + + 42 = in_guard_3(<<1,2,3,42>>, <<1,2,3>>), + 42 = in_guard_3(<<1,2,3,42>>, <<1,2,3>>), + nope = in_guard_3(<<>>, <<>>), + + ok = in_guard_4(<<15:4>>, 255), + nope = in_guard_4(<<15:8>>, 255), ok. in_guard_1(Bin, A, B) when <<A:13,B:3>> == Bin -> 1; @@ -360,10 +360,10 @@ in_guard_4(Bin, A) when <<A:4>> =:= Bin -> ok; in_guard_4(_, _) -> nope. in_catch(Config) when is_list(Config) -> - ?line <<42,0,5>> = small(42, 5), - ?line <<255>> = small(255, <<1,2,3,4,5,6,7,8,9>>), - ?line <<1,2>> = small(<<7,8,9,10>>, 258), - ?line <<>> = small(<<1,2,3,4,5>>, <<7,8,9,10>>), + <<42,0,5>> = small(42, 5), + <<255>> = small(255, <<1,2,3,4,5,6,7,8,9>>), + <<1,2>> = small(<<7,8,9,10>>, 258), + <<>> = small(<<1,2,3,4,5>>, <<7,8,9,10>>), <<15,240,0,42>> = small2(255, 42), <<7:20>> = small2(<<1,2,3>>, 7), @@ -412,20 +412,20 @@ small2(A, B) -> nasty_literals(Config) when is_list(Config) -> case erlang:system_info(endian) of big -> - ?line [0,42] = binary_to_list(id(<<42:16/native>>)); + [0,42] = binary_to_list(id(<<42:16/native>>)); little -> - ?line [42,0] = binary_to_list(id(<<42:16/native>>)) + [42,0] = binary_to_list(id(<<42:16/native>>)) end, - ?line Bin0 = id(<<1,2,3,0:10000000,4,5,6>>), - ?line 1250006 = size(Bin0), - ?line <<1,2,3,0:10000000,4,5,6>> = Bin0, + Bin0 = id(<<1,2,3,0:10000000,4,5,6>>), + 1250006 = size(Bin0), + <<1,2,3,0:10000000,4,5,6>> = Bin0, - ?line Bin1 = id(<<0:10000000,7,8,-1:10000000,9,10,0:10000000>>), - ?line 3750004 = size(Bin1), - ?line <<0:10000000,7,8,-1:10000000/signed,9,10,0:10000000>> = Bin1, + Bin1 = id(<<0:10000000,7,8,-1:10000000,9,10,0:10000000>>), + 3750004 = size(Bin1), + <<0:10000000,7,8,-1:10000000/signed,9,10,0:10000000>> = Bin1, - ?line <<255,255,0,0,0>> = id(<<255,255,0,0,0>>), + <<255,255,0,0,0>> = id(<<255,255,0,0,0>>), %% Coverage. I = 16#7777FFFF7777FFFF7777FFFF7777FFFF7777FFFF7777FFFF, @@ -434,18 +434,18 @@ nasty_literals(Config) when is_list(Config) -> ok. -define(COF(Int0), - ?line (fun(Int) -> - true = <<Int:32/float>> =:= <<(float(Int)):32/float>>, - true = <<Int:64/float>> =:= <<(float(Int)):64/float>> - end)(nonliteral(Int0)), - ?line true = <<Int0:32/float>> =:= <<(float(Int0)):32/float>>, - ?line true = <<Int0:64/float>> =:= <<(float(Int0)):64/float>>). + (fun(Int) -> + true = <<Int:32/float>> =:= <<(float(Int)):32/float>>, + true = <<Int:64/float>> =:= <<(float(Int)):64/float>> + end)(nonliteral(Int0)), + true = <<Int0:32/float>> =:= <<(float(Int0)):32/float>>, + true = <<Int0:64/float>> =:= <<(float(Int0)):64/float>>). -define(COF64(Int0), - ?line (fun(Int) -> - true = <<Int:64/float>> =:= <<(float(Int)):64/float>> - end)(nonliteral(Int0)), - ?line true = <<Int0:64/float>> =:= <<(float(Int0)):64/float>>). + (fun(Int) -> + true = <<Int:64/float>> =:= <<(float(Int)):64/float>> + end)(nonliteral(Int0)), + true = <<Int0:64/float>> =:= <<(float(Int0)):64/float>>). nonliteral(X) -> X. @@ -466,7 +466,7 @@ coerce_to_float(Config) when is_list(Config) -> side_effect(Config) when is_list(Config) -> {'EXIT',{badarg,_}} = (catch side_effect_1(a)), {'EXIT',{badarg,_}} = (catch side_effect_1(<<>>)), - ?line ok = side_effect_1(42), + ok = side_effect_1(42), ok. side_effect_1(A) -> @@ -476,32 +476,32 @@ side_effect_1(A) -> -record(otp_7029, {a,b}). opt(Config) when is_list(Config) -> - ?line 42 = otp_7029(#otp_7029{a = <<>>,b = 42}), + 42 = otp_7029(#otp_7029{a = <<>>,b = 42}), N = 16, - ?line <<1,3,65>> = id(<<1,833:N>>), - ?line <<1,66,3>> = id(<<1,834:N/little>>), - ?line <<1,65,136,0,0>> = id(<<1,17.0:32/float>>), - ?line <<1,64,8,0,0,0,0,0,0>> = id(<<1,3.0:N/float-unit:4>>), - ?line <<1,0,0,0,0,0,0,8,64>> = id(<<1,3.0:N/little-float-unit:4>>), - ?line {'EXIT',{badarg,_}} = (catch id(<<3.1416:N/float>>)), + <<1,3,65>> = id(<<1,833:N>>), + <<1,66,3>> = id(<<1,834:N/little>>), + <<1,65,136,0,0>> = id(<<1,17.0:32/float>>), + <<1,64,8,0,0,0,0,0,0>> = id(<<1,3.0:N/float-unit:4>>), + <<1,0,0,0,0,0,0,8,64>> = id(<<1,3.0:N/little-float-unit:4>>), + {'EXIT',{badarg,_}} = (catch id(<<3.1416:N/float>>)), B = <<1,2,3,4,5>>, - ?line <<0,1,2,3,4,5>> = id(<<0,B/binary>>), - ?line <<1,2,3,4,5,19>> = id(<<B:5/binary,19>>), - ?line <<1,2,3,42>> = id(<<B:3/binary,42>>), + <<0,1,2,3,4,5>> = id(<<0,B/binary>>), + <<1,2,3,4,5,19>> = id(<<B:5/binary,19>>), + <<1,2,3,42>> = id(<<B:3/binary,42>>), - ?line {'EXIT',_} = (catch <<<<23,56,0,2>>:(2.5)/binary>>), - ?line {'EXIT',_} = (catch <<<<23,56,0,2>>:(-16)/binary>>), - ?line {'EXIT',_} = (catch <<<<23,56,0,2>>:(anka)>>), - ?line {'EXIT',_} = (catch <<<<23,56,0,2>>:64/float>>), - ?line {'EXIT',_} = (catch <<<<23,56,0,2:7>>/binary>>), + {'EXIT',_} = (catch <<<<23,56,0,2>>:(2.5)/binary>>), + {'EXIT',_} = (catch <<<<23,56,0,2>>:(-16)/binary>>), + {'EXIT',_} = (catch <<<<23,56,0,2>>:(anka)>>), + {'EXIT',_} = (catch <<<<23,56,0,2>>:64/float>>), + {'EXIT',_} = (catch <<<<23,56,0,2:7>>/binary>>), %% Test constant propagation - there should be a warning. BadSz = 2.5, {'EXIT',_} = (catch <<<<N,56,0,2>>:BadSz/binary>>), case id(false) of - true -> ?line opt_dont_call_me(); + true -> opt_dont_call_me(); false -> ok end, @@ -529,7 +529,7 @@ otp_7556(Bin, A, B, C) -> %% for a binary construction with a later allocation). float_arith(Config) when is_list(Config) -> - ?line {<<1,2,3,64,69,0,0,0,0,0,0>>,21.0} = do_float_arith(<<1,2,3>>, 42, 2), + {<<1,2,3,64,69,0,0,0,0,0,0>>,21.0} = do_float_arith(<<1,2,3>>, 42, 2), ok. do_float_arith(Bin0, X, Y) -> @@ -537,7 +537,7 @@ do_float_arith(Bin0, X, Y) -> {Bin,X / Y}. otp_8054(Config) when is_list(Config) -> - ?line <<"abc">> = otp_8054_1([null,1,2,3], <<"abc">>), + <<"abc">> = otp_8054_1([null,1,2,3], <<"abc">>), ok. otp_8054_1([H|T], Bin) -> |