- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patharray_test.rb
More file actions
Latest commit
47 lines (38 loc) · 1.08 KB
/
Copy patharray_test.rb
File metadata and controls
47 lines (38 loc) · 1.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
require'test_helper'
classArrayTest < EdgeCase::TestCase
deftest_basic_arrays
food=[:peanut,:button,:and,:jelly]
assert_equal__,food[0]
assert_equal__,food.size
end
deftest_array_access
food=[:peanut,:button,:and,:jelly]
assert_equal__,food.first
assert_equal__,food.last
assert_equal__,food[0]
assert_equal__,food[2]
assert_equal__,food[(food.size() - 1)]
end
deftest_arrays_with_other_objects
food=[:peanut,:button,:and,:jelly,1,nil]
assert_equal__,food.size
assert_equal__,food.last
assert_equal__,food[5]
end
deftest_adding_to_an_array_with_shovel_shovel
food=[:peanut,:button,:and,:jelly]
food << 'sandwich'
assert_equal__,food.size
assert_equal__,food.first
end
deftest_adding_to_an_array_with_push
food=[:peanut,:button,:and,:jelly]
food.push('sandwich')
assert_equal__,food.last
end
deftest_adding_to_an_array_with_unshift
food=[:peanut,:button,:and,:jelly]
food.unshift('a')
assert_equal__,food.first
end
end