[View] [Edit] [Lock] [References] [Attachments] [History] [Home] [Changes] [Search] [Help]
obsolete[m8n] 75 inlines math
Tests for compiled methods with inlined code (category: math)
-- setup
test=smalltalk.Test:new()
--core inlines (+ - * / =)
if (test:valueOf_plus_(1,2)~=3) then error("Must return 3") end
if (test:twoPlus_(2)~=4) then error("Must return 4") end
if (test:succ_(4)~=5) then error("Must return 5") end
if (test:valueOf_less_(7,1)~=6) then error("Must return 6") end
if (test:twoLess_(1)~=1) then error("Must return 1") end
if (test:pred_(8)~=7) then error("Must return 7") end
if (test:valueOf_times_(3,3)~=9) then error("Must return 9") end
if (test:twoTimes_(4)~=8) then error("Must return 8") end
if (test:timesTwo_(6)~=12) then error("Must return 12") end
if (test:valueOf_div_(22,2)~=11) then error("Must return 11") end
if (test:twoDiv_(1)~=2) then error("Must return 2") end
if (test:half_(100)~=50) then error("Must return 50") end
if (test:is_eq_(5*5,25)~=true) then error("Must return true") end
if (test:twoEq_(2)~=true) then error("Must return true") end
if (test:eqTwo_(1+1)~=true) then error("Must return true") end
-- cleanup
test = nil