Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- , testGroup "myTests" [
- testProperty "ObjectIterator w/ 1 value existent and one value non-existent" prop_obj_iterator1_null],
- testProperty "ObjectIterator w/ 2 values existent, one being an empty ob!" prop_obj_iterator2_ok,
- testProperty "ArrIterator w/ 1 index out of bounds (i > length xs)" prop_arr_iterator_one_out_of_bound,
- testProperty "ArrIterator [] (take all elements)" prop_arr_iterator_take_all,
- testProperty "ArrIterator w/ negative index values (i < 0), in bounds (0 <= -i < length xs)" prop_arr_iterator_negative_values,
- testProperty "ArrIterator w/ 1 negative value that is out of bounds (-i > length xs)" prop_arr_iterator_negative_out_of_bounds,
- testProperty "ArrIndex base case (positive, in bounds: 0 <= i < length xs)" prop_arr_index_base_case,
- testProperty "ArrIndex positive index out of bounds (i > length xs)" prop_arr_index_out_of_bound_positiv,
- testProperty "ArrIndex negative OK case (in bounds: 0 <= -i < length xs)" prop_arr_index_negative_case,
- testProperty "ArrInedx negative index out of bounds (-i >= length xs)" prop_arr_index_out_of_bound_negative,
- testProperty "ArrInedx negative (-i == length xs) (i.e.: v : [0, 1, 2], v[-3] == v[0])" prop_arr_index_negative_first_element,
- testProperty "ArrSliceIndex base case (Both left and right positive and in bounds, left <= right); [a:b]" prop_arr_slice_base_case,
- testProperty "ArrSliceIndex only Left specified [a:]" prop_arr_slice_only_left_specified,
- testProperty "ArrSliceIndex only Right specified [:b]" prop_arr_slice_only_right_specified,
- testProperty "ArrSliceIndex both left and right negative, left <= right, both in bounds (0 <= -left, -right < length xs)" prop_arr_slice_both_negative,
- testProperty "ArrSliceIndex left >= right => Empty list" prop_arr_slice_left_greater_than_right,
- testProperty "ArrSliceIndex Out of bounds both (left, right > length xs) => Empty list" prop_arr_slice_out_of_bounds_both,
- testProperty "ArrSliceIndex Out of bound right (right >= length xs => cap it to length xs) => equivalent to [a:]" prop_arr_slice_out_of_bounds_right,
- testProperty "ArrSliceIndex Out of bound left (-left >= length xs => cap it to i = (-length xs)) => equivalent to [:b]" prop_arr_slice_out_of_bounds_left
- -- My tests :D
- prop_obj_iterator1_null = run (compile $ ObjValueIt ["a", "c"]) (JObject [("a", JArray [JNumber 1])]) == Right [JArray [JNumber 1], JNull]
- prop_obj_iterator2_ok = run (compile $ ObjValueIt ["a", "c"]) (JObject [("a", JNumber 1), ("c", JObject [])]) == Right [JNumber 1, JObject []]
- prop_arr_iterator_one_out_of_bound = run (compile $ ArrIt [0, 2, 4]) (JArray [JNumber 0, JNumber 1, JNumber 2]) === Right [JNumber 0, JNumber 2, JNull]
- prop_arr_iterator_take_all = run (compile $ ArrIt []) (JArray [JNumber 0, JNumber 1, JNumber 2]) === Right [JNumber 0, JNumber 1, JNumber 2]
- prop_arr_iterator_negative_values = run (compile $ ArrIt [1, -3, -2, 3]) (JArray [JNumber 0, JNumber 1, JNumber 2, JNumber 3, JNumber 4, JNumber 5]) === Right [JNumber 1, JNumber 3, JNumber 4, JNumber 3]
- prop_arr_iterator_negative_out_of_bounds = run (compile $ ArrIt [-100]) (JArray [JNumber 0, JNumber 1, JNumber 2, JNumber 3, JNumber 4, JNumber 5]) === Right [JNull]
- prop_arr_iterator_negative_out_of_bounds_more_it_to_check = run (compile $ ArrIt [1, -100, 1]) (JArray [JNumber 0, JNumber 1, JNumber 2, JNumber 3, JNumber 4, JNumber 5]) === Right [JNumber 1, JNull, JNumber 1]
- prop_arr_index_base_case = run (compile $ ArrIndex 2) (JArray [JNumber 0, JNumber 1, JNumber 2, JNumber 3, JNumber 4, JNumber 5]) === Right [JNumber 2]
- prop_arr_index_out_of_bound_positiv = run (compile $ ArrIndex 10) (JArray [JNumber 0, JNumber 1, JNumber 2, JNumber 3, JNumber 4, JNumber 5]) === Right [JNull]
- prop_arr_index_negative_case = run (compile $ ArrIndex (-2)) (JArray [JNumber 0, JNumber 1, JNumber 2, JNumber 3, JNumber 4, JNumber 5]) === Right [JNumber 4]
- prop_arr_index_out_of_bound_negative = run (compile $ ArrIndex (-7)) (JArray [JNumber 0, JNumber 1, JNumber 2, JNumber 3, JNumber 4, JNumber 5]) === Right [JNull]
- prop_arr_index_negative_first_element = run (compile $ ArrIndex (-6)) (JArray [JNumber 0, JNumber 1, JNumber 2, JNumber 3, JNumber 4, JNumber 5]) === Right [JNumber 0]
- prop_arr_slice_base_case = run (compile $ ArrIndexSlice (Just 2) (Just 4)) (JArray [JNumber 0, JNumber 1, JNumber 2, JNumber 3, JNumber 4, JNumber 5]) === Right [JNumber 2, JNumber 3]
- prop_arr_slice_only_left_specified = run (compile $ ArrIndexSlice (Just 4) Nothing) (JArray [JNumber 0, JNumber 1, JNumber 2, JNumber 3, JNumber 4, JNumber 5]) === Right [JNumber 4, JNumber 5]
- prop_arr_slice_only_right_specified = run (compile $ ArrIndexSlice Nothing (Just 2)) (JArray [JNumber 0, JNumber 1, JNumber 2, JNumber 3, JNumber 4, JNumber 5]) === Right [JNumber 0, JNumber 1]
- prop_arr_slice_both_negative = run (compile $ ArrIndexSlice (Just (-3)) (Just (-1))) (JArray [JNumber 0, JNumber 1, JNumber 2, JNumber 3, JNumber 4, JNumber 5]) === Right [JNumber 3, JNumber 4]
- prop_arr_slice_left_greater_than_right = run (compile $ ArrIndexSlice (Just 3) (Just 1)) (JArray [JNumber 0, JNumber 1, JNumber 2, JNumber 3, JNumber 4, JNumber 5]) === Right [] -- [] empty list
- prop_arr_slice_out_of_bounds_both = run (compile $ ArrIndexSlice (Just 6) (Just 8)) (JArray [JNumber 0, JNumber 1, JNumber 2, JNumber 3, JNumber 4, JNumber 5]) === Right [] -- [] empty list
- prop_arr_slice_out_of_bounds_right = run (compile $ ArrIndexSlice (Just 4) (Just 8)) (JArray [JNumber 0, JNumber 1, JNumber 2, JNumber 3, JNumber 4, JNumber 5]) === Right [JNumber 4, JNumber 5]
- prop_arr_slice_out_of_bounds_left = run (compile $ ArrIndexSlice (Just (-8)) (Just 2)) (JArray [JNumber 0, JNumber 1, JNumber 2, JNumber 3, JNumber 4, JNumber 5]) === Right [JNumber 0, JNumber 1]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement