|
@@ -1059,6 +1059,23 @@ referencedClasses: []
|
|
|
}),
|
|
|
smalltalk.CollectionTest);
|
|
|
|
|
|
+smalltalk.addMethod(
|
|
|
+smalltalk.method({
|
|
|
+selector: "testAssociation",
|
|
|
+category: 'tests',
|
|
|
+fn: function (){
|
|
|
+var self=this;
|
|
|
+return smalltalk.withContext(function($ctx1) {
|
|
|
+self._assert_equals_("key:value:","key:value:");
|
|
|
+self._deny_("key:value:".__eq("value:key:"));
|
|
|
+return self}, function($ctx1) {$ctx1.fill(self,"testAssociation",{},smalltalk.CollectionTest)})},
|
|
|
+args: [],
|
|
|
+source: "testAssociation\x0a self assert: #key:value: equals: 'key:value:'.\x0a self deny: #key:value: = 'value:key:'",
|
|
|
+messageSends: ["assert:equals:", "deny:", "="],
|
|
|
+referencedClasses: []
|
|
|
+}),
|
|
|
+smalltalk.CollectionTest);
|
|
|
+
|
|
|
smalltalk.addMethod(
|
|
|
smalltalk.method({
|
|
|
selector: "testCollect",
|
|
@@ -1986,6 +2003,25 @@ smalltalk.addClass('SequenceableCollectionTest', smalltalk.IndexableCollectionTe
|
|
|
|
|
|
|
|
|
smalltalk.addClass('ArrayTest', smalltalk.SequenceableCollectionTest, [], 'Kernel-Tests');
|
|
|
+smalltalk.addMethod(
|
|
|
+smalltalk.method({
|
|
|
+selector: "testAdd",
|
|
|
+category: 'tests',
|
|
|
+fn: function (){
|
|
|
+var self=this;
|
|
|
+var array;
|
|
|
+return smalltalk.withContext(function($ctx1) {
|
|
|
+array=[(1), (2), (3), (4), (5)];
|
|
|
+_st(array)._add_((6));
|
|
|
+self._assert_equals_(array,[(1), (2), (3), (4), (5), (6)]);
|
|
|
+return self}, function($ctx1) {$ctx1.fill(self,"testAdd",{array:array},smalltalk.ArrayTest)})},
|
|
|
+args: [],
|
|
|
+source: "testAdd \x0a\x09| array | \x0a\x09array := #(1 2 3 4 5). \x0a\x09array add:6 . \x0a\x09self assert: array equals: #(1 2 3 4 5 6).",
|
|
|
+messageSends: ["add:", "assert:equals:"],
|
|
|
+referencedClasses: []
|
|
|
+}),
|
|
|
+smalltalk.ArrayTest);
|
|
|
+
|
|
|
smalltalk.addMethod(
|
|
|
smalltalk.method({
|
|
|
selector: "testAddFirst",
|
|
@@ -2041,6 +2077,24 @@ referencedClasses: []
|
|
|
}),
|
|
|
smalltalk.ArrayTest);
|
|
|
|
|
|
+smalltalk.addMethod(
|
|
|
+smalltalk.method({
|
|
|
+selector: "testFirst",
|
|
|
+category: 'tests',
|
|
|
+fn: function (){
|
|
|
+var self=this;
|
|
|
+var array;
|
|
|
+return smalltalk.withContext(function($ctx1) {
|
|
|
+array=[(1), (2), (3), (4), (5)];
|
|
|
+self._assert_(_st(_st(array)._first()).__eq(_st(array)._at_((1))));
|
|
|
+return self}, function($ctx1) {$ctx1.fill(self,"testFirst",{array:array},smalltalk.ArrayTest)})},
|
|
|
+args: [],
|
|
|
+source: "testFirst\x0a\x09|array|\x0a\x09array := #(1 2 3 4 5).\x0a\x09self assert: (array first) = (array at:1)",
|
|
|
+messageSends: ["assert:", "=", "first", "at:"],
|
|
|
+referencedClasses: []
|
|
|
+}),
|
|
|
+smalltalk.ArrayTest);
|
|
|
+
|
|
|
smalltalk.addMethod(
|
|
|
smalltalk.method({
|
|
|
selector: "testFirstN",
|
|
@@ -2057,6 +2111,24 @@ referencedClasses: []
|
|
|
}),
|
|
|
smalltalk.ArrayTest);
|
|
|
|
|
|
+smalltalk.addMethod(
|
|
|
+smalltalk.method({
|
|
|
+selector: "testFourth",
|
|
|
+category: 'tests',
|
|
|
+fn: function (){
|
|
|
+var self=this;
|
|
|
+var array;
|
|
|
+return smalltalk.withContext(function($ctx1) {
|
|
|
+array=[(1), (2), (3), (4), (5)];
|
|
|
+self._assert_(_st(_st(array)._fourth()).__eq(_st(array)._at_((4))));
|
|
|
+return self}, function($ctx1) {$ctx1.fill(self,"testFourth",{array:array},smalltalk.ArrayTest)})},
|
|
|
+args: [],
|
|
|
+source: "testFourth\x0a\x09|array|\x0a\x09array := #(1 2 3 4 5).\x0a\x09self assert: (array fourth) = (array at:4)",
|
|
|
+messageSends: ["assert:", "=", "fourth", "at:"],
|
|
|
+referencedClasses: []
|
|
|
+}),
|
|
|
+smalltalk.ArrayTest);
|
|
|
+
|
|
|
smalltalk.addMethod(
|
|
|
smalltalk.method({
|
|
|
selector: "testIfEmpty",
|
|
@@ -2076,6 +2148,24 @@ referencedClasses: []
|
|
|
}),
|
|
|
smalltalk.ArrayTest);
|
|
|
|
|
|
+smalltalk.addMethod(
|
|
|
+smalltalk.method({
|
|
|
+selector: "testLast",
|
|
|
+category: 'tests',
|
|
|
+fn: function (){
|
|
|
+var self=this;
|
|
|
+var array;
|
|
|
+return smalltalk.withContext(function($ctx1) {
|
|
|
+array=[(1), (2), (3), (4), (5)];
|
|
|
+self._assert_(_st(_st(array)._last()).__eq(_st(array)._at_((5))));
|
|
|
+return self}, function($ctx1) {$ctx1.fill(self,"testLast",{array:array},smalltalk.ArrayTest)})},
|
|
|
+args: [],
|
|
|
+source: "testLast\x0a\x09|array|\x0a\x09array := #(1 2 3 4 5).\x0a\x09self assert: (array last) = (array at:5)",
|
|
|
+messageSends: ["assert:", "=", "last", "at:"],
|
|
|
+referencedClasses: []
|
|
|
+}),
|
|
|
+smalltalk.ArrayTest);
|
|
|
+
|
|
|
smalltalk.addMethod(
|
|
|
smalltalk.method({
|
|
|
selector: "testPrintString",
|
|
@@ -2110,6 +2200,30 @@ referencedClasses: ["Array"]
|
|
|
}),
|
|
|
smalltalk.ArrayTest);
|
|
|
|
|
|
+smalltalk.addMethod(
|
|
|
+smalltalk.method({
|
|
|
+selector: "testRemove",
|
|
|
+category: 'tests',
|
|
|
+fn: function (){
|
|
|
+var self=this;
|
|
|
+var array;
|
|
|
+function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
|
|
|
+return smalltalk.withContext(function($ctx1) {
|
|
|
+array=[(1), (2), (3), (4), (5)];
|
|
|
+_st(array)._remove_((3));
|
|
|
+self._assert_equals_(array,[(1), (2), (4), (5)]);
|
|
|
+self._should_raise_((function(){
|
|
|
+return smalltalk.withContext(function($ctx2) {
|
|
|
+return _st(array)._remove_((3));
|
|
|
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
|
|
|
+return self}, function($ctx1) {$ctx1.fill(self,"testRemove",{array:array},smalltalk.ArrayTest)})},
|
|
|
+args: [],
|
|
|
+source: "testRemove \x0a\x09|array|\x0a\x09array := #(1 2 3 4 5). \x0a\x09array remove:3.\x0a\x09self assert: array equals: #(1 2 4 5).\x0a\x09self should: [array remove:3] raise: Error.",
|
|
|
+messageSends: ["remove:", "assert:equals:", "should:raise:"],
|
|
|
+referencedClasses: ["Error"]
|
|
|
+}),
|
|
|
+smalltalk.ArrayTest);
|
|
|
+
|
|
|
smalltalk.addMethod(
|
|
|
smalltalk.method({
|
|
|
selector: "testRemoveFromTo",
|
|
@@ -2146,6 +2260,100 @@ referencedClasses: []
|
|
|
}),
|
|
|
smalltalk.ArrayTest);
|
|
|
|
|
|
+smalltalk.addMethod(
|
|
|
+smalltalk.method({
|
|
|
+selector: "testRemoveLast",
|
|
|
+category: 'tests',
|
|
|
+fn: function (){
|
|
|
+var self=this;
|
|
|
+var array;
|
|
|
+return smalltalk.withContext(function($ctx1) {
|
|
|
+array=[(1), (2)];
|
|
|
+_st(array)._removeLast();
|
|
|
+self._assert_(_st(_st(array)._last()).__eq((1)));
|
|
|
+return self}, function($ctx1) {$ctx1.fill(self,"testRemoveLast",{array:array},smalltalk.ArrayTest)})},
|
|
|
+args: [],
|
|
|
+source: "testRemoveLast \x0a\x09|array|\x0a\x09array := #(1 2). \x0a\x09array removeLast.\x0a\x09self assert: array last = 1.",
|
|
|
+messageSends: ["removeLast", "assert:", "=", "last"],
|
|
|
+referencedClasses: []
|
|
|
+}),
|
|
|
+smalltalk.ArrayTest);
|
|
|
+
|
|
|
+smalltalk.addMethod(
|
|
|
+smalltalk.method({
|
|
|
+selector: "testReversed",
|
|
|
+category: 'tests',
|
|
|
+fn: function (){
|
|
|
+var self=this;
|
|
|
+var array;
|
|
|
+return smalltalk.withContext(function($ctx1) {
|
|
|
+array=[(5), (4), (3), (2), (1)];
|
|
|
+self._assert_equals_(_st(array)._reversed(),[(1), (2), (3), (4), (5)]);
|
|
|
+return self}, function($ctx1) {$ctx1.fill(self,"testReversed",{array:array},smalltalk.ArrayTest)})},
|
|
|
+args: [],
|
|
|
+source: "testReversed\x0a\x09|array|\x0a\x09array := #(5 4 3 2 1). \x0a\x09self assert: (array reversed) equals: #(1 2 3 4 5)",
|
|
|
+messageSends: ["assert:equals:", "reversed"],
|
|
|
+referencedClasses: []
|
|
|
+}),
|
|
|
+smalltalk.ArrayTest);
|
|
|
+
|
|
|
+smalltalk.addMethod(
|
|
|
+smalltalk.method({
|
|
|
+selector: "testSize",
|
|
|
+category: 'tests',
|
|
|
+fn: function (){
|
|
|
+var self=this;
|
|
|
+var array;
|
|
|
+function $Array(){return smalltalk.Array||(typeof Array=="undefined"?nil:Array)}
|
|
|
+return smalltalk.withContext(function($ctx1) {
|
|
|
+array=["hello", "world"];
|
|
|
+self._assert_(_st(_st(array)._size()).__eq((2)));
|
|
|
+self._assert_(_st(_st(_st($Array())._new())._size()).__eq((0)));
|
|
|
+return self}, function($ctx1) {$ctx1.fill(self,"testSize",{array:array},smalltalk.ArrayTest)})},
|
|
|
+args: [],
|
|
|
+source: "testSize\x0a\x09\x09| array | \x0a\x09\x09array := #('hello' 'world'). \x0a\x09\x09self assert: array size = 2. \x0a\x09\x09self assert: Array new size = 0.",
|
|
|
+messageSends: ["assert:", "=", "size", "new"],
|
|
|
+referencedClasses: ["Array"]
|
|
|
+}),
|
|
|
+smalltalk.ArrayTest);
|
|
|
+
|
|
|
+smalltalk.addMethod(
|
|
|
+smalltalk.method({
|
|
|
+selector: "testSort",
|
|
|
+category: 'tests',
|
|
|
+fn: function (){
|
|
|
+var self=this;
|
|
|
+var array;
|
|
|
+return smalltalk.withContext(function($ctx1) {
|
|
|
+array=[(3), (1), (4), (5), (2)];
|
|
|
+_st(array)._sort();
|
|
|
+self._assert_equals_(array,[(1), (2), (3), (4), (5)]);
|
|
|
+return self}, function($ctx1) {$ctx1.fill(self,"testSort",{array:array},smalltalk.ArrayTest)})},
|
|
|
+args: [],
|
|
|
+source: "testSort\x0a\x09|array|\x0a\x09array := #(3 1 4 5 2). \x0a\x09array sort.\x0a\x09self assert: array equals: #(1 2 3 4 5)",
|
|
|
+messageSends: ["sort", "assert:equals:"],
|
|
|
+referencedClasses: []
|
|
|
+}),
|
|
|
+smalltalk.ArrayTest);
|
|
|
+
|
|
|
+smalltalk.addMethod(
|
|
|
+smalltalk.method({
|
|
|
+selector: "testThird",
|
|
|
+category: 'tests',
|
|
|
+fn: function (){
|
|
|
+var self=this;
|
|
|
+var array;
|
|
|
+return smalltalk.withContext(function($ctx1) {
|
|
|
+array=[(1), (2), (3), (4), (5)];
|
|
|
+self._assert_(_st(_st(array)._third()).__eq(_st(array)._at_((3))));
|
|
|
+return self}, function($ctx1) {$ctx1.fill(self,"testThird",{array:array},smalltalk.ArrayTest)})},
|
|
|
+args: [],
|
|
|
+source: "testThird\x0a\x09|array|\x0a\x09array := #(1 2 3 4 5).\x0a\x09self assert: (array third) = (array at:3)",
|
|
|
+messageSends: ["assert:", "=", "third", "at:"],
|
|
|
+referencedClasses: []
|
|
|
+}),
|
|
|
+smalltalk.ArrayTest);
|
|
|
+
|
|
|
|
|
|
smalltalk.addMethod(
|
|
|
smalltalk.method({
|
|
@@ -2240,6 +2448,22 @@ referencedClasses: []
|
|
|
}),
|
|
|
smalltalk.StringTest);
|
|
|
|
|
|
+smalltalk.addMethod(
|
|
|
+smalltalk.method({
|
|
|
+selector: "testAsLowerCase",
|
|
|
+category: 'tests',
|
|
|
+fn: function (){
|
|
|
+var self=this;
|
|
|
+return smalltalk.withContext(function($ctx1) {
|
|
|
+self._assert_equals_("JACKIE"._asLowercase(),"jackie");
|
|
|
+return self}, function($ctx1) {$ctx1.fill(self,"testAsLowerCase",{},smalltalk.StringTest)})},
|
|
|
+args: [],
|
|
|
+source: "testAsLowerCase\x0a\x09self assert: 'JACKIE' asLowercase equals: 'jackie'.",
|
|
|
+messageSends: ["assert:equals:", "asLowercase"],
|
|
|
+referencedClasses: []
|
|
|
+}),
|
|
|
+smalltalk.StringTest);
|
|
|
+
|
|
|
smalltalk.addMethod(
|
|
|
smalltalk.method({
|
|
|
selector: "testAsNumber",
|
|
@@ -2258,6 +2482,42 @@ referencedClasses: []
|
|
|
}),
|
|
|
smalltalk.StringTest);
|
|
|
|
|
|
+smalltalk.addMethod(
|
|
|
+smalltalk.method({
|
|
|
+selector: "testAsUpperCase",
|
|
|
+category: 'tests',
|
|
|
+fn: function (){
|
|
|
+var self=this;
|
|
|
+return smalltalk.withContext(function($ctx1) {
|
|
|
+self._assert_equals_("jackie"._asUppercase(),"JACKIE");
|
|
|
+return self}, function($ctx1) {$ctx1.fill(self,"testAsUpperCase",{},smalltalk.StringTest)})},
|
|
|
+args: [],
|
|
|
+source: "testAsUpperCase\x0a\x09self assert: 'jackie' asUppercase equals: 'JACKIE'.",
|
|
|
+messageSends: ["assert:equals:", "asUppercase"],
|
|
|
+referencedClasses: []
|
|
|
+}),
|
|
|
+smalltalk.StringTest);
|
|
|
+
|
|
|
+smalltalk.addMethod(
|
|
|
+smalltalk.method({
|
|
|
+selector: "testAsciiValue",
|
|
|
+category: 'tests',
|
|
|
+fn: function (){
|
|
|
+var self=this;
|
|
|
+var characterA,characterU;
|
|
|
+return smalltalk.withContext(function($ctx1) {
|
|
|
+characterA="A";
|
|
|
+characterU="U";
|
|
|
+self._assert_equals_(_st(characterA)._asciiValue(),(65));
|
|
|
+self._assert_equals_(_st(characterU)._asciiValue(),(85));
|
|
|
+return self}, function($ctx1) {$ctx1.fill(self,"testAsciiValue",{characterA:characterA,characterU:characterU},smalltalk.StringTest)})},
|
|
|
+args: [],
|
|
|
+source: "testAsciiValue\x0a |characterA characterU|\x0a characterA := 'A'.\x0a characterU := 'U'.\x0a self assert: (characterA asciiValue) equals:65.\x0a self assert: (characterU asciiValue) equals:85",
|
|
|
+messageSends: ["assert:equals:", "asciiValue"],
|
|
|
+referencedClasses: []
|
|
|
+}),
|
|
|
+smalltalk.StringTest);
|
|
|
+
|
|
|
smalltalk.addMethod(
|
|
|
smalltalk.method({
|
|
|
selector: "testAt",
|
|
@@ -2319,6 +2579,29 @@ referencedClasses: []
|
|
|
}),
|
|
|
smalltalk.StringTest);
|
|
|
|
|
|
+smalltalk.addMethod(
|
|
|
+smalltalk.method({
|
|
|
+selector: "testCharCodeAt",
|
|
|
+category: 'tests',
|
|
|
+fn: function (){
|
|
|
+var self=this;
|
|
|
+var s;
|
|
|
+return smalltalk.withContext(function($ctx1) {
|
|
|
+s="jackie";
|
|
|
+self._assert_equals_("jackie"._charCodeAt_((1)),(106));
|
|
|
+self._assert_equals_("jackie"._charCodeAt_((2)),(97));
|
|
|
+self._assert_equals_("jackie"._charCodeAt_((3)),(99));
|
|
|
+self._assert_equals_("jackie"._charCodeAt_((4)),(107));
|
|
|
+self._assert_equals_("jackie"._charCodeAt_((5)),(105));
|
|
|
+self._assert_equals_("jackie"._charCodeAt_((6)),(101));
|
|
|
+return self}, function($ctx1) {$ctx1.fill(self,"testCharCodeAt",{s:s},smalltalk.StringTest)})},
|
|
|
+args: [],
|
|
|
+source: "testCharCodeAt\x0a\x09|s|\x0a\x09s := 'jackie'.\x0a\x09self assert: ('jackie' charCodeAt:1) equals: 106.\x0a\x09self assert: ('jackie' charCodeAt:2) equals: 97.\x0a\x09self assert: ('jackie' charCodeAt:3) equals: 99.\x0a\x09self assert: ('jackie' charCodeAt:4) equals: 107.\x0a\x09self assert: ('jackie' charCodeAt:5) equals: 105.\x0a\x09self assert: ('jackie' charCodeAt:6) equals: 101.",
|
|
|
+messageSends: ["assert:equals:", "charCodeAt:"],
|
|
|
+referencedClasses: []
|
|
|
+}),
|
|
|
+smalltalk.StringTest);
|
|
|
+
|
|
|
smalltalk.addMethod(
|
|
|
smalltalk.method({
|
|
|
selector: "testCollect",
|
|
@@ -2340,6 +2623,23 @@ referencedClasses: []
|
|
|
}),
|
|
|
smalltalk.StringTest);
|
|
|
|
|
|
+smalltalk.addMethod(
|
|
|
+smalltalk.method({
|
|
|
+selector: "testCopyFromTo",
|
|
|
+category: 'tests',
|
|
|
+fn: function (){
|
|
|
+var self=this;
|
|
|
+return smalltalk.withContext(function($ctx1) {
|
|
|
+self._assert_equals_("jackie"._copyFrom_to_((1),(3)),"jac");
|
|
|
+self._assert_equals_("jackie"._copyFrom_to_((4),(6)),"kie");
|
|
|
+return self}, function($ctx1) {$ctx1.fill(self,"testCopyFromTo",{},smalltalk.StringTest)})},
|
|
|
+args: [],
|
|
|
+source: "testCopyFromTo\x0a\x09self assert: ('jackie' copyFrom: 1 to: 3) equals: 'jac'.\x0a\x09self assert: ('jackie' copyFrom: 4 to: 6) equals: 'kie'.",
|
|
|
+messageSends: ["assert:equals:", "copyFrom:to:"],
|
|
|
+referencedClasses: []
|
|
|
+}),
|
|
|
+smalltalk.StringTest);
|
|
|
+
|
|
|
smalltalk.addMethod(
|
|
|
smalltalk.method({
|
|
|
selector: "testCopyWithoutAll",
|
|
@@ -2485,6 +2785,26 @@ referencedClasses: ["Error"]
|
|
|
}),
|
|
|
smalltalk.StringTest);
|
|
|
|
|
|
+smalltalk.addMethod(
|
|
|
+smalltalk.method({
|
|
|
+selector: "testIsVowel",
|
|
|
+category: 'tests',
|
|
|
+fn: function (){
|
|
|
+var self=this;
|
|
|
+var vowel,consonant;
|
|
|
+return smalltalk.withContext(function($ctx1) {
|
|
|
+vowel="u";
|
|
|
+consonant="z";
|
|
|
+self._assert_equals_(_st(vowel)._isVowel(),true);
|
|
|
+self._assert_equals_(_st(consonant)._isVowel(),false);
|
|
|
+return self}, function($ctx1) {$ctx1.fill(self,"testIsVowel",{vowel:vowel,consonant:consonant},smalltalk.StringTest)})},
|
|
|
+args: [],
|
|
|
+source: "testIsVowel\x0a |vowel consonant|\x0a vowel := 'u'.\x0a consonant := 'z'.\x0a self assert: vowel isVowel equals: true.\x0a self assert: consonant isVowel equals: false",
|
|
|
+messageSends: ["assert:equals:", "isVowel"],
|
|
|
+referencedClasses: []
|
|
|
+}),
|
|
|
+smalltalk.StringTest);
|
|
|
+
|
|
|
smalltalk.addMethod(
|
|
|
smalltalk.method({
|
|
|
selector: "testJoin",
|
|
@@ -2501,6 +2821,22 @@ referencedClasses: []
|
|
|
}),
|
|
|
smalltalk.StringTest);
|
|
|
|
|
|
+smalltalk.addMethod(
|
|
|
+smalltalk.method({
|
|
|
+selector: "testReversed",
|
|
|
+category: 'tests',
|
|
|
+fn: function (){
|
|
|
+var self=this;
|
|
|
+return smalltalk.withContext(function($ctx1) {
|
|
|
+self._assert_equals_("jackiechan"._reversed(),"nahceikcaj");
|
|
|
+return self}, function($ctx1) {$ctx1.fill(self,"testReversed",{},smalltalk.StringTest)})},
|
|
|
+args: [],
|
|
|
+source: "testReversed\x0a\x09self assert: 'jackiechan' reversed equals: 'nahceikcaj'.",
|
|
|
+messageSends: ["assert:equals:", "reversed"],
|
|
|
+referencedClasses: []
|
|
|
+}),
|
|
|
+smalltalk.StringTest);
|
|
|
+
|
|
|
smalltalk.addMethod(
|
|
|
smalltalk.method({
|
|
|
selector: "testSelect",
|
|
@@ -2564,6 +2900,39 @@ referencedClasses: ["String"]
|
|
|
}),
|
|
|
smalltalk.StringTest);
|
|
|
|
|
|
+smalltalk.addMethod(
|
|
|
+smalltalk.method({
|
|
|
+selector: "testSubStrings",
|
|
|
+category: 'tests',
|
|
|
+fn: function (){
|
|
|
+var self=this;
|
|
|
+return smalltalk.withContext(function($ctx1) {
|
|
|
+self._assert_equals_("jackiechan"._subStrings_("ie"),["jack", "chan"]);
|
|
|
+return self}, function($ctx1) {$ctx1.fill(self,"testSubStrings",{},smalltalk.StringTest)})},
|
|
|
+args: [],
|
|
|
+source: "testSubStrings\x0a\x09self assert: ('jackiechan' subStrings: 'ie') equals: #( 'jack' 'chan' ).",
|
|
|
+messageSends: ["assert:equals:", "subStrings:"],
|
|
|
+referencedClasses: []
|
|
|
+}),
|
|
|
+smalltalk.StringTest);
|
|
|
+
|
|
|
+smalltalk.addMethod(
|
|
|
+smalltalk.method({
|
|
|
+selector: "testTrim",
|
|
|
+category: 'tests',
|
|
|
+fn: function (){
|
|
|
+var self=this;
|
|
|
+return smalltalk.withContext(function($ctx1) {
|
|
|
+self._assert_equals_(" jackie"._trimLeft(),"jackie");
|
|
|
+self._assert_equals_("jackie "._trimRight(),"jackie");
|
|
|
+return self}, function($ctx1) {$ctx1.fill(self,"testTrim",{},smalltalk.StringTest)})},
|
|
|
+args: [],
|
|
|
+source: "testTrim\x0a\x09self assert: ' jackie' trimLeft equals: 'jackie'.\x0a\x09self assert: 'jackie ' trimRight equals: 'jackie'.",
|
|
|
+messageSends: ["assert:equals:", "trimLeft", "trimRight"],
|
|
|
+referencedClasses: []
|
|
|
+}),
|
|
|
+smalltalk.StringTest);
|
|
|
+
|
|
|
|
|
|
smalltalk.addMethod(
|
|
|
smalltalk.method({
|
|
@@ -4521,6 +4890,26 @@ referencedClasses: []
|
|
|
}),
|
|
|
smalltalk.PointTest);
|
|
|
|
|
|
+smalltalk.addMethod(
|
|
|
+smalltalk.method({
|
|
|
+selector: "testNew",
|
|
|
+category: 'tests',
|
|
|
+fn: function (){
|
|
|
+var self=this;
|
|
|
+function $Point(){return smalltalk.Point||(typeof Point=="undefined"?nil:Point)}
|
|
|
+return smalltalk.withContext(function($ctx1) {
|
|
|
+self._assert_equals_(_st(_st(_st($Point())._new())._x_((3)))._y(),nil);
|
|
|
+self._deny_(_st(_st(_st(_st($Point())._new())._x_((3)))._x()).__eq((0)));
|
|
|
+self._assert_equals_(_st(_st(_st($Point())._new())._y_((4)))._x(),nil);
|
|
|
+self._deny_(_st(_st(_st(_st($Point())._new())._y_((4)))._y()).__eq((0)));
|
|
|
+return self}, function($ctx1) {$ctx1.fill(self,"testNew",{},smalltalk.PointTest)})},
|
|
|
+args: [],
|
|
|
+source: "testNew\x0a\x0a\x09self assert: (Point new x: 3)y equals: nil.\x0a\x09self deny: (Point new x: 3)x = 0.\x0a\x09self assert: (Point new y: 4)x equals: nil.\x0a\x09self deny: (Point new y: 4)y = 0.",
|
|
|
+messageSends: ["assert:equals:", "y", "x:", "new", "deny:", "=", "x", "y:"],
|
|
|
+referencedClasses: ["Point"]
|
|
|
+}),
|
|
|
+smalltalk.PointTest);
|
|
|
+
|
|
|
smalltalk.addMethod(
|
|
|
smalltalk.method({
|
|
|
selector: "testTranslateBy",
|
|
@@ -4542,7 +4931,89 @@ smalltalk.PointTest);
|
|
|
|
|
|
|
|
|
|
|
|
+smalltalk.addClass('QueueTest', smalltalk.TestCase, [], 'Kernel-Tests');
|
|
|
+smalltalk.addMethod(
|
|
|
+smalltalk.method({
|
|
|
+selector: "testNextIfAbsent",
|
|
|
+category: 'not yet classified',
|
|
|
+fn: function (){
|
|
|
+var self=this;
|
|
|
+var queueVal;
|
|
|
+function $Queue(){return smalltalk.Queue||(typeof Queue=="undefined"?nil:Queue)}
|
|
|
+return smalltalk.withContext(function($ctx1) {
|
|
|
+queueVal=_st($Queue())._new();
|
|
|
+_st(queueVal)._nextPut_("index1");
|
|
|
+self._assert_(_st(_st(queueVal)._nextIfAbsent_("empty")).__eq("index1"));
|
|
|
+self._deny_(_st(_st(queueVal)._nextIfAbsent_("empty")).__eq("index1"));
|
|
|
+return self}, function($ctx1) {$ctx1.fill(self,"testNextIfAbsent",{queueVal:queueVal},smalltalk.QueueTest)})},
|
|
|
+args: [],
|
|
|
+source: "testNextIfAbsent\x0a\x09| queueVal | \x0a\x0a\x09queueVal:= Queue new.\x0a\x09queueVal nextPut: 'index1'. \x0a\x0a\x09self assert: (queueVal nextIfAbsent:'empty') = 'index1'.\x0a\x09self deny: (queueVal nextIfAbsent:'empty') = 'index1'.",
|
|
|
+messageSends: ["new", "nextPut:", "assert:", "=", "nextIfAbsent:", "deny:"],
|
|
|
+referencedClasses: ["Queue"]
|
|
|
+}),
|
|
|
+smalltalk.QueueTest);
|
|
|
+
|
|
|
+smalltalk.addMethod(
|
|
|
+smalltalk.method({
|
|
|
+selector: "testQueueNext",
|
|
|
+category: 'not yet classified',
|
|
|
+fn: function (){
|
|
|
+var self=this;
|
|
|
+var collec;
|
|
|
+function $Queue(){return smalltalk.Queue||(typeof Queue=="undefined"?nil:Queue)}
|
|
|
+function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
|
|
|
+return smalltalk.withContext(function($ctx1) {
|
|
|
+var $1,$2;
|
|
|
+collec=_st($Queue())._new();
|
|
|
+$1=collec;
|
|
|
+_st($1)._nextPut_("index1");
|
|
|
+$2=_st($1)._nextPut_("index2");
|
|
|
+self._assert_(_st(_st(collec)._next()).__eq("index1"));
|
|
|
+self._deny_(_st(_st(collec)._next()).__eq("index"));
|
|
|
+self._should_raise_((function(){
|
|
|
+return smalltalk.withContext(function($ctx2) {
|
|
|
+return _st(collec)._next();
|
|
|
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
|
|
|
+return self}, function($ctx1) {$ctx1.fill(self,"testQueueNext",{collec:collec},smalltalk.QueueTest)})},
|
|
|
+args: [],
|
|
|
+source: "testQueueNext\x0a\x09| collec | \x0a\x0a\x09collec:= Queue new.\x0a\x09collec nextPut: 'index1' ;\x0a nextPut: 'index2' . \x0a\x0a\x09self assert: collec next = 'index1'.\x0a\x09self deny: collec next = 'index'.\x0a\x09self should:[ collec next ] raise: Error.",
|
|
|
+messageSends: ["new", "nextPut:", "assert:", "=", "next", "deny:", "should:raise:"],
|
|
|
+referencedClasses: ["Queue", "Error"]
|
|
|
+}),
|
|
|
+smalltalk.QueueTest);
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
smalltalk.addClass('RandomTest', smalltalk.TestCase, [], 'Kernel-Tests');
|
|
|
+smalltalk.addMethod(
|
|
|
+smalltalk.method({
|
|
|
+selector: "testAtRandom",
|
|
|
+category: 'tests',
|
|
|
+fn: function (){
|
|
|
+var self=this;
|
|
|
+var val;
|
|
|
+return smalltalk.withContext(function($ctx1) {
|
|
|
+(10000)._timesRepeat_((function(){
|
|
|
+return smalltalk.withContext(function($ctx2) {
|
|
|
+val="abc"._atRandom();
|
|
|
+val;
|
|
|
+return self._assert_(_st(_st(_st(val).__eq("a")).__or(_st(val).__eq("b"))).__or(_st(val).__eq("c")));
|
|
|
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
|
|
|
+(10000)._timesRepeat_((function(){
|
|
|
+return smalltalk.withContext(function($ctx2) {
|
|
|
+val=(10)._atRandom();
|
|
|
+val;
|
|
|
+self._assert_(_st(val).__gt((0)));
|
|
|
+return self._assert_(_st(val).__lt((11)));
|
|
|
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
|
|
|
+return self}, function($ctx1) {$ctx1.fill(self,"testAtRandom",{val:val},smalltalk.RandomTest)})},
|
|
|
+args: [],
|
|
|
+source: "testAtRandom\x0a|val|\x0a\x0910000 timesRepeat: [\x0a\x09val := 'abc' atRandom.\x0a\x09self assert: ((val = 'a') | (val = 'b') | (val = 'c' )).\x0a\x09].\x0a\x09\x0a\x0910000 timesRepeat: [\x0a\x09\x09val := 10 atRandom.\x0a\x09\x09self assert: (val > 0).\x0a\x09\x09self assert: (val <11)\x0a\x09]",
|
|
|
+messageSends: ["timesRepeat:", "atRandom", "assert:", "|", "=", ">", "<"],
|
|
|
+referencedClasses: []
|
|
|
+}),
|
|
|
+smalltalk.RandomTest);
|
|
|
+
|
|
|
smalltalk.addMethod(
|
|
|
smalltalk.method({
|
|
|
selector: "textNext",
|