% $Id: EnvironmentTest.oz,v 1.4 2008/09/30 04:34:52 leavens Exp $ \insert 'Environment.oz' \insert 'TestingNoStop.oz' %% from the course library {StartTesting 'Environment'} {Test {NameOfEnv {InitEnv}} '==' 'e0'} local Env1 = {InitEnv} in {Test {NameOfEnv Env1} '==' 'e1'} {Test {HasEnv Env1 k} '==' false} end local Env2 = {ExtendEnv {InitEnv} k 3} in {Test {NameOfEnv Env2} '==' e2_3} {Test {HasEnv Env2 k} '==' true} {Test {HasEnv Env2 v2} '==' false} {Test {ApplyEnv Env2 k} '==' 3} local Env3 = {ExtendEnvList Env2 v1|k|v2|nil 0|1|2|nil} in {Test {NameOfEnv Env3} '==' e2_3_4} {Test {HasEnv Env3 k} '==' true} {Test {HasEnv Env3 v1} '==' true} {Test {HasEnv Env3 v2} '==' true} {Test {ApplyEnv Env3 k} '==' 1} {Test {ApplyEnv Env3 v1} '==' 0} {Test {ApplyEnv Env3 v2} '==' 2} {Test {EqualEnv Env2 Env2} '==' true} {Test {EqualEnv Env2 Env3} '==' false} {Test {EqualEnv Env3 Env3} '==' true} {Test {StringForEnv {InitEnv}} '==' '{'#nil#'}'} {System.showInfo {StringForEnv {InitEnv}}} {System.showInfo {StringForEnv Env2}} {System.showInfo {StringForEnv Env3}} end end