1
0

Kernel-Tests.deploy.js 65 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566
  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. return self;}
  802. }),
  803. smalltalk.ObjectTest);
  804. smalltalk.addMethod(
  805. "_testIfNil",
  806. smalltalk.method({
  807. selector: "testIfNil",
  808. fn: function (){
  809. var self=this;
  810. smalltalk.send(self, "_deny_", [smalltalk.send(smalltalk.send((smalltalk.Object || Object), "_new", []), "_isNil", [])]);
  811. smalltalk.send(self, "_deny_", [smalltalk.send((($receiver = smalltalk.send((smalltalk.Object || Object), "_new", [])) == nil || $receiver == undefined) ? (function(){return true;})() : $receiver, "__eq", [true])]);
  812. smalltalk.send(self, "_assert_", [smalltalk.send((($receiver = smalltalk.send((smalltalk.Object || Object), "_new", [])) != nil && $receiver != undefined) ? (function(){return true;})() : nil, "__eq", [true])]);
  813. smalltalk.send(self, "_assert_", [smalltalk.send((($receiver = smalltalk.send((smalltalk.Object || Object), "_new", [])) == nil || $receiver == undefined) ? (function(){return false;})() : (function(){return true;})(), "__eq", [true])]);
  814. smalltalk.send(self, "_assert_", [smalltalk.send((($receiver = smalltalk.send((smalltalk.Object || Object), "_new", [])) == nil || $receiver == undefined) ? (function(){return false;})() : (function(){return true;})(), "__eq", [true])]);
  815. return self;}
  816. }),
  817. smalltalk.ObjectTest);
  818. smalltalk.addMethod(
  819. "_testInstVars",
  820. smalltalk.method({
  821. selector: "testInstVars",
  822. fn: function (){
  823. var self=this;
  824. var o=nil;
  825. (o=smalltalk.send((smalltalk.ObjectMock || ObjectMock), "_new", []));
  826. smalltalk.send(self, "_assert_equals_", [smalltalk.send(o, "_instVarAt_", [smalltalk.symbolFor("foo")]), nil]);
  827. smalltalk.send(o, "_instVarAt_put_", [smalltalk.symbolFor("foo"), (1)]);
  828. smalltalk.send(self, "_assert_equals_", [smalltalk.send(o, "_instVarAt_", [smalltalk.symbolFor("foo")]), (1)]);
  829. smalltalk.send(self, "_assert_equals_", [smalltalk.send(o, "_instVarAt_", ["foo"]), (1)]);
  830. return self;}
  831. }),
  832. smalltalk.ObjectTest);
  833. smalltalk.addMethod(
  834. "_testNilUndefined",
  835. smalltalk.method({
  836. selector: "testNilUndefined",
  837. fn: function (){
  838. var self=this;
  839. smalltalk.send(self, "_assert_", [smalltalk.send(nil, "__eq", [(typeof undefined == 'undefined' ? nil : undefined)])]);
  840. return self;}
  841. }),
  842. smalltalk.ObjectTest);
  843. smalltalk.addMethod(
  844. "_testYourself",
  845. smalltalk.method({
  846. selector: "testYourself",
  847. fn: function (){
  848. var self=this;
  849. var o=nil;
  850. (o=smalltalk.send((smalltalk.ObjectMock || ObjectMock), "_new", []));
  851. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(o, "_yourself", []), "__eq_eq", [o])]);
  852. return self;}
  853. }),
  854. smalltalk.ObjectTest);
  855. smalltalk.addMethod(
  856. "_testidentityHash",
  857. smalltalk.method({
  858. selector: "testidentityHash",
  859. fn: function (){
  860. var self=this;
  861. var o1=nil;
  862. var o2=nil;
  863. (o1=smalltalk.send((smalltalk.Object || Object), "_new", []));
  864. (o2=smalltalk.send((smalltalk.Object || Object), "_new", []));
  865. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(o1, "_identityHash", []), "__eq_eq", [smalltalk.send(o1, "_identityHash", [])])]);
  866. smalltalk.send(self, "_deny_", [smalltalk.send(smalltalk.send(o1, "_identityHash", []), "__eq_eq", [smalltalk.send(o2, "_identityHash", [])])]);
  867. return self;}
  868. }),
  869. smalltalk.ObjectTest);
  870. smalltalk.addClass('PackageTest', smalltalk.TestCase, ['zorkPackage', 'grulPackage', 'backUpCommitPathJs', 'backUpCommitPathSt'], 'Kernel-Tests');
  871. smalltalk.addMethod(
  872. "_setUp",
  873. smalltalk.method({
  874. selector: "setUp",
  875. fn: function (){
  876. var self=this;
  877. (self['@backUpCommitPathJs']=smalltalk.send((smalltalk.Package || Package), "_defaultCommitPathJs", []));
  878. (self['@backUpCommitPathSt']=smalltalk.send((smalltalk.Package || Package), "_defaultCommitPathSt", []));
  879. smalltalk.send((smalltalk.Package || Package), "_resetCommitPaths", []);
  880. (self['@zorkPackage']=smalltalk.send(smalltalk.send((smalltalk.Package || Package), "_new", []), "_name_", ["Zork"]));
  881. (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", [])));
  882. return self;}
  883. }),
  884. smalltalk.PackageTest);
  885. smalltalk.addMethod(
  886. "_tearDown",
  887. smalltalk.method({
  888. selector: "tearDown",
  889. fn: function (){
  890. var self=this;
  891. (function($rec){smalltalk.send($rec, "_defaultCommitPathJs_", [self['@backUpCommitPathJs']]);return smalltalk.send($rec, "_defaultCommitPathSt_", [self['@backUpCommitPathSt']]);})((smalltalk.Package || Package));
  892. return self;}
  893. }),
  894. smalltalk.PackageTest);
  895. smalltalk.addMethod(
  896. "_testGrulCommitPathJsShouldBeServerGrulJs",
  897. smalltalk.method({
  898. selector: "testGrulCommitPathJsShouldBeServerGrulJs",
  899. fn: function (){
  900. var self=this;
  901. smalltalk.send(self, "_assert_equals_", ["server/grul/js", smalltalk.send(self['@grulPackage'], "_commitPathJs", [])]);
  902. return self;}
  903. }),
  904. smalltalk.PackageTest);
  905. smalltalk.addMethod(
  906. "_testGrulCommitPathStShouldBeGrulSt",
  907. smalltalk.method({
  908. selector: "testGrulCommitPathStShouldBeGrulSt",
  909. fn: function (){
  910. var self=this;
  911. smalltalk.send(self, "_assert_equals_", ["grul/st", smalltalk.send(self['@grulPackage'], "_commitPathSt", [])]);
  912. return self;}
  913. }),
  914. smalltalk.PackageTest);
  915. smalltalk.addMethod(
  916. "_testZorkCommitPathJsShouldBeJs",
  917. smalltalk.method({
  918. selector: "testZorkCommitPathJsShouldBeJs",
  919. fn: function (){
  920. var self=this;
  921. smalltalk.send(self, "_assert_equals_", ["js", smalltalk.send(self['@zorkPackage'], "_commitPathJs", [])]);
  922. return self;}
  923. }),
  924. smalltalk.PackageTest);
  925. smalltalk.addMethod(
  926. "_testZorkCommitPathStShouldBeSt",
  927. smalltalk.method({
  928. selector: "testZorkCommitPathStShouldBeSt",
  929. fn: function (){
  930. var self=this;
  931. smalltalk.send(self, "_assert_equals_", ["st", smalltalk.send(self['@zorkPackage'], "_commitPathSt", [])]);
  932. return self;}
  933. }),
  934. smalltalk.PackageTest);
  935. smalltalk.addClass('PackageWithDefaultCommitPathChangedTest', smalltalk.PackageTest, [], 'Kernel-Tests');
  936. smalltalk.addMethod(
  937. "_setUp",
  938. smalltalk.method({
  939. selector: "setUp",
  940. fn: function (){
  941. var self=this;
  942. smalltalk.send(self, "_setUp", [], smalltalk.PackageWithDefaultCommitPathChangedTest.superclass || nil);
  943. (function($rec){smalltalk.send($rec, "_defaultCommitPathJs_", ["javascripts/"]);return smalltalk.send($rec, "_defaultCommitPathSt_", ["smalltalk/"]);})((smalltalk.Package || Package));
  944. return self;}
  945. }),
  946. smalltalk.PackageWithDefaultCommitPathChangedTest);
  947. smalltalk.addMethod(
  948. "_testGrulCommitPathJsShouldBeServerGrulJs",
  949. smalltalk.method({
  950. selector: "testGrulCommitPathJsShouldBeServerGrulJs",
  951. fn: function (){
  952. var self=this;
  953. smalltalk.send(self, "_assert_equals_", ["server/grul/js", smalltalk.send(self['@grulPackage'], "_commitPathJs", [])]);
  954. return self;}
  955. }),
  956. smalltalk.PackageWithDefaultCommitPathChangedTest);
  957. smalltalk.addMethod(
  958. "_testGrulCommitPathStShouldBeGrulSt",
  959. smalltalk.method({
  960. selector: "testGrulCommitPathStShouldBeGrulSt",
  961. fn: function (){
  962. var self=this;
  963. smalltalk.send(self, "_assert_equals_", ["grul/st", smalltalk.send(self['@grulPackage'], "_commitPathSt", [])]);
  964. return self;}
  965. }),
  966. smalltalk.PackageWithDefaultCommitPathChangedTest);
  967. smalltalk.addMethod(
  968. "_testZorkCommitPathJsShouldBeJavascript",
  969. smalltalk.method({
  970. selector: "testZorkCommitPathJsShouldBeJavascript",
  971. fn: function (){
  972. var self=this;
  973. smalltalk.send(self, "_assert_equals_", ["javascripts/", smalltalk.send(self['@zorkPackage'], "_commitPathJs", [])]);
  974. return self;}
  975. }),
  976. smalltalk.PackageWithDefaultCommitPathChangedTest);
  977. smalltalk.addMethod(
  978. "_testZorkCommitPathStShouldBeSmalltalk",
  979. smalltalk.method({
  980. selector: "testZorkCommitPathStShouldBeSmalltalk",
  981. fn: function (){
  982. var self=this;
  983. smalltalk.send(self, "_assert_equals_", ["smalltalk/", smalltalk.send(self['@zorkPackage'], "_commitPathSt", [])]);
  984. return self;}
  985. }),
  986. smalltalk.PackageWithDefaultCommitPathChangedTest);
  987. smalltalk.addMethod(
  988. "_shouldInheritSelectors",
  989. smalltalk.method({
  990. selector: "shouldInheritSelectors",
  991. fn: function (){
  992. var self=this;
  993. return false;
  994. return self;}
  995. }),
  996. smalltalk.PackageWithDefaultCommitPathChangedTest.klass);
  997. smalltalk.addClass('PointTest', smalltalk.TestCase, [], 'Kernel-Tests');
  998. smalltalk.addMethod(
  999. "_testAccessing",
  1000. smalltalk.method({
  1001. selector: "testAccessing",
  1002. fn: function (){
  1003. var self=this;
  1004. smalltalk.send(self, "_assert_equals_", [smalltalk.send(smalltalk.send((smalltalk.Point || Point), "_x_y_", [(3), (4)]), "_x", []), (3)]);
  1005. smalltalk.send(self, "_assert_equals_", [smalltalk.send(smalltalk.send((smalltalk.Point || Point), "_x_y_", [(3), (4)]), "_y", []), (4)]);
  1006. smalltalk.send(self, "_assert_equals_", [smalltalk.send(smalltalk.send(smalltalk.send((smalltalk.Point || Point), "_new", []), "_x_", [(3)]), "_x", []), (3)]);
  1007. smalltalk.send(self, "_assert_equals_", [smalltalk.send(smalltalk.send(smalltalk.send((smalltalk.Point || Point), "_new", []), "_y_", [(4)]), "_y", []), (4)]);
  1008. return self;}
  1009. }),
  1010. smalltalk.PointTest);
  1011. smalltalk.addMethod(
  1012. "_testArithmetic",
  1013. smalltalk.method({
  1014. selector: "testArithmetic",
  1015. fn: function (){
  1016. var self=this;
  1017. 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)])]);
  1018. 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)])]);
  1019. 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)])]);
  1020. 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)])]);
  1021. return self;}
  1022. }),
  1023. smalltalk.PointTest);
  1024. smalltalk.addMethod(
  1025. "_testAt",
  1026. smalltalk.method({
  1027. selector: "testAt",
  1028. fn: function (){
  1029. var self=this;
  1030. smalltalk.send(self, "_assert_equals_", [smalltalk.send((3), "__at", [(4)]), smalltalk.send((smalltalk.Point || Point), "_x_y_", [(3), (4)])]);
  1031. return self;}
  1032. }),
  1033. smalltalk.PointTest);
  1034. smalltalk.addMethod(
  1035. "_testEgality",
  1036. smalltalk.method({
  1037. selector: "testEgality",
  1038. fn: function (){
  1039. var self=this;
  1040. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((3), "__at", [(4)]), "__eq", [smalltalk.send((3), "__at", [(4)])])]);
  1041. smalltalk.send(self, "_deny_", [smalltalk.send(smalltalk.send((3), "__at", [(5)]), "__eq", [smalltalk.send((3), "__at", [(6)])])]);
  1042. return self;}
  1043. }),
  1044. smalltalk.PointTest);
  1045. smalltalk.addMethod(
  1046. "_testTranslateBy",
  1047. smalltalk.method({
  1048. selector: "testTranslateBy",
  1049. fn: function (){
  1050. var self=this;
  1051. smalltalk.send(self, "_assert_equals_", [smalltalk.send((3), "__at", [(4)]), smalltalk.send(smalltalk.send((3), "__at", [(3)]), "_translateBy_", [smalltalk.send((0), "__at", [(1)])])]);
  1052. 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", [])])])]);
  1053. smalltalk.send(self, "_assert_equals_", [smalltalk.send((5), "__at", [(6)]), smalltalk.send(smalltalk.send((3), "__at", [(3)]), "_translateBy_", [smalltalk.send((2), "__at", [(3)])])]);
  1054. 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)])])]);
  1055. return self;}
  1056. }),
  1057. smalltalk.PointTest);
  1058. smalltalk.addClass('RandomTest', smalltalk.TestCase, [], 'Kernel-Tests');
  1059. smalltalk.addMethod(
  1060. "_textNext",
  1061. smalltalk.method({
  1062. selector: "textNext",
  1063. fn: function (){
  1064. var self=this;
  1065. smalltalk.send((10000), "_timesRepeat_", [(function(){var current=nil;
  1066. var next=nil;
  1067. (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]);})]);
  1068. return self;}
  1069. }),
  1070. smalltalk.RandomTest);
  1071. smalltalk.addClass('SetTest', smalltalk.TestCase, [], 'Kernel-Tests');
  1072. smalltalk.addMethod(
  1073. "_testAddRemove",
  1074. smalltalk.method({
  1075. selector: "testAddRemove",
  1076. fn: function (){
  1077. var self=this;
  1078. var set=nil;
  1079. (set=smalltalk.send((smalltalk.Set || Set), "_new", []));
  1080. smalltalk.send(self, "_assert_", [smalltalk.send(set, "_isEmpty", [])]);
  1081. smalltalk.send(set, "_add_", [(3)]);
  1082. smalltalk.send(self, "_assert_", [smalltalk.send(set, "_includes_", [(3)])]);
  1083. smalltalk.send(set, "_add_", [(5)]);
  1084. smalltalk.send(self, "_assert_", [smalltalk.send(set, "_includes_", [(5)])]);
  1085. smalltalk.send(set, "_remove_", [(3)]);
  1086. smalltalk.send(self, "_deny_", [smalltalk.send(set, "_includes_", [(3)])]);
  1087. return self;}
  1088. }),
  1089. smalltalk.SetTest);
  1090. smalltalk.addMethod(
  1091. "_testAt",
  1092. smalltalk.method({
  1093. selector: "testAt",
  1094. fn: function (){
  1095. var self=this;
  1096. smalltalk.send(self, "_should_raise_", [(function(){return smalltalk.send(smalltalk.send((smalltalk.Set || Set), "_new", []), "_at_put_", [(1), (2)]);}), (smalltalk.Error || Error)]);
  1097. return self;}
  1098. }),
  1099. smalltalk.SetTest);
  1100. smalltalk.addMethod(
  1101. "_testSize",
  1102. smalltalk.method({
  1103. selector: "testSize",
  1104. fn: function (){
  1105. var self=this;
  1106. smalltalk.send(self, "_assert_equals_", [smalltalk.send(smalltalk.send((smalltalk.Set || Set), "_new", []), "_size", []), (0)]);
  1107. smalltalk.send(self, "_assert_equals_", [smalltalk.send(smalltalk.send((smalltalk.Set || Set), "_withAll_", [[(1), (2), (3), (4)]]), "_size", []), (4)]);
  1108. smalltalk.send(self, "_assert_equals_", [smalltalk.send(smalltalk.send((smalltalk.Set || Set), "_withAll_", [[(1), (1), (1), (1)]]), "_size", []), (1)]);
  1109. return self;}
  1110. }),
  1111. smalltalk.SetTest);
  1112. smalltalk.addMethod(
  1113. "_testUnicity",
  1114. smalltalk.method({
  1115. selector: "testUnicity",
  1116. fn: function (){
  1117. var self=this;
  1118. var set=nil;
  1119. (set=smalltalk.send((smalltalk.Set || Set), "_new", []));
  1120. smalltalk.send(set, "_add_", [(21)]);
  1121. smalltalk.send(set, "_add_", ["hello"]);
  1122. smalltalk.send(set, "_add_", [(21)]);
  1123. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(set, "_size", []), "__eq", [(2)])]);
  1124. smalltalk.send(set, "_add_", ["hello"]);
  1125. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(set, "_size", []), "__eq", [(2)])]);
  1126. smalltalk.send(self, "_assert_equals_", [smalltalk.send(set, "_asArray", []), [(21), "hello"]]);
  1127. return self;}
  1128. }),
  1129. smalltalk.SetTest);
  1130. smalltalk.addClass('StringTest', smalltalk.TestCase, [], 'Kernel-Tests');
  1131. smalltalk.addMethod(
  1132. "_testAddRemove",
  1133. smalltalk.method({
  1134. selector: "testAddRemove",
  1135. fn: function (){
  1136. var self=this;
  1137. smalltalk.send(self, "_should_raise_", [(function(){return smalltalk.send("hello", "_add_", ["a"]);}), (smalltalk.Error || Error)]);
  1138. smalltalk.send(self, "_should_raise_", [(function(){return smalltalk.send("hello", "_remove_", ["h"]);}), (smalltalk.Error || Error)]);
  1139. return self;}
  1140. }),
  1141. smalltalk.StringTest);
  1142. smalltalk.addMethod(
  1143. "_testAsArray",
  1144. smalltalk.method({
  1145. selector: "testAsArray",
  1146. fn: function (){
  1147. var self=this;
  1148. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send("hello", "_asArray", []), "__eq", [["h", "e", "l", "l", "o"]])]);
  1149. return self;}
  1150. }),
  1151. smalltalk.StringTest);
  1152. smalltalk.addMethod(
  1153. "_testAt",
  1154. smalltalk.method({
  1155. selector: "testAt",
  1156. fn: function (){
  1157. var self=this;
  1158. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send("hello", "_at_", [(1)]), "__eq", ["h"])]);
  1159. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send("hello", "_at_", [(5)]), "__eq", ["o"])]);
  1160. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send("hello", "_at_ifAbsent_", [(6), (function(){return nil;})]), "__eq", [nil])]);
  1161. return self;}
  1162. }),
  1163. smalltalk.StringTest);
  1164. smalltalk.addMethod(
  1165. "_testAtPut",
  1166. smalltalk.method({
  1167. selector: "testAtPut",
  1168. fn: function (){
  1169. var self=this;
  1170. smalltalk.send(self, "_should_raise_", [(function(){return smalltalk.send("hello", "_at_put_", [(1), "a"]);}), (smalltalk.Error || Error)]);
  1171. return self;}
  1172. }),
  1173. smalltalk.StringTest);
  1174. smalltalk.addMethod(
  1175. "_testCopyWithoutAll",
  1176. smalltalk.method({
  1177. selector: "testCopyWithoutAll",
  1178. fn: function (){
  1179. var self=this;
  1180. smalltalk.send(self, "_assert_equals_", ["hello world", smalltalk.send("*hello* *world*", "_copyWithoutAll_", ["*"])]);
  1181. return self;}
  1182. }),
  1183. smalltalk.StringTest);
  1184. smalltalk.addMethod(
  1185. "_testEquality",
  1186. smalltalk.method({
  1187. selector: "testEquality",
  1188. fn: function (){
  1189. var self=this;
  1190. smalltalk.send(self, "_assert_", [smalltalk.send("hello", "__eq", ["hello"])]);
  1191. smalltalk.send(self, "_deny_", [smalltalk.send("hello", "__eq", ["world"])]);
  1192. smalltalk.send(self, "_assert_", [smalltalk.send("hello", "__eq", [smalltalk.send("hello", "_yourself", [])])]);
  1193. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send("hello", "_yourself", []), "__eq", ["hello"])]);
  1194. smalltalk.send(self, "_deny_", [smalltalk.send("", "__eq", [(0)])]);
  1195. return self;}
  1196. }),
  1197. smalltalk.StringTest);
  1198. smalltalk.addMethod(
  1199. "_testIdentity",
  1200. smalltalk.method({
  1201. selector: "testIdentity",
  1202. fn: function (){
  1203. var self=this;
  1204. smalltalk.send(self, "_assert_", [smalltalk.send("hello", "__eq_eq", ["hello"])]);
  1205. smalltalk.send(self, "_deny_", [smalltalk.send("hello", "__eq_eq", ["world"])]);
  1206. smalltalk.send(self, "_assert_", [smalltalk.send("hello", "__eq_eq", [smalltalk.send("hello", "_yourself", [])])]);
  1207. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send("hello", "_yourself", []), "__eq_eq", ["hello"])]);
  1208. smalltalk.send(self, "_deny_", [smalltalk.send("", "__eq_eq", [(0)])]);
  1209. return self;}
  1210. }),
  1211. smalltalk.StringTest);
  1212. smalltalk.addMethod(
  1213. "_testIncludesSubString",
  1214. smalltalk.method({
  1215. selector: "testIncludesSubString",
  1216. fn: function (){
  1217. var self=this;
  1218. smalltalk.send(self, "_assert_", [smalltalk.send("amber", "_includesSubString_", ["ber"])]);
  1219. smalltalk.send(self, "_deny_", [smalltalk.send("amber", "_includesSubString_", ["zork"])]);
  1220. return self;}
  1221. }),
  1222. smalltalk.StringTest);
  1223. smalltalk.addMethod(
  1224. "_testJoin",
  1225. smalltalk.method({
  1226. selector: "testJoin",
  1227. fn: function (){
  1228. var self=this;
  1229. smalltalk.send(self, "_assert_equals_", ["hello,world", smalltalk.send(",", "_join_", [["hello", "world"]])]);
  1230. return self;}
  1231. }),
  1232. smalltalk.StringTest);
  1233. smalltalk.addMethod(
  1234. "_testSize",
  1235. smalltalk.method({
  1236. selector: "testSize",
  1237. fn: function (){
  1238. var self=this;
  1239. smalltalk.send(self, "_assert_equals_", [smalltalk.send("smalltalk", "_size", []), (9)]);
  1240. smalltalk.send(self, "_assert_equals_", [smalltalk.send("", "_size", []), (0)]);
  1241. return self;}
  1242. }),
  1243. smalltalk.StringTest);
  1244. smalltalk.addMethod(
  1245. "_testStreamContents",
  1246. smalltalk.method({
  1247. selector: "testStreamContents",
  1248. fn: function (){
  1249. var self=this;
  1250. 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);})])]);
  1251. return self;}
  1252. }),
  1253. smalltalk.StringTest);
  1254. smalltalk.addClass('SymbolTest', smalltalk.TestCase, [], 'Kernel-Tests');
  1255. smalltalk.addMethod(
  1256. "_testAsString",
  1257. smalltalk.method({
  1258. selector: "testAsString",
  1259. fn: function (){
  1260. var self=this;
  1261. smalltalk.send(self, "_assert_equals_", [smalltalk.send(smalltalk.symbolFor("hello"), "_asString", []), "hello"]);
  1262. return self;}
  1263. }),
  1264. smalltalk.SymbolTest);
  1265. smalltalk.addMethod(
  1266. "_testAsSymbol",
  1267. smalltalk.method({
  1268. selector: "testAsSymbol",
  1269. fn: function (){
  1270. var self=this;
  1271. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.symbolFor("hello"), "__eq_eq", [smalltalk.send(smalltalk.symbolFor("hello"), "_asSymbol", [])])]);
  1272. return self;}
  1273. }),
  1274. smalltalk.SymbolTest);
  1275. smalltalk.addMethod(
  1276. "_testAt",
  1277. smalltalk.method({
  1278. selector: "testAt",
  1279. fn: function (){
  1280. var self=this;
  1281. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(smalltalk.symbolFor("hello"), "_at_", [(1)]), "__eq", ["h"])]);
  1282. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(smalltalk.symbolFor("hello"), "_at_", [(5)]), "__eq", ["o"])]);
  1283. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(smalltalk.symbolFor("hello"), "_at_ifAbsent_", [(6), (function(){return nil;})]), "__eq", [nil])]);
  1284. return self;}
  1285. }),
  1286. smalltalk.SymbolTest);
  1287. smalltalk.addMethod(
  1288. "_testAtPut",
  1289. smalltalk.method({
  1290. selector: "testAtPut",
  1291. fn: function (){
  1292. var self=this;
  1293. smalltalk.send(self, "_should_raise_", [(function(){return smalltalk.send("hello", "_at_put_", [(1), "a"]);}), (smalltalk.Error || Error)]);
  1294. return self;}
  1295. }),
  1296. smalltalk.SymbolTest);
  1297. smalltalk.addMethod(
  1298. "_testComparing",
  1299. smalltalk.method({
  1300. selector: "testComparing",
  1301. fn: function (){
  1302. var self=this;
  1303. smalltalk.send(self, "_assert_", [((($receiver = smalltalk.symbolFor("ab")).klass === smalltalk.Number) ? $receiver >smalltalk.symbolFor("aa") : smalltalk.send($receiver, "__gt", [smalltalk.symbolFor("aa")]))]);
  1304. smalltalk.send(self, "_deny_", [((($receiver = smalltalk.symbolFor("ab")).klass === smalltalk.Number) ? $receiver >smalltalk.symbolFor("ba") : smalltalk.send($receiver, "__gt", [smalltalk.symbolFor("ba")]))]);
  1305. smalltalk.send(self, "_assert_", [((($receiver = smalltalk.symbolFor("ab")).klass === smalltalk.Number) ? $receiver <smalltalk.symbolFor("ba") : smalltalk.send($receiver, "__lt", [smalltalk.symbolFor("ba")]))]);
  1306. smalltalk.send(self, "_deny_", [((($receiver = smalltalk.symbolFor("bb")).klass === smalltalk.Number) ? $receiver <smalltalk.symbolFor("ba") : smalltalk.send($receiver, "__lt", [smalltalk.symbolFor("ba")]))]);
  1307. smalltalk.send(self, "_assert_", [((($receiver = smalltalk.symbolFor("ab")).klass === smalltalk.Number) ? $receiver >=smalltalk.symbolFor("aa") : smalltalk.send($receiver, "__gt_eq", [smalltalk.symbolFor("aa")]))]);
  1308. smalltalk.send(self, "_deny_", [((($receiver = smalltalk.symbolFor("ab")).klass === smalltalk.Number) ? $receiver >=smalltalk.symbolFor("ba") : smalltalk.send($receiver, "__gt_eq", [smalltalk.symbolFor("ba")]))]);
  1309. smalltalk.send(self, "_assert_", [((($receiver = smalltalk.symbolFor("ab")).klass === smalltalk.Number) ? $receiver <=smalltalk.symbolFor("ba") : smalltalk.send($receiver, "__lt_eq", [smalltalk.symbolFor("ba")]))]);
  1310. smalltalk.send(self, "_deny_", [((($receiver = smalltalk.symbolFor("bb")).klass === smalltalk.Number) ? $receiver <=smalltalk.symbolFor("ba") : smalltalk.send($receiver, "__lt_eq", [smalltalk.symbolFor("ba")]))]);
  1311. return self;}
  1312. }),
  1313. smalltalk.SymbolTest);
  1314. smalltalk.addMethod(
  1315. "_testCopying",
  1316. smalltalk.method({
  1317. selector: "testCopying",
  1318. fn: function (){
  1319. var self=this;
  1320. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(smalltalk.symbolFor("hello"), "_copy", []), "__eq_eq", [smalltalk.symbolFor("hello")])]);
  1321. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(smalltalk.symbolFor("hello"), "_deepCopy", []), "__eq_eq", [smalltalk.symbolFor("hello")])]);
  1322. return self;}
  1323. }),
  1324. smalltalk.SymbolTest);
  1325. smalltalk.addMethod(
  1326. "_testEquality",
  1327. smalltalk.method({
  1328. selector: "testEquality",
  1329. fn: function (){
  1330. var self=this;
  1331. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.symbolFor("hello"), "__eq", [smalltalk.symbolFor("hello")])]);
  1332. smalltalk.send(self, "_deny_", [smalltalk.send(smalltalk.symbolFor("hello"), "__eq", [smalltalk.symbolFor("world")])]);
  1333. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.symbolFor("hello"), "__eq", [smalltalk.send(smalltalk.symbolFor("hello"), "_yourself", [])])]);
  1334. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(smalltalk.symbolFor("hello"), "_yourself", []), "__eq", [smalltalk.symbolFor("hello")])]);
  1335. smalltalk.send(self, "_deny_", [smalltalk.send(smalltalk.symbolFor("hello"), "__eq", ["hello"])]);
  1336. smalltalk.send(self, "_deny_", [smalltalk.send("hello", "__eq", [smalltalk.symbolFor("hello")])]);
  1337. return self;}
  1338. }),
  1339. smalltalk.SymbolTest);
  1340. smalltalk.addMethod(
  1341. "_testIdentity",
  1342. smalltalk.method({
  1343. selector: "testIdentity",
  1344. fn: function (){
  1345. var self=this;
  1346. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.symbolFor("hello"), "__eq_eq", [smalltalk.symbolFor("hello")])]);
  1347. smalltalk.send(self, "_deny_", [smalltalk.send(smalltalk.symbolFor("hello"), "__eq_eq", [smalltalk.symbolFor("world")])]);
  1348. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.symbolFor("hello"), "__eq", [smalltalk.send(smalltalk.symbolFor("hello"), "_yourself", [])])]);
  1349. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(smalltalk.symbolFor("hello"), "_yourself", []), "__eq", [smalltalk.send(smalltalk.send(smalltalk.symbolFor("hello"), "_asString", []), "_asSymbol", [])])]);
  1350. return self;}
  1351. }),
  1352. smalltalk.SymbolTest);
  1353. smalltalk.addMethod(
  1354. "_testIsSymbolIsString",
  1355. smalltalk.method({
  1356. selector: "testIsSymbolIsString",
  1357. fn: function (){
  1358. var self=this;
  1359. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.symbolFor("hello"), "_isSymbol", [])]);
  1360. smalltalk.send(self, "_deny_", [smalltalk.send("hello", "_isSymbol", [])]);
  1361. smalltalk.send(self, "_deny_", [smalltalk.send(smalltalk.symbolFor("hello"), "_isString", [])]);
  1362. smalltalk.send(self, "_assert_", [smalltalk.send("hello", "_isString", [])]);
  1363. return self;}
  1364. }),
  1365. smalltalk.SymbolTest);
  1366. smalltalk.addMethod(
  1367. "_testSize",
  1368. smalltalk.method({
  1369. selector: "testSize",
  1370. fn: function (){
  1371. var self=this;
  1372. smalltalk.send(self, "_assert_equals_", [smalltalk.send(smalltalk.symbolFor("a"), "_size", []), (1)]);
  1373. smalltalk.send(self, "_assert_equals_", [smalltalk.send(smalltalk.symbolFor("aaaaa"), "_size", []), (5)]);
  1374. return self;}
  1375. }),
  1376. smalltalk.SymbolTest);
  1377. smalltalk.addClass('UndefinedTest', smalltalk.TestCase, [], 'Kernel-Tests');
  1378. smalltalk.addMethod(
  1379. "_testCopying",
  1380. smalltalk.method({
  1381. selector: "testCopying",
  1382. fn: function (){
  1383. var self=this;
  1384. smalltalk.send(self, "_assert_equals_", [smalltalk.send(nil, "_copy", []), nil]);
  1385. return self;}
  1386. }),
  1387. smalltalk.UndefinedTest);
  1388. smalltalk.addMethod(
  1389. "_testDeepCopy",
  1390. smalltalk.method({
  1391. selector: "testDeepCopy",
  1392. fn: function (){
  1393. var self=this;
  1394. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(nil, "_deepCopy", []), "__eq", [nil])]);
  1395. return self;}
  1396. }),
  1397. smalltalk.UndefinedTest);
  1398. smalltalk.addMethod(
  1399. "_testIfNil",
  1400. smalltalk.method({
  1401. selector: "testIfNil",
  1402. fn: function (){
  1403. var self=this;
  1404. smalltalk.send(self, "_assert_equals_", [(($receiver = nil) == nil || $receiver == undefined) ? (function(){return true;})() : $receiver, true]);
  1405. smalltalk.send(self, "_deny_", [smalltalk.send((($receiver = nil) != nil && $receiver != undefined) ? (function(){return true;})() : nil, "__eq", [true])]);
  1406. smalltalk.send(self, "_assert_equals_", [(($receiver = nil) == nil || $receiver == undefined) ? (function(){return true;})() : (function(){return false;})(), true]);
  1407. smalltalk.send(self, "_deny_", [smalltalk.send((($receiver = nil) == nil || $receiver == undefined) ? (function(){return false;})() : (function(){return true;})(), "__eq", [true])]);
  1408. return self;}
  1409. }),
  1410. smalltalk.UndefinedTest);
  1411. smalltalk.addMethod(
  1412. "_testIsNil",
  1413. smalltalk.method({
  1414. selector: "testIsNil",
  1415. fn: function (){
  1416. var self=this;
  1417. smalltalk.send(self, "_assert_", [smalltalk.send(nil, "_isNil", [])]);
  1418. smalltalk.send(self, "_deny_", [smalltalk.send(nil, "_notNil", [])]);
  1419. return self;}
  1420. }),
  1421. smalltalk.UndefinedTest);