[View] [Edit] [Lock] [References] [Attachments] [History] [Home] [Changes] [Search] [Help]
obsolete[m8n] 75 inlines core
Tests for compiled methods with inlined code (category: core)
-- setup
test=smalltalk.Test:new()
--core inlines (class isNil notNil)
if (test:cls()~=smalltalk.Test) then error("Must return Test") end
if (test:selfIsNil()~=false) then error("Must be false") end
if (test:nilIsNil()~=true) then error("Must be true") end
if (test:selfNotNil()==false) then error("Must be true") end
if (test:nilNotNil()==true) then error("Must be false") end
--core inlines (= ~=)
if (test:equNil()) then error("Equality to nil failed") end
if (test:nilEqu()) then error("nilEqu failed") end
if (test:equ1()) then error("Equality to 1 failed") end
if (test:oneEqu()) then error("oneEqu failed") end
if (not test:equSelf()) then error("Equality failed") end
if (not test:equSelf_(test)) then error("Equality to self failed") end
if (test:equSelf_(smalltalk.Object)) then error("Equality to Object failed") end
if (test:equSelf_(nil)) then error("Equality to nil failed") end
if (test:equSelf_(1)) then error("Equality to 1 failed") end
if (not test:oneEqu_(1)) then error("1Equality failed") end
if (test:oneEqu_(smalltalk.Object)) then error("1Equality to Object failed") end
if (test:oneEqu_(nil)) then error("1Equality to nil failed") end
if (test:oneEqu_(test)) then error("1Equality to test failed") end
if (not test:is_equ_(test,test)) then error("Must be equal") end
if (not test:is_equ_(nil,nil)) then error("Must be equal") end
if (not test:is_equ_(1,1)) then error("Must be equal") end
if (not test:is_equ_(smalltalk.Object,smalltalk.Point:superclass())) then error("Must be equal") end
if (not test:is_equ_("hello","hello")) then error("Must be equal") end
if (not test:is_equ_("hello","he".."llo")) then error("Must be equal") end
if (test:is_equ_(1,test)) then error("is 1 equ test failed") end
if (test:is_equ_(smalltalk.Test:new(),test)) then error("is new equ test failed") end
if (test:is_equ_(smalltalk.Test,test)) then error("is Test equ test failed") end
if (test:is_equ_(nil,test)) then error("is nil equ test failed") end
if (test:is_equ_(1,"1")) then error("is 1 equ $1 failed") end
--core inlines (== ===)
if (test:equequ()~=true) then error("Must be true") end
if (test:equequ1()~=true) then error("Must be true") end
if (test:equequ2()~=true) then error("Must be true") end
if (test:equequequ()~=true) then error("Must be true") end
if (test:equequequ1()~=true) then error("Must be true") end
if (test:equequequ2()~=true) then error("Must be true") end
--core inlines (||)
if (test:selfOrSelf()~=test) then error("Must be test") end
if (test:selfOr1()~=test) then error("Must be test") end
if (test:selfOrNil()~=test) then error("Must be test") end
if (test:selfOrPoint()~=test) then error("Must be test") end
if (test:nilOrSelf()~=test) then error("Must be test") end
if (test:nilOr1()~=1) then error("Must be 1") end
if (test:nilOrNil()~=nil) then error("Must be nil") end
--core inlines (concatenation)
if (test:comma()~="comma") then error("Must be comma") end
if (test:helloWorld()~="hello world") then error("Must be 'hello world'") end
--core inlines (basicAt:... isUndefined:)
if (test:point5x5AtX()~=5) then error("Must be 5") end
if (test:point5x5AtZ()~="none") then error("Must be none") end
if (test:point5x5AtXPut10()~=10) then error("Must be 10") end
if (test:ifUndefined()~=test) then error("Must be the receiver") end
if (test:ifNilUndefined()~="isUndefined") then error("Must be 'undefined'") end
if (test:ifFalseUndefined()~=false) then error("Must be false") end
if (test:if0Undefined()~=0) then error("Must be zero") end
-- cleanup
test = nil