1
0

Kernel-Tests.deploy.js 79 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573
  1. smalltalk.addPackage('Kernel-Tests', {});
  2. smalltalk.addClass('BlockClosureTest', smalltalk.TestCase, [], 'Kernel-Tests');
  3. smalltalk.addMethod(
  4. "_testCompiledSource",
  5. smalltalk.method({
  6. selector: "testCompiledSource",
  7. fn: function (){
  8. var self=this;
  9. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send((function(){
  10. return smalltalk.send((1),"__plus",[(1)]);
  11. }),"_compiledSource",[]),"_includesSubString_",["function"])]);
  12. return self}
  13. }),
  14. smalltalk.BlockClosureTest);
  15. smalltalk.addMethod(
  16. "_testEnsure",
  17. smalltalk.method({
  18. selector: "testEnsure",
  19. fn: function (){
  20. var self=this;
  21. smalltalk.send(self,"_assert_equals_",[(3),smalltalk.send((function(){
  22. return (3);
  23. }),"_ensure_",[(function(){
  24. return (4);
  25. })])]);
  26. return self}
  27. }),
  28. smalltalk.BlockClosureTest);
  29. smalltalk.addMethod(
  30. "_testEnsureRaises",
  31. smalltalk.method({
  32. selector: "testEnsureRaises",
  33. fn: function (){
  34. var self=this;
  35. smalltalk.send(self,"_should_raise_",[(function(){
  36. return smalltalk.send((function(){
  37. return smalltalk.send(smalltalk.send((smalltalk.Error || Error),"_new",[]),"_signal",[]);
  38. }),"_ensure_",[(function(){
  39. return true;
  40. })]);
  41. }),(smalltalk.Error || Error)]);
  42. return self}
  43. }),
  44. smalltalk.BlockClosureTest);
  45. smalltalk.addMethod(
  46. "_testNumArgs",
  47. smalltalk.method({
  48. selector: "testNumArgs",
  49. fn: function (){
  50. var self=this;
  51. smalltalk.send(self,"_assert_equals_",[smalltalk.send((function(){
  52. }),"_numArgs",[]),(0)]);
  53. smalltalk.send(self,"_assert_equals_",[smalltalk.send((function(a,b){
  54. }),"_numArgs",[]),(2)]);
  55. return self}
  56. }),
  57. smalltalk.BlockClosureTest);
  58. smalltalk.addMethod(
  59. "_testOnDo",
  60. smalltalk.method({
  61. selector: "testOnDo",
  62. fn: function (){
  63. var self=this;
  64. smalltalk.send(self,"_assert_",[smalltalk.send((function(){
  65. return smalltalk.send(smalltalk.send((smalltalk.Error || Error),"_new",[]),"_signal",[]);
  66. }),"_on_do_",[(smalltalk.Error || Error),(function(ex){
  67. return true;
  68. })])]);
  69. return self}
  70. }),
  71. smalltalk.BlockClosureTest);
  72. smalltalk.addMethod(
  73. "_testValue",
  74. smalltalk.method({
  75. selector: "testValue",
  76. fn: function (){
  77. var self=this;
  78. smalltalk.send(self,"_assert_equals_",[smalltalk.send((function(){
  79. return smalltalk.send((1),"__plus",[(1)]);
  80. }),"_value",[]),(2)]);
  81. smalltalk.send(self,"_assert_equals_",[smalltalk.send((function(x){
  82. return smalltalk.send(x,"__plus",[(1)]);
  83. }),"_value_",[(2)]),(3)]);
  84. smalltalk.send(self,"_assert_equals_",[smalltalk.send((function(x,y){
  85. return smalltalk.send(x,"__star",[y]);
  86. }),"_value_value_",[(2),(4)]),(8)]);
  87. smalltalk.send(self,"_assert_equals_",[smalltalk.send((function(a,b,c){
  88. return (1);
  89. }),"_value",[]),(1)]);
  90. return self}
  91. }),
  92. smalltalk.BlockClosureTest);
  93. smalltalk.addMethod(
  94. "_testValueWithPossibleArguments",
  95. smalltalk.method({
  96. selector: "testValueWithPossibleArguments",
  97. fn: function (){
  98. var self=this;
  99. smalltalk.send(self,"_assert_equals_",[smalltalk.send((function(){
  100. return (1);
  101. }),"_valueWithPossibleArguments_",[[(3), (4)]]),(1)]);
  102. smalltalk.send(self,"_assert_equals_",[smalltalk.send((function(a){
  103. return smalltalk.send(a,"__plus",[(4)]);
  104. }),"_valueWithPossibleArguments_",[[(3), (4)]]),(7)]);
  105. smalltalk.send(self,"_assert_equals_",[smalltalk.send((function(a,b){
  106. return smalltalk.send(a,"__plus",[b]);
  107. }),"_valueWithPossibleArguments_",[[(3), (4), (5)]]),(7)]);
  108. return self}
  109. }),
  110. smalltalk.BlockClosureTest);
  111. smalltalk.addMethod(
  112. "_testWhileFalse",
  113. smalltalk.method({
  114. selector: "testWhileFalse",
  115. fn: function (){
  116. var self=this;
  117. var i;
  118. i=(0);
  119. smalltalk.send((function(){
  120. return smalltalk.send(i,"__gt",[(5)]);
  121. }),"_whileFalse_",[(function(){
  122. i=smalltalk.send(i,"__plus",[(1)]);
  123. return i;
  124. })]);
  125. smalltalk.send(self,"_assert_equals_",[i,(6)]);
  126. i=(0);
  127. smalltalk.send((function(){
  128. i=smalltalk.send(i,"__plus",[(1)]);
  129. i;
  130. return smalltalk.send(i,"__gt",[(5)]);
  131. }),"_whileFalse",[]);
  132. smalltalk.send(self,"_assert_equals_",[i,(6)]);
  133. return self}
  134. }),
  135. smalltalk.BlockClosureTest);
  136. smalltalk.addMethod(
  137. "_testWhileTrue",
  138. smalltalk.method({
  139. selector: "testWhileTrue",
  140. fn: function (){
  141. var self=this;
  142. var i;
  143. i=(0);
  144. smalltalk.send((function(){
  145. return smalltalk.send(i,"__lt",[(5)]);
  146. }),"_whileTrue_",[(function(){
  147. i=smalltalk.send(i,"__plus",[(1)]);
  148. return i;
  149. })]);
  150. smalltalk.send(self,"_assert_equals_",[i,(5)]);
  151. i=(0);
  152. smalltalk.send((function(){
  153. i=smalltalk.send(i,"__plus",[(1)]);
  154. i;
  155. return smalltalk.send(i,"__lt",[(5)]);
  156. }),"_whileTrue",[]);
  157. smalltalk.send(self,"_assert_equals_",[i,(5)]);
  158. return self}
  159. }),
  160. smalltalk.BlockClosureTest);
  161. smalltalk.addClass('BooleanTest', smalltalk.TestCase, [], 'Kernel-Tests');
  162. smalltalk.addMethod(
  163. "_testEquality",
  164. smalltalk.method({
  165. selector: "testEquality",
  166. fn: function (){
  167. var self=this;
  168. smalltalk.send(self,"_deny_",[smalltalk.send((0),"__eq",[false])]);
  169. smalltalk.send(self,"_deny_",[smalltalk.send(false,"__eq",[(0)])]);
  170. smalltalk.send(self,"_deny_",[smalltalk.send("","__eq",[false])]);
  171. smalltalk.send(self,"_deny_",[smalltalk.send(false,"__eq",[""])]);
  172. smalltalk.send(self,"_assert_",[smalltalk.send(true,"__eq",[true])]);
  173. smalltalk.send(self,"_deny_",[smalltalk.send(false,"__eq",[true])]);
  174. smalltalk.send(self,"_deny_",[smalltalk.send(true,"__eq",[false])]);
  175. smalltalk.send(self,"_assert_",[smalltalk.send(false,"__eq",[false])]);
  176. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send(true,"_yourself",[]),"__eq",[true])]);
  177. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send(true,"_yourself",[]),"__eq",[smalltalk.send(true,"_yourself",[])])]);
  178. return self}
  179. }),
  180. smalltalk.BooleanTest);
  181. smalltalk.addMethod(
  182. "_testIdentity",
  183. smalltalk.method({
  184. selector: "testIdentity",
  185. fn: function (){
  186. var self=this;
  187. smalltalk.send(self,"_deny_",[smalltalk.send((0),"__eq_eq",[false])]);
  188. smalltalk.send(self,"_deny_",[smalltalk.send(false,"__eq_eq",[(0)])]);
  189. smalltalk.send(self,"_deny_",[smalltalk.send("","__eq_eq",[false])]);
  190. smalltalk.send(self,"_deny_",[smalltalk.send(false,"__eq_eq",[""])]);
  191. smalltalk.send(self,"_assert_",[smalltalk.send(true,"__eq_eq",[true])]);
  192. smalltalk.send(self,"_deny_",[smalltalk.send(false,"__eq_eq",[true])]);
  193. smalltalk.send(self,"_deny_",[smalltalk.send(true,"__eq_eq",[false])]);
  194. smalltalk.send(self,"_assert_",[smalltalk.send(false,"__eq_eq",[false])]);
  195. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send(true,"_yourself",[]),"__eq_eq",[true])]);
  196. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send(true,"_yourself",[]),"__eq_eq",[smalltalk.send(true,"_yourself",[])])]);
  197. return self}
  198. }),
  199. smalltalk.BooleanTest);
  200. smalltalk.addMethod(
  201. "_testIfTrueIfFalse",
  202. smalltalk.method({
  203. selector: "testIfTrueIfFalse",
  204. fn: function (){
  205. var self=this;
  206. var $1,$2,$3,$4,$5,$6,$7,$8;
  207. if(smalltalk.assert(true)){
  208. $1="alternative block";
  209. };
  210. smalltalk.send(self,"_assert_",[smalltalk.send($1,"__eq",["alternative block"])]);
  211. if(! smalltalk.assert(true)){
  212. $2="alternative block";
  213. };
  214. smalltalk.send(self,"_assert_",[smalltalk.send($2,"__eq",[nil])]);
  215. if(smalltalk.assert(false)){
  216. $3="alternative block";
  217. };
  218. smalltalk.send(self,"_assert_",[smalltalk.send($3,"__eq",[nil])]);
  219. if(! smalltalk.assert(false)){
  220. $4="alternative block";
  221. };
  222. smalltalk.send(self,"_assert_",[smalltalk.send($4,"__eq",["alternative block"])]);
  223. if(smalltalk.assert(false)){
  224. $5="alternative block";
  225. } else {
  226. $5="alternative block2";
  227. };
  228. smalltalk.send(self,"_assert_",[smalltalk.send($5,"__eq",["alternative block2"])]);
  229. if(smalltalk.assert(false)){
  230. $6="alternative block2";
  231. } else {
  232. $6="alternative block";
  233. };
  234. smalltalk.send(self,"_assert_",[smalltalk.send($6,"__eq",["alternative block"])]);
  235. if(smalltalk.assert(true)){
  236. $7="alternative block";
  237. } else {
  238. $7="alternative block2";
  239. };
  240. smalltalk.send(self,"_assert_",[smalltalk.send($7,"__eq",["alternative block"])]);
  241. if(smalltalk.assert(true)){
  242. $8="alternative block2";
  243. } else {
  244. $8="alternative block";
  245. };
  246. smalltalk.send(self,"_assert_",[smalltalk.send($8,"__eq",["alternative block2"])]);
  247. return self}
  248. }),
  249. smalltalk.BooleanTest);
  250. smalltalk.addMethod(
  251. "_testLogic",
  252. smalltalk.method({
  253. selector: "testLogic",
  254. fn: function (){
  255. var self=this;
  256. var $1,$2,$3,$4;
  257. smalltalk.send(self,"_assert_",[smalltalk.send(true,"_&",[true])]);
  258. smalltalk.send(self,"_deny_",[smalltalk.send(true,"_&",[false])]);
  259. smalltalk.send(self,"_deny_",[smalltalk.send(false,"_&",[true])]);
  260. $1=smalltalk.send(self,"_deny_",[smalltalk.send(false,"_&",[false])]);
  261. smalltalk.send(self,"_assert_",[smalltalk.send(true,"_|",[true])]);
  262. smalltalk.send(self,"_assert_",[smalltalk.send(true,"_|",[false])]);
  263. smalltalk.send(self,"_assert_",[smalltalk.send(false,"_|",[true])]);
  264. $2=smalltalk.send(self,"_deny_",[smalltalk.send(false,"_|",[false])]);
  265. smalltalk.send(self,"_assert_",[smalltalk.send(true,"_&",[smalltalk.send((1),"__gt",[(0)])])]);
  266. smalltalk.send(self,"_deny_",[smalltalk.send(smalltalk.send((1),"__gt",[(0)]),"_&",[false])]);
  267. $3=smalltalk.send(self,"_deny_",[smalltalk.send(smalltalk.send((1),"__gt",[(0)]),"_&",[smalltalk.send((1),"__gt",[(2)])])]);
  268. smalltalk.send(self,"_assert_",[smalltalk.send(false,"_|",[smalltalk.send((1),"__gt",[(0)])])]);
  269. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send((1),"__gt",[(0)]),"_|",[false])]);
  270. $4=smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send((1),"__gt",[(0)]),"_|",[smalltalk.send((1),"__gt",[(2)])])]);
  271. return self}
  272. }),
  273. smalltalk.BooleanTest);
  274. smalltalk.addMethod(
  275. "_testLogicKeywords",
  276. smalltalk.method({
  277. selector: "testLogicKeywords",
  278. fn: function (){
  279. var self=this;
  280. var $1,$2,$3,$4;
  281. smalltalk.send(self,"_assert_",[smalltalk.send(true,"_and_",[(function(){
  282. return true;
  283. })])]);
  284. smalltalk.send(self,"_deny_",[smalltalk.send(true,"_and_",[(function(){
  285. return false;
  286. })])]);
  287. smalltalk.send(self,"_deny_",[smalltalk.send(false,"_and_",[(function(){
  288. return true;
  289. })])]);
  290. $1=smalltalk.send(self,"_deny_",[smalltalk.send(false,"_and_",[(function(){
  291. return false;
  292. })])]);
  293. smalltalk.send(self,"_assert_",[smalltalk.send(true,"_or_",[(function(){
  294. return true;
  295. })])]);
  296. smalltalk.send(self,"_assert_",[smalltalk.send(true,"_or_",[(function(){
  297. return false;
  298. })])]);
  299. smalltalk.send(self,"_assert_",[smalltalk.send(false,"_or_",[(function(){
  300. return true;
  301. })])]);
  302. $2=smalltalk.send(self,"_deny_",[smalltalk.send(false,"_or_",[(function(){
  303. return false;
  304. })])]);
  305. smalltalk.send(self,"_assert_",[smalltalk.send(true,"_and_",[(function(){
  306. return smalltalk.send((1),"__gt",[(0)]);
  307. })])]);
  308. smalltalk.send(self,"_deny_",[smalltalk.send(smalltalk.send((1),"__gt",[(0)]),"_and_",[(function(){
  309. return false;
  310. })])]);
  311. $3=smalltalk.send(self,"_deny_",[smalltalk.send(smalltalk.send((1),"__gt",[(0)]),"_and_",[(function(){
  312. return smalltalk.send((1),"__gt",[(2)]);
  313. })])]);
  314. smalltalk.send(self,"_assert_",[smalltalk.send(false,"_or_",[(function(){
  315. return smalltalk.send((1),"__gt",[(0)]);
  316. })])]);
  317. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send((1),"__gt",[(0)]),"_or_",[(function(){
  318. return false;
  319. })])]);
  320. $4=smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send((1),"__gt",[(0)]),"_or_",[(function(){
  321. return smalltalk.send((1),"__gt",[(2)]);
  322. })])]);
  323. return self}
  324. }),
  325. smalltalk.BooleanTest);
  326. smalltalk.addMethod(
  327. "_testNonBooleanError",
  328. smalltalk.method({
  329. selector: "testNonBooleanError",
  330. fn: function (){
  331. var self=this;
  332. var b;
  333. b= '' ;
  334. ;
  335. smalltalk.send(self,"_should_raise_",[(function(){
  336. if(smalltalk.assert(self["@nonBoolean"])){
  337. } else {
  338. };
  339. }),(smalltalk.NonBooleanReceiver || NonBooleanReceiver)]);
  340. return self}
  341. }),
  342. smalltalk.BooleanTest);
  343. smalltalk.addClass('ClassBuilderTest', smalltalk.TestCase, ['builder', 'theClass'], 'Kernel-Tests');
  344. smalltalk.addMethod(
  345. "_setUp",
  346. smalltalk.method({
  347. selector: "setUp",
  348. fn: function (){
  349. var self=this;
  350. self["@builder"]=smalltalk.send((smalltalk.ClassBuilder || ClassBuilder),"_new",[]);
  351. return self}
  352. }),
  353. smalltalk.ClassBuilderTest);
  354. smalltalk.addMethod(
  355. "_tearDown",
  356. smalltalk.method({
  357. selector: "tearDown",
  358. fn: function (){
  359. var self=this;
  360. if(($receiver = self["@theClass"]) == nil || $receiver == undefined){
  361. self["@theClass"];
  362. } else {
  363. smalltalk.send(smalltalk.send((smalltalk.Smalltalk || Smalltalk),"_current",[]),"_removeClass_",[self["@theClass"]]);
  364. self["@theClass"]=nil;
  365. self["@theClass"];
  366. };
  367. return self}
  368. }),
  369. smalltalk.ClassBuilderTest);
  370. smalltalk.addMethod(
  371. "_testClassCopy",
  372. smalltalk.method({
  373. selector: "testClassCopy",
  374. fn: function (){
  375. var self=this;
  376. self["@theClass"]=smalltalk.send(self["@builder"],"_copyClass_named_",[(smalltalk.ObjectMock || ObjectMock),"ObjectMock2"]);
  377. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send(self["@theClass"],"_superclass",[]),"__eq_eq",[smalltalk.send((smalltalk.ObjectMock || ObjectMock),"_superclass",[])])]);
  378. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send(self["@theClass"],"_instanceVariableNames",[]),"__eq_eq",[smalltalk.send((smalltalk.ObjectMock || ObjectMock),"_instanceVariableNames",[])])]);
  379. smalltalk.send(self,"_assert_equals_",[smalltalk.send(self["@theClass"],"_name",[]),"ObjectMock2"]);
  380. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send(self["@theClass"],"_package",[]),"__eq_eq",[smalltalk.send((smalltalk.ObjectMock || ObjectMock),"_package",[])])]);
  381. smalltalk.send(self,"_assert_equals_",[smalltalk.send(smalltalk.send(self["@theClass"],"_methodDictionary",[]),"_keys",[]),smalltalk.send(smalltalk.send((smalltalk.ObjectMock || ObjectMock),"_methodDictionary",[]),"_keys",[])]);
  382. return self}
  383. }),
  384. smalltalk.ClassBuilderTest);
  385. smalltalk.addMethod(
  386. "_testInstanceVariableNames",
  387. smalltalk.method({
  388. selector: "testInstanceVariableNames",
  389. fn: function (){
  390. var self=this;
  391. smalltalk.send(self,"_assert_equals_",[smalltalk.send(self["@builder"],"_instanceVariableNamesFor_",[" hello world "]),["hello", "world"]]);
  392. return self}
  393. }),
  394. smalltalk.ClassBuilderTest);
  395. smalltalk.addClass('CollectionTest', smalltalk.TestCase, [], 'Kernel-Tests');
  396. smalltalk.addMethod(
  397. "_assertSameContents_as_",
  398. smalltalk.method({
  399. selector: "assertSameContents:as:",
  400. fn: function (aCollection,anotherCollection){
  401. var self=this;
  402. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send(aCollection,"_size",[]),"__eq",[smalltalk.send(anotherCollection,"_size",[])])]);
  403. smalltalk.send(aCollection,"_do_",[(function(each){
  404. return smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send(aCollection,"_occurrencesOf_",[each]),"__eq",[smalltalk.send(anotherCollection,"_occurrencesOf_",[each])])]);
  405. })]);
  406. return self}
  407. }),
  408. smalltalk.CollectionTest);
  409. smalltalk.addMethod(
  410. "_collection",
  411. smalltalk.method({
  412. selector: "collection",
  413. fn: function (){
  414. var self=this;
  415. var $1;
  416. $1=smalltalk.send(smalltalk.send(self,"_collectionClass",[]),"_withAll_",[smalltalk.send(self,"_defaultValues",[])]);
  417. return $1;
  418. }
  419. }),
  420. smalltalk.CollectionTest);
  421. smalltalk.addMethod(
  422. "_collectionClass",
  423. smalltalk.method({
  424. selector: "collectionClass",
  425. fn: function (){
  426. var self=this;
  427. var $1;
  428. $1=smalltalk.send(smalltalk.send(self,"_class",[]),"_collectionClass",[]);
  429. return $1;
  430. }
  431. }),
  432. smalltalk.CollectionTest);
  433. smalltalk.addMethod(
  434. "_collectionWithDuplicates",
  435. smalltalk.method({
  436. selector: "collectionWithDuplicates",
  437. fn: function (){
  438. var self=this;
  439. var $1;
  440. $1=smalltalk.send(smalltalk.send(self,"_collectionClass",[]),"_withAll_",[["a", "b", "c", (1), (2), (1), "a"]]);
  441. return $1;
  442. }
  443. }),
  444. smalltalk.CollectionTest);
  445. smalltalk.addMethod(
  446. "_defaultValues",
  447. smalltalk.method({
  448. selector: "defaultValues",
  449. fn: function (){
  450. var self=this;
  451. return [(1), (2), (3), (-4)];
  452. }
  453. }),
  454. smalltalk.CollectionTest);
  455. smalltalk.addMethod(
  456. "_isCollectionReadOnly",
  457. smalltalk.method({
  458. selector: "isCollectionReadOnly",
  459. fn: function (){
  460. var self=this;
  461. return false;
  462. }
  463. }),
  464. smalltalk.CollectionTest);
  465. smalltalk.addMethod(
  466. "_testAsArray",
  467. smalltalk.method({
  468. selector: "testAsArray",
  469. fn: function (){
  470. var self=this;
  471. smalltalk.send(self,"_assertSameContents_as_",[smalltalk.send(self,"_collection",[]),smalltalk.send(smalltalk.send(self,"_collection",[]),"_asArray",[])]);
  472. return self}
  473. }),
  474. smalltalk.CollectionTest);
  475. smalltalk.addMethod(
  476. "_testAsOrderedCollection",
  477. smalltalk.method({
  478. selector: "testAsOrderedCollection",
  479. fn: function (){
  480. var self=this;
  481. smalltalk.send(self,"_assertSameContents_as_",[smalltalk.send(self,"_collection",[]),smalltalk.send(smalltalk.send(self,"_collection",[]),"_asOrderedCollection",[])]);
  482. return self}
  483. }),
  484. smalltalk.CollectionTest);
  485. smalltalk.addMethod(
  486. "_testAsSet",
  487. smalltalk.method({
  488. selector: "testAsSet",
  489. fn: function (){
  490. var self=this;
  491. var c;
  492. var set;
  493. c=smalltalk.send(self,"_collectionWithDuplicates",[]);
  494. set=smalltalk.send(c,"_asSet",[]);
  495. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send(set,"_size",[]),"__eq",[(5)])]);
  496. smalltalk.send(c,"_do_",[(function(each){
  497. return smalltalk.send(self,"_assert_",[smalltalk.send(set,"_includes_",[each])]);
  498. })]);
  499. return self}
  500. }),
  501. smalltalk.CollectionTest);
  502. smalltalk.addMethod(
  503. "_testCollect",
  504. smalltalk.method({
  505. selector: "testCollect",
  506. fn: function (){
  507. var self=this;
  508. var newCollection;
  509. newCollection=[(1), (2), (3), (4)];
  510. smalltalk.send(self,"_assertSameContents_as_",[smalltalk.send(smalltalk.send(self,"_collection",[]),"_collect_",[(function(each){
  511. return smalltalk.send(each,"_abs",[]);
  512. })]),newCollection]);
  513. return self}
  514. }),
  515. smalltalk.CollectionTest);
  516. smalltalk.addMethod(
  517. "_testDetect",
  518. smalltalk.method({
  519. selector: "testDetect",
  520. fn: function (){
  521. var self=this;
  522. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send(smalltalk.send(self,"_collection",[]),"_detect_",[(function(each){
  523. return smalltalk.send(each,"__lt",[(0)]);
  524. })]),"__eq",[(-4)])]);
  525. smalltalk.send(self,"_should_raise_",[(function(){
  526. return smalltalk.send(smalltalk.send(self,"_collection",[]),"_detect_",[(function(each){
  527. return smalltalk.send(each,"__eq",[(6)]);
  528. })]);
  529. }),(smalltalk.Error || Error)]);
  530. return self}
  531. }),
  532. smalltalk.CollectionTest);
  533. smalltalk.addMethod(
  534. "_testDo",
  535. smalltalk.method({
  536. selector: "testDo",
  537. fn: function (){
  538. var self=this;
  539. var newCollection;
  540. newCollection=smalltalk.send((smalltalk.OrderedCollection || OrderedCollection),"_new",[]);
  541. smalltalk.send(smalltalk.send(self,"_collection",[]),"_do_",[(function(each){
  542. return smalltalk.send(newCollection,"_add_",[each]);
  543. })]);
  544. smalltalk.send(self,"_assertSameContents_as_",[smalltalk.send(self,"_collection",[]),newCollection]);
  545. return self}
  546. }),
  547. smalltalk.CollectionTest);
  548. smalltalk.addMethod(
  549. "_testIsEmpty",
  550. smalltalk.method({
  551. selector: "testIsEmpty",
  552. fn: function (){
  553. var self=this;
  554. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send(smalltalk.send(self,"_collectionClass",[]),"_new",[]),"_isEmpty",[])]);
  555. smalltalk.send(self,"_deny_",[smalltalk.send(smalltalk.send(self,"_collection",[]),"_isEmpty",[])]);
  556. return self}
  557. }),
  558. smalltalk.CollectionTest);
  559. smalltalk.addMethod(
  560. "_testSelect",
  561. smalltalk.method({
  562. selector: "testSelect",
  563. fn: function (){
  564. var self=this;
  565. var newCollection;
  566. newCollection=[(2), (-4)];
  567. smalltalk.send(self,"_assertSameContents_as_",[smalltalk.send(smalltalk.send(self,"_collection",[]),"_select_",[(function(each){
  568. return smalltalk.send(each,"_even",[]);
  569. })]),newCollection]);
  570. return self}
  571. }),
  572. smalltalk.CollectionTest);
  573. smalltalk.addMethod(
  574. "_testSize",
  575. smalltalk.method({
  576. selector: "testSize",
  577. fn: function (){
  578. var self=this;
  579. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(self,"_collectionClass",[]),"_new",[]),"_size",[]),"__eq",[(0)])]);
  580. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send(smalltalk.send(self,"_collection",[]),"_size",[]),"__eq",[(4)])]);
  581. return self}
  582. }),
  583. smalltalk.CollectionTest);
  584. smalltalk.addMethod(
  585. "_collectionClass",
  586. smalltalk.method({
  587. selector: "collectionClass",
  588. fn: function (){
  589. var self=this;
  590. return nil;
  591. }
  592. }),
  593. smalltalk.CollectionTest.klass);
  594. smalltalk.addMethod(
  595. "_isAbstract",
  596. smalltalk.method({
  597. selector: "isAbstract",
  598. fn: function (){
  599. var self=this;
  600. var $1;
  601. $1=smalltalk.send(smalltalk.send(self,"_collectionClass",[]),"_isNil",[]);
  602. return $1;
  603. }
  604. }),
  605. smalltalk.CollectionTest.klass);
  606. smalltalk.addClass('HashedCollectionTest', smalltalk.CollectionTest, [], 'Kernel-Tests');
  607. smalltalk.addMethod(
  608. "_collection",
  609. smalltalk.method({
  610. selector: "collection",
  611. fn: function (){
  612. var self=this;
  613. var $1;
  614. $1=smalltalk.HashedCollection._fromPairs_([smalltalk.send("a","__minus_gt",[(1)]),smalltalk.send("b","__minus_gt",[(2)]),smalltalk.send("c","__minus_gt",[(3)]),smalltalk.send("d","__minus_gt",[(-4)])]);
  615. return $1;
  616. }
  617. }),
  618. smalltalk.HashedCollectionTest);
  619. smalltalk.addMethod(
  620. "_collectionWithDuplicates",
  621. smalltalk.method({
  622. selector: "collectionWithDuplicates",
  623. fn: function (){
  624. var self=this;
  625. var $1;
  626. $1=smalltalk.HashedCollection._fromPairs_([smalltalk.send("a","__minus_gt",[(1)]),smalltalk.send("b","__minus_gt",[(2)]),smalltalk.send("c","__minus_gt",[(3)]),smalltalk.send("d","__minus_gt",[(-4)]),smalltalk.send("e","__minus_gt",[(1)]),smalltalk.send("f","__minus_gt",[(2)]),smalltalk.send("g","__minus_gt",[(10)])]);
  627. return $1;
  628. }
  629. }),
  630. smalltalk.HashedCollectionTest);
  631. smalltalk.addMethod(
  632. "_collectionClass",
  633. smalltalk.method({
  634. selector: "collectionClass",
  635. fn: function (){
  636. var self=this;
  637. return (smalltalk.HashedCollection || HashedCollection);
  638. }
  639. }),
  640. smalltalk.HashedCollectionTest.klass);
  641. smalltalk.addClass('DictionaryTest', smalltalk.HashedCollectionTest, [], 'Kernel-Tests');
  642. smalltalk.addMethod(
  643. "_collection",
  644. smalltalk.method({
  645. selector: "collection",
  646. fn: function (){
  647. var self=this;
  648. var $2,$3,$1;
  649. $2=smalltalk.send((smalltalk.Dictionary || Dictionary),"_new",[]);
  650. smalltalk.send($2,"_at_put_",[(1),(1)]);
  651. smalltalk.send($2,"_at_put_",["a",(2)]);
  652. smalltalk.send($2,"_at_put_",[true,(3)]);
  653. smalltalk.send($2,"_at_put_",[(4),(-4)]);
  654. $3=smalltalk.send($2,"_yourself",[]);
  655. $1=$3;
  656. return $1;
  657. }
  658. }),
  659. smalltalk.DictionaryTest);
  660. smalltalk.addMethod(
  661. "_collectionWithDuplicates",
  662. smalltalk.method({
  663. selector: "collectionWithDuplicates",
  664. fn: function (){
  665. var self=this;
  666. var $2,$3,$1;
  667. $2=smalltalk.send((smalltalk.Dictionary || Dictionary),"_new",[]);
  668. smalltalk.send($2,"_at_put_",[(1),(1)]);
  669. smalltalk.send($2,"_at_put_",["a",(2)]);
  670. smalltalk.send($2,"_at_put_",[true,(3)]);
  671. smalltalk.send($2,"_at_put_",[(4),(-4)]);
  672. smalltalk.send($2,"_at_put_",["b",(1)]);
  673. smalltalk.send($2,"_at_put_",[(3),(3)]);
  674. smalltalk.send($2,"_at_put_",[false,(12)]);
  675. $3=smalltalk.send($2,"_yourself",[]);
  676. $1=$3;
  677. return $1;
  678. }
  679. }),
  680. smalltalk.DictionaryTest);
  681. smalltalk.addMethod(
  682. "_testAccessing",
  683. smalltalk.method({
  684. selector: "testAccessing",
  685. fn: function (){
  686. var self=this;
  687. var d;
  688. d=smalltalk.send((smalltalk.Dictionary || Dictionary),"_new",[]);
  689. smalltalk.send(d,"_at_put_",["hello","world"]);
  690. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send(d,"_at_",["hello"]),"__eq",["world"])]);
  691. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send(d,"_at_ifAbsent_",["hello",(function(){
  692. return nil;
  693. })]),"__eq",["world"])]);
  694. smalltalk.send(self,"_deny_",[smalltalk.send(smalltalk.send(d,"_at_ifAbsent_",["foo",(function(){
  695. return nil;
  696. })]),"__eq",["world"])]);
  697. smalltalk.send(d,"_at_put_",[(1),(2)]);
  698. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send(d,"_at_",[(1)]),"__eq",[(2)])]);
  699. smalltalk.send(d,"_at_put_",[smalltalk.send((1),"__at",[(3)]),(3)]);
  700. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send(d,"_at_",[smalltalk.send((1),"__at",[(3)])]),"__eq",[(3)])]);
  701. return self}
  702. }),
  703. smalltalk.DictionaryTest);
  704. smalltalk.addMethod(
  705. "_testDynamicDictionaries",
  706. smalltalk.method({
  707. selector: "testDynamicDictionaries",
  708. fn: function (){
  709. var self=this;
  710. 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)])])])]);
  711. return self}
  712. }),
  713. smalltalk.DictionaryTest);
  714. smalltalk.addMethod(
  715. "_testEquality",
  716. smalltalk.method({
  717. selector: "testEquality",
  718. fn: function (){
  719. var self=this;
  720. var $1,$2,$3,$4,$5,$6,$7,$8,$9,$10;
  721. var d1;
  722. var d2;
  723. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send((smalltalk.Dictionary || Dictionary),"_new",[]),"__eq",[smalltalk.send((smalltalk.Dictionary || Dictionary),"_new",[])])]);
  724. $1=smalltalk.send((smalltalk.Dictionary || Dictionary),"_new",[]);
  725. smalltalk.send($1,"_at_put_",[(1),(2)]);
  726. $2=smalltalk.send($1,"_yourself",[]);
  727. d1=$2;
  728. $3=smalltalk.send((smalltalk.Dictionary || Dictionary),"_new",[]);
  729. smalltalk.send($3,"_at_put_",[(1),(2)]);
  730. $4=smalltalk.send($3,"_yourself",[]);
  731. d2=$4;
  732. smalltalk.send(self,"_assert_",[smalltalk.send(d1,"__eq",[d2])]);
  733. $5=smalltalk.send((smalltalk.Dictionary || Dictionary),"_new",[]);
  734. smalltalk.send($5,"_at_put_",[(1),(3)]);
  735. $6=smalltalk.send($5,"_yourself",[]);
  736. d2=$6;
  737. smalltalk.send(self,"_deny_",[smalltalk.send(d1,"__eq",[d2])]);
  738. $7=smalltalk.send((smalltalk.Dictionary || Dictionary),"_new",[]);
  739. smalltalk.send($7,"_at_put_",[(2),(2)]);
  740. $8=smalltalk.send($7,"_yourself",[]);
  741. d2=$8;
  742. smalltalk.send(self,"_deny_",[smalltalk.send(d1,"__eq",[d2])]);
  743. $9=smalltalk.send((smalltalk.Dictionary || Dictionary),"_new",[]);
  744. smalltalk.send($9,"_at_put_",[(1),(2)]);
  745. smalltalk.send($9,"_at_put_",[(3),(4)]);
  746. $10=smalltalk.send($9,"_yourself",[]);
  747. d2=$10;
  748. smalltalk.send(self,"_deny_",[smalltalk.send(d1,"__eq",[d2])]);
  749. return self}
  750. }),
  751. smalltalk.DictionaryTest);
  752. smalltalk.addMethod(
  753. "_testIfAbsent",
  754. smalltalk.method({
  755. selector: "testIfAbsent",
  756. fn: function (){
  757. var self=this;
  758. var d;
  759. var visited;
  760. visited=false;
  761. d=smalltalk.send((smalltalk.Dictionary || Dictionary),"_new",[]);
  762. smalltalk.send(d,"_at_ifAbsent_",["hello",(function(){
  763. visited=true;
  764. return visited;
  765. })]);
  766. smalltalk.send(self,"_assert_",[visited]);
  767. return self}
  768. }),
  769. smalltalk.DictionaryTest);
  770. smalltalk.addMethod(
  771. "_testIfPresent",
  772. smalltalk.method({
  773. selector: "testIfPresent",
  774. fn: function (){
  775. var self=this;
  776. var d;
  777. var visited;
  778. var absent;
  779. visited=false;
  780. d=smalltalk.send((smalltalk.Dictionary || Dictionary),"_new",[]);
  781. smalltalk.send(d,"_at_put_",["hello","world"]);
  782. smalltalk.send(d,"_at_ifPresent_",["hello",(function(value){
  783. visited=value;
  784. return visited;
  785. })]);
  786. smalltalk.send(self,"_assert_",[smalltalk.send(visited,"__eq",["world"])]);
  787. absent=smalltalk.send(d,"_at_ifPresent_",["bye",(function(value){
  788. visited=value;
  789. return visited;
  790. })]);
  791. smalltalk.send(self,"_assert_",[smalltalk.send(absent,"_isNil",[])]);
  792. return self}
  793. }),
  794. smalltalk.DictionaryTest);
  795. smalltalk.addMethod(
  796. "_testIfPresentIfAbsent",
  797. smalltalk.method({
  798. selector: "testIfPresentIfAbsent",
  799. fn: function (){
  800. var self=this;
  801. var d;
  802. var visited;
  803. visited=false;
  804. d=smalltalk.send((smalltalk.Dictionary || Dictionary),"_new",[]);
  805. smalltalk.send(d,"_at_put_",["hello","world"]);
  806. smalltalk.send(d,"_at_ifPresent_ifAbsent_",["hello",(function(value){
  807. visited=value;
  808. return visited;
  809. }),(function(){
  810. visited=true;
  811. return visited;
  812. })]);
  813. smalltalk.send(self,"_assert_",[smalltalk.send(visited,"__eq",["world"])]);
  814. smalltalk.send(d,"_at_ifPresent_ifAbsent_",["buy",(function(value){
  815. visited=value;
  816. return visited;
  817. }),(function(){
  818. visited=true;
  819. return visited;
  820. })]);
  821. smalltalk.send(self,"_assert_",[visited]);
  822. return self}
  823. }),
  824. smalltalk.DictionaryTest);
  825. smalltalk.addMethod(
  826. "_testKeys",
  827. smalltalk.method({
  828. selector: "testKeys",
  829. fn: function (){
  830. var self=this;
  831. var d;
  832. d=smalltalk.send((smalltalk.Dictionary || Dictionary),"_new",[]);
  833. smalltalk.send(d,"_at_put_",[(1),(2)]);
  834. smalltalk.send(d,"_at_put_",[(2),(3)]);
  835. smalltalk.send(d,"_at_put_",[(3),(4)]);
  836. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send(d,"_keys",[]),"__eq",[[(1), (2), (3)]])]);
  837. return self}
  838. }),
  839. smalltalk.DictionaryTest);
  840. smalltalk.addMethod(
  841. "_testPrintString",
  842. smalltalk.method({
  843. selector: "testPrintString",
  844. fn: function (){
  845. var self=this;
  846. var $1,$2;
  847. $1=smalltalk.send((smalltalk.Dictionary || Dictionary),"_new",[]);
  848. smalltalk.send($1,"_at_put_",["firstname","James"]);
  849. smalltalk.send($1,"_at_put_",["lastname","Bond"]);
  850. $2=smalltalk.send($1,"_printString",[]);
  851. smalltalk.send(self,"_assert_equals_",["a Dictionary('firstname'->'James' , 'lastname'->'Bond')",$2]);
  852. return self}
  853. }),
  854. smalltalk.DictionaryTest);
  855. smalltalk.addMethod(
  856. "_testRemoveKey",
  857. smalltalk.method({
  858. selector: "testRemoveKey",
  859. fn: function (){
  860. var self=this;
  861. var d;
  862. var key;
  863. d=smalltalk.send((smalltalk.Dictionary || Dictionary),"_new",[]);
  864. smalltalk.send(d,"_at_put_",[(1),(2)]);
  865. smalltalk.send(d,"_at_put_",[(2),(3)]);
  866. smalltalk.send(d,"_at_put_",[(3),(4)]);
  867. key=(2);
  868. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send(d,"_keys",[]),"__eq",[[(1), (2), (3)]])]);
  869. smalltalk.send(d,"_removeKey_",[key]);
  870. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send(d,"_keys",[]),"__eq",[[(1), (3)]])]);
  871. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send(d,"_values",[]),"__eq",[[(2), (4)]])]);
  872. smalltalk.send(self,"_deny_",[smalltalk.send(d,"_includesKey_",[(2)])]);
  873. return self}
  874. }),
  875. smalltalk.DictionaryTest);
  876. smalltalk.addMethod(
  877. "_testRemoveKeyIfAbsent",
  878. smalltalk.method({
  879. selector: "testRemoveKeyIfAbsent",
  880. fn: function (){
  881. var self=this;
  882. var d;
  883. var key;
  884. d=smalltalk.send((smalltalk.Dictionary || Dictionary),"_new",[]);
  885. smalltalk.send(d,"_at_put_",[(1),(2)]);
  886. smalltalk.send(d,"_at_put_",[(2),(3)]);
  887. smalltalk.send(d,"_at_put_",[(3),(4)]);
  888. key=(2);
  889. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send(d,"_removeKey_",[key]),"__eq",[(3)])]);
  890. key=(3);
  891. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send(d,"_removeKey_ifAbsent_",[key,(function(){
  892. return (42);
  893. })]),"__eq",[(4)])]);
  894. key="why";
  895. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send(d,"_removeKey_ifAbsent_",[key,(function(){
  896. return (42);
  897. })]),"__eq",[(42)])]);
  898. return self}
  899. }),
  900. smalltalk.DictionaryTest);
  901. smalltalk.addMethod(
  902. "_testSize",
  903. smalltalk.method({
  904. selector: "testSize",
  905. fn: function (){
  906. var self=this;
  907. var d;
  908. d=smalltalk.send((smalltalk.Dictionary || Dictionary),"_new",[]);
  909. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send(d,"_size",[]),"__eq",[(0)])]);
  910. smalltalk.send(d,"_at_put_",[(1),(2)]);
  911. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send(d,"_size",[]),"__eq",[(1)])]);
  912. smalltalk.send(d,"_at_put_",[(2),(3)]);
  913. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send(d,"_size",[]),"__eq",[(2)])]);
  914. return self}
  915. }),
  916. smalltalk.DictionaryTest);
  917. smalltalk.addMethod(
  918. "_testValues",
  919. smalltalk.method({
  920. selector: "testValues",
  921. fn: function (){
  922. var self=this;
  923. var d;
  924. d=smalltalk.send((smalltalk.Dictionary || Dictionary),"_new",[]);
  925. smalltalk.send(d,"_at_put_",[(1),(2)]);
  926. smalltalk.send(d,"_at_put_",[(2),(3)]);
  927. smalltalk.send(d,"_at_put_",[(3),(4)]);
  928. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send(d,"_values",[]),"__eq",[[(2), (3), (4)]])]);
  929. return self}
  930. }),
  931. smalltalk.DictionaryTest);
  932. smalltalk.addMethod(
  933. "_collectionClass",
  934. smalltalk.method({
  935. selector: "collectionClass",
  936. fn: function (){
  937. var self=this;
  938. return (smalltalk.Dictionary || Dictionary);
  939. }
  940. }),
  941. smalltalk.DictionaryTest.klass);
  942. smalltalk.addClass('SequenceableCollectionTest', smalltalk.CollectionTest, [], 'Kernel-Tests');
  943. smalltalk.addMethod(
  944. "_testAt",
  945. smalltalk.method({
  946. selector: "testAt",
  947. fn: function (){
  948. var self=this;
  949. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send(smalltalk.send(self,"_collection",[]),"_at_",[(4)]),"__eq",[(-4)])]);
  950. smalltalk.send(self,"_should_raise_",[(function(){
  951. return smalltalk.send(smalltalk.send(self,"_collection",[]),"_at_",[(5)]);
  952. }),(smalltalk.Error || Error)]);
  953. return self}
  954. }),
  955. smalltalk.SequenceableCollectionTest);
  956. smalltalk.addMethod(
  957. "_testAtIfAbsent",
  958. smalltalk.method({
  959. selector: "testAtIfAbsent",
  960. fn: function (){
  961. var self=this;
  962. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send(smalltalk.send(self,"_collection",[]),"_at_ifAbsent_",[smalltalk.send(smalltalk.send(smalltalk.send(self,"_collection",[]),"_size",[]),"__plus",[(1)]),(function(){
  963. return "none";
  964. })]),"__eq",["none"])]);
  965. return self}
  966. }),
  967. smalltalk.SequenceableCollectionTest);
  968. smalltalk.addClass('ArrayTest', smalltalk.SequenceableCollectionTest, [], 'Kernel-Tests');
  969. smalltalk.addMethod(
  970. "_testAtIfAbsent",
  971. smalltalk.method({
  972. selector: "testAtIfAbsent",
  973. fn: function (){
  974. var self=this;
  975. var array;
  976. array=["hello", "world"];
  977. smalltalk.send(self,"_assert_equals_",[smalltalk.send(array,"_at_",[(1)]),"hello"]);
  978. smalltalk.send(self,"_assert_equals_",[smalltalk.send(array,"_at_",[(2)]),"world"]);
  979. smalltalk.send(self,"_assert_equals_",[smalltalk.send(array,"_at_ifAbsent_",[(2),(function(){
  980. return "not found";
  981. })]),"world"]);
  982. smalltalk.send(self,"_assert_equals_",[smalltalk.send(array,"_at_ifAbsent_",[(0),(function(){
  983. return "not found";
  984. })]),"not found"]);
  985. smalltalk.send(self,"_assert_equals_",[smalltalk.send(array,"_at_ifAbsent_",[(-10),(function(){
  986. return "not found";
  987. })]),"not found"]);
  988. smalltalk.send(self,"_assert_equals_",[smalltalk.send(array,"_at_ifAbsent_",[(3),(function(){
  989. return "not found";
  990. })]),"not found"]);
  991. return self}
  992. }),
  993. smalltalk.ArrayTest);
  994. smalltalk.addMethod(
  995. "_testFirstN",
  996. smalltalk.method({
  997. selector: "testFirstN",
  998. fn: function (){
  999. var self=this;
  1000. smalltalk.send(self,"_assert_equals_",[[(1),(2),(3)],smalltalk.send([(1),(2),(3),(4),(5)],"_first_",[(3)])]);
  1001. return self}
  1002. }),
  1003. smalltalk.ArrayTest);
  1004. smalltalk.addMethod(
  1005. "_testIfEmpty",
  1006. smalltalk.method({
  1007. selector: "testIfEmpty",
  1008. fn: function (){
  1009. var self=this;
  1010. smalltalk.send(self,"_assert_equals_",["zork",smalltalk.send("","_ifEmpty_",[(function(){
  1011. return "zork";
  1012. })])]);
  1013. return self}
  1014. }),
  1015. smalltalk.ArrayTest);
  1016. smalltalk.addMethod(
  1017. "_testPrintString",
  1018. smalltalk.method({
  1019. selector: "testPrintString",
  1020. fn: function (){
  1021. var self=this;
  1022. var $1,$2;
  1023. var array;
  1024. array=smalltalk.send((smalltalk.Array || Array),"_new",[]);
  1025. smalltalk.send(self,"_assert_equals_",["a Array ()",smalltalk.send(array,"_printString",[])]);
  1026. smalltalk.send(array,"_add_",[(1)]);
  1027. $1=smalltalk.send(array,"_add_",[(3)]);
  1028. smalltalk.send(self,"_assert_equals_",["a Array (1 3)",smalltalk.send(array,"_printString",[])]);
  1029. smalltalk.send(array,"_add_",["foo"]);
  1030. smalltalk.send(self,"_assert_equals_",["a Array (1 3 'foo')",smalltalk.send(array,"_printString",[])]);
  1031. smalltalk.send(array,"_remove_",[(1)]);
  1032. $2=smalltalk.send(array,"_remove_",[(3)]);
  1033. smalltalk.send(self,"_assert_equals_",["a Array ('foo')",smalltalk.send(array,"_printString",[])]);
  1034. smalltalk.send(array,"_addLast_",[(3)]);
  1035. smalltalk.send(self,"_assert_equals_",["a Array ('foo' 3)",smalltalk.send(array,"_printString",[])]);
  1036. smalltalk.send(array,"_addLast_",[(3)]);
  1037. smalltalk.send(self,"_assert_equals_",["a Array ('foo' 3 3)",smalltalk.send(array,"_printString",[])]);
  1038. return self}
  1039. }),
  1040. smalltalk.ArrayTest);
  1041. smalltalk.addMethod(
  1042. "_collectionClass",
  1043. smalltalk.method({
  1044. selector: "collectionClass",
  1045. fn: function (){
  1046. var self=this;
  1047. return (smalltalk.Array || Array);
  1048. }
  1049. }),
  1050. smalltalk.ArrayTest.klass);
  1051. smalltalk.addClass('StringTest', smalltalk.SequenceableCollectionTest, [], 'Kernel-Tests');
  1052. smalltalk.addMethod(
  1053. "_collection",
  1054. smalltalk.method({
  1055. selector: "collection",
  1056. fn: function (){
  1057. var self=this;
  1058. return "hello";
  1059. }
  1060. }),
  1061. smalltalk.StringTest);
  1062. smalltalk.addMethod(
  1063. "_collectionWithDuplicates",
  1064. smalltalk.method({
  1065. selector: "collectionWithDuplicates",
  1066. fn: function (){
  1067. var self=this;
  1068. return "abbaerte";
  1069. }
  1070. }),
  1071. smalltalk.StringTest);
  1072. smalltalk.addMethod(
  1073. "_testAddRemove",
  1074. smalltalk.method({
  1075. selector: "testAddRemove",
  1076. fn: function (){
  1077. var self=this;
  1078. smalltalk.send(self,"_should_raise_",[(function(){
  1079. return smalltalk.send("hello","_add_",["a"]);
  1080. }),(smalltalk.Error || Error)]);
  1081. smalltalk.send(self,"_should_raise_",[(function(){
  1082. return smalltalk.send("hello","_remove_",["h"]);
  1083. }),(smalltalk.Error || Error)]);
  1084. return self}
  1085. }),
  1086. smalltalk.StringTest);
  1087. smalltalk.addMethod(
  1088. "_testAsArray",
  1089. smalltalk.method({
  1090. selector: "testAsArray",
  1091. fn: function (){
  1092. var self=this;
  1093. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send("hello","_asArray",[]),"__eq",[["h", "e", "l", "l", "o"]])]);
  1094. return self}
  1095. }),
  1096. smalltalk.StringTest);
  1097. smalltalk.addMethod(
  1098. "_testAt",
  1099. smalltalk.method({
  1100. selector: "testAt",
  1101. fn: function (){
  1102. var self=this;
  1103. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send("hello","_at_",[(1)]),"__eq",["h"])]);
  1104. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send("hello","_at_",[(5)]),"__eq",["o"])]);
  1105. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send("hello","_at_ifAbsent_",[(6),(function(){
  1106. return nil;
  1107. })]),"__eq",[nil])]);
  1108. return self}
  1109. }),
  1110. smalltalk.StringTest);
  1111. smalltalk.addMethod(
  1112. "_testAtPut",
  1113. smalltalk.method({
  1114. selector: "testAtPut",
  1115. fn: function (){
  1116. var self=this;
  1117. smalltalk.send(self,"_should_raise_",[(function(){
  1118. return smalltalk.send("hello","_at_put_",[(1),"a"]);
  1119. }),(smalltalk.Error || Error)]);
  1120. return self}
  1121. }),
  1122. smalltalk.StringTest);
  1123. smalltalk.addMethod(
  1124. "_testCollect",
  1125. smalltalk.method({
  1126. selector: "testCollect",
  1127. fn: function (){
  1128. var self=this;
  1129. var newCollection;
  1130. newCollection="hheelllloo";
  1131. smalltalk.send(self,"_assertSameContents_as_",[smalltalk.send(smalltalk.send(self,"_collection",[]),"_collect_",[(function(each){
  1132. return smalltalk.send(each,"__comma",[each]);
  1133. })]),newCollection]);
  1134. return self}
  1135. }),
  1136. smalltalk.StringTest);
  1137. smalltalk.addMethod(
  1138. "_testCopyWithoutAll",
  1139. smalltalk.method({
  1140. selector: "testCopyWithoutAll",
  1141. fn: function (){
  1142. var self=this;
  1143. smalltalk.send(self,"_assert_equals_",["hello world",smalltalk.send("*hello* *world*","_copyWithoutAll_",["*"])]);
  1144. return self}
  1145. }),
  1146. smalltalk.StringTest);
  1147. smalltalk.addMethod(
  1148. "_testDetect",
  1149. smalltalk.method({
  1150. selector: "testDetect",
  1151. fn: function (){
  1152. var self=this;
  1153. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send(smalltalk.send(self,"_collection",[]),"_detect_",[(function(each){
  1154. return smalltalk.send(each,"__eq",["h"]);
  1155. })]),"__eq",["h"])]);
  1156. smalltalk.send(self,"_should_raise_",[(function(){
  1157. return smalltalk.send(smalltalk.send(self,"_collection",[]),"_detect_",[(function(each){
  1158. return smalltalk.send(each,"__eq",[(6)]);
  1159. })]);
  1160. }),(smalltalk.Error || Error)]);
  1161. return self}
  1162. }),
  1163. smalltalk.StringTest);
  1164. smalltalk.addMethod(
  1165. "_testEquality",
  1166. smalltalk.method({
  1167. selector: "testEquality",
  1168. fn: function (){
  1169. var self=this;
  1170. smalltalk.send(self,"_assert_",[smalltalk.send("hello","__eq",["hello"])]);
  1171. smalltalk.send(self,"_deny_",[smalltalk.send("hello","__eq",["world"])]);
  1172. smalltalk.send(self,"_assert_",[smalltalk.send("hello","__eq",[smalltalk.send("hello","_yourself",[])])]);
  1173. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send("hello","_yourself",[]),"__eq",["hello"])]);
  1174. smalltalk.send(self,"_deny_",[smalltalk.send("","__eq",[(0)])]);
  1175. return self}
  1176. }),
  1177. smalltalk.StringTest);
  1178. smalltalk.addMethod(
  1179. "_testIdentity",
  1180. smalltalk.method({
  1181. selector: "testIdentity",
  1182. fn: function (){
  1183. var self=this;
  1184. smalltalk.send(self,"_assert_",[smalltalk.send("hello","__eq_eq",["hello"])]);
  1185. smalltalk.send(self,"_deny_",[smalltalk.send("hello","__eq_eq",["world"])]);
  1186. smalltalk.send(self,"_assert_",[smalltalk.send("hello","__eq_eq",[smalltalk.send("hello","_yourself",[])])]);
  1187. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send("hello","_yourself",[]),"__eq_eq",["hello"])]);
  1188. smalltalk.send(self,"_deny_",[smalltalk.send("","__eq_eq",[(0)])]);
  1189. return self}
  1190. }),
  1191. smalltalk.StringTest);
  1192. smalltalk.addMethod(
  1193. "_testIncludesSubString",
  1194. smalltalk.method({
  1195. selector: "testIncludesSubString",
  1196. fn: function (){
  1197. var self=this;
  1198. smalltalk.send(self,"_assert_",[smalltalk.send("amber","_includesSubString_",["ber"])]);
  1199. smalltalk.send(self,"_deny_",[smalltalk.send("amber","_includesSubString_",["zork"])]);
  1200. return self}
  1201. }),
  1202. smalltalk.StringTest);
  1203. smalltalk.addMethod(
  1204. "_testJoin",
  1205. smalltalk.method({
  1206. selector: "testJoin",
  1207. fn: function (){
  1208. var self=this;
  1209. smalltalk.send(self,"_assert_equals_",["hello,world",smalltalk.send(",","_join_",[["hello", "world"]])]);
  1210. return self}
  1211. }),
  1212. smalltalk.StringTest);
  1213. smalltalk.addMethod(
  1214. "_testSelect",
  1215. smalltalk.method({
  1216. selector: "testSelect",
  1217. fn: function (){
  1218. var self=this;
  1219. var newCollection;
  1220. newCollection="o";
  1221. smalltalk.send(self,"_assertSameContents_as_",[smalltalk.send(smalltalk.send(self,"_collection",[]),"_select_",[(function(each){
  1222. return smalltalk.send(each,"__eq",["o"]);
  1223. })]),newCollection]);
  1224. return self}
  1225. }),
  1226. smalltalk.StringTest);
  1227. smalltalk.addMethod(
  1228. "_testSize",
  1229. smalltalk.method({
  1230. selector: "testSize",
  1231. fn: function (){
  1232. var self=this;
  1233. smalltalk.send(self,"_assert_equals_",[smalltalk.send("smalltalk","_size",[]),(9)]);
  1234. smalltalk.send(self,"_assert_equals_",[smalltalk.send("","_size",[]),(0)]);
  1235. return self}
  1236. }),
  1237. smalltalk.StringTest);
  1238. smalltalk.addMethod(
  1239. "_testStreamContents",
  1240. smalltalk.method({
  1241. selector: "testStreamContents",
  1242. fn: function (){
  1243. var self=this;
  1244. var $1;
  1245. smalltalk.send(self,"_assert_equals_",["hello world",smalltalk.send((smalltalk.String || String),"_streamContents_",[(function(aStream){
  1246. smalltalk.send(aStream,"_nextPutAll_",["hello"]);
  1247. smalltalk.send(aStream,"_space",[]);
  1248. $1=smalltalk.send(aStream,"_nextPutAll_",["world"]);
  1249. return $1;
  1250. })])]);
  1251. return self}
  1252. }),
  1253. smalltalk.StringTest);
  1254. smalltalk.addMethod(
  1255. "_collectionClass",
  1256. smalltalk.method({
  1257. selector: "collectionClass",
  1258. fn: function (){
  1259. var self=this;
  1260. return (smalltalk.String || String);
  1261. }
  1262. }),
  1263. smalltalk.StringTest.klass);
  1264. smalltalk.addClass('SymbolTest', smalltalk.SequenceableCollectionTest, [], 'Kernel-Tests');
  1265. smalltalk.addMethod(
  1266. "_collection",
  1267. smalltalk.method({
  1268. selector: "collection",
  1269. fn: function (){
  1270. var self=this;
  1271. return smalltalk.symbolFor("hello");
  1272. }
  1273. }),
  1274. smalltalk.SymbolTest);
  1275. smalltalk.addMethod(
  1276. "_collectionWithDuplicates",
  1277. smalltalk.method({
  1278. selector: "collectionWithDuplicates",
  1279. fn: function (){
  1280. var self=this;
  1281. return smalltalk.symbolFor("phhaaarorra");
  1282. }
  1283. }),
  1284. smalltalk.SymbolTest);
  1285. smalltalk.addMethod(
  1286. "_testAsString",
  1287. smalltalk.method({
  1288. selector: "testAsString",
  1289. fn: function (){
  1290. var self=this;
  1291. smalltalk.send(self,"_assert_equals_",[smalltalk.send(smalltalk.symbolFor("hello"),"_asString",[]),"hello"]);
  1292. return self}
  1293. }),
  1294. smalltalk.SymbolTest);
  1295. smalltalk.addMethod(
  1296. "_testAsSymbol",
  1297. smalltalk.method({
  1298. selector: "testAsSymbol",
  1299. fn: function (){
  1300. var self=this;
  1301. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.symbolFor("hello"),"__eq_eq",[smalltalk.send(smalltalk.symbolFor("hello"),"_asSymbol",[])])]);
  1302. return self}
  1303. }),
  1304. smalltalk.SymbolTest);
  1305. smalltalk.addMethod(
  1306. "_testAt",
  1307. smalltalk.method({
  1308. selector: "testAt",
  1309. fn: function (){
  1310. var self=this;
  1311. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send(smalltalk.symbolFor("hello"),"_at_",[(1)]),"__eq",["h"])]);
  1312. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send(smalltalk.symbolFor("hello"),"_at_",[(5)]),"__eq",["o"])]);
  1313. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send(smalltalk.symbolFor("hello"),"_at_ifAbsent_",[(6),(function(){
  1314. return nil;
  1315. })]),"__eq",[nil])]);
  1316. return self}
  1317. }),
  1318. smalltalk.SymbolTest);
  1319. smalltalk.addMethod(
  1320. "_testAtPut",
  1321. smalltalk.method({
  1322. selector: "testAtPut",
  1323. fn: function (){
  1324. var self=this;
  1325. smalltalk.send(self,"_should_raise_",[(function(){
  1326. return smalltalk.send("hello","_at_put_",[(1),"a"]);
  1327. }),(smalltalk.Error || Error)]);
  1328. return self}
  1329. }),
  1330. smalltalk.SymbolTest);
  1331. smalltalk.addMethod(
  1332. "_testCollect",
  1333. smalltalk.method({
  1334. selector: "testCollect",
  1335. fn: function (){
  1336. var self=this;
  1337. var newCollection;
  1338. newCollection=smalltalk.symbolFor("hheelllloo");
  1339. smalltalk.send(self,"_assertSameContents_as_",[smalltalk.send(smalltalk.send(self,"_collection",[]),"_collect_",[(function(each){
  1340. return smalltalk.send(each,"__comma",[each]);
  1341. })]),newCollection]);
  1342. return self}
  1343. }),
  1344. smalltalk.SymbolTest);
  1345. smalltalk.addMethod(
  1346. "_testComparing",
  1347. smalltalk.method({
  1348. selector: "testComparing",
  1349. fn: function (){
  1350. var self=this;
  1351. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.symbolFor("ab"),"__gt",[smalltalk.symbolFor("aa")])]);
  1352. smalltalk.send(self,"_deny_",[smalltalk.send(smalltalk.symbolFor("ab"),"__gt",[smalltalk.symbolFor("ba")])]);
  1353. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.symbolFor("ab"),"__lt",[smalltalk.symbolFor("ba")])]);
  1354. smalltalk.send(self,"_deny_",[smalltalk.send(smalltalk.symbolFor("bb"),"__lt",[smalltalk.symbolFor("ba")])]);
  1355. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.symbolFor("ab"),"__gt_eq",[smalltalk.symbolFor("aa")])]);
  1356. smalltalk.send(self,"_deny_",[smalltalk.send(smalltalk.symbolFor("ab"),"__gt_eq",[smalltalk.symbolFor("ba")])]);
  1357. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.symbolFor("ab"),"__lt_eq",[smalltalk.symbolFor("ba")])]);
  1358. smalltalk.send(self,"_deny_",[smalltalk.send(smalltalk.symbolFor("bb"),"__lt_eq",[smalltalk.symbolFor("ba")])]);
  1359. return self}
  1360. }),
  1361. smalltalk.SymbolTest);
  1362. smalltalk.addMethod(
  1363. "_testCopying",
  1364. smalltalk.method({
  1365. selector: "testCopying",
  1366. fn: function (){
  1367. var self=this;
  1368. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send(smalltalk.symbolFor("hello"),"_copy",[]),"__eq_eq",[smalltalk.symbolFor("hello")])]);
  1369. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send(smalltalk.symbolFor("hello"),"_deepCopy",[]),"__eq_eq",[smalltalk.symbolFor("hello")])]);
  1370. return self}
  1371. }),
  1372. smalltalk.SymbolTest);
  1373. smalltalk.addMethod(
  1374. "_testDetect",
  1375. smalltalk.method({
  1376. selector: "testDetect",
  1377. fn: function (){
  1378. var self=this;
  1379. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send(smalltalk.send(self,"_collection",[]),"_detect_",[(function(each){
  1380. return smalltalk.send(each,"__eq",["h"]);
  1381. })]),"__eq",["h"])]);
  1382. smalltalk.send(self,"_should_raise_",[(function(){
  1383. return smalltalk.send(smalltalk.send(self,"_collection",[]),"_detect_",[(function(each){
  1384. return smalltalk.send(each,"__eq",["z"]);
  1385. })]);
  1386. }),(smalltalk.Error || Error)]);
  1387. return self}
  1388. }),
  1389. smalltalk.SymbolTest);
  1390. smalltalk.addMethod(
  1391. "_testEquality",
  1392. smalltalk.method({
  1393. selector: "testEquality",
  1394. fn: function (){
  1395. var self=this;
  1396. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.symbolFor("hello"),"__eq",[smalltalk.symbolFor("hello")])]);
  1397. smalltalk.send(self,"_deny_",[smalltalk.send(smalltalk.symbolFor("hello"),"__eq",[smalltalk.symbolFor("world")])]);
  1398. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.symbolFor("hello"),"__eq",[smalltalk.send(smalltalk.symbolFor("hello"),"_yourself",[])])]);
  1399. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send(smalltalk.symbolFor("hello"),"_yourself",[]),"__eq",[smalltalk.symbolFor("hello")])]);
  1400. smalltalk.send(self,"_deny_",[smalltalk.send(smalltalk.symbolFor("hello"),"__eq",["hello"])]);
  1401. smalltalk.send(self,"_deny_",[smalltalk.send("hello","__eq",[smalltalk.symbolFor("hello")])]);
  1402. return self}
  1403. }),
  1404. smalltalk.SymbolTest);
  1405. smalltalk.addMethod(
  1406. "_testIdentity",
  1407. smalltalk.method({
  1408. selector: "testIdentity",
  1409. fn: function (){
  1410. var self=this;
  1411. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.symbolFor("hello"),"__eq_eq",[smalltalk.symbolFor("hello")])]);
  1412. smalltalk.send(self,"_deny_",[smalltalk.send(smalltalk.symbolFor("hello"),"__eq_eq",[smalltalk.symbolFor("world")])]);
  1413. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.symbolFor("hello"),"__eq",[smalltalk.send(smalltalk.symbolFor("hello"),"_yourself",[])])]);
  1414. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send(smalltalk.symbolFor("hello"),"_yourself",[]),"__eq",[smalltalk.send(smalltalk.send(smalltalk.symbolFor("hello"),"_asString",[]),"_asSymbol",[])])]);
  1415. return self}
  1416. }),
  1417. smalltalk.SymbolTest);
  1418. smalltalk.addMethod(
  1419. "_testIsEmpty",
  1420. smalltalk.method({
  1421. selector: "testIsEmpty",
  1422. fn: function (){
  1423. var self=this;
  1424. smalltalk.send(self,"_deny_",[smalltalk.send(smalltalk.send(self,"_collection",[]),"_isEmpty",[])]);
  1425. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send("","_asSymbol",[]),"_isEmpty",[])]);
  1426. return self}
  1427. }),
  1428. smalltalk.SymbolTest);
  1429. smalltalk.addMethod(
  1430. "_testIsSymbolIsString",
  1431. smalltalk.method({
  1432. selector: "testIsSymbolIsString",
  1433. fn: function (){
  1434. var self=this;
  1435. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.symbolFor("hello"),"_isSymbol",[])]);
  1436. smalltalk.send(self,"_deny_",[smalltalk.send("hello","_isSymbol",[])]);
  1437. smalltalk.send(self,"_deny_",[smalltalk.send(smalltalk.symbolFor("hello"),"_isString",[])]);
  1438. smalltalk.send(self,"_assert_",[smalltalk.send("hello","_isString",[])]);
  1439. return self}
  1440. }),
  1441. smalltalk.SymbolTest);
  1442. smalltalk.addMethod(
  1443. "_testSelect",
  1444. smalltalk.method({
  1445. selector: "testSelect",
  1446. fn: function (){
  1447. var self=this;
  1448. var newCollection;
  1449. newCollection="o";
  1450. smalltalk.send(self,"_assertSameContents_as_",[smalltalk.send(smalltalk.send(self,"_collection",[]),"_select_",[(function(each){
  1451. return smalltalk.send(each,"__eq",["o"]);
  1452. })]),newCollection]);
  1453. return self}
  1454. }),
  1455. smalltalk.SymbolTest);
  1456. smalltalk.addMethod(
  1457. "_testSize",
  1458. smalltalk.method({
  1459. selector: "testSize",
  1460. fn: function (){
  1461. var self=this;
  1462. smalltalk.send(self,"_assert_equals_",[smalltalk.send(smalltalk.symbolFor("a"),"_size",[]),(1)]);
  1463. smalltalk.send(self,"_assert_equals_",[smalltalk.send(smalltalk.symbolFor("aaaaa"),"_size",[]),(5)]);
  1464. return self}
  1465. }),
  1466. smalltalk.SymbolTest);
  1467. smalltalk.addMethod(
  1468. "_collectionClass",
  1469. smalltalk.method({
  1470. selector: "collectionClass",
  1471. fn: function (){
  1472. var self=this;
  1473. return (smalltalk.Symbol || Symbol);
  1474. }
  1475. }),
  1476. smalltalk.SymbolTest.klass);
  1477. smalltalk.addClass('JSObjectProxyTest', smalltalk.TestCase, [], 'Kernel-Tests');
  1478. smalltalk.addMethod(
  1479. "_jsObject",
  1480. smalltalk.method({
  1481. selector: "jsObject",
  1482. fn: function (){
  1483. var self=this;
  1484. return jsObject = {a: 1, b: function() {return 2;}, c: function(object) {return object;}, d: ''};
  1485. ;
  1486. return self}
  1487. }),
  1488. smalltalk.JSObjectProxyTest);
  1489. smalltalk.addMethod(
  1490. "_testDNU",
  1491. smalltalk.method({
  1492. selector: "testDNU",
  1493. fn: function (){
  1494. var self=this;
  1495. smalltalk.send(self,"_should_raise_",[(function(){
  1496. return smalltalk.send(smalltalk.send(self,"_jsObject",[]),"_foo",[]);
  1497. }),(smalltalk.MessageNotUnderstood || MessageNotUnderstood)]);
  1498. return self}
  1499. }),
  1500. smalltalk.JSObjectProxyTest);
  1501. smalltalk.addMethod(
  1502. "_testMessageSend",
  1503. smalltalk.method({
  1504. selector: "testMessageSend",
  1505. fn: function (){
  1506. var self=this;
  1507. smalltalk.send(self,"_assert_equals_",[smalltalk.send(smalltalk.send(self,"_jsObject",[]),"_a",[]),(1)]);
  1508. smalltalk.send(self,"_assert_equals_",[smalltalk.send(smalltalk.send(self,"_jsObject",[]),"_b",[]),(2)]);
  1509. smalltalk.send(self,"_assert_equals_",[smalltalk.send(smalltalk.send(self,"_jsObject",[]),"_c_",[(3)]),(3)]);
  1510. return self}
  1511. }),
  1512. smalltalk.JSObjectProxyTest);
  1513. smalltalk.addMethod(
  1514. "_testMethodWithArguments",
  1515. smalltalk.method({
  1516. selector: "testMethodWithArguments",
  1517. fn: function (){
  1518. var self=this;
  1519. smalltalk.send(self,"_assert_equals_",[smalltalk.send(smalltalk.send(self,"_jsObject",[]),"_c_",[(1)]),(1)]);
  1520. return self}
  1521. }),
  1522. smalltalk.JSObjectProxyTest);
  1523. smalltalk.addMethod(
  1524. "_testPrinting",
  1525. smalltalk.method({
  1526. selector: "testPrinting",
  1527. fn: function (){
  1528. var self=this;
  1529. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send(smalltalk.send(self,"_jsObject",[]),"_printString",[]),"__eq",["[object Object]"])]);
  1530. return self}
  1531. }),
  1532. smalltalk.JSObjectProxyTest);
  1533. smalltalk.addMethod(
  1534. "_testPropertyThatReturnsEmptyString",
  1535. smalltalk.method({
  1536. selector: "testPropertyThatReturnsEmptyString",
  1537. fn: function (){
  1538. var self=this;
  1539. var object;
  1540. object=smalltalk.send(self,"_jsObject",[]);
  1541. smalltalk.send(self,"_assert_equals_",["",smalltalk.send(object,"_d",[])]);
  1542. smalltalk.send(object,"_d_",["hello"]);
  1543. smalltalk.send(self,"_assert_equals_",["hello",smalltalk.send(object,"_d",[])]);
  1544. return self}
  1545. }),
  1546. smalltalk.JSObjectProxyTest);
  1547. smalltalk.addMethod(
  1548. "_testYourself",
  1549. smalltalk.method({
  1550. selector: "testYourself",
  1551. fn: function (){
  1552. var self=this;
  1553. var $1,$2;
  1554. var object;
  1555. $1=smalltalk.send(self,"_jsObject",[]);
  1556. smalltalk.send($1,"_d_",["test"]);
  1557. $2=smalltalk.send($1,"_yourself",[]);
  1558. object=$2;
  1559. smalltalk.send(self,"_assert_equals_",[smalltalk.send(object,"_d",[]),"test"]);
  1560. return self}
  1561. }),
  1562. smalltalk.JSObjectProxyTest);
  1563. smalltalk.addClass('NumberTest', smalltalk.TestCase, [], 'Kernel-Tests');
  1564. smalltalk.addMethod(
  1565. "_testAbs",
  1566. smalltalk.method({
  1567. selector: "testAbs",
  1568. fn: function (){
  1569. var self=this;
  1570. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send((4),"_abs",[]),"__eq",[(4)])]);
  1571. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send((-4),"_abs",[]),"__eq",[(4)])]);
  1572. return self}
  1573. }),
  1574. smalltalk.NumberTest);
  1575. smalltalk.addMethod(
  1576. "_testArithmetic",
  1577. smalltalk.method({
  1578. selector: "testArithmetic",
  1579. fn: function (){
  1580. var self=this;
  1581. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send((1.5),"__plus",[(1)]),"__eq",[(2.5)])]);
  1582. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send((2),"__minus",[(1)]),"__eq",[(1)])]);
  1583. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send((-2),"__minus",[(1)]),"__eq",[(-3)])]);
  1584. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send((12),"__slash",[(2)]),"__eq",[(6)])]);
  1585. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send((3),"__star",[(4)]),"__eq",[(12)])]);
  1586. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send(smalltalk.send((1),"__plus",[(2)]),"__star",[(3)]),"__eq",[(9)])]);
  1587. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send((1),"__plus",[smalltalk.send((2),"__star",[(3)])]),"__eq",[(7)])]);
  1588. return self}
  1589. }),
  1590. smalltalk.NumberTest);
  1591. smalltalk.addMethod(
  1592. "_testComparison",
  1593. smalltalk.method({
  1594. selector: "testComparison",
  1595. fn: function (){
  1596. var self=this;
  1597. smalltalk.send(self,"_assert_",[smalltalk.send((3),"__gt",[(2)])]);
  1598. smalltalk.send(self,"_assert_",[smalltalk.send((2),"__lt",[(3)])]);
  1599. smalltalk.send(self,"_deny_",[smalltalk.send((3),"__lt",[(2)])]);
  1600. smalltalk.send(self,"_deny_",[smalltalk.send((2),"__gt",[(3)])]);
  1601. smalltalk.send(self,"_assert_",[smalltalk.send((3),"__gt_eq",[(3)])]);
  1602. smalltalk.send(self,"_assert_",[smalltalk.send((3.1),"__gt_eq",[(3)])]);
  1603. smalltalk.send(self,"_assert_",[smalltalk.send((3),"__lt_eq",[(3)])]);
  1604. smalltalk.send(self,"_assert_",[smalltalk.send((3),"__lt_eq",[(3.1)])]);
  1605. return self}
  1606. }),
  1607. smalltalk.NumberTest);
  1608. smalltalk.addMethod(
  1609. "_testCopying",
  1610. smalltalk.method({
  1611. selector: "testCopying",
  1612. fn: function (){
  1613. var self=this;
  1614. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send((1),"_copy",[]),"__eq_eq",[(1)])]);
  1615. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send((1),"_deepCopy",[]),"__eq_eq",[(1)])]);
  1616. return self}
  1617. }),
  1618. smalltalk.NumberTest);
  1619. smalltalk.addMethod(
  1620. "_testEquality",
  1621. smalltalk.method({
  1622. selector: "testEquality",
  1623. fn: function (){
  1624. var self=this;
  1625. smalltalk.send(self,"_assert_",[smalltalk.send((1),"__eq",[(1)])]);
  1626. smalltalk.send(self,"_assert_",[smalltalk.send((0),"__eq",[(0)])]);
  1627. smalltalk.send(self,"_deny_",[smalltalk.send((1),"__eq",[(0)])]);
  1628. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send((1),"_yourself",[]),"__eq",[(1)])]);
  1629. smalltalk.send(self,"_assert_",[smalltalk.send((1),"__eq",[smalltalk.send((1),"_yourself",[])])]);
  1630. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send((1),"_yourself",[]),"__eq",[smalltalk.send((1),"_yourself",[])])]);
  1631. smalltalk.send(self,"_deny_",[smalltalk.send((0),"__eq",[false])]);
  1632. smalltalk.send(self,"_deny_",[smalltalk.send(false,"__eq",[(0)])]);
  1633. smalltalk.send(self,"_deny_",[smalltalk.send("","__eq",[(0)])]);
  1634. smalltalk.send(self,"_deny_",[smalltalk.send((0),"__eq",[""])]);
  1635. return self}
  1636. }),
  1637. smalltalk.NumberTest);
  1638. smalltalk.addMethod(
  1639. "_testHexNumbers",
  1640. smalltalk.method({
  1641. selector: "testHexNumbers",
  1642. fn: function (){
  1643. var self=this;
  1644. smalltalk.send(self,"_assert_",[smalltalk.send((9),"__eq",[(9)])]);
  1645. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send((10),"_truncated",[]),"__eq",[(10)])]);
  1646. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send((11),"_truncated",[]),"__eq",[(11)])]);
  1647. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send((12),"_truncated",[]),"__eq",[(12)])]);
  1648. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send((13),"_truncated",[]),"__eq",[(13)])]);
  1649. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send((14),"_truncated",[]),"__eq",[(14)])]);
  1650. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send((15),"_truncated",[]),"__eq",[(15)])]);
  1651. return self}
  1652. }),
  1653. smalltalk.NumberTest);
  1654. smalltalk.addMethod(
  1655. "_testIdentity",
  1656. smalltalk.method({
  1657. selector: "testIdentity",
  1658. fn: function (){
  1659. var self=this;
  1660. smalltalk.send(self,"_assert_",[smalltalk.send((1),"__eq_eq",[(1)])]);
  1661. smalltalk.send(self,"_assert_",[smalltalk.send((0),"__eq_eq",[(0)])]);
  1662. smalltalk.send(self,"_deny_",[smalltalk.send((1),"__eq_eq",[(0)])]);
  1663. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send((1),"_yourself",[]),"__eq_eq",[(1)])]);
  1664. smalltalk.send(self,"_assert_",[smalltalk.send((1),"__eq_eq",[smalltalk.send((1),"_yourself",[])])]);
  1665. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send((1),"_yourself",[]),"__eq_eq",[smalltalk.send((1),"_yourself",[])])]);
  1666. smalltalk.send(self,"_deny_",[smalltalk.send((1),"__eq_eq",[(2)])]);
  1667. return self}
  1668. }),
  1669. smalltalk.NumberTest);
  1670. smalltalk.addMethod(
  1671. "_testMinMax",
  1672. smalltalk.method({
  1673. selector: "testMinMax",
  1674. fn: function (){
  1675. var self=this;
  1676. smalltalk.send(self,"_assert_equals_",[smalltalk.send((2),"_max_",[(5)]),(5)]);
  1677. smalltalk.send(self,"_assert_equals_",[smalltalk.send((2),"_min_",[(5)]),(2)]);
  1678. return self}
  1679. }),
  1680. smalltalk.NumberTest);
  1681. smalltalk.addMethod(
  1682. "_testNegated",
  1683. smalltalk.method({
  1684. selector: "testNegated",
  1685. fn: function (){
  1686. var self=this;
  1687. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send((3),"_negated",[]),"__eq",[(-3)])]);
  1688. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send((-3),"_negated",[]),"__eq",[(3)])]);
  1689. return self}
  1690. }),
  1691. smalltalk.NumberTest);
  1692. smalltalk.addMethod(
  1693. "_testPrintShowingDecimalPlaces",
  1694. smalltalk.method({
  1695. selector: "testPrintShowingDecimalPlaces",
  1696. fn: function (){
  1697. var self=this;
  1698. smalltalk.send(self,"_assert_equals_",["23.00",smalltalk.send((23),"_printShowingDecimalPlaces_",[(2)])]);
  1699. smalltalk.send(self,"_assert_equals_",["23.57",smalltalk.send((23.5698),"_printShowingDecimalPlaces_",[(2)])]);
  1700. smalltalk.send(self,"_assert_equals_",["-234.56700",smalltalk.send(smalltalk.send((234.567),"_negated",[]),"_printShowingDecimalPlaces_",[(5)])]);
  1701. smalltalk.send(self,"_assert_equals_",["23",smalltalk.send((23.4567),"_printShowingDecimalPlaces_",[(0)])]);
  1702. smalltalk.send(self,"_assert_equals_",["24",smalltalk.send((23.5567),"_printShowingDecimalPlaces_",[(0)])]);
  1703. smalltalk.send(self,"_assert_equals_",["-23",smalltalk.send(smalltalk.send((23.4567),"_negated",[]),"_printShowingDecimalPlaces_",[(0)])]);
  1704. smalltalk.send(self,"_assert_equals_",["-24",smalltalk.send(smalltalk.send((23.5567),"_negated",[]),"_printShowingDecimalPlaces_",[(0)])]);
  1705. smalltalk.send(self,"_assert_equals_",["100000000.0",smalltalk.send((100000000),"_printShowingDecimalPlaces_",[(1)])]);
  1706. smalltalk.send(self,"_assert_equals_",["0.98000",smalltalk.send((0.98),"_printShowingDecimalPlaces_",[(5)])]);
  1707. smalltalk.send(self,"_assert_equals_",["-0.98",smalltalk.send(smalltalk.send((0.98),"_negated",[]),"_printShowingDecimalPlaces_",[(2)])]);
  1708. smalltalk.send(self,"_assert_equals_",["2.57",smalltalk.send((2.567),"_printShowingDecimalPlaces_",[(2)])]);
  1709. smalltalk.send(self,"_assert_equals_",["-2.57",smalltalk.send((-2.567),"_printShowingDecimalPlaces_",[(2)])]);
  1710. smalltalk.send(self,"_assert_equals_",["0.00",smalltalk.send((0),"_printShowingDecimalPlaces_",[(2)])]);
  1711. return self}
  1712. }),
  1713. smalltalk.NumberTest);
  1714. smalltalk.addMethod(
  1715. "_testRounded",
  1716. smalltalk.method({
  1717. selector: "testRounded",
  1718. fn: function (){
  1719. var self=this;
  1720. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send((3),"_rounded",[]),"__eq",[(3)])]);
  1721. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send((3.212),"_rounded",[]),"__eq",[(3)])]);
  1722. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send((3.51),"_rounded",[]),"__eq",[(4)])]);
  1723. return self}
  1724. }),
  1725. smalltalk.NumberTest);
  1726. smalltalk.addMethod(
  1727. "_testSqrt",
  1728. smalltalk.method({
  1729. selector: "testSqrt",
  1730. fn: function (){
  1731. var self=this;
  1732. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send((4),"_sqrt",[]),"__eq",[(2)])]);
  1733. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send((16),"_sqrt",[]),"__eq",[(4)])]);
  1734. return self}
  1735. }),
  1736. smalltalk.NumberTest);
  1737. smalltalk.addMethod(
  1738. "_testSquared",
  1739. smalltalk.method({
  1740. selector: "testSquared",
  1741. fn: function (){
  1742. var self=this;
  1743. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send((4),"_squared",[]),"__eq",[(16)])]);
  1744. return self}
  1745. }),
  1746. smalltalk.NumberTest);
  1747. smalltalk.addMethod(
  1748. "_testTimesRepeat",
  1749. smalltalk.method({
  1750. selector: "testTimesRepeat",
  1751. fn: function (){
  1752. var self=this;
  1753. var i;
  1754. i=(0);
  1755. smalltalk.send((0),"_timesRepeat_",[(function(){
  1756. i=smalltalk.send(i,"__plus",[(1)]);
  1757. return i;
  1758. })]);
  1759. smalltalk.send(self,"_assert_equals_",[i,(0)]);
  1760. smalltalk.send((5),"_timesRepeat_",[(function(){
  1761. i=smalltalk.send(i,"__plus",[(1)]);
  1762. return i;
  1763. })]);
  1764. smalltalk.send(self,"_assert_equals_",[i,(5)]);
  1765. return self}
  1766. }),
  1767. smalltalk.NumberTest);
  1768. smalltalk.addMethod(
  1769. "_testTo",
  1770. smalltalk.method({
  1771. selector: "testTo",
  1772. fn: function (){
  1773. var self=this;
  1774. smalltalk.send(self,"_assert_equals_",[smalltalk.send((1),"_to_",[(5)]),[(1), (2), (3), (4), (5)]]);
  1775. return self}
  1776. }),
  1777. smalltalk.NumberTest);
  1778. smalltalk.addMethod(
  1779. "_testToBy",
  1780. smalltalk.method({
  1781. selector: "testToBy",
  1782. fn: function (){
  1783. var self=this;
  1784. smalltalk.send(self,"_assert_equals_",[smalltalk.send((0),"_to_by_",[(6),(2)]),[(0), (2), (4), (6)]]);
  1785. smalltalk.send(self,"_should_raise_",[(function(){
  1786. return smalltalk.send((1),"_to_by_",[(4),(0)]);
  1787. }),(smalltalk.Error || Error)]);
  1788. return self}
  1789. }),
  1790. smalltalk.NumberTest);
  1791. smalltalk.addMethod(
  1792. "_testTruncated",
  1793. smalltalk.method({
  1794. selector: "testTruncated",
  1795. fn: function (){
  1796. var self=this;
  1797. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send((3),"_truncated",[]),"__eq",[(3)])]);
  1798. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send((3.212),"_truncated",[]),"__eq",[(3)])]);
  1799. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send((3.51),"_truncated",[]),"__eq",[(3)])]);
  1800. return self}
  1801. }),
  1802. smalltalk.NumberTest);
  1803. smalltalk.addClass('ObjectMock', smalltalk.Object, ['foo', 'bar'], 'Kernel-Tests');
  1804. smalltalk.addMethod(
  1805. "_foo",
  1806. smalltalk.method({
  1807. selector: "foo",
  1808. fn: function (){
  1809. var self=this;
  1810. return self["@foo"];
  1811. }
  1812. }),
  1813. smalltalk.ObjectMock);
  1814. smalltalk.addMethod(
  1815. "_foo_",
  1816. smalltalk.method({
  1817. selector: "foo:",
  1818. fn: function (anObject){
  1819. var self=this;
  1820. self["@foo"]=anObject;
  1821. return self}
  1822. }),
  1823. smalltalk.ObjectMock);
  1824. smalltalk.addClass('ObjectTest', smalltalk.TestCase, [], 'Kernel-Tests');
  1825. smalltalk.addMethod(
  1826. "_testBasicAccess",
  1827. smalltalk.method({
  1828. selector: "testBasicAccess",
  1829. fn: function (){
  1830. var self=this;
  1831. var o;
  1832. o=smalltalk.send((smalltalk.Object || Object),"_new",[]);
  1833. smalltalk.send(o,"_basicAt_put_",["a",(1)]);
  1834. smalltalk.send(self,"_assert_equals_",[smalltalk.send(o,"_basicAt_",["a"]),(1)]);
  1835. smalltalk.send(self,"_assert_equals_",[smalltalk.send(o,"_basicAt_",["b"]),nil]);
  1836. return self}
  1837. }),
  1838. smalltalk.ObjectTest);
  1839. smalltalk.addMethod(
  1840. "_testBasicPerform",
  1841. smalltalk.method({
  1842. selector: "testBasicPerform",
  1843. fn: function (){
  1844. var self=this;
  1845. var o;
  1846. o=smalltalk.send((smalltalk.Object || Object),"_new",[]);
  1847. smalltalk.send(o,"_basicAt_put_",["func",(function(){
  1848. return "hello";
  1849. })]);
  1850. smalltalk.send(o,"_basicAt_put_",["func2",(function(a){
  1851. return smalltalk.send(a,"__plus",[(1)]);
  1852. })]);
  1853. smalltalk.send(self,"_assert_equals_",[smalltalk.send(o,"_basicPerform_",["func"]),"hello"]);
  1854. smalltalk.send(self,"_assert_equals_",[smalltalk.send(o,"_basicPerform_withArguments_",["func2",[(3)]]),(4)]);
  1855. return self}
  1856. }),
  1857. smalltalk.ObjectTest);
  1858. smalltalk.addMethod(
  1859. "_testDNU",
  1860. smalltalk.method({
  1861. selector: "testDNU",
  1862. fn: function (){
  1863. var self=this;
  1864. smalltalk.send(self,"_should_raise_",[(function(){
  1865. return smalltalk.send(smalltalk.send((smalltalk.Object || Object),"_new",[]),"_foo",[]);
  1866. }),(smalltalk.MessageNotUnderstood || MessageNotUnderstood)]);
  1867. return self}
  1868. }),
  1869. smalltalk.ObjectTest);
  1870. smalltalk.addMethod(
  1871. "_testEquality",
  1872. smalltalk.method({
  1873. selector: "testEquality",
  1874. fn: function (){
  1875. var self=this;
  1876. var o;
  1877. o=smalltalk.send((smalltalk.Object || Object),"_new",[]);
  1878. smalltalk.send(self,"_deny_",[smalltalk.send(o,"__eq",[smalltalk.send((smalltalk.Object || Object),"_new",[])])]);
  1879. smalltalk.send(self,"_assert_",[smalltalk.send(o,"__eq",[o])]);
  1880. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send(o,"_yourself",[]),"__eq",[o])]);
  1881. smalltalk.send(self,"_assert_",[smalltalk.send(o,"__eq",[smalltalk.send(o,"_yourself",[])])]);
  1882. return self}
  1883. }),
  1884. smalltalk.ObjectTest);
  1885. smalltalk.addMethod(
  1886. "_testHalt",
  1887. smalltalk.method({
  1888. selector: "testHalt",
  1889. fn: function (){
  1890. var self=this;
  1891. smalltalk.send(self,"_should_raise_",[(function(){
  1892. return smalltalk.send(smalltalk.send((smalltalk.Object || Object),"_new",[]),"_halt",[]);
  1893. }),(smalltalk.Error || Error)]);
  1894. return self}
  1895. }),
  1896. smalltalk.ObjectTest);
  1897. smalltalk.addMethod(
  1898. "_testIdentity",
  1899. smalltalk.method({
  1900. selector: "testIdentity",
  1901. fn: function (){
  1902. var self=this;
  1903. var o;
  1904. o=smalltalk.send((smalltalk.Object || Object),"_new",[]);
  1905. smalltalk.send(self,"_deny_",[smalltalk.send(o,"__eq_eq",[smalltalk.send((smalltalk.Object || Object),"_new",[])])]);
  1906. smalltalk.send(self,"_assert_",[smalltalk.send(o,"__eq_eq",[o])]);
  1907. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send(o,"_yourself",[]),"__eq_eq",[o])]);
  1908. smalltalk.send(self,"_assert_",[smalltalk.send(o,"__eq_eq",[smalltalk.send(o,"_yourself",[])])]);
  1909. return self}
  1910. }),
  1911. smalltalk.ObjectTest);
  1912. smalltalk.addMethod(
  1913. "_testIfNil",
  1914. smalltalk.method({
  1915. selector: "testIfNil",
  1916. fn: function (){
  1917. var self=this;
  1918. var $2,$1,$4,$3,$6,$5;
  1919. smalltalk.send(self,"_deny_",[smalltalk.send(smalltalk.send((smalltalk.Object || Object),"_new",[]),"_isNil",[])]);
  1920. $2=smalltalk.send((smalltalk.Object || Object),"_new",[]);
  1921. if(($receiver = $2) == nil || $receiver == undefined){
  1922. $1=true;
  1923. } else {
  1924. $1=$2;
  1925. };
  1926. smalltalk.send(self,"_deny_",[smalltalk.send($1,"__eq",[true])]);
  1927. $4=smalltalk.send((smalltalk.Object || Object),"_new",[]);
  1928. if(($receiver = $4) == nil || $receiver == undefined){
  1929. $3=$4;
  1930. } else {
  1931. $3=true;
  1932. };
  1933. smalltalk.send(self,"_assert_",[smalltalk.send($3,"__eq",[true])]);
  1934. $6=smalltalk.send((smalltalk.Object || Object),"_new",[]);
  1935. if(($receiver = $6) == nil || $receiver == undefined){
  1936. $5=false;
  1937. } else {
  1938. $5=true;
  1939. };
  1940. smalltalk.send(self,"_assert_",[smalltalk.send($5,"__eq",[true])]);
  1941. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send(smalltalk.send((smalltalk.Object || Object),"_new",[]),"_ifNotNil_ifNil_",[(function(){
  1942. return true;
  1943. }),(function(){
  1944. return false;
  1945. })]),"__eq",[true])]);
  1946. return self}
  1947. }),
  1948. smalltalk.ObjectTest);
  1949. smalltalk.addMethod(
  1950. "_testInstVars",
  1951. smalltalk.method({
  1952. selector: "testInstVars",
  1953. fn: function (){
  1954. var self=this;
  1955. var o;
  1956. o=smalltalk.send((smalltalk.ObjectMock || ObjectMock),"_new",[]);
  1957. smalltalk.send(self,"_assert_equals_",[smalltalk.send(o,"_instVarAt_",[smalltalk.symbolFor("foo")]),nil]);
  1958. smalltalk.send(o,"_instVarAt_put_",[smalltalk.symbolFor("foo"),(1)]);
  1959. smalltalk.send(self,"_assert_equals_",[smalltalk.send(o,"_instVarAt_",[smalltalk.symbolFor("foo")]),(1)]);
  1960. smalltalk.send(self,"_assert_equals_",[smalltalk.send(o,"_instVarAt_",["foo"]),(1)]);
  1961. return self}
  1962. }),
  1963. smalltalk.ObjectTest);
  1964. smalltalk.addMethod(
  1965. "_testNilUndefined",
  1966. smalltalk.method({
  1967. selector: "testNilUndefined",
  1968. fn: function (){
  1969. var self=this;
  1970. var notDefined;
  1971. notDefined = undefined;
  1972. ;
  1973. smalltalk.send(self,"_assert_",[smalltalk.send(nil,"__eq",[notDefined])]);
  1974. return self}
  1975. }),
  1976. smalltalk.ObjectTest);
  1977. smalltalk.addMethod(
  1978. "_testYourself",
  1979. smalltalk.method({
  1980. selector: "testYourself",
  1981. fn: function () {
  1982. var self = this;
  1983. var o;
  1984. o = smalltalk.send(smalltalk.ObjectMock || ObjectMock, "_new", []);
  1985. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(o, "_yourself", []), "__eq_eq", [o])]);
  1986. return self;
  1987. }
  1988. }),
  1989. smalltalk.ObjectTest);
  1990. smalltalk.addMethod(
  1991. "_testidentityHash",
  1992. smalltalk.method({
  1993. selector: "testidentityHash",
  1994. fn: function () {
  1995. var self = this;
  1996. var o1;
  1997. var o2;
  1998. o1 = smalltalk.send(smalltalk.Object || Object, "_new", []);
  1999. o2 = smalltalk.send(smalltalk.Object || Object, "_new", []);
  2000. smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(o1, "_identityHash", []), "__eq_eq", [smalltalk.send(o1, "_identityHash", [])])]);
  2001. smalltalk.send(self, "_deny_", [smalltalk.send(smalltalk.send(o1, "_identityHash", []), "__eq_eq", [smalltalk.send(o2, "_identityHash", [])])]);
  2002. return self;
  2003. }
  2004. }),
  2005. smalltalk.ObjectTest);
  2006. smalltalk.addClass('PackageTest', smalltalk.TestCase, ['zorkPackage', 'grulPackage', 'backUpCommitPathJs', 'backUpCommitPathSt'], 'Kernel-Tests');
  2007. smalltalk.addMethod(
  2008. "_setUp",
  2009. smalltalk.method({
  2010. selector: "setUp",
  2011. fn: function (){
  2012. var self=this;
  2013. var $1,$2;
  2014. self["@backUpCommitPathJs"]=smalltalk.send((smalltalk.Package || Package),"_defaultCommitPathJs",[]);
  2015. self["@backUpCommitPathSt"]=smalltalk.send((smalltalk.Package || Package),"_defaultCommitPathSt",[]);
  2016. smalltalk.send((smalltalk.Package || Package),"_resetCommitPaths",[]);
  2017. self["@zorkPackage"]=smalltalk.send(smalltalk.send((smalltalk.Package || Package),"_new",[]),"_name_",["Zork"]);
  2018. $1=smalltalk.send((smalltalk.Package || Package),"_new",[]);
  2019. smalltalk.send($1,"_name_",["Grul"]);
  2020. smalltalk.send($1,"_commitPathJs_",["server/grul/js"]);
  2021. smalltalk.send($1,"_commitPathSt_",["grul/st"]);
  2022. $2=smalltalk.send($1,"_yourself",[]);
  2023. self["@grulPackage"]=$2;
  2024. return self}
  2025. }),
  2026. smalltalk.PackageTest);
  2027. smalltalk.addMethod(
  2028. "_tearDown",
  2029. smalltalk.method({
  2030. selector: "tearDown",
  2031. fn: function (){
  2032. var self=this;
  2033. var $1;
  2034. smalltalk.send((smalltalk.Package || Package),"_defaultCommitPathJs_",[self["@backUpCommitPathJs"]]);
  2035. $1=smalltalk.send((smalltalk.Package || Package),"_defaultCommitPathSt_",[self["@backUpCommitPathSt"]]);
  2036. return self}
  2037. }),
  2038. smalltalk.PackageTest);
  2039. smalltalk.addMethod(
  2040. "_testGrulCommitPathJsShouldBeServerGrulJs",
  2041. smalltalk.method({
  2042. selector: "testGrulCommitPathJsShouldBeServerGrulJs",
  2043. fn: function (){
  2044. var self=this;
  2045. smalltalk.send(self,"_assert_equals_",["server/grul/js",smalltalk.send(self["@grulPackage"],"_commitPathJs",[])]);
  2046. return self}
  2047. }),
  2048. smalltalk.PackageTest);
  2049. smalltalk.addMethod(
  2050. "_testGrulCommitPathStShouldBeGrulSt",
  2051. smalltalk.method({
  2052. selector: "testGrulCommitPathStShouldBeGrulSt",
  2053. fn: function (){
  2054. var self=this;
  2055. smalltalk.send(self,"_assert_equals_",["grul/st",smalltalk.send(self["@grulPackage"],"_commitPathSt",[])]);
  2056. return self}
  2057. }),
  2058. smalltalk.PackageTest);
  2059. smalltalk.addMethod(
  2060. "_testZorkCommitPathJsShouldBeJs",
  2061. smalltalk.method({
  2062. selector: "testZorkCommitPathJsShouldBeJs",
  2063. fn: function (){
  2064. var self=this;
  2065. smalltalk.send(self,"_assert_equals_",["js",smalltalk.send(self["@zorkPackage"],"_commitPathJs",[])]);
  2066. return self}
  2067. }),
  2068. smalltalk.PackageTest);
  2069. smalltalk.addMethod(
  2070. "_testZorkCommitPathStShouldBeSt",
  2071. smalltalk.method({
  2072. selector: "testZorkCommitPathStShouldBeSt",
  2073. fn: function (){
  2074. var self=this;
  2075. smalltalk.send(self,"_assert_equals_",["st",smalltalk.send(self["@zorkPackage"],"_commitPathSt",[])]);
  2076. return self}
  2077. }),
  2078. smalltalk.PackageTest);
  2079. smalltalk.addClass('PackageWithDefaultCommitPathChangedTest', smalltalk.PackageTest, [], 'Kernel-Tests');
  2080. smalltalk.addMethod(
  2081. "_setUp",
  2082. smalltalk.method({
  2083. selector: "setUp",
  2084. fn: function (){
  2085. var self=this;
  2086. var $1;
  2087. smalltalk.send(self,"_setUp",[],smalltalk.PackageTest);
  2088. smalltalk.send((smalltalk.Package || Package),"_defaultCommitPathJs_",["javascripts/"]);
  2089. $1=smalltalk.send((smalltalk.Package || Package),"_defaultCommitPathSt_",["smalltalk/"]);
  2090. return self}
  2091. }),
  2092. smalltalk.PackageWithDefaultCommitPathChangedTest);
  2093. smalltalk.addMethod(
  2094. "_testGrulCommitPathJsShouldBeServerGrulJs",
  2095. smalltalk.method({
  2096. selector: "testGrulCommitPathJsShouldBeServerGrulJs",
  2097. fn: function (){
  2098. var self=this;
  2099. smalltalk.send(self,"_assert_equals_",["server/grul/js",smalltalk.send(self["@grulPackage"],"_commitPathJs",[])]);
  2100. return self}
  2101. }),
  2102. smalltalk.PackageWithDefaultCommitPathChangedTest);
  2103. smalltalk.addMethod(
  2104. "_testGrulCommitPathStShouldBeGrulSt",
  2105. smalltalk.method({
  2106. selector: "testGrulCommitPathStShouldBeGrulSt",
  2107. fn: function (){
  2108. var self=this;
  2109. smalltalk.send(self,"_assert_equals_",["grul/st",smalltalk.send(self["@grulPackage"],"_commitPathSt",[])]);
  2110. return self}
  2111. }),
  2112. smalltalk.PackageWithDefaultCommitPathChangedTest);
  2113. smalltalk.addMethod(
  2114. "_testZorkCommitPathJsShouldBeJavascript",
  2115. smalltalk.method({
  2116. selector: "testZorkCommitPathJsShouldBeJavascript",
  2117. fn: function (){
  2118. var self=this;
  2119. smalltalk.send(self,"_assert_equals_",["javascripts/",smalltalk.send(self["@zorkPackage"],"_commitPathJs",[])]);
  2120. return self}
  2121. }),
  2122. smalltalk.PackageWithDefaultCommitPathChangedTest);
  2123. smalltalk.addMethod(
  2124. "_testZorkCommitPathStShouldBeSmalltalk",
  2125. smalltalk.method({
  2126. selector: "testZorkCommitPathStShouldBeSmalltalk",
  2127. fn: function (){
  2128. var self=this;
  2129. smalltalk.send(self,"_assert_equals_",["smalltalk/",smalltalk.send(self["@zorkPackage"],"_commitPathSt",[])]);
  2130. return self}
  2131. }),
  2132. smalltalk.PackageWithDefaultCommitPathChangedTest);
  2133. smalltalk.addMethod(
  2134. "_shouldInheritSelectors",
  2135. smalltalk.method({
  2136. selector: "shouldInheritSelectors",
  2137. fn: function (){
  2138. var self=this;
  2139. return false;
  2140. }
  2141. }),
  2142. smalltalk.PackageWithDefaultCommitPathChangedTest.klass);
  2143. smalltalk.addClass('PointTest', smalltalk.TestCase, [], 'Kernel-Tests');
  2144. smalltalk.addMethod(
  2145. "_testAccessing",
  2146. smalltalk.method({
  2147. selector: "testAccessing",
  2148. fn: function (){
  2149. var self=this;
  2150. smalltalk.send(self,"_assert_equals_",[smalltalk.send(smalltalk.send((smalltalk.Point || Point),"_x_y_",[(3),(4)]),"_x",[]),(3)]);
  2151. smalltalk.send(self,"_assert_equals_",[smalltalk.send(smalltalk.send((smalltalk.Point || Point),"_x_y_",[(3),(4)]),"_y",[]),(4)]);
  2152. smalltalk.send(self,"_assert_equals_",[smalltalk.send(smalltalk.send(smalltalk.send((smalltalk.Point || Point),"_new",[]),"_x_",[(3)]),"_x",[]),(3)]);
  2153. smalltalk.send(self,"_assert_equals_",[smalltalk.send(smalltalk.send(smalltalk.send((smalltalk.Point || Point),"_new",[]),"_y_",[(4)]),"_y",[]),(4)]);
  2154. return self}
  2155. }),
  2156. smalltalk.PointTest);
  2157. smalltalk.addMethod(
  2158. "_testArithmetic",
  2159. smalltalk.method({
  2160. selector: "testArithmetic",
  2161. fn: function (){
  2162. var self=this;
  2163. smalltalk.send(self,"_assert_equals_",[smalltalk.send(smalltalk.send((3),"__at",[(4)]),"__star",[smalltalk.send((3),"__at",[(4)])]),smalltalk.send((smalltalk.Point || Point),"_x_y_",[(9),(16)])]);
  2164. smalltalk.send(self,"_assert_equals_",[smalltalk.send(smalltalk.send((3),"__at",[(4)]),"__plus",[smalltalk.send((3),"__at",[(4)])]),smalltalk.send((smalltalk.Point || Point),"_x_y_",[(6),(8)])]);
  2165. smalltalk.send(self,"_assert_equals_",[smalltalk.send(smalltalk.send((3),"__at",[(4)]),"__minus",[smalltalk.send((3),"__at",[(4)])]),smalltalk.send((smalltalk.Point || Point),"_x_y_",[(0),(0)])]);
  2166. smalltalk.send(self,"_assert_equals_",[smalltalk.send(smalltalk.send((6),"__at",[(8)]),"__slash",[smalltalk.send((3),"__at",[(4)])]),smalltalk.send((smalltalk.Point || Point),"_x_y_",[(2),(2)])]);
  2167. return self}
  2168. }),
  2169. smalltalk.PointTest);
  2170. smalltalk.addMethod(
  2171. "_testAt",
  2172. smalltalk.method({
  2173. selector: "testAt",
  2174. fn: function (){
  2175. var self=this;
  2176. smalltalk.send(self,"_assert_equals_",[smalltalk.send((3),"__at",[(4)]),smalltalk.send((smalltalk.Point || Point),"_x_y_",[(3),(4)])]);
  2177. return self}
  2178. }),
  2179. smalltalk.PointTest);
  2180. smalltalk.addMethod(
  2181. "_testEgality",
  2182. smalltalk.method({
  2183. selector: "testEgality",
  2184. fn: function (){
  2185. var self=this;
  2186. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send((3),"__at",[(4)]),"__eq",[smalltalk.send((3),"__at",[(4)])])]);
  2187. smalltalk.send(self,"_deny_",[smalltalk.send(smalltalk.send((3),"__at",[(5)]),"__eq",[smalltalk.send((3),"__at",[(6)])])]);
  2188. return self}
  2189. }),
  2190. smalltalk.PointTest);
  2191. smalltalk.addMethod(
  2192. "_testTranslateBy",
  2193. smalltalk.method({
  2194. selector: "testTranslateBy",
  2195. fn: function (){
  2196. var self=this;
  2197. smalltalk.send(self,"_assert_equals_",[smalltalk.send((3),"__at",[(4)]),smalltalk.send(smalltalk.send((3),"__at",[(3)]),"_translateBy_",[smalltalk.send((0),"__at",[(1)])])]);
  2198. 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",[])])])]);
  2199. smalltalk.send(self,"_assert_equals_",[smalltalk.send((5),"__at",[(6)]),smalltalk.send(smalltalk.send((3),"__at",[(3)]),"_translateBy_",[smalltalk.send((2),"__at",[(3)])])]);
  2200. 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)])])]);
  2201. return self}
  2202. }),
  2203. smalltalk.PointTest);
  2204. smalltalk.addClass('RandomTest', smalltalk.TestCase, [], 'Kernel-Tests');
  2205. smalltalk.addMethod(
  2206. "_textNext",
  2207. smalltalk.method({
  2208. selector: "textNext",
  2209. fn: function (){
  2210. var self=this;
  2211. smalltalk.send((10000),"_timesRepeat_",[(function(){
  2212. var current;
  2213. var next;
  2214. next=smalltalk.send(smalltalk.send((smalltalk.Random || Random),"_new",[]),"_next",[]);
  2215. next;
  2216. smalltalk.send(self,"_assert_",[smalltalk.send(next,"__gt_eq",[(0)])]);
  2217. smalltalk.send(self,"_assert_",[smalltalk.send(next,"__lt",[(1)])]);
  2218. smalltalk.send(self,"_deny_",[smalltalk.send(current,"__eq",[next])]);
  2219. return smalltalk.send(next,"__eq",[current]);
  2220. })]);
  2221. return self}
  2222. }),
  2223. smalltalk.RandomTest);
  2224. smalltalk.addClass('SetTest', smalltalk.TestCase, [], 'Kernel-Tests');
  2225. smalltalk.addMethod(
  2226. "_testAddRemove",
  2227. smalltalk.method({
  2228. selector: "testAddRemove",
  2229. fn: function (){
  2230. var self=this;
  2231. var set;
  2232. set=smalltalk.send((smalltalk.Set || Set),"_new",[]);
  2233. smalltalk.send(self,"_assert_",[smalltalk.send(set,"_isEmpty",[])]);
  2234. smalltalk.send(set,"_add_",[(3)]);
  2235. smalltalk.send(self,"_assert_",[smalltalk.send(set,"_includes_",[(3)])]);
  2236. smalltalk.send(set,"_add_",[(5)]);
  2237. smalltalk.send(self,"_assert_",[smalltalk.send(set,"_includes_",[(5)])]);
  2238. smalltalk.send(set,"_remove_",[(3)]);
  2239. smalltalk.send(self,"_deny_",[smalltalk.send(set,"_includes_",[(3)])]);
  2240. return self}
  2241. }),
  2242. smalltalk.SetTest);
  2243. smalltalk.addMethod(
  2244. "_testAt",
  2245. smalltalk.method({
  2246. selector: "testAt",
  2247. fn: function (){
  2248. var self=this;
  2249. smalltalk.send(self,"_should_raise_",[(function(){
  2250. return smalltalk.send(smalltalk.send((smalltalk.Set || Set),"_new",[]),"_at_put_",[(1),(2)]);
  2251. }),(smalltalk.Error || Error)]);
  2252. return self}
  2253. }),
  2254. smalltalk.SetTest);
  2255. smalltalk.addMethod(
  2256. "_testPrintString",
  2257. smalltalk.method({
  2258. selector: "testPrintString",
  2259. fn: function (){
  2260. var self=this;
  2261. var $1,$2;
  2262. var set;
  2263. set=smalltalk.send((smalltalk.Set || Set),"_new",[]);
  2264. smalltalk.send(self,"_assert_equals_",["a Set ()",smalltalk.send(set,"_printString",[])]);
  2265. smalltalk.send(set,"_add_",[(1)]);
  2266. $1=smalltalk.send(set,"_add_",[(3)]);
  2267. smalltalk.send(self,"_assert_equals_",["a Set (1 3)",smalltalk.send(set,"_printString",[])]);
  2268. smalltalk.send(set,"_add_",["foo"]);
  2269. smalltalk.send(self,"_assert_equals_",["a Set (1 3 'foo')",smalltalk.send(set,"_printString",[])]);
  2270. smalltalk.send(set,"_remove_",[(1)]);
  2271. $2=smalltalk.send(set,"_remove_",[(3)]);
  2272. smalltalk.send(self,"_assert_equals_",["a Set ('foo')",smalltalk.send(set,"_printString",[])]);
  2273. smalltalk.send(set,"_add_",[(3)]);
  2274. smalltalk.send(self,"_assert_equals_",["a Set ('foo' 3)",smalltalk.send(set,"_printString",[])]);
  2275. smalltalk.send(set,"_add_",[(3)]);
  2276. smalltalk.send(self,"_assert_equals_",["a Set ('foo' 3)",smalltalk.send(set,"_printString",[])]);
  2277. return self}
  2278. }),
  2279. smalltalk.SetTest);
  2280. smalltalk.addMethod(
  2281. "_testSize",
  2282. smalltalk.method({
  2283. selector: "testSize",
  2284. fn: function (){
  2285. var self=this;
  2286. smalltalk.send(self,"_assert_equals_",[smalltalk.send(smalltalk.send((smalltalk.Set || Set),"_new",[]),"_size",[]),(0)]);
  2287. smalltalk.send(self,"_assert_equals_",[smalltalk.send(smalltalk.send((smalltalk.Set || Set),"_withAll_",[[(1), (2), (3), (4)]]),"_size",[]),(4)]);
  2288. smalltalk.send(self,"_assert_equals_",[smalltalk.send(smalltalk.send((smalltalk.Set || Set),"_withAll_",[[(1), (1), (1), (1)]]),"_size",[]),(1)]);
  2289. return self}
  2290. }),
  2291. smalltalk.SetTest);
  2292. smalltalk.addMethod(
  2293. "_testUnicity",
  2294. smalltalk.method({
  2295. selector: "testUnicity",
  2296. fn: function (){
  2297. var self=this;
  2298. var set;
  2299. set=smalltalk.send((smalltalk.Set || Set),"_new",[]);
  2300. smalltalk.send(set,"_add_",[(21)]);
  2301. smalltalk.send(set,"_add_",["hello"]);
  2302. smalltalk.send(set,"_add_",[(21)]);
  2303. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send(set,"_size",[]),"__eq",[(2)])]);
  2304. smalltalk.send(set,"_add_",["hello"]);
  2305. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send(set,"_size",[]),"__eq",[(2)])]);
  2306. smalltalk.send(self,"_assert_equals_",[smalltalk.send(set,"_asArray",[]),[(21), "hello"]]);
  2307. return self}
  2308. }),
  2309. smalltalk.SetTest);
  2310. smalltalk.addClass('UndefinedTest', smalltalk.TestCase, [], 'Kernel-Tests');
  2311. smalltalk.addMethod(
  2312. "_testCopying",
  2313. smalltalk.method({
  2314. selector: "testCopying",
  2315. fn: function (){
  2316. var self=this;
  2317. smalltalk.send(self,"_assert_equals_",[smalltalk.send(nil,"_copy",[]),nil]);
  2318. return self}
  2319. }),
  2320. smalltalk.UndefinedTest);
  2321. smalltalk.addMethod(
  2322. "_testDeepCopy",
  2323. smalltalk.method({
  2324. selector: "testDeepCopy",
  2325. fn: function (){
  2326. var self=this;
  2327. smalltalk.send(self,"_assert_",[smalltalk.send(smalltalk.send(nil,"_deepCopy",[]),"__eq",[nil])]);
  2328. return self}
  2329. }),
  2330. smalltalk.UndefinedTest);
  2331. smalltalk.addMethod(
  2332. "_testIfNil",
  2333. smalltalk.method({
  2334. selector: "testIfNil",
  2335. fn: function (){
  2336. var self=this;
  2337. var $1,$2,$3;
  2338. if(($receiver = nil) == nil || $receiver == undefined){
  2339. $1=true;
  2340. } else {
  2341. $1=nil;
  2342. };
  2343. smalltalk.send(self,"_assert_equals_",[$1,true]);
  2344. if(($receiver = nil) == nil || $receiver == undefined){
  2345. $2=nil;
  2346. } else {
  2347. $2=true;
  2348. };
  2349. smalltalk.send(self,"_deny_",[smalltalk.send($2,"__eq",[true])]);
  2350. if(($receiver = nil) == nil || $receiver == undefined){
  2351. $3=true;
  2352. } else {
  2353. $3=false;
  2354. };
  2355. smalltalk.send(self,"_assert_equals_",[$3,true]);
  2356. smalltalk.send(self,"_deny_",[smalltalk.send(smalltalk.send(nil,"_ifNotNil_ifNil_",[(function(){
  2357. return true;
  2358. }),(function(){
  2359. return false;
  2360. })]),"__eq",[true])]);
  2361. return self}
  2362. }),
  2363. smalltalk.UndefinedTest);
  2364. smalltalk.addMethod(
  2365. "_testIsNil",
  2366. smalltalk.method({
  2367. selector: "testIsNil",
  2368. fn: function (){
  2369. var self=this;
  2370. smalltalk.send(self,"_assert_",[smalltalk.send(nil,"_isNil",[])]);
  2371. smalltalk.send(self,"_deny_",[smalltalk.send(nil,"_notNil",[])]);
  2372. return self}
  2373. }),
  2374. smalltalk.UndefinedTest);