Files
mercury/tests/hard_coded/test_array2d.exp
Ralph Becket 40f91a28ef Added a new library module, array2d.m, implementing 2d rectangular arrays.
Estimated hours taken: 4
Branches: main

Added a new library module, array2d.m, implementing 2d rectangular arrays.

NEWS:
	Report the new addition.

library/array2d.m:
	Added.

library/library.m:
	Added import for array2d.

compiler/modules.m:
	Added clause for array2d to mercury_std_library_module/1.

tests/hard_coded/test_array2d.m:
tests/hard_coded/test_array2d.exp:
tests/hard_coded/Mmakefile:
	Test case added.
2003-01-23 04:25:47 +00:00

36 lines
941 B
Plaintext

Empty =
[[]]
One =
[[1]]
One ^ elem(0, 0) = 1
Two =
[[1, 0]
[0, 2]]
Two ^ elem(0, 0) = 1
Two ^ elem(0, 1) = 0
Two ^ elem(1, 0) = 0
Two ^ elem(1, 1) = 2
Two_a =
[[1, 3]
[0, 2]]
Two_b =
[[1, 3]
[4, 2]]
Zeroes =
[[0, 0, 0]
[0, 0, 0]
[0, 0, 0]]
Empty ^ elem(0, 0) = exception(univ_cons(software_error("array2d.elem: indices out of bounds")))
Zeroes ^ elem(-1, 0) = exception(univ_cons(software_error("array2d.elem: indices out of bounds")))
Zeroes ^ elem(0, -1) = exception(univ_cons(software_error("array2d.elem: indices out of bounds")))
Zeroes ^ elem(-1, -1) = exception(univ_cons(software_error("array2d.elem: indices out of bounds")))
Zeroes ^ elem(3, 0) = exception(univ_cons(software_error("array2d.elem: indices out of bounds")))
Zeroes ^ elem(0, 3) = exception(univ_cons(software_error("array2d.elem: indices out of bounds")))
Zeroes ^ elem(3, 3) = exception(univ_cons(software_error("array2d.elem: indices out of bounds")))