https://github.com/jrincayc/ucblogo-code
Tip revision: 0e21c1db877c1e7cb601aa079331d47076b47d30 authored by jeremycowles on 26 April 2009, 01:16:52 UTC
Added more test for standard OOP features.
Added more test for standard OOP features.
Tip revision: 0e21c1d
UnitTests-Predicates.lg
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; ;;
;; BERKELEY LOGO ;;
;; Predicates Test Suite ;;
;; ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
InstallSuite [Predicates] [Tests.Predicates.Setup]
;; The list of all OOP unit tests
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
MAKE "Tests.Predicates [
;list tests here
Tests.Predicates.LessP
Tests.Predicates.Less?
Tests.Predicates.GreaterP
Tests.Predicates.Greater?
Tests.Predicates.LessEqualP
Tests.Predicates.LessEqual?
Tests.Predicates.GreaterEqualP
Tests.Predicates.GreaterEqual?
]
;; Test Suite setup procedure, main entry
;; point for all tests in this suite
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
to Tests.Predicates.Setup
RunTests :Tests.Predicates
end
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; ;;
;; HELPERS, MISC ;;
;; ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; ;;
;; ADD INDIVIDUAL UNIT TESTS BELOW ;;
;; ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;all tests must return T/F indicating success/failure
to Tests.Predicates.LessP
OUTPUT (AND [LESSP 1 2]
[LESSP 0 1]
[LESSP -1 0])
end
to Tests.Predicates.Less?
OUTPUT (AND [LESS? 1 2]
[LESS? 0 1]
[LESS? -1 0])
end
to Tests.Predicates.GreaterP
OUTPUT (AND [GreaterP 2 1]
[GreaterP 1 0]
[GreaterP 0 -1])
end
to Tests.Predicates.Greater?
OUTPUT (AND [Greater? 2 1]
[Greater? 1 0]
[Greater? 0 -1])
end
to Tests.Predicates.LessEqualP
OUTPUT (AND [LessEqualP 2 2]
[LessEqualP 0 1]
[LessEqualP -3 -3])
end
to Tests.Predicates.LessEqual?
OUTPUT (AND [LessEqual? 2 2]
[LessEqual? 0 1]
[LessEqual? -3 -3])
end
to Tests.Predicates.GreaterEqualP
OUTPUT (AND [GreaterEqualP 2 2]
[GreaterEqualP 1 0]
[GreaterEqualP -1 -1])
end
to Tests.Predicates.GreaterEqual?
OUTPUT (AND [GreaterEqual? 2 2]
[GreaterEqual? 1 0]
[GreaterEqual? -1 -1])
end