aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorSverker Eriksson <[email protected]>2015-04-29 17:26:19 +0200
committerSverker Eriksson <[email protected]>2015-04-29 17:26:19 +0200
commita105db26b2e8b3f26895189f460c851a34f25147 (patch)
treee2e2abc7e49fcb4792099ff1f631a9be1f133e0f /lib
parente40aab7e9fb9d622e9879efa43af2ce30b287450 (diff)
downloadotp-a105db26b2e8b3f26895189f460c851a34f25147.tar.gz
otp-a105db26b2e8b3f26895189f460c851a34f25147.tar.bz2
otp-a105db26b2e8b3f26895189f460c851a34f25147.zip
hipe: Add test for matching of writable binary
Diffstat (limited to 'lib')
-rw-r--r--lib/hipe/test/bs_SUITE_data/bs_match.erl14
1 files changed, 13 insertions, 1 deletions
diff --git a/lib/hipe/test/bs_SUITE_data/bs_match.erl b/lib/hipe/test/bs_SUITE_data/bs_match.erl
index 8194d878b8..7bc93a316b 100644
--- a/lib/hipe/test/bs_SUITE_data/bs_match.erl
+++ b/lib/hipe/test/bs_SUITE_data/bs_match.erl
@@ -12,7 +12,8 @@
test() ->
Funs = [fun test_aligned/0, fun test_unaligned/0,
- fun test_zero_tail/0, fun test_integer_matching/0],
+ fun test_zero_tail/0, fun test_integer_matching/0,
+ fun test_writable_bin/0],
lists:foreach(fun (F) -> ok = F() end, Funs).
%%-------------------------------------------------------------------
@@ -173,3 +174,14 @@ test_dynamic_integer_matching(N) ->
<<12:N/integer, 0:S>> = <<12:N/integer, 0:S>>,
<<12:N/integer-little, 0:S>> = <<12:N/integer-little, 0:S>>,
ok.
+
+test_writable_bin() ->
+ test_writable_bin(<<>>, 0),
+ ok.
+
+test_writable_bin(Bin, 128) ->
+ Bin;
+test_writable_bin(Bin0, N) when N < 128 ->
+ Bin1 = <<Bin0/binary, N>>,
+ <<_/utf8, _/binary>> = Bin1,
+ test_writable_bin(Bin1, N+1).