(module tests mzscheme
(require (planet "test.ss" ("schematics" "schemeunit.plt" 1)))
(require (planet "graphical-ui.ss" ("schematics" "schemeunit.plt" 1)))
(require "../../nationality.ss")
(define philippines-tests
(make-test-suite
"Philippines tests"
(make-test-case "singular adjective"
(assert-equal? (nationality-adjective "Philippines" 'singular)
"Philippine"))
(make-test-case "feminine singular adjective"
(assert-equal? (nationality-adjective "Philippines" 'feminine/singular)
"Philippine"))
(make-test-case "plural adjective"
(assert-equal? (nationality-adjective "Philippines" 'plural)
"Philippine"))
(make-test-case "singular noun"
(assert-equal? (nationality-noun "Philippines" 'singular)
"Filipino"))
(make-test-case "feminine singular noun"
(assert-equal? (nationality-noun "Philippines" 'feminine/singular)
"Filipina"))
(make-test-case "plural noun"
(assert-equal? (nationality-noun "Philippines" 'plural)
"Filipinos"))
))
(define two-part-country-tests
(make-test-suite
"two-part country tests"
))
(define (has-adjective-forall-types? location)
(and (nationality-adjective location 'singular)
(nationality-adjective location 'feminine/singular)
(nationality-adjective location 'plural)
#t))
(define general-tests
(make-test-suite
"general tests"
(make-test-case "every inhabited country has an adjective for all adjective types"
(assert-true (andmap has-adjective-forall-types? inhabited-locations)))
(make-test-case "uninhabited location is a location"
(assert-true (location? "Antarctica")))
(make-test-case "uninhabited location is uninhabited"
(assert-false (location-inhabited? "Antarctica")))
(make-test-case "inhabited location is a location"
(assert-true (location? "France")))
(make-test-case "inhabited location is not uninhabited"
(assert-true (location-inhabited? "France")))
(make-test-case "non-location cannot be tested for being inhabited"
(assert-exn exn? (lambda ()
(location-inhabited? "Boobooland"))))
))
(define all-tests
(make-test-suite
"all nationality.plt tests"
philippines-tests
two-part-country-tests
general-tests
))
(test/graphical-ui all-tests)
(provide all-tests))