diff options
author | Erlang/OTP <[email protected]> | 2009-11-27 15:43:26 +0100 |
---|---|---|
committer | Erlang/OTP <[email protected]> | 2009-11-27 15:43:26 +0100 |
commit | 6448c56ecc7c6584a983c5173fd0748068820698 (patch) | |
tree | 97a7c0a15723cd9c1059836a2fdfe38e0d094130 /lib/stdlib | |
parent | 0af49f38886f4829a0a5df8bced3bf8815f89523 (diff) | |
parent | 8f554b5f5cd31c253bd27abb117596929269d157 (diff) | |
download | otp-6448c56ecc7c6584a983c5173fd0748068820698.tar.gz otp-6448c56ecc7c6584a983c5173fd0748068820698.tar.bz2 otp-6448c56ecc7c6584a983c5173fd0748068820698.zip |
Merge remote branch 'refs/remotes/origin/dgud/array_tests' into ccase/r13b04_dev
* refs/remotes/origin/dgud/array_tests:
Added more tests for array:reset/2.
Diffstat (limited to 'lib/stdlib')
-rw-r--r-- | lib/stdlib/src/array.erl | 16 | ||||
-rw-r--r-- | lib/stdlib/test/array_SUITE.erl | 16 |
2 files changed, 22 insertions, 10 deletions
diff --git a/lib/stdlib/src/array.erl b/lib/stdlib/src/array.erl index 295eeac221..83576c9fd3 100644 --- a/lib/stdlib/src/array.erl +++ b/lib/stdlib/src/array.erl @@ -741,11 +741,17 @@ set_get_test_() -> ?_assert(array:get(0, set(0, 42, set(0, 17, new()))) =:= 42), - ?_assert(array:get(0, reset(0, new())) =:= undefined), - ?_assert(array:get(0, reset(0, set(0, 17, new()))) =:= undefined), - ?_assert(array:get(0, reset(0, new({default,42}))) =:= 42), - ?_assert(array:get(0, reset(0, set(0, 17, new({default,42})))) - =:= 42) + ?_assertError(badarg, array:get(0, reset(11, new([{size,10}])))), + ?_assertError(badarg, array:get(0, reset(-1, new([{size,10}])))), + ?_assert(array:get(0, reset(0, new())) =:= undefined), + ?_assert(array:get(0, reset(0, set(0, 17, new()))) =:= undefined), + ?_assert(array:get(0, reset(9, set(9, 17, new()))) =:= undefined), + ?_assert(array:get(0, reset(11, set(11, 17, new()))) =:= undefined), + ?_assert(array:get(0, reset(11, set(12, 17, new()))) =:= undefined), + ?_assert(array:get(0, reset(1, set(12, 17, new()))) =:= undefined), + ?_assert(array:get(0, reset(11, new())) =:= undefined), + ?_assert(array:get(0, reset(0, set(0, 17, new({default,42})))) =:= 42), + ?_assert(array:get(0, reset(0, new({default,42}))) =:= 42) ]. -endif. diff --git a/lib/stdlib/test/array_SUITE.erl b/lib/stdlib/test/array_SUITE.erl index 7cfdcf6dfd..e7cfc65be1 100644 --- a/lib/stdlib/test/array_SUITE.erl +++ b/lib/stdlib/test/array_SUITE.erl @@ -384,11 +384,17 @@ set_get_test_() -> ?_assert(array:get(0, set(0, 42, set(0, 17, new()))) =:= 42), - ?_assert(array:get(0, reset(0, new())) =:= undefined), - ?_assert(array:get(0, reset(0, set(0, 17, new()))) =:= undefined), - ?_assert(array:get(0, reset(0, new({default,42}))) =:= 42), - ?_assert(array:get(0, reset(0, set(0, 17, new({default,42})))) - =:= 42) + ?_assertError(badarg, array:get(0, reset(11, new([{size,10}])))), + ?_assertError(badarg, array:get(0, reset(-1, new([{size,10}])))), + ?_assert(array:get(0, reset(0, new())) =:= undefined), + ?_assert(array:get(0, reset(0, set(0, 17, new()))) =:= undefined), + ?_assert(array:get(0, reset(9, set(9, 17, new()))) =:= undefined), + ?_assert(array:get(0, reset(11, set(11, 17, new()))) =:= undefined), + ?_assert(array:get(0, reset(11, set(12, 17, new()))) =:= undefined), + ?_assert(array:get(0, reset(1, set(12, 17, new()))) =:= undefined), + ?_assert(array:get(0, reset(11, new())) =:= undefined), + ?_assert(array:get(0, reset(0, set(0, 17, new({default,42})))) =:= 42), + ?_assert(array:get(0, reset(0, new({default,42}))) =:= 42) ]. to_list_test_() -> |