Kernel-Tests.deploy.js 66 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568
  1. smalltalk.addPackage('Kernel-Tests', {});
  2. smalltalk.addClass('ArrayTest', smalltalk.TestCase, [], 'Kernel-Tests');
  3. smalltalk.addMethod(
  4. "_testAtIfAbsent",
  5. smalltalk.method({
  6. selector: "testAtIfAbsent",
  7. fn: function (){
  8. var self=this;
  9. var array=nil;
  10. (array=["hello", "world"]);
  11. smalltalk.send(self, "_assert_equals_", [smalltalk.send(array, "_at_", [(1)]), "hello"]);
  12. smalltalk.send(self, "_assert_equals_", [smalltalk.send(array, "_at_", [(2)]), "world"]);
  13. smalltalk.send(self, "_assert_equals_", [smalltalk.send(array, "_at_ifAbsent_", [(2), (function(){return "not found";})]), "world"]);
  14. smalltalk.send(self, "_assert_equals_", [smalltalk.send(array, "_at_ifAbsent_", [(0), (function(){return "not found";})]), "not found"]);
  15. smalltalk.send(self, "_assert_equals_", [smalltalk.send(array, "_at_ifAbsent_", [(-10), (function(){return "not found";})]), "not found"]);
  16. smalltalk.send(self, "_assert_equals_", [smalltalk.send(array, "_at_ifAbsent_", [(3), (function(){return "not found";})]), "not found"]);
  17. return self;}
  18. }),
  19. smalltalk.ArrayTest);
  20. smalltalk.addMethod(
  21. "_testFirstN",
  22. smalltalk.method({
  23. selector: "testFirstN",
  24. fn: function (){
  25. var self=this;
  26. smalltalk.send(self, "_assert_equals_", [[(1),(2),(3)], smalltalk.send([(1),(2),(3),(4),(5)], "_first_", [(3)])]);
  27. return self;}
  28. }),
  29. smalltalk.ArrayTest);
  30. smalltalk.addMethod(
  31. "_testIfEmpty",
  32. smalltalk.method({
  33. selector: "testIfEmpty",
  34. fn: function (){
  35. var self=this;
  36. smalltalk.send(self, "_assert_equals_", ["zork", smalltalk.send("", "_ifEmpty_", [(function(){return "zork";})])]);
  37. return self;}
  38. }),
  39. smalltalk.ArrayTest);
  40. smalltalk.addClass('BlockClosureTest', smalltalk.TestCase, [], 'Kernel-Tests');
  41. smalltalk.addMethod(
  42. "_testCompiledSource",
  43. smalltalk.method({
  44. selector: "testCompiledSource",
  45. fn: function (){
  46. var self=this;
  47. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((function(){return (1) + (1);}), "_compiledSource", []), "_includesSubString_", ["function"])]);
  48. return self;}
  49. }),
  50. smalltalk.BlockClosureTest);
  51. smalltalk.addMethod(
  52. "_testEnsure",
  53. smalltalk.method({
  54. selector: "testEnsure",
  55. fn: function (){
  56. var self=this;
  57. smalltalk.send(self, "_assert_", [smalltalk.send((function(){return smalltalk.send((smalltalk.Error || Error), "_new", []);}), "_ensure_", [(function(){return true;})])]);
  58. return self;}
  59. }),
  60. smalltalk.BlockClosureTest);
  61. smalltalk.addMethod(
  62. "_testNumArgs",
  63. smalltalk.method({
  64. selector: "testNumArgs",
  65. fn: function (){
  66. var self=this;
  67. smalltalk.send(self, "_assert_equals_", [smalltalk.send((function(){return nil;}), "_numArgs", []), (0)]);
  68. smalltalk.send(self, "_assert_equals_", [smalltalk.send((function(a, b){return nil;}), "_numArgs", []), (2)]);
  69. return self;}
  70. }),
  71. smalltalk.BlockClosureTest);
  72. smalltalk.addMethod(
  73. "_testOnDo",
  74. smalltalk.method({
  75. selector: "testOnDo",
  76. fn: function (){
  77. var self=this;
  78. smalltalk.send(self, "_assert_", [smalltalk.send((function(){return smalltalk.send(smalltalk.send((smalltalk.Error || Error), "_new", []), "_signal", []);}), "_on_do_", [(smalltalk.Error || Error), (function(ex){return true;})])]);
  79. return self;}
  80. }),
  81. smalltalk.BlockClosureTest);
  82. smalltalk.addMethod(
  83. "_testValue",
  84. smalltalk.method({
  85. selector: "testValue",
  86. fn: function (){
  87. var self=this;
  88. smalltalk.send(self, "_assert_equals_", [smalltalk.send((function(){return (1) + (1);}), "_value", []), (2)]);
  89. smalltalk.send(self, "_assert_equals_", [smalltalk.send((function(x){return ((($receiver = x).klass === smalltalk.Number) ? $receiver +(1) : smalltalk.send($receiver, "__plus", [(1)]));}), "_value_", [(2)]), (3)]);
  90. smalltalk.send(self, "_assert_equals_", [smalltalk.send((function(x, y){return ((($receiver = x).klass === smalltalk.Number) ? $receiver *y : smalltalk.send($receiver, "__star", [y]));}), "_value_value_", [(2), (4)]), (8)]);
  91. smalltalk.send(self, "_assert_equals_", [smalltalk.send((function(a, b, c){return (1);}), "_value", []), (1)]);
  92. return self;}
  93. }),
  94. smalltalk.BlockClosureTest);
  95. smalltalk.addMethod(
  96. "_testValueWithPossibleArguments",
  97. smalltalk.method({
  98. selector: "testValueWithPossibleArguments",
  99. fn: function (){
  100. var self=this;
  101. smalltalk.send(self, "_assert_equals_", [smalltalk.send((function(){return (1);}), "_valueWithPossibleArguments_", [[(3), (4)]]), (1)]);
  102. smalltalk.send(self, "_assert_equals_", [smalltalk.send((function(a){return ((($receiver = a).klass === smalltalk.Number) ? $receiver +(4) : smalltalk.send($receiver, "__plus", [(4)]));}), "_valueWithPossibleArguments_", [[(3), (4)]]), (7)]);
  103. smalltalk.send(self, "_assert_equals_", [smalltalk.send((function(a, b){return ((($receiver = a).klass === smalltalk.Number) ? $receiver +b : smalltalk.send($receiver, "__plus", [b]));}), "_valueWithPossibleArguments_", [[(3), (4), (5)]]), (7)]);
  104. return self;}
  105. }),
  106. smalltalk.BlockClosureTest);
  107. smalltalk.addMethod(
  108. "_testWhileFalse",
  109. smalltalk.method({
  110. selector: "testWhileFalse",
  111. fn: function (){
  112. var self=this;
  113. var i=nil;
  114. (i=(0));
  115. (function(){while(!(function(){return ((($receiver = i).klass === smalltalk.Number) ? $receiver >(5) : smalltalk.send($receiver, "__gt", [(5)]));})()) {(function(){return (i=((($receiver = i).klass === smalltalk.Number) ? $receiver +(1) : smalltalk.send($receiver, "__plus", [(1)])));})()}})();
  116. smalltalk.send(self, "_assert_equals_", [i, (6)]);
  117. (i=(0));
  118. (function(){while(!(function(){(i=((($receiver = i).klass === smalltalk.Number) ? $receiver +(1) : smalltalk.send($receiver, "__plus", [(1)])));return ((($receiver = i).klass === smalltalk.Number) ? $receiver >(5) : smalltalk.send($receiver, "__gt", [(5)]));})()) {}})();
  119. smalltalk.send(self, "_assert_equals_", [i, (6)]);
  120. return self;}
  121. }),
  122. smalltalk.BlockClosureTest);
  123. smalltalk.addMethod(
  124. "_testWhileTrue",
  125. smalltalk.method({
  126. selector: "testWhileTrue",
  127. fn: function (){
  128. var self=this;
  129. var i=nil;
  130. (i=(0));
  131. (function(){while((function(){return ((($receiver = i).klass === smalltalk.Number) ? $receiver <(5) : smalltalk.send($receiver, "__lt", [(5)]));})()) {(function(){return (i=((($receiver = i).klass === smalltalk.Number) ? $receiver +(1) : smalltalk.send($receiver, "__plus", [(1)])));})()}})();
  132. smalltalk.send(self, "_assert_equals_", [i, (5)]);
  133. (i=(0));
  134. (function(){while((function(){(i=((($receiver = i).klass === smalltalk.Number) ? $receiver +(1) : smalltalk.send($receiver, "__plus", [(1)])));return ((($receiver = i).klass === smalltalk.Number) ? $receiver <(5) : smalltalk.send($receiver, "__lt", [(5)]));})()) {}})();
  135. smalltalk.send(self, "_assert_equals_", [i, (5)]);
  136. return self;}
  137. }),
  138. smalltalk.BlockClosureTest);
  139. smalltalk.addClass('BooleanTest', smalltalk.TestCase, [], 'Kernel-Tests');
  140. smalltalk.addMethod(
  141. "_testEquality",
  142. smalltalk.method({
  143. selector: "testEquality",
  144. fn: function (){
  145. var self=this;
  146. smalltalk.send(self, "_deny_", [smalltalk.send((0), "__eq", [false])]);
  147. smalltalk.send(self, "_deny_", [smalltalk.send(false, "__eq", [(0)])]);
  148. smalltalk.send(self, "_deny_", [smalltalk.send("", "__eq", [false])]);
  149. smalltalk.send(self, "_deny_", [smalltalk.send(false, "__eq", [""])]);
  150. smalltalk.send(self, "_assert_", [smalltalk.send(true, "__eq", [true])]);
  151. smalltalk.send(self, "_deny_", [smalltalk.send(false, "__eq", [true])]);
  152. smalltalk.send(self, "_deny_", [smalltalk.send(true, "__eq", [false])]);
  153. smalltalk.send(self, "_assert_", [smalltalk.send(false, "__eq", [false])]);
  154. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(true, "_yourself", []), "__eq", [true])]);
  155. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(true, "_yourself", []), "__eq", [smalltalk.send(true, "_yourself", [])])]);
  156. return self;}
  157. }),
  158. smalltalk.BooleanTest);
  159. smalltalk.addMethod(
  160. "_testIdentity",
  161. smalltalk.method({
  162. selector: "testIdentity",
  163. fn: function (){
  164. var self=this;
  165. smalltalk.send(self, "_deny_", [smalltalk.send((0), "__eq_eq", [false])]);
  166. smalltalk.send(self, "_deny_", [smalltalk.send(false, "__eq_eq", [(0)])]);
  167. smalltalk.send(self, "_deny_", [smalltalk.send("", "__eq_eq", [false])]);
  168. smalltalk.send(self, "_deny_", [smalltalk.send(false, "__eq_eq", [""])]);
  169. smalltalk.send(self, "_assert_", [smalltalk.send(true, "__eq_eq", [true])]);
  170. smalltalk.send(self, "_deny_", [smalltalk.send(false, "__eq_eq", [true])]);
  171. smalltalk.send(self, "_deny_", [smalltalk.send(true, "__eq_eq", [false])]);
  172. smalltalk.send(self, "_assert_", [smalltalk.send(false, "__eq_eq", [false])]);
  173. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(true, "_yourself", []), "__eq_eq", [true])]);
  174. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(true, "_yourself", []), "__eq_eq", [smalltalk.send(true, "_yourself", [])])]);
  175. return self;}
  176. }),
  177. smalltalk.BooleanTest);
  178. smalltalk.addMethod(
  179. "_testIfTrueIfFalse",
  180. smalltalk.method({
  181. selector: "testIfTrueIfFalse",
  182. fn: function (){
  183. var self=this;
  184. smalltalk.send(self, "_assert_", [smalltalk.send(((($receiver = true).klass === smalltalk.Boolean) ? ($receiver ? (function(){return "alternative block";})() : nil) : smalltalk.send($receiver, "_ifTrue_", [(function(){return "alternative block";})])), "__eq", ["alternative block"])]);
  185. smalltalk.send(self, "_assert_", [smalltalk.send(((($receiver = true).klass === smalltalk.Boolean) ? (! $receiver ? (function(){return "alternative block";})() : nil) : smalltalk.send($receiver, "_ifFalse_", [(function(){return "alternative block";})])), "__eq", [nil])]);
  186. smalltalk.send(self, "_assert_", [smalltalk.send(((($receiver = false).klass === smalltalk.Boolean) ? ($receiver ? (function(){return "alternative block";})() : nil) : smalltalk.send($receiver, "_ifTrue_", [(function(){return "alternative block";})])), "__eq", [nil])]);
  187. smalltalk.send(self, "_assert_", [smalltalk.send(((($receiver = false).klass === smalltalk.Boolean) ? (! $receiver ? (function(){return "alternative block";})() : nil) : smalltalk.send($receiver, "_ifFalse_", [(function(){return "alternative block";})])), "__eq", ["alternative block"])]);
  188. smalltalk.send(self, "_assert_", [smalltalk.send(((($receiver = false).klass === smalltalk.Boolean) ? ($receiver ? (function(){return "alternative block";})() : (function(){return "alternative block2";})()) : smalltalk.send($receiver, "_ifTrue_ifFalse_", [(function(){return "alternative block";}), (function(){return "alternative block2";})])), "__eq", ["alternative block2"])]);
  189. smalltalk.send(self, "_assert_", [smalltalk.send(((($receiver = false).klass === smalltalk.Boolean) ? (! $receiver ? (function(){return "alternative block";})() : (function(){return "alternative block2";})()) : smalltalk.send($receiver, "_ifFalse_ifTrue_", [(function(){return "alternative block";}), (function(){return "alternative block2";})])), "__eq", ["alternative block"])]);
  190. smalltalk.send(self, "_assert_", [smalltalk.send(((($receiver = true).klass === smalltalk.Boolean) ? ($receiver ? (function(){return "alternative block";})() : (function(){return "alternative block2";})()) : smalltalk.send($receiver, "_ifTrue_ifFalse_", [(function(){return "alternative block";}), (function(){return "alternative block2";})])), "__eq", ["alternative block"])]);
  191. smalltalk.send(self, "_assert_", [smalltalk.send(((($receiver = true).klass === smalltalk.Boolean) ? (! $receiver ? (function(){return "alternative block";})() : (function(){return "alternative block2";})()) : smalltalk.send($receiver, "_ifFalse_ifTrue_", [(function(){return "alternative block";}), (function(){return "alternative block2";})])), "__eq", ["alternative block2"])]);
  192. return self;}
  193. }),
  194. smalltalk.BooleanTest);
  195. smalltalk.addMethod(
  196. "_testLogic",
  197. smalltalk.method({
  198. selector: "testLogic",
  199. fn: function (){
  200. var self=this;
  201. (function($rec){smalltalk.send($rec, "_assert_", [smalltalk.send(true, "_&", [true])]);smalltalk.send($rec, "_deny_", [smalltalk.send(true, "_&", [false])]);smalltalk.send($rec, "_deny_", [smalltalk.send(false, "_&", [true])]);return smalltalk.send($rec, "_deny_", [smalltalk.send(false, "_&", [false])]);})(self);
  202. (function($rec){smalltalk.send($rec, "_assert_", [smalltalk.send(true, "_|", [true])]);smalltalk.send($rec, "_assert_", [smalltalk.send(true, "_|", [false])]);smalltalk.send($rec, "_assert_", [smalltalk.send(false, "_|", [true])]);return smalltalk.send($rec, "_deny_", [smalltalk.send(false, "_|", [false])]);})(self);
  203. (function($rec){smalltalk.send($rec, "_assert_", [smalltalk.send(true, "_&", [(1) > (0)])]);smalltalk.send($rec, "_deny_", [smalltalk.send((1) > (0), "_&", [false])]);return smalltalk.send($rec, "_deny_", [smalltalk.send((1) > (0), "_&", [(1) > (2)])]);})(self);
  204. (function($rec){smalltalk.send($rec, "_assert_", [smalltalk.send(false, "_|", [(1) > (0)])]);smalltalk.send($rec, "_assert_", [smalltalk.send((1) > (0), "_|", [false])]);return smalltalk.send($rec, "_assert_", [smalltalk.send((1) > (0), "_|", [(1) > (2)])]);})(self);
  205. return self;}
  206. }),
  207. smalltalk.BooleanTest);
  208. smalltalk.addMethod(
  209. "_testLogicKeywords",
  210. smalltalk.method({
  211. selector: "testLogicKeywords",
  212. fn: function (){
  213. var self=this;
  214. (function($rec){smalltalk.send($rec, "_assert_", [smalltalk.send(true, "_and_", [(function(){return true;})])]);smalltalk.send($rec, "_deny_", [smalltalk.send(true, "_and_", [(function(){return false;})])]);smalltalk.send($rec, "_deny_", [smalltalk.send(false, "_and_", [(function(){return true;})])]);return smalltalk.send($rec, "_deny_", [smalltalk.send(false, "_and_", [(function(){return false;})])]);})(self);
  215. (function($rec){smalltalk.send($rec, "_assert_", [smalltalk.send(true, "_or_", [(function(){return true;})])]);smalltalk.send($rec, "_assert_", [smalltalk.send(true, "_or_", [(function(){return false;})])]);smalltalk.send($rec, "_assert_", [smalltalk.send(false, "_or_", [(function(){return true;})])]);return smalltalk.send($rec, "_deny_", [smalltalk.send(false, "_or_", [(function(){return false;})])]);})(self);
  216. (function($rec){smalltalk.send($rec, "_assert_", [smalltalk.send(true, "_and_", [(function(){return (1) > (0);})])]);smalltalk.send($rec, "_deny_", [smalltalk.send((1) > (0), "_and_", [(function(){return false;})])]);return smalltalk.send($rec, "_deny_", [smalltalk.send((1) > (0), "_and_", [(function(){return (1) > (2);})])]);})(self);
  217. (function($rec){smalltalk.send($rec, "_assert_", [smalltalk.send(false, "_or_", [(function(){return (1) > (0);})])]);smalltalk.send($rec, "_assert_", [smalltalk.send((1) > (0), "_or_", [(function(){return false;})])]);return smalltalk.send($rec, "_assert_", [smalltalk.send((1) > (0), "_or_", [(function(){return (1) > (2);})])]);})(self);
  218. return self;}
  219. }),
  220. smalltalk.BooleanTest);
  221. smalltalk.addClass('ClassBuilderTest', smalltalk.TestCase, ['builder', 'theClass'], 'Kernel-Tests');
  222. smalltalk.addMethod(
  223. "_setUp",
  224. smalltalk.method({
  225. selector: "setUp",
  226. fn: function (){
  227. var self=this;
  228. (self['@builder']=smalltalk.send((smalltalk.ClassBuilder || ClassBuilder), "_new", []));
  229. return self;}
  230. }),
  231. smalltalk.ClassBuilderTest);
  232. smalltalk.addMethod(
  233. "_tearDown",
  234. smalltalk.method({
  235. selector: "tearDown",
  236. fn: function (){
  237. var self=this;
  238. (($receiver = self['@theClass']) != nil && $receiver != undefined) ? (function(){smalltalk.send(smalltalk.send((smalltalk.Smalltalk || Smalltalk), "_current", []), "_removeClass_", [self['@theClass']]);return (self['@theClass']=nil);})() : nil;
  239. return self;}
  240. }),
  241. smalltalk.ClassBuilderTest);
  242. smalltalk.addMethod(
  243. "_testClassCopy",
  244. smalltalk.method({
  245. selector: "testClassCopy",
  246. fn: function (){
  247. var self=this;
  248. (self['@theClass']=smalltalk.send(self['@builder'], "_copyClass_named_", [(smalltalk.ObjectMock || ObjectMock), "ObjectMock2"]));
  249. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(self['@theClass'], "_superclass", []), "__eq_eq", [smalltalk.send((smalltalk.ObjectMock || ObjectMock), "_superclass", [])])]);
  250. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(self['@theClass'], "_instanceVariableNames", []), "__eq_eq", [smalltalk.send((smalltalk.ObjectMock || ObjectMock), "_instanceVariableNames", [])])]);
  251. smalltalk.send(self, "_assert_equals_", [smalltalk.send(self['@theClass'], "_name", []), "ObjectMock2"]);
  252. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(self['@theClass'], "_package", []), "__eq_eq", [smalltalk.send((smalltalk.ObjectMock || ObjectMock), "_package", [])])]);
  253. smalltalk.send(self, "_assert_equals_", [smalltalk.send(smalltalk.send(self['@theClass'], "_methodDictionary", []), "_keys", []), smalltalk.send(smalltalk.send((smalltalk.ObjectMock || ObjectMock), "_methodDictionary", []), "_keys", [])]);
  254. return self;}
  255. }),
  256. smalltalk.ClassBuilderTest);
  257. smalltalk.addMethod(
  258. "_testInstanceVariableNames",
  259. smalltalk.method({
  260. selector: "testInstanceVariableNames",
  261. fn: function (){
  262. var self=this;
  263. smalltalk.send(self, "_assert_equals_", [smalltalk.send(self['@builder'], "_instanceVariableNamesFor_", [" hello world "]), ["hello", "world"]]);
  264. return self;}
  265. }),
  266. smalltalk.ClassBuilderTest);
  267. smalltalk.addClass('DictionaryTest', smalltalk.TestCase, [], 'Kernel-Tests');
  268. smalltalk.addMethod(
  269. "_testAccessing",
  270. smalltalk.method({
  271. selector: "testAccessing",
  272. fn: function (){
  273. var self=this;
  274. var d=nil;
  275. (d=smalltalk.send((smalltalk.Dictionary || Dictionary), "_new", []));
  276. smalltalk.send(d, "_at_put_", ["hello", "world"]);
  277. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(d, "_at_", ["hello"]), "__eq", ["world"])]);
  278. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(d, "_at_ifAbsent_", ["hello", (function(){return nil;})]), "__eq", ["world"])]);
  279. smalltalk.send(self, "_deny_", [smalltalk.send(smalltalk.send(d, "_at_ifAbsent_", ["foo", (function(){return nil;})]), "__eq", ["world"])]);
  280. smalltalk.send(d, "_at_put_", [(1), (2)]);
  281. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(d, "_at_", [(1)]), "__eq", [(2)])]);
  282. smalltalk.send(d, "_at_put_", [smalltalk.send((1), "__at", [(3)]), (3)]);
  283. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(d, "_at_", [smalltalk.send((1), "__at", [(3)])]), "__eq", [(3)])]);
  284. return self;}
  285. }),
  286. smalltalk.DictionaryTest);
  287. smalltalk.addMethod(
  288. "_testDynamicDictionaries",
  289. smalltalk.method({
  290. selector: "testDynamicDictionaries",
  291. fn: function (){
  292. var self=this;
  293. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(smalltalk.HashedCollection._fromPairs_([smalltalk.send("hello", "__minus_gt", [(1)])]), "_asDictionary", []), "__eq", [smalltalk.send((smalltalk.Dictionary || Dictionary), "_with_", [smalltalk.send("hello", "__minus_gt", [(1)])])])]);
  294. return self;}
  295. }),
  296. smalltalk.DictionaryTest);
  297. smalltalk.addMethod(
  298. "_testEquality",
  299. smalltalk.method({
  300. selector: "testEquality",
  301. fn: function (){
  302. var self=this;
  303. var d1=nil;
  304. var d2=nil;
  305. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((smalltalk.Dictionary || Dictionary), "_new", []), "__eq", [smalltalk.send((smalltalk.Dictionary || Dictionary), "_new", [])])]);
  306. (d1=(function($rec){smalltalk.send($rec, "_at_put_", [(1), (2)]);return smalltalk.send($rec, "_yourself", []);})(smalltalk.send((smalltalk.Dictionary || Dictionary), "_new", [])));
  307. (d2=(function($rec){smalltalk.send($rec, "_at_put_", [(1), (2)]);return smalltalk.send($rec, "_yourself", []);})(smalltalk.send((smalltalk.Dictionary || Dictionary), "_new", [])));
  308. smalltalk.send(self, "_assert_", [smalltalk.send(d1, "__eq", [d2])]);
  309. (d2=(function($rec){smalltalk.send($rec, "_at_put_", [(1), (3)]);return smalltalk.send($rec, "_yourself", []);})(smalltalk.send((smalltalk.Dictionary || Dictionary), "_new", [])));
  310. smalltalk.send(self, "_deny_", [smalltalk.send(d1, "__eq", [d2])]);
  311. (d2=(function($rec){smalltalk.send($rec, "_at_put_", [(2), (2)]);return smalltalk.send($rec, "_yourself", []);})(smalltalk.send((smalltalk.Dictionary || Dictionary), "_new", [])));
  312. smalltalk.send(self, "_deny_", [smalltalk.send(d1, "__eq", [d2])]);
  313. (d2=(function($rec){smalltalk.send($rec, "_at_put_", [(1), (2)]);smalltalk.send($rec, "_at_put_", [(3), (4)]);return smalltalk.send($rec, "_yourself", []);})(smalltalk.send((smalltalk.Dictionary || Dictionary), "_new", [])));
  314. smalltalk.send(self, "_deny_", [smalltalk.send(d1, "__eq", [d2])]);
  315. return self;}
  316. }),
  317. smalltalk.DictionaryTest);
  318. smalltalk.addMethod(
  319. "_testKeys",
  320. smalltalk.method({
  321. selector: "testKeys",
  322. fn: function (){
  323. var self=this;
  324. var d=nil;
  325. (d=smalltalk.send((smalltalk.Dictionary || Dictionary), "_new", []));
  326. smalltalk.send(d, "_at_put_", [(1), (2)]);
  327. smalltalk.send(d, "_at_put_", [(2), (3)]);
  328. smalltalk.send(d, "_at_put_", [(3), (4)]);
  329. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(d, "_keys", []), "__eq", [[(1), (2), (3)]])]);
  330. return self;}
  331. }),
  332. smalltalk.DictionaryTest);
  333. smalltalk.addMethod(
  334. "_testPrintString",
  335. smalltalk.method({
  336. selector: "testPrintString",
  337. fn: function (){
  338. var self=this;
  339. smalltalk.send(self, "_assert_equals_", ["a Dictionary('firstname' -> 'James' , 'lastname' -> 'Bond')", (function($rec){smalltalk.send($rec, "_at_put_", ["firstname", "James"]);smalltalk.send($rec, "_at_put_", ["lastname", "Bond"]);return smalltalk.send($rec, "_printString", []);})(smalltalk.send((smalltalk.Dictionary || Dictionary), "_new", []))]);
  340. return self;}
  341. }),
  342. smalltalk.DictionaryTest);
  343. smalltalk.addMethod(
  344. "_testRemoveKey",
  345. smalltalk.method({
  346. selector: "testRemoveKey",
  347. fn: function (){
  348. var self=this;
  349. var d=nil;
  350. var key=nil;
  351. (d=smalltalk.send((smalltalk.Dictionary || Dictionary), "_new", []));
  352. smalltalk.send(d, "_at_put_", [(1), (2)]);
  353. smalltalk.send(d, "_at_put_", [(2), (3)]);
  354. smalltalk.send(d, "_at_put_", [(3), (4)]);
  355. (key=(2));
  356. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(d, "_keys", []), "__eq", [[(1), (2), (3)]])]);
  357. smalltalk.send(d, "_removeKey_", [key]);
  358. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(d, "_keys", []), "__eq", [[(1), (3)]])]);
  359. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(d, "_values", []), "__eq", [[(2), (4)]])]);
  360. smalltalk.send(self, "_deny_", [smalltalk.send(d, "_includesKey_", [(2)])]);
  361. return self;}
  362. }),
  363. smalltalk.DictionaryTest);
  364. smalltalk.addMethod(
  365. "_testRemoveKeyIfAbsent",
  366. smalltalk.method({
  367. selector: "testRemoveKeyIfAbsent",
  368. fn: function (){
  369. var self=this;
  370. var d=nil;
  371. var key=nil;
  372. (d=smalltalk.send((smalltalk.Dictionary || Dictionary), "_new", []));
  373. smalltalk.send(d, "_at_put_", [(1), (2)]);
  374. smalltalk.send(d, "_at_put_", [(2), (3)]);
  375. smalltalk.send(d, "_at_put_", [(3), (4)]);
  376. (key=(2));
  377. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(d, "_removeKey_", [key]), "__eq", [(3)])]);
  378. (key=(3));
  379. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(d, "_removeKey_ifAbsent_", [key, (function(){return (42);})]), "__eq", [(4)])]);
  380. (key="why");
  381. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(d, "_removeKey_ifAbsent_", [key, (function(){return (42);})]), "__eq", [(42)])]);
  382. return self;}
  383. }),
  384. smalltalk.DictionaryTest);
  385. smalltalk.addMethod(
  386. "_testSize",
  387. smalltalk.method({
  388. selector: "testSize",
  389. fn: function (){
  390. var self=this;
  391. var d=nil;
  392. (d=smalltalk.send((smalltalk.Dictionary || Dictionary), "_new", []));
  393. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(d, "_size", []), "__eq", [(0)])]);
  394. smalltalk.send(d, "_at_put_", [(1), (2)]);
  395. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(d, "_size", []), "__eq", [(1)])]);
  396. smalltalk.send(d, "_at_put_", [(2), (3)]);
  397. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(d, "_size", []), "__eq", [(2)])]);
  398. return self;}
  399. }),
  400. smalltalk.DictionaryTest);
  401. smalltalk.addMethod(
  402. "_testValues",
  403. smalltalk.method({
  404. selector: "testValues",
  405. fn: function (){
  406. var self=this;
  407. var d=nil;
  408. (d=smalltalk.send((smalltalk.Dictionary || Dictionary), "_new", []));
  409. smalltalk.send(d, "_at_put_", [(1), (2)]);
  410. smalltalk.send(d, "_at_put_", [(2), (3)]);
  411. smalltalk.send(d, "_at_put_", [(3), (4)]);
  412. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(d, "_values", []), "__eq", [[(2), (3), (4)]])]);
  413. return self;}
  414. }),
  415. smalltalk.DictionaryTest);
  416. smalltalk.addClass('JSObjectProxyTest', smalltalk.TestCase, [], 'Kernel-Tests');
  417. smalltalk.addMethod(
  418. "_jsObject",
  419. smalltalk.method({
  420. selector: "jsObject",
  421. fn: function (){
  422. var self=this;
  423. return jsObject = {a: 1, b: function() {return 2;}, c: function(object) {return object;}};
  424. return self;}
  425. }),
  426. smalltalk.JSObjectProxyTest);
  427. smalltalk.addMethod(
  428. "_testDNU",
  429. smalltalk.method({
  430. selector: "testDNU",
  431. fn: function (){
  432. var self=this;
  433. smalltalk.send(self, "_should_raise_", [(function(){return smalltalk.send(smalltalk.send(self, "_jsObject", []), "_foo", []);}), (smalltalk.MessageNotUnderstood || MessageNotUnderstood)]);
  434. return self;}
  435. }),
  436. smalltalk.JSObjectProxyTest);
  437. smalltalk.addMethod(
  438. "_testMessageSend",
  439. smalltalk.method({
  440. selector: "testMessageSend",
  441. fn: function (){
  442. var self=this;
  443. smalltalk.send(self, "_assert_equals_", [smalltalk.send(smalltalk.send(self, "_jsObject", []), "_a", []), (1)]);
  444. smalltalk.send(self, "_assert_equals_", [smalltalk.send(smalltalk.send(self, "_jsObject", []), "_b", []), (2)]);
  445. smalltalk.send(self, "_assert_equals_", [smalltalk.send(smalltalk.send(self, "_jsObject", []), "_c_", [(3)]), (3)]);
  446. return self;}
  447. }),
  448. smalltalk.JSObjectProxyTest);
  449. smalltalk.addMethod(
  450. "_testMethodWithArguments",
  451. smalltalk.method({
  452. selector: "testMethodWithArguments",
  453. fn: function (){
  454. var self=this;
  455. smalltalk.send(self, "_deny_", [smalltalk.send(smalltalk.send("body", "_asJQuery", []), "_hasClass_", ["amber"])]);
  456. smalltalk.send(smalltalk.send("body", "_asJQuery", []), "_addClass_", ["amber"]);
  457. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send("body", "_asJQuery", []), "_hasClass_", ["amber"])]);
  458. smalltalk.send(smalltalk.send("body", "_asJQuery", []), "_removeClass_", ["amber"]);
  459. smalltalk.send(self, "_deny_", [smalltalk.send(smalltalk.send("body", "_asJQuery", []), "_hasClass_", ["amber"])]);
  460. return self;}
  461. }),
  462. smalltalk.JSObjectProxyTest);
  463. smalltalk.addMethod(
  464. "_testPrinting",
  465. smalltalk.method({
  466. selector: "testPrinting",
  467. fn: function (){
  468. var self=this;
  469. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(smalltalk.send(self, "_jsObject", []), "_printString", []), "__eq", ["[object Object]"])]);
  470. return self;}
  471. }),
  472. smalltalk.JSObjectProxyTest);
  473. smalltalk.addMethod(
  474. "_testPropertyThatReturnsEmptyString",
  475. smalltalk.method({
  476. selector: "testPropertyThatReturnsEmptyString",
  477. fn: function (){
  478. var self=this;
  479. document.location.hash = '';
  480. smalltalk.send(self, "_assert_equals_", ["", smalltalk.send(smalltalk.send((typeof document == 'undefined' ? nil : document), "_location", []), "_hash", [])]);
  481. smalltalk.send(smalltalk.send((typeof document == 'undefined' ? nil : document), "_location", []), "_hash_", ["test"]);
  482. smalltalk.send(self, "_assert_equals_", ["#test", smalltalk.send(smalltalk.send((typeof document == 'undefined' ? nil : document), "_location", []), "_hash", [])]);
  483. return self;}
  484. }),
  485. smalltalk.JSObjectProxyTest);
  486. smalltalk.addMethod(
  487. "_testYourself",
  488. smalltalk.method({
  489. selector: "testYourself",
  490. fn: function (){
  491. var self=this;
  492. var body=nil;
  493. (body=(function($rec){smalltalk.send($rec, "_addClass_", ["amber"]);return smalltalk.send($rec, "_yourself", []);})(smalltalk.send("body", "_asJQuery", [])));
  494. smalltalk.send(self, "_assert_", [smalltalk.send(body, "_hasClass_", ["amber"])]);
  495. smalltalk.send(body, "_removeClass_", ["amber"]);
  496. smalltalk.send(self, "_deny_", [smalltalk.send(body, "_hasClass_", ["amber"])]);
  497. return self;}
  498. }),
  499. smalltalk.JSObjectProxyTest);
  500. smalltalk.addClass('NumberTest', smalltalk.TestCase, [], 'Kernel-Tests');
  501. smalltalk.addMethod(
  502. "_testArithmetic",
  503. smalltalk.method({
  504. selector: "testArithmetic",
  505. fn: function (){
  506. var self=this;
  507. smalltalk.send(self, "_assert_", [smalltalk.send((1.5) + (1), "__eq", [(2.5)])]);
  508. smalltalk.send(self, "_assert_", [smalltalk.send((2) - (1), "__eq", [(1)])]);
  509. smalltalk.send(self, "_assert_", [smalltalk.send((-2) - (1), "__eq", [(-3)])]);
  510. smalltalk.send(self, "_assert_", [smalltalk.send((12) / (2), "__eq", [(6)])]);
  511. smalltalk.send(self, "_assert_", [smalltalk.send((3) * (4), "__eq", [(12)])]);
  512. smalltalk.send(self, "_assert_", [smalltalk.send(((($receiver = (1) + (2)).klass === smalltalk.Number) ? $receiver *(3) : smalltalk.send($receiver, "__star", [(3)])), "__eq", [(9)])]);
  513. smalltalk.send(self, "_assert_", [smalltalk.send((1) + (2) * (3), "__eq", [(7)])]);
  514. return self;}
  515. }),
  516. smalltalk.NumberTest);
  517. smalltalk.addMethod(
  518. "_testComparison",
  519. smalltalk.method({
  520. selector: "testComparison",
  521. fn: function (){
  522. var self=this;
  523. smalltalk.send(self, "_assert_", [(3) > (2)]);
  524. smalltalk.send(self, "_assert_", [(2) < (3)]);
  525. smalltalk.send(self, "_deny_", [(3) < (2)]);
  526. smalltalk.send(self, "_deny_", [(2) > (3)]);
  527. smalltalk.send(self, "_assert_", [(3) >= (3)]);
  528. smalltalk.send(self, "_assert_", [(3.1) >= (3)]);
  529. smalltalk.send(self, "_assert_", [(3) <= (3)]);
  530. smalltalk.send(self, "_assert_", [(3) <= (3.1)]);
  531. return self;}
  532. }),
  533. smalltalk.NumberTest);
  534. smalltalk.addMethod(
  535. "_testCopying",
  536. smalltalk.method({
  537. selector: "testCopying",
  538. fn: function (){
  539. var self=this;
  540. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((1), "_copy", []), "__eq_eq", [(1)])]);
  541. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((1), "_deepCopy", []), "__eq_eq", [(1)])]);
  542. return self;}
  543. }),
  544. smalltalk.NumberTest);
  545. smalltalk.addMethod(
  546. "_testEquality",
  547. smalltalk.method({
  548. selector: "testEquality",
  549. fn: function (){
  550. var self=this;
  551. smalltalk.send(self, "_assert_", [smalltalk.send((1), "__eq", [(1)])]);
  552. smalltalk.send(self, "_assert_", [smalltalk.send((0), "__eq", [(0)])]);
  553. smalltalk.send(self, "_deny_", [smalltalk.send((1), "__eq", [(0)])]);
  554. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((1), "_yourself", []), "__eq", [(1)])]);
  555. smalltalk.send(self, "_assert_", [smalltalk.send((1), "__eq", [smalltalk.send((1), "_yourself", [])])]);
  556. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((1), "_yourself", []), "__eq", [smalltalk.send((1), "_yourself", [])])]);
  557. smalltalk.send(self, "_deny_", [smalltalk.send((0), "__eq", [false])]);
  558. smalltalk.send(self, "_deny_", [smalltalk.send(false, "__eq", [(0)])]);
  559. smalltalk.send(self, "_deny_", [smalltalk.send("", "__eq", [(0)])]);
  560. smalltalk.send(self, "_deny_", [smalltalk.send((0), "__eq", [""])]);
  561. return self;}
  562. }),
  563. smalltalk.NumberTest);
  564. smalltalk.addMethod(
  565. "_testIdentity",
  566. smalltalk.method({
  567. selector: "testIdentity",
  568. fn: function (){
  569. var self=this;
  570. smalltalk.send(self, "_assert_", [smalltalk.send((1), "__eq_eq", [(1)])]);
  571. smalltalk.send(self, "_assert_", [smalltalk.send((0), "__eq_eq", [(0)])]);
  572. smalltalk.send(self, "_deny_", [smalltalk.send((1), "__eq_eq", [(0)])]);
  573. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((1), "_yourself", []), "__eq_eq", [(1)])]);
  574. smalltalk.send(self, "_assert_", [smalltalk.send((1), "__eq_eq", [smalltalk.send((1), "_yourself", [])])]);
  575. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((1), "_yourself", []), "__eq_eq", [smalltalk.send((1), "_yourself", [])])]);
  576. smalltalk.send(self, "_deny_", [smalltalk.send((1), "__eq_eq", [(2)])]);
  577. return self;}
  578. }),
  579. smalltalk.NumberTest);
  580. smalltalk.addMethod(
  581. "_testMinMax",
  582. smalltalk.method({
  583. selector: "testMinMax",
  584. fn: function (){
  585. var self=this;
  586. smalltalk.send(self, "_assert_equals_", [smalltalk.send((2), "_max_", [(5)]), (5)]);
  587. smalltalk.send(self, "_assert_equals_", [smalltalk.send((2), "_min_", [(5)]), (2)]);
  588. return self;}
  589. }),
  590. smalltalk.NumberTest);
  591. smalltalk.addMethod(
  592. "_testNegated",
  593. smalltalk.method({
  594. selector: "testNegated",
  595. fn: function (){
  596. var self=this;
  597. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((3), "_negated", []), "__eq", [(-3)])]);
  598. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((-3), "_negated", []), "__eq", [(3)])]);
  599. return self;}
  600. }),
  601. smalltalk.NumberTest);
  602. smalltalk.addMethod(
  603. "_testPrintShowingDecimalPlaces",
  604. smalltalk.method({
  605. selector: "testPrintShowingDecimalPlaces",
  606. fn: function (){
  607. var self=this;
  608. smalltalk.send(self, "_assert_equals_", ["23.00", smalltalk.send((23), "_printShowingDecimalPlaces_", [(2)])]);
  609. smalltalk.send(self, "_assert_equals_", ["23.57", smalltalk.send((23.5698), "_printShowingDecimalPlaces_", [(2)])]);
  610. smalltalk.send(self, "_assert_equals_", ["-234.56700", smalltalk.send(smalltalk.send((234.567), "_negated", []), "_printShowingDecimalPlaces_", [(5)])]);
  611. smalltalk.send(self, "_assert_equals_", ["23", smalltalk.send((23.4567), "_printShowingDecimalPlaces_", [(0)])]);
  612. smalltalk.send(self, "_assert_equals_", ["24", smalltalk.send((23.5567), "_printShowingDecimalPlaces_", [(0)])]);
  613. smalltalk.send(self, "_assert_equals_", ["-23", smalltalk.send(smalltalk.send((23.4567), "_negated", []), "_printShowingDecimalPlaces_", [(0)])]);
  614. smalltalk.send(self, "_assert_equals_", ["-24", smalltalk.send(smalltalk.send((23.5567), "_negated", []), "_printShowingDecimalPlaces_", [(0)])]);
  615. smalltalk.send(self, "_assert_equals_", ["100000000.0", smalltalk.send((100000000), "_printShowingDecimalPlaces_", [(1)])]);
  616. smalltalk.send(self, "_assert_equals_", ["0.98000", smalltalk.send((0.98), "_printShowingDecimalPlaces_", [(5)])]);
  617. smalltalk.send(self, "_assert_equals_", ["-0.98", smalltalk.send(smalltalk.send((0.98), "_negated", []), "_printShowingDecimalPlaces_", [(2)])]);
  618. smalltalk.send(self, "_assert_equals_", ["2.57", smalltalk.send((2.567), "_printShowingDecimalPlaces_", [(2)])]);
  619. smalltalk.send(self, "_assert_equals_", ["-2.57", smalltalk.send((-2.567), "_printShowingDecimalPlaces_", [(2)])]);
  620. smalltalk.send(self, "_assert_equals_", ["0.00", smalltalk.send((0), "_printShowingDecimalPlaces_", [(2)])]);
  621. return self;}
  622. }),
  623. smalltalk.NumberTest);
  624. smalltalk.addMethod(
  625. "_testRounded",
  626. smalltalk.method({
  627. selector: "testRounded",
  628. fn: function (){
  629. var self=this;
  630. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((3), "_rounded", []), "__eq", [(3)])]);
  631. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((3.212), "_rounded", []), "__eq", [(3)])]);
  632. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((3.51), "_rounded", []), "__eq", [(4)])]);
  633. return self;}
  634. }),
  635. smalltalk.NumberTest);
  636. smalltalk.addMethod(
  637. "_testSqrt",
  638. smalltalk.method({
  639. selector: "testSqrt",
  640. fn: function (){
  641. var self=this;
  642. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((4), "_sqrt", []), "__eq", [(2)])]);
  643. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((16), "_sqrt", []), "__eq", [(4)])]);
  644. return self;}
  645. }),
  646. smalltalk.NumberTest);
  647. smalltalk.addMethod(
  648. "_testSquared",
  649. smalltalk.method({
  650. selector: "testSquared",
  651. fn: function (){
  652. var self=this;
  653. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((4), "_squared", []), "__eq", [(16)])]);
  654. return self;}
  655. }),
  656. smalltalk.NumberTest);
  657. smalltalk.addMethod(
  658. "_testTimesRepeat",
  659. smalltalk.method({
  660. selector: "testTimesRepeat",
  661. fn: function (){
  662. var self=this;
  663. var i=nil;
  664. (i=(0));
  665. smalltalk.send((0), "_timesRepeat_", [(function(){return (i=((($receiver = i).klass === smalltalk.Number) ? $receiver +(1) : smalltalk.send($receiver, "__plus", [(1)])));})]);
  666. smalltalk.send(self, "_assert_equals_", [i, (0)]);
  667. smalltalk.send((5), "_timesRepeat_", [(function(){return (i=((($receiver = i).klass === smalltalk.Number) ? $receiver +(1) : smalltalk.send($receiver, "__plus", [(1)])));})]);
  668. smalltalk.send(self, "_assert_equals_", [i, (5)]);
  669. return self;}
  670. }),
  671. smalltalk.NumberTest);
  672. smalltalk.addMethod(
  673. "_testTo",
  674. smalltalk.method({
  675. selector: "testTo",
  676. fn: function (){
  677. var self=this;
  678. smalltalk.send(self, "_assert_equals_", [smalltalk.send((1), "_to_", [(5)]), [(1), (2), (3), (4), (5)]]);
  679. return self;}
  680. }),
  681. smalltalk.NumberTest);
  682. smalltalk.addMethod(
  683. "_testToBy",
  684. smalltalk.method({
  685. selector: "testToBy",
  686. fn: function (){
  687. var self=this;
  688. smalltalk.send(self, "_assert_equals_", [smalltalk.send((0), "_to_by_", [(6), (2)]), [(0), (2), (4), (6)]]);
  689. smalltalk.send(self, "_should_raise_", [(function(){return smalltalk.send((1), "_to_by_", [(4), (0)]);}), (smalltalk.Error || Error)]);
  690. return self;}
  691. }),
  692. smalltalk.NumberTest);
  693. smalltalk.addMethod(
  694. "_testTruncated",
  695. smalltalk.method({
  696. selector: "testTruncated",
  697. fn: function (){
  698. var self=this;
  699. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((3), "_truncated", []), "__eq", [(3)])]);
  700. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((3.212), "_truncated", []), "__eq", [(3)])]);
  701. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((3.51), "_truncated", []), "__eq", [(3)])]);
  702. return self;}
  703. }),
  704. smalltalk.NumberTest);
  705. smalltalk.addClass('ObjectMock', smalltalk.Object, ['foo', 'bar'], 'Kernel-Tests');
  706. smalltalk.addMethod(
  707. "_foo",
  708. smalltalk.method({
  709. selector: "foo",
  710. fn: function (){
  711. var self=this;
  712. return self['@foo'];
  713. return self;}
  714. }),
  715. smalltalk.ObjectMock);
  716. smalltalk.addMethod(
  717. "_foo_",
  718. smalltalk.method({
  719. selector: "foo:",
  720. fn: function (anObject){
  721. var self=this;
  722. (self['@foo']=anObject);
  723. return self;}
  724. }),
  725. smalltalk.ObjectMock);
  726. smalltalk.addClass('ObjectTest', smalltalk.TestCase, [], 'Kernel-Tests');
  727. smalltalk.addMethod(
  728. "_testBasicAccess",
  729. smalltalk.method({
  730. selector: "testBasicAccess",
  731. fn: function (){
  732. var self=this;
  733. var o=nil;
  734. (o=smalltalk.send((smalltalk.Object || Object), "_new", []));
  735. smalltalk.send(o, "_basicAt_put_", ["a", (1)]);
  736. smalltalk.send(self, "_assert_equals_", [smalltalk.send(o, "_basicAt_", ["a"]), (1)]);
  737. smalltalk.send(self, "_assert_equals_", [smalltalk.send(o, "_basicAt_", ["b"]), nil]);
  738. return self;}
  739. }),
  740. smalltalk.ObjectTest);
  741. smalltalk.addMethod(
  742. "_testBasicPerform",
  743. smalltalk.method({
  744. selector: "testBasicPerform",
  745. fn: function (){
  746. var self=this;
  747. var o=nil;
  748. (o=smalltalk.send((smalltalk.Object || Object), "_new", []));
  749. smalltalk.send(o, "_basicAt_put_", ["func", (function(){return "hello";})]);
  750. smalltalk.send(o, "_basicAt_put_", ["func2", (function(a){return ((($receiver = a).klass === smalltalk.Number) ? $receiver +(1) : smalltalk.send($receiver, "__plus", [(1)]));})]);
  751. smalltalk.send(self, "_assert_equals_", [smalltalk.send(o, "_basicPerform_", ["func"]), "hello"]);
  752. smalltalk.send(self, "_assert_equals_", [smalltalk.send(o, "_basicPerform_withArguments_", ["func2", [(3)]]), (4)]);
  753. return self;}
  754. }),
  755. smalltalk.ObjectTest);
  756. smalltalk.addMethod(
  757. "_testDNU",
  758. smalltalk.method({
  759. selector: "testDNU",
  760. fn: function (){
  761. var self=this;
  762. smalltalk.send(self, "_should_raise_", [(function(){return smalltalk.send(smalltalk.send((smalltalk.Object || Object), "_new", []), "_foo", []);}), (smalltalk.MessageNotUnderstood || MessageNotUnderstood)]);
  763. return self;}
  764. }),
  765. smalltalk.ObjectTest);
  766. smalltalk.addMethod(
  767. "_testEquality",
  768. smalltalk.method({
  769. selector: "testEquality",
  770. fn: function (){
  771. var self=this;
  772. var o=nil;
  773. (o=smalltalk.send((smalltalk.Object || Object), "_new", []));
  774. smalltalk.send(self, "_deny_", [smalltalk.send(o, "__eq", [smalltalk.send((smalltalk.Object || Object), "_new", [])])]);
  775. smalltalk.send(self, "_assert_", [smalltalk.send(o, "__eq", [o])]);
  776. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(o, "_yourself", []), "__eq", [o])]);
  777. smalltalk.send(self, "_assert_", [smalltalk.send(o, "__eq", [smalltalk.send(o, "_yourself", [])])]);
  778. return self;}
  779. }),
  780. smalltalk.ObjectTest);
  781. smalltalk.addMethod(
  782. "_testHalt",
  783. smalltalk.method({
  784. selector: "testHalt",
  785. fn: function (){
  786. var self=this;
  787. smalltalk.send(self, "_should_raise_", [(function(){return smalltalk.send(smalltalk.send((smalltalk.Object || Object), "_new", []), "_halt", []);}), (smalltalk.Error || Error)]);
  788. return self;}
  789. }),
  790. smalltalk.ObjectTest);
  791. smalltalk.addMethod(
  792. "_testIdentity",
  793. smalltalk.method({
  794. selector: "testIdentity",
  795. fn: function (){
  796. var self=this;
  797. var o=nil;
  798. (o=smalltalk.send((smalltalk.Object || Object), "_new", []));
  799. smalltalk.send(self, "_deny_", [smalltalk.send(o, "__eq_eq", [smalltalk.send((smalltalk.Object || Object), "_new", [])])]);
  800. smalltalk.send(self, "_assert_", [smalltalk.send(o, "__eq_eq", [o])]);
  801. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(o, "_yourself", []), "__eq_eq", [o])]);
  802. smalltalk.send(self, "_assert_", [smalltalk.send(o, "__eq_eq", [smalltalk.send(o, "_yourself", [])])]);
  803. return self;}
  804. }),
  805. smalltalk.ObjectTest);
  806. smalltalk.addMethod(
  807. "_testIfNil",
  808. smalltalk.method({
  809. selector: "testIfNil",
  810. fn: function (){
  811. var self=this;
  812. smalltalk.send(self, "_deny_", [smalltalk.send(smalltalk.send((smalltalk.Object || Object), "_new", []), "_isNil", [])]);
  813. smalltalk.send(self, "_deny_", [smalltalk.send((($receiver = smalltalk.send((smalltalk.Object || Object), "_new", [])) == nil || $receiver == undefined) ? (function(){return true;})() : $receiver, "__eq", [true])]);
  814. smalltalk.send(self, "_assert_", [smalltalk.send((($receiver = smalltalk.send((smalltalk.Object || Object), "_new", [])) != nil && $receiver != undefined) ? (function(){return true;})() : nil, "__eq", [true])]);
  815. smalltalk.send(self, "_assert_", [smalltalk.send((($receiver = smalltalk.send((smalltalk.Object || Object), "_new", [])) == nil || $receiver == undefined) ? (function(){return false;})() : (function(){return true;})(), "__eq", [true])]);
  816. smalltalk.send(self, "_assert_", [smalltalk.send((($receiver = smalltalk.send((smalltalk.Object || Object), "_new", [])) == nil || $receiver == undefined) ? (function(){return false;})() : (function(){return true;})(), "__eq", [true])]);
  817. return self;}
  818. }),
  819. smalltalk.ObjectTest);
  820. smalltalk.addMethod(
  821. "_testInstVars",
  822. smalltalk.method({
  823. selector: "testInstVars",
  824. fn: function (){
  825. var self=this;
  826. var o=nil;
  827. (o=smalltalk.send((smalltalk.ObjectMock || ObjectMock), "_new", []));
  828. smalltalk.send(self, "_assert_equals_", [smalltalk.send(o, "_instVarAt_", [smalltalk.symbolFor("foo")]), nil]);
  829. smalltalk.send(o, "_instVarAt_put_", [smalltalk.symbolFor("foo"), (1)]);
  830. smalltalk.send(self, "_assert_equals_", [smalltalk.send(o, "_instVarAt_", [smalltalk.symbolFor("foo")]), (1)]);
  831. smalltalk.send(self, "_assert_equals_", [smalltalk.send(o, "_instVarAt_", ["foo"]), (1)]);
  832. return self;}
  833. }),
  834. smalltalk.ObjectTest);
  835. smalltalk.addMethod(
  836. "_testNilUndefined",
  837. smalltalk.method({
  838. selector: "testNilUndefined",
  839. fn: function (){
  840. var self=this;
  841. smalltalk.send(self, "_assert_", [smalltalk.send(nil, "__eq", [(typeof undefined == 'undefined' ? nil : undefined)])]);
  842. return self;}
  843. }),
  844. smalltalk.ObjectTest);
  845. smalltalk.addMethod(
  846. "_testYourself",
  847. smalltalk.method({
  848. selector: "testYourself",
  849. fn: function (){
  850. var self=this;
  851. var o=nil;
  852. (o=smalltalk.send((smalltalk.ObjectMock || ObjectMock), "_new", []));
  853. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(o, "_yourself", []), "__eq_eq", [o])]);
  854. return self;}
  855. }),
  856. smalltalk.ObjectTest);
  857. smalltalk.addMethod(
  858. "_testidentityHash",
  859. smalltalk.method({
  860. selector: "testidentityHash",
  861. fn: function (){
  862. var self=this;
  863. var o1=nil;
  864. var o2=nil;
  865. (o1=smalltalk.send((smalltalk.Object || Object), "_new", []));
  866. (o2=smalltalk.send((smalltalk.Object || Object), "_new", []));
  867. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(o1, "_identityHash", []), "__eq_eq", [smalltalk.send(o1, "_identityHash", [])])]);
  868. smalltalk.send(self, "_deny_", [smalltalk.send(smalltalk.send(o1, "_identityHash", []), "__eq_eq", [smalltalk.send(o2, "_identityHash", [])])]);
  869. return self;}
  870. }),
  871. smalltalk.ObjectTest);
  872. smalltalk.addClass('PackageTest', smalltalk.TestCase, ['zorkPackage', 'grulPackage', 'backUpCommitPathJs', 'backUpCommitPathSt'], 'Kernel-Tests');
  873. smalltalk.addMethod(
  874. "_setUp",
  875. smalltalk.method({
  876. selector: "setUp",
  877. fn: function (){
  878. var self=this;
  879. (self['@backUpCommitPathJs']=smalltalk.send((smalltalk.Package || Package), "_defaultCommitPathJs", []));
  880. (self['@backUpCommitPathSt']=smalltalk.send((smalltalk.Package || Package), "_defaultCommitPathSt", []));
  881. smalltalk.send((smalltalk.Package || Package), "_resetCommitPaths", []);
  882. (self['@zorkPackage']=smalltalk.send(smalltalk.send((smalltalk.Package || Package), "_new", []), "_name_", ["Zork"]));
  883. (self['@grulPackage']=(function($rec){smalltalk.send($rec, "_name_", ["Grul"]);smalltalk.send($rec, "_commitPathJs_", ["server/grul/js"]);smalltalk.send($rec, "_commitPathSt_", ["grul/st"]);return smalltalk.send($rec, "_yourself", []);})(smalltalk.send((smalltalk.Package || Package), "_new", [])));
  884. return self;}
  885. }),
  886. smalltalk.PackageTest);
  887. smalltalk.addMethod(
  888. "_tearDown",
  889. smalltalk.method({
  890. selector: "tearDown",
  891. fn: function (){
  892. var self=this;
  893. (function($rec){smalltalk.send($rec, "_defaultCommitPathJs_", [self['@backUpCommitPathJs']]);return smalltalk.send($rec, "_defaultCommitPathSt_", [self['@backUpCommitPathSt']]);})((smalltalk.Package || Package));
  894. return self;}
  895. }),
  896. smalltalk.PackageTest);
  897. smalltalk.addMethod(
  898. "_testGrulCommitPathJsShouldBeServerGrulJs",
  899. smalltalk.method({
  900. selector: "testGrulCommitPathJsShouldBeServerGrulJs",
  901. fn: function (){
  902. var self=this;
  903. smalltalk.send(self, "_assert_equals_", ["server/grul/js", smalltalk.send(self['@grulPackage'], "_commitPathJs", [])]);
  904. return self;}
  905. }),
  906. smalltalk.PackageTest);
  907. smalltalk.addMethod(
  908. "_testGrulCommitPathStShouldBeGrulSt",
  909. smalltalk.method({
  910. selector: "testGrulCommitPathStShouldBeGrulSt",
  911. fn: function (){
  912. var self=this;
  913. smalltalk.send(self, "_assert_equals_", ["grul/st", smalltalk.send(self['@grulPackage'], "_commitPathSt", [])]);
  914. return self;}
  915. }),
  916. smalltalk.PackageTest);
  917. smalltalk.addMethod(
  918. "_testZorkCommitPathJsShouldBeJs",
  919. smalltalk.method({
  920. selector: "testZorkCommitPathJsShouldBeJs",
  921. fn: function (){
  922. var self=this;
  923. smalltalk.send(self, "_assert_equals_", ["js", smalltalk.send(self['@zorkPackage'], "_commitPathJs", [])]);
  924. return self;}
  925. }),
  926. smalltalk.PackageTest);
  927. smalltalk.addMethod(
  928. "_testZorkCommitPathStShouldBeSt",
  929. smalltalk.method({
  930. selector: "testZorkCommitPathStShouldBeSt",
  931. fn: function (){
  932. var self=this;
  933. smalltalk.send(self, "_assert_equals_", ["st", smalltalk.send(self['@zorkPackage'], "_commitPathSt", [])]);
  934. return self;}
  935. }),
  936. smalltalk.PackageTest);
  937. smalltalk.addClass('PackageWithDefaultCommitPathChangedTest', smalltalk.PackageTest, [], 'Kernel-Tests');
  938. smalltalk.addMethod(
  939. "_setUp",
  940. smalltalk.method({
  941. selector: "setUp",
  942. fn: function (){
  943. var self=this;
  944. smalltalk.send(self, "_setUp", [], smalltalk.PackageWithDefaultCommitPathChangedTest.superclass || nil);
  945. (function($rec){smalltalk.send($rec, "_defaultCommitPathJs_", ["javascripts/"]);return smalltalk.send($rec, "_defaultCommitPathSt_", ["smalltalk/"]);})((smalltalk.Package || Package));
  946. return self;}
  947. }),
  948. smalltalk.PackageWithDefaultCommitPathChangedTest);
  949. smalltalk.addMethod(
  950. "_testGrulCommitPathJsShouldBeServerGrulJs",
  951. smalltalk.method({
  952. selector: "testGrulCommitPathJsShouldBeServerGrulJs",
  953. fn: function (){
  954. var self=this;
  955. smalltalk.send(self, "_assert_equals_", ["server/grul/js", smalltalk.send(self['@grulPackage'], "_commitPathJs", [])]);
  956. return self;}
  957. }),
  958. smalltalk.PackageWithDefaultCommitPathChangedTest);
  959. smalltalk.addMethod(
  960. "_testGrulCommitPathStShouldBeGrulSt",
  961. smalltalk.method({
  962. selector: "testGrulCommitPathStShouldBeGrulSt",
  963. fn: function (){
  964. var self=this;
  965. smalltalk.send(self, "_assert_equals_", ["grul/st", smalltalk.send(self['@grulPackage'], "_commitPathSt", [])]);
  966. return self;}
  967. }),
  968. smalltalk.PackageWithDefaultCommitPathChangedTest);
  969. smalltalk.addMethod(
  970. "_testZorkCommitPathJsShouldBeJavascript",
  971. smalltalk.method({
  972. selector: "testZorkCommitPathJsShouldBeJavascript",
  973. fn: function (){
  974. var self=this;
  975. smalltalk.send(self, "_assert_equals_", ["javascripts/", smalltalk.send(self['@zorkPackage'], "_commitPathJs", [])]);
  976. return self;}
  977. }),
  978. smalltalk.PackageWithDefaultCommitPathChangedTest);
  979. smalltalk.addMethod(
  980. "_testZorkCommitPathStShouldBeSmalltalk",
  981. smalltalk.method({
  982. selector: "testZorkCommitPathStShouldBeSmalltalk",
  983. fn: function (){
  984. var self=this;
  985. smalltalk.send(self, "_assert_equals_", ["smalltalk/", smalltalk.send(self['@zorkPackage'], "_commitPathSt", [])]);
  986. return self;}
  987. }),
  988. smalltalk.PackageWithDefaultCommitPathChangedTest);
  989. smalltalk.addMethod(
  990. "_shouldInheritSelectors",
  991. smalltalk.method({
  992. selector: "shouldInheritSelectors",
  993. fn: function (){
  994. var self=this;
  995. return false;
  996. return self;}
  997. }),
  998. smalltalk.PackageWithDefaultCommitPathChangedTest.klass);
  999. smalltalk.addClass('PointTest', smalltalk.TestCase, [], 'Kernel-Tests');
  1000. smalltalk.addMethod(
  1001. "_testAccessing",
  1002. smalltalk.method({
  1003. selector: "testAccessing",
  1004. fn: function (){
  1005. var self=this;
  1006. smalltalk.send(self, "_assert_equals_", [smalltalk.send(smalltalk.send((smalltalk.Point || Point), "_x_y_", [(3), (4)]), "_x", []), (3)]);
  1007. smalltalk.send(self, "_assert_equals_", [smalltalk.send(smalltalk.send((smalltalk.Point || Point), "_x_y_", [(3), (4)]), "_y", []), (4)]);
  1008. smalltalk.send(self, "_assert_equals_", [smalltalk.send(smalltalk.send(smalltalk.send((smalltalk.Point || Point), "_new", []), "_x_", [(3)]), "_x", []), (3)]);
  1009. smalltalk.send(self, "_assert_equals_", [smalltalk.send(smalltalk.send(smalltalk.send((smalltalk.Point || Point), "_new", []), "_y_", [(4)]), "_y", []), (4)]);
  1010. return self;}
  1011. }),
  1012. smalltalk.PointTest);
  1013. smalltalk.addMethod(
  1014. "_testArithmetic",
  1015. smalltalk.method({
  1016. selector: "testArithmetic",
  1017. fn: function (){
  1018. var self=this;
  1019. smalltalk.send(self, "_assert_equals_", [((($receiver = smalltalk.send((3), "__at", [(4)])).klass === smalltalk.Number) ? $receiver *smalltalk.send((3), "__at", [(4)]) : smalltalk.send($receiver, "__star", [smalltalk.send((3), "__at", [(4)])])), smalltalk.send((smalltalk.Point || Point), "_x_y_", [(9), (16)])]);
  1020. smalltalk.send(self, "_assert_equals_", [((($receiver = smalltalk.send((3), "__at", [(4)])).klass === smalltalk.Number) ? $receiver +smalltalk.send((3), "__at", [(4)]) : smalltalk.send($receiver, "__plus", [smalltalk.send((3), "__at", [(4)])])), smalltalk.send((smalltalk.Point || Point), "_x_y_", [(6), (8)])]);
  1021. smalltalk.send(self, "_assert_equals_", [((($receiver = smalltalk.send((3), "__at", [(4)])).klass === smalltalk.Number) ? $receiver -smalltalk.send((3), "__at", [(4)]) : smalltalk.send($receiver, "__minus", [smalltalk.send((3), "__at", [(4)])])), smalltalk.send((smalltalk.Point || Point), "_x_y_", [(0), (0)])]);
  1022. smalltalk.send(self, "_assert_equals_", [((($receiver = smalltalk.send((6), "__at", [(8)])).klass === smalltalk.Number) ? $receiver /smalltalk.send((3), "__at", [(4)]) : smalltalk.send($receiver, "__slash", [smalltalk.send((3), "__at", [(4)])])), smalltalk.send((smalltalk.Point || Point), "_x_y_", [(2), (2)])]);
  1023. return self;}
  1024. }),
  1025. smalltalk.PointTest);
  1026. smalltalk.addMethod(
  1027. "_testAt",
  1028. smalltalk.method({
  1029. selector: "testAt",
  1030. fn: function (){
  1031. var self=this;
  1032. smalltalk.send(self, "_assert_equals_", [smalltalk.send((3), "__at", [(4)]), smalltalk.send((smalltalk.Point || Point), "_x_y_", [(3), (4)])]);
  1033. return self;}
  1034. }),
  1035. smalltalk.PointTest);
  1036. smalltalk.addMethod(
  1037. "_testEgality",
  1038. smalltalk.method({
  1039. selector: "testEgality",
  1040. fn: function (){
  1041. var self=this;
  1042. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((3), "__at", [(4)]), "__eq", [smalltalk.send((3), "__at", [(4)])])]);
  1043. smalltalk.send(self, "_deny_", [smalltalk.send(smalltalk.send((3), "__at", [(5)]), "__eq", [smalltalk.send((3), "__at", [(6)])])]);
  1044. return self;}
  1045. }),
  1046. smalltalk.PointTest);
  1047. smalltalk.addMethod(
  1048. "_testTranslateBy",
  1049. smalltalk.method({
  1050. selector: "testTranslateBy",
  1051. fn: function (){
  1052. var self=this;
  1053. smalltalk.send(self, "_assert_equals_", [smalltalk.send((3), "__at", [(4)]), smalltalk.send(smalltalk.send((3), "__at", [(3)]), "_translateBy_", [smalltalk.send((0), "__at", [(1)])])]);
  1054. smalltalk.send(self, "_assert_equals_", [smalltalk.send((3), "__at", [(2)]), smalltalk.send(smalltalk.send((3), "__at", [(3)]), "_translateBy_", [smalltalk.send((0), "__at", [smalltalk.send((1), "_negated", [])])])]);
  1055. smalltalk.send(self, "_assert_equals_", [smalltalk.send((5), "__at", [(6)]), smalltalk.send(smalltalk.send((3), "__at", [(3)]), "_translateBy_", [smalltalk.send((2), "__at", [(3)])])]);
  1056. smalltalk.send(self, "_assert_equals_", [smalltalk.send((0), "__at", [(3)]), smalltalk.send(smalltalk.send((3), "__at", [(3)]), "_translateBy_", [smalltalk.send(smalltalk.send((3), "_negated", []), "__at", [(0)])])]);
  1057. return self;}
  1058. }),
  1059. smalltalk.PointTest);
  1060. smalltalk.addClass('RandomTest', smalltalk.TestCase, [], 'Kernel-Tests');
  1061. smalltalk.addMethod(
  1062. "_textNext",
  1063. smalltalk.method({
  1064. selector: "textNext",
  1065. fn: function (){
  1066. var self=this;
  1067. smalltalk.send((10000), "_timesRepeat_", [(function(){var current=nil;
  1068. var next=nil;
  1069. (next=smalltalk.send(smalltalk.send((smalltalk.Random || Random), "_new", []), "_next", []));smalltalk.send(self, "_assert_", [((($receiver = next).klass === smalltalk.Number) ? $receiver >=(0) : smalltalk.send($receiver, "__gt_eq", [(0)]))]);smalltalk.send(self, "_assert_", [((($receiver = next).klass === smalltalk.Number) ? $receiver <(1) : smalltalk.send($receiver, "__lt", [(1)]))]);smalltalk.send(self, "_deny_", [smalltalk.send(current, "__eq", [next])]);return smalltalk.send(next, "__eq", [current]);})]);
  1070. return self;}
  1071. }),
  1072. smalltalk.RandomTest);
  1073. smalltalk.addClass('SetTest', smalltalk.TestCase, [], 'Kernel-Tests');
  1074. smalltalk.addMethod(
  1075. "_testAddRemove",
  1076. smalltalk.method({
  1077. selector: "testAddRemove",
  1078. fn: function (){
  1079. var self=this;
  1080. var set=nil;
  1081. (set=smalltalk.send((smalltalk.Set || Set), "_new", []));
  1082. smalltalk.send(self, "_assert_", [smalltalk.send(set, "_isEmpty", [])]);
  1083. smalltalk.send(set, "_add_", [(3)]);
  1084. smalltalk.send(self, "_assert_", [smalltalk.send(set, "_includes_", [(3)])]);
  1085. smalltalk.send(set, "_add_", [(5)]);
  1086. smalltalk.send(self, "_assert_", [smalltalk.send(set, "_includes_", [(5)])]);
  1087. smalltalk.send(set, "_remove_", [(3)]);
  1088. smalltalk.send(self, "_deny_", [smalltalk.send(set, "_includes_", [(3)])]);
  1089. return self;}
  1090. }),
  1091. smalltalk.SetTest);
  1092. smalltalk.addMethod(
  1093. "_testAt",
  1094. smalltalk.method({
  1095. selector: "testAt",
  1096. fn: function (){
  1097. var self=this;
  1098. smalltalk.send(self, "_should_raise_", [(function(){return smalltalk.send(smalltalk.send((smalltalk.Set || Set), "_new", []), "_at_put_", [(1), (2)]);}), (smalltalk.Error || Error)]);
  1099. return self;}
  1100. }),
  1101. smalltalk.SetTest);
  1102. smalltalk.addMethod(
  1103. "_testSize",
  1104. smalltalk.method({
  1105. selector: "testSize",
  1106. fn: function (){
  1107. var self=this;
  1108. smalltalk.send(self, "_assert_equals_", [smalltalk.send(smalltalk.send((smalltalk.Set || Set), "_new", []), "_size", []), (0)]);
  1109. smalltalk.send(self, "_assert_equals_", [smalltalk.send(smalltalk.send((smalltalk.Set || Set), "_withAll_", [[(1), (2), (3), (4)]]), "_size", []), (4)]);
  1110. smalltalk.send(self, "_assert_equals_", [smalltalk.send(smalltalk.send((smalltalk.Set || Set), "_withAll_", [[(1), (1), (1), (1)]]), "_size", []), (1)]);
  1111. return self;}
  1112. }),
  1113. smalltalk.SetTest);
  1114. smalltalk.addMethod(
  1115. "_testUnicity",
  1116. smalltalk.method({
  1117. selector: "testUnicity",
  1118. fn: function (){
  1119. var self=this;
  1120. var set=nil;
  1121. (set=smalltalk.send((smalltalk.Set || Set), "_new", []));
  1122. smalltalk.send(set, "_add_", [(21)]);
  1123. smalltalk.send(set, "_add_", ["hello"]);
  1124. smalltalk.send(set, "_add_", [(21)]);
  1125. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(set, "_size", []), "__eq", [(2)])]);
  1126. smalltalk.send(set, "_add_", ["hello"]);
  1127. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(set, "_size", []), "__eq", [(2)])]);
  1128. smalltalk.send(self, "_assert_equals_", [smalltalk.send(set, "_asArray", []), [(21), "hello"]]);
  1129. return self;}
  1130. }),
  1131. smalltalk.SetTest);
  1132. smalltalk.addClass('StringTest', smalltalk.TestCase, [], 'Kernel-Tests');
  1133. smalltalk.addMethod(
  1134. "_testAddRemove",
  1135. smalltalk.method({
  1136. selector: "testAddRemove",
  1137. fn: function (){
  1138. var self=this;
  1139. smalltalk.send(self, "_should_raise_", [(function(){return smalltalk.send("hello", "_add_", ["a"]);}), (smalltalk.Error || Error)]);
  1140. smalltalk.send(self, "_should_raise_", [(function(){return smalltalk.send("hello", "_remove_", ["h"]);}), (smalltalk.Error || Error)]);
  1141. return self;}
  1142. }),
  1143. smalltalk.StringTest);
  1144. smalltalk.addMethod(
  1145. "_testAsArray",
  1146. smalltalk.method({
  1147. selector: "testAsArray",
  1148. fn: function (){
  1149. var self=this;
  1150. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send("hello", "_asArray", []), "__eq", [["h", "e", "l", "l", "o"]])]);
  1151. return self;}
  1152. }),
  1153. smalltalk.StringTest);
  1154. smalltalk.addMethod(
  1155. "_testAt",
  1156. smalltalk.method({
  1157. selector: "testAt",
  1158. fn: function (){
  1159. var self=this;
  1160. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send("hello", "_at_", [(1)]), "__eq", ["h"])]);
  1161. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send("hello", "_at_", [(5)]), "__eq", ["o"])]);
  1162. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send("hello", "_at_ifAbsent_", [(6), (function(){return nil;})]), "__eq", [nil])]);
  1163. return self;}
  1164. }),
  1165. smalltalk.StringTest);
  1166. smalltalk.addMethod(
  1167. "_testAtPut",
  1168. smalltalk.method({
  1169. selector: "testAtPut",
  1170. fn: function (){
  1171. var self=this;
  1172. smalltalk.send(self, "_should_raise_", [(function(){return smalltalk.send("hello", "_at_put_", [(1), "a"]);}), (smalltalk.Error || Error)]);
  1173. return self;}
  1174. }),
  1175. smalltalk.StringTest);
  1176. smalltalk.addMethod(
  1177. "_testCopyWithoutAll",
  1178. smalltalk.method({
  1179. selector: "testCopyWithoutAll",
  1180. fn: function (){
  1181. var self=this;
  1182. smalltalk.send(self, "_assert_equals_", ["hello world", smalltalk.send("*hello* *world*", "_copyWithoutAll_", ["*"])]);
  1183. return self;}
  1184. }),
  1185. smalltalk.StringTest);
  1186. smalltalk.addMethod(
  1187. "_testEquality",
  1188. smalltalk.method({
  1189. selector: "testEquality",
  1190. fn: function (){
  1191. var self=this;
  1192. smalltalk.send(self, "_assert_", [smalltalk.send("hello", "__eq", ["hello"])]);
  1193. smalltalk.send(self, "_deny_", [smalltalk.send("hello", "__eq", ["world"])]);
  1194. smalltalk.send(self, "_assert_", [smalltalk.send("hello", "__eq", [smalltalk.send("hello", "_yourself", [])])]);
  1195. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send("hello", "_yourself", []), "__eq", ["hello"])]);
  1196. smalltalk.send(self, "_deny_", [smalltalk.send("", "__eq", [(0)])]);
  1197. return self;}
  1198. }),
  1199. smalltalk.StringTest);
  1200. smalltalk.addMethod(
  1201. "_testIdentity",
  1202. smalltalk.method({
  1203. selector: "testIdentity",
  1204. fn: function (){
  1205. var self=this;
  1206. smalltalk.send(self, "_assert_", [smalltalk.send("hello", "__eq_eq", ["hello"])]);
  1207. smalltalk.send(self, "_deny_", [smalltalk.send("hello", "__eq_eq", ["world"])]);
  1208. smalltalk.send(self, "_assert_", [smalltalk.send("hello", "__eq_eq", [smalltalk.send("hello", "_yourself", [])])]);
  1209. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send("hello", "_yourself", []), "__eq_eq", ["hello"])]);
  1210. smalltalk.send(self, "_deny_", [smalltalk.send("", "__eq_eq", [(0)])]);
  1211. return self;}
  1212. }),
  1213. smalltalk.StringTest);
  1214. smalltalk.addMethod(
  1215. "_testIncludesSubString",
  1216. smalltalk.method({
  1217. selector: "testIncludesSubString",
  1218. fn: function (){
  1219. var self=this;
  1220. smalltalk.send(self, "_assert_", [smalltalk.send("amber", "_includesSubString_", ["ber"])]);
  1221. smalltalk.send(self, "_deny_", [smalltalk.send("amber", "_includesSubString_", ["zork"])]);
  1222. return self;}
  1223. }),
  1224. smalltalk.StringTest);
  1225. smalltalk.addMethod(
  1226. "_testJoin",
  1227. smalltalk.method({
  1228. selector: "testJoin",
  1229. fn: function (){
  1230. var self=this;
  1231. smalltalk.send(self, "_assert_equals_", ["hello,world", smalltalk.send(",", "_join_", [["hello", "world"]])]);
  1232. return self;}
  1233. }),
  1234. smalltalk.StringTest);
  1235. smalltalk.addMethod(
  1236. "_testSize",
  1237. smalltalk.method({
  1238. selector: "testSize",
  1239. fn: function (){
  1240. var self=this;
  1241. smalltalk.send(self, "_assert_equals_", [smalltalk.send("smalltalk", "_size", []), (9)]);
  1242. smalltalk.send(self, "_assert_equals_", [smalltalk.send("", "_size", []), (0)]);
  1243. return self;}
  1244. }),
  1245. smalltalk.StringTest);
  1246. smalltalk.addMethod(
  1247. "_testStreamContents",
  1248. smalltalk.method({
  1249. selector: "testStreamContents",
  1250. fn: function (){
  1251. var self=this;
  1252. smalltalk.send(self, "_assert_equals_", ["hello world", smalltalk.send((smalltalk.String || String), "_streamContents_", [(function(aStream){return (function($rec){smalltalk.send($rec, "_nextPutAll_", ["hello"]);smalltalk.send($rec, "_space", []);return smalltalk.send($rec, "_nextPutAll_", ["world"]);})(aStream);})])]);
  1253. return self;}
  1254. }),
  1255. smalltalk.StringTest);
  1256. smalltalk.addClass('SymbolTest', smalltalk.TestCase, [], 'Kernel-Tests');
  1257. smalltalk.addMethod(
  1258. "_testAsString",
  1259. smalltalk.method({
  1260. selector: "testAsString",
  1261. fn: function (){
  1262. var self=this;
  1263. smalltalk.send(self, "_assert_equals_", [smalltalk.send(smalltalk.symbolFor("hello"), "_asString", []), "hello"]);
  1264. return self;}
  1265. }),
  1266. smalltalk.SymbolTest);
  1267. smalltalk.addMethod(
  1268. "_testAsSymbol",
  1269. smalltalk.method({
  1270. selector: "testAsSymbol",
  1271. fn: function (){
  1272. var self=this;
  1273. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.symbolFor("hello"), "__eq_eq", [smalltalk.send(smalltalk.symbolFor("hello"), "_asSymbol", [])])]);
  1274. return self;}
  1275. }),
  1276. smalltalk.SymbolTest);
  1277. smalltalk.addMethod(
  1278. "_testAt",
  1279. smalltalk.method({
  1280. selector: "testAt",
  1281. fn: function (){
  1282. var self=this;
  1283. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(smalltalk.symbolFor("hello"), "_at_", [(1)]), "__eq", ["h"])]);
  1284. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(smalltalk.symbolFor("hello"), "_at_", [(5)]), "__eq", ["o"])]);
  1285. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(smalltalk.symbolFor("hello"), "_at_ifAbsent_", [(6), (function(){return nil;})]), "__eq", [nil])]);
  1286. return self;}
  1287. }),
  1288. smalltalk.SymbolTest);
  1289. smalltalk.addMethod(
  1290. "_testAtPut",
  1291. smalltalk.method({
  1292. selector: "testAtPut",
  1293. fn: function (){
  1294. var self=this;
  1295. smalltalk.send(self, "_should_raise_", [(function(){return smalltalk.send("hello", "_at_put_", [(1), "a"]);}), (smalltalk.Error || Error)]);
  1296. return self;}
  1297. }),
  1298. smalltalk.SymbolTest);
  1299. smalltalk.addMethod(
  1300. "_testComparing",
  1301. smalltalk.method({
  1302. selector: "testComparing",
  1303. fn: function (){
  1304. var self=this;
  1305. smalltalk.send(self, "_assert_", [((($receiver = smalltalk.symbolFor("ab")).klass === smalltalk.Number) ? $receiver >smalltalk.symbolFor("aa") : smalltalk.send($receiver, "__gt", [smalltalk.symbolFor("aa")]))]);
  1306. smalltalk.send(self, "_deny_", [((($receiver = smalltalk.symbolFor("ab")).klass === smalltalk.Number) ? $receiver >smalltalk.symbolFor("ba") : smalltalk.send($receiver, "__gt", [smalltalk.symbolFor("ba")]))]);
  1307. smalltalk.send(self, "_assert_", [((($receiver = smalltalk.symbolFor("ab")).klass === smalltalk.Number) ? $receiver <smalltalk.symbolFor("ba") : smalltalk.send($receiver, "__lt", [smalltalk.symbolFor("ba")]))]);
  1308. smalltalk.send(self, "_deny_", [((($receiver = smalltalk.symbolFor("bb")).klass === smalltalk.Number) ? $receiver <smalltalk.symbolFor("ba") : smalltalk.send($receiver, "__lt", [smalltalk.symbolFor("ba")]))]);
  1309. smalltalk.send(self, "_assert_", [((($receiver = smalltalk.symbolFor("ab")).klass === smalltalk.Number) ? $receiver >=smalltalk.symbolFor("aa") : smalltalk.send($receiver, "__gt_eq", [smalltalk.symbolFor("aa")]))]);
  1310. smalltalk.send(self, "_deny_", [((($receiver = smalltalk.symbolFor("ab")).klass === smalltalk.Number) ? $receiver >=smalltalk.symbolFor("ba") : smalltalk.send($receiver, "__gt_eq", [smalltalk.symbolFor("ba")]))]);
  1311. smalltalk.send(self, "_assert_", [((($receiver = smalltalk.symbolFor("ab")).klass === smalltalk.Number) ? $receiver <=smalltalk.symbolFor("ba") : smalltalk.send($receiver, "__lt_eq", [smalltalk.symbolFor("ba")]))]);
  1312. smalltalk.send(self, "_deny_", [((($receiver = smalltalk.symbolFor("bb")).klass === smalltalk.Number) ? $receiver <=smalltalk.symbolFor("ba") : smalltalk.send($receiver, "__lt_eq", [smalltalk.symbolFor("ba")]))]);
  1313. return self;}
  1314. }),
  1315. smalltalk.SymbolTest);
  1316. smalltalk.addMethod(
  1317. "_testCopying",
  1318. smalltalk.method({
  1319. selector: "testCopying",
  1320. fn: function (){
  1321. var self=this;
  1322. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(smalltalk.symbolFor("hello"), "_copy", []), "__eq_eq", [smalltalk.symbolFor("hello")])]);
  1323. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(smalltalk.symbolFor("hello"), "_deepCopy", []), "__eq_eq", [smalltalk.symbolFor("hello")])]);
  1324. return self;}
  1325. }),
  1326. smalltalk.SymbolTest);
  1327. smalltalk.addMethod(
  1328. "_testEquality",
  1329. smalltalk.method({
  1330. selector: "testEquality",
  1331. fn: function (){
  1332. var self=this;
  1333. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.symbolFor("hello"), "__eq", [smalltalk.symbolFor("hello")])]);
  1334. smalltalk.send(self, "_deny_", [smalltalk.send(smalltalk.symbolFor("hello"), "__eq", [smalltalk.symbolFor("world")])]);
  1335. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.symbolFor("hello"), "__eq", [smalltalk.send(smalltalk.symbolFor("hello"), "_yourself", [])])]);
  1336. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(smalltalk.symbolFor("hello"), "_yourself", []), "__eq", [smalltalk.symbolFor("hello")])]);
  1337. smalltalk.send(self, "_deny_", [smalltalk.send(smalltalk.symbolFor("hello"), "__eq", ["hello"])]);
  1338. smalltalk.send(self, "_deny_", [smalltalk.send("hello", "__eq", [smalltalk.symbolFor("hello")])]);
  1339. return self;}
  1340. }),
  1341. smalltalk.SymbolTest);
  1342. smalltalk.addMethod(
  1343. "_testIdentity",
  1344. smalltalk.method({
  1345. selector: "testIdentity",
  1346. fn: function (){
  1347. var self=this;
  1348. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.symbolFor("hello"), "__eq_eq", [smalltalk.symbolFor("hello")])]);
  1349. smalltalk.send(self, "_deny_", [smalltalk.send(smalltalk.symbolFor("hello"), "__eq_eq", [smalltalk.symbolFor("world")])]);
  1350. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.symbolFor("hello"), "__eq", [smalltalk.send(smalltalk.symbolFor("hello"), "_yourself", [])])]);
  1351. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(smalltalk.symbolFor("hello"), "_yourself", []), "__eq", [smalltalk.send(smalltalk.send(smalltalk.symbolFor("hello"), "_asString", []), "_asSymbol", [])])]);
  1352. return self;}
  1353. }),
  1354. smalltalk.SymbolTest);
  1355. smalltalk.addMethod(
  1356. "_testIsSymbolIsString",
  1357. smalltalk.method({
  1358. selector: "testIsSymbolIsString",
  1359. fn: function (){
  1360. var self=this;
  1361. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.symbolFor("hello"), "_isSymbol", [])]);
  1362. smalltalk.send(self, "_deny_", [smalltalk.send("hello", "_isSymbol", [])]);
  1363. smalltalk.send(self, "_deny_", [smalltalk.send(smalltalk.symbolFor("hello"), "_isString", [])]);
  1364. smalltalk.send(self, "_assert_", [smalltalk.send("hello", "_isString", [])]);
  1365. return self;}
  1366. }),
  1367. smalltalk.SymbolTest);
  1368. smalltalk.addMethod(
  1369. "_testSize",
  1370. smalltalk.method({
  1371. selector: "testSize",
  1372. fn: function (){
  1373. var self=this;
  1374. smalltalk.send(self, "_assert_equals_", [smalltalk.send(smalltalk.symbolFor("a"), "_size", []), (1)]);
  1375. smalltalk.send(self, "_assert_equals_", [smalltalk.send(smalltalk.symbolFor("aaaaa"), "_size", []), (5)]);
  1376. return self;}
  1377. }),
  1378. smalltalk.SymbolTest);
  1379. smalltalk.addClass('UndefinedTest', smalltalk.TestCase, [], 'Kernel-Tests');
  1380. smalltalk.addMethod(
  1381. "_testCopying",
  1382. smalltalk.method({
  1383. selector: "testCopying",
  1384. fn: function (){
  1385. var self=this;
  1386. smalltalk.send(self, "_assert_equals_", [smalltalk.send(nil, "_copy", []), nil]);
  1387. return self;}
  1388. }),
  1389. smalltalk.UndefinedTest);
  1390. smalltalk.addMethod(
  1391. "_testDeepCopy",
  1392. smalltalk.method({
  1393. selector: "testDeepCopy",
  1394. fn: function (){
  1395. var self=this;
  1396. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(nil, "_deepCopy", []), "__eq", [nil])]);
  1397. return self;}
  1398. }),
  1399. smalltalk.UndefinedTest);
  1400. smalltalk.addMethod(
  1401. "_testIfNil",
  1402. smalltalk.method({
  1403. selector: "testIfNil",
  1404. fn: function (){
  1405. var self=this;
  1406. smalltalk.send(self, "_assert_equals_", [(($receiver = nil) == nil || $receiver == undefined) ? (function(){return true;})() : $receiver, true]);
  1407. smalltalk.send(self, "_deny_", [smalltalk.send((($receiver = nil) != nil && $receiver != undefined) ? (function(){return true;})() : nil, "__eq", [true])]);
  1408. smalltalk.send(self, "_assert_equals_", [(($receiver = nil) == nil || $receiver == undefined) ? (function(){return true;})() : (function(){return false;})(), true]);
  1409. smalltalk.send(self, "_deny_", [smalltalk.send((($receiver = nil) == nil || $receiver == undefined) ? (function(){return false;})() : (function(){return true;})(), "__eq", [true])]);
  1410. return self;}
  1411. }),
  1412. smalltalk.UndefinedTest);
  1413. smalltalk.addMethod(
  1414. "_testIsNil",
  1415. smalltalk.method({
  1416. selector: "testIsNil",
  1417. fn: function (){
  1418. var self=this;
  1419. smalltalk.send(self, "_assert_", [smalltalk.send(nil, "_isNil", [])]);
  1420. smalltalk.send(self, "_deny_", [smalltalk.send(nil, "_notNil", [])]);
  1421. return self;}
  1422. }),
  1423. smalltalk.UndefinedTest);