|
@@ -2576,6 +2576,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\x09\x0a\x09self assert: array equals: #(1 2 3 4 5 6).",
|
|
|
+messageSends: ["add:", "assert:equals:"],
|
|
|
+referencedClasses: []
|
|
|
+}),
|
|
|
+smalltalk.ArrayTest);
|
|
|
+
|
|
|
smalltalk.addMethod(
|
|
|
smalltalk.method({
|
|
|
selector: "testAddFirst",
|
|
@@ -2647,6 +2666,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_equals_(_st(array)._first(),_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) equals: (array at:1)",
|
|
|
+messageSends: ["assert:equals:", "first", "at:"],
|
|
|
+referencedClasses: []
|
|
|
+}),
|
|
|
+smalltalk.ArrayTest);
|
|
|
+
|
|
|
smalltalk.addMethod(
|
|
|
smalltalk.method({
|
|
|
selector: "testFirstN",
|
|
@@ -2663,6 +2700,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_equals_(_st(array)._fourth(),_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) equals: (array at:4)",
|
|
|
+messageSends: ["assert:equals:", "fourth", "at:"],
|
|
|
+referencedClasses: []
|
|
|
+}),
|
|
|
+smalltalk.ArrayTest);
|
|
|
+
|
|
|
smalltalk.addMethod(
|
|
|
smalltalk.method({
|
|
|
selector: "testIfEmpty",
|
|
@@ -2682,6 +2737,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_equals_(_st(array)._last(),_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\x09\x0a\x09self assert: (array last) equals: (array at:5)",
|
|
|
+messageSends: ["assert:equals:", "last", "at:"],
|
|
|
+referencedClasses: []
|
|
|
+}),
|
|
|
+smalltalk.ArrayTest);
|
|
|
+
|
|
|
smalltalk.addMethod(
|
|
|
smalltalk.method({
|
|
|
selector: "testPrintString",
|
|
@@ -2736,6 +2809,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\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",
|
|
@@ -2788,6 +2885,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_equals_(_st(array)._last(),(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\x09\x0a\x09self assert: array last equals: 1.",
|
|
|
+messageSends: ["removeLast", "assert:equals:", "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_equals_(_st(array)._size(),(2));
|
|
|
+self._assert_equals_(_st(_st($Array())._new())._size(),(0));
|
|
|
+return self}, function($ctx1) {$ctx1.fill(self,"testSize",{array:array},smalltalk.ArrayTest)})},
|
|
|
+args: [],
|
|
|
+source: "testSize\x0a\x09|array| \x0a\x09array := #('hello' 'world'). \x0a\x09\x0a\x09self assert: array size equals: 2. \x0a\x09self assert: Array new size equals: 0.",
|
|
|
+messageSends: ["assert:equals:", "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_equals_(_st(array)._third(),_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) equals: (array at:3)",
|
|
|
+messageSends: ["assert:equals:", "third", "at:"],
|
|
|
+referencedClasses: []
|
|
|
+}),
|
|
|
+smalltalk.ArrayTest);
|
|
|
+
|
|
|
|
|
|
smalltalk.addMethod(
|
|
|
smalltalk.method({
|
|
@@ -2884,6 +3075,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",
|
|
@@ -2910,6 +3117,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",
|
|
@@ -2990,6 +3233,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",
|
|
@@ -3011,6 +3277,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",
|
|
@@ -3215,6 +3498,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",
|
|
@@ -3231,6 +3534,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",
|
|
@@ -3300,6 +3619,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({
|
|
@@ -5790,6 +6142,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",
|
|
@@ -5848,7 +6220,105 @@ 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 queue;
|
|
|
+function $Queue(){return smalltalk.Queue||(typeof Queue=="undefined"?nil:Queue)}
|
|
|
+return smalltalk.withContext(function($ctx1) {
|
|
|
+queue=_st($Queue())._new();
|
|
|
+_st(queue)._nextPut_("index1");
|
|
|
+self._assert_(_st(_st(queue)._nextIfAbsent_("empty")).__eq("index1"));
|
|
|
+self._deny_(_st(_st(queue)._nextIfAbsent_("empty")).__eq("index1"));
|
|
|
+return self}, function($ctx1) {$ctx1.fill(self,"testNextIfAbsent",{queue:queue},smalltalk.QueueTest)})},
|
|
|
+args: [],
|
|
|
+source: "testNextIfAbsent\x0a\x09|queue|\x0a\x09queue:= Queue new.\x0a\x09queue nextPut: 'index1'. \x0a\x0a\x09self assert: (queue nextIfAbsent:'empty') = 'index1'.\x0a\x09self deny: (queue 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 queue;
|
|
|
+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;
|
|
|
+queue=_st($Queue())._new();
|
|
|
+$1=queue;
|
|
|
+_st($1)._nextPut_("index1");
|
|
|
+$2=_st($1)._nextPut_("index2");
|
|
|
+self._assert_(_st(_st(queue)._next()).__eq("index1"));
|
|
|
+self._deny_(_st(_st(queue)._next()).__eq("index"));
|
|
|
+self._should_raise_((function(){
|
|
|
+return smalltalk.withContext(function($ctx2) {
|
|
|
+return _st(queue)._next();
|
|
|
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
|
|
|
+return self}, function($ctx1) {$ctx1.fill(self,"testQueueNext",{queue:queue},smalltalk.QueueTest)})},
|
|
|
+args: [],
|
|
|
+source: "testQueueNext\x0a\x09|queue| \x0a\x09queue:= Queue new.\x0a\x09queue nextPut: 'index1' ;\x0a\x09nextPut: 'index2' . \x0a\x0a\x09self assert: queue next = 'index1'.\x0a\x09self deny: queue next = 'index'.\x0a\x09self should:[ queue 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: "testAtRandomNumber",
|
|
|
+category: 'tests',
|
|
|
+fn: function (){
|
|
|
+var self=this;
|
|
|
+var val;
|
|
|
+return smalltalk.withContext(function($ctx1) {
|
|
|
+(100)._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,1)})}));
|
|
|
+return self}, function($ctx1) {$ctx1.fill(self,"testAtRandomNumber",{val:val},smalltalk.RandomTest)})},
|
|
|
+args: [],
|
|
|
+source: "testAtRandomNumber\x0a\x09|val|\x09\x0a\x0a\x09100 timesRepeat: [\x0a\x09\x09val := 10 atRandom.\x09\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: "testAtRandomSequenceableCollection",
|
|
|
+category: 'tests',
|
|
|
+fn: function (){
|
|
|
+var self=this;
|
|
|
+var val;
|
|
|
+return smalltalk.withContext(function($ctx1) {
|
|
|
+(100)._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)})}));
|
|
|
+return self}, function($ctx1) {$ctx1.fill(self,"testAtRandomSequenceableCollection",{val:val},smalltalk.RandomTest)})},
|
|
|
+args: [],
|
|
|
+source: "testAtRandomSequenceableCollection\x0a\x09|val|\x0a\x09\x0a\x09100 timesRepeat: [\x0a\x09\x09val := 'abc' atRandom.\x0a\x09\x09self assert: ((val = 'a') | (val = 'b') | (val = 'c' )).\x0a\x09].",
|
|
|
+messageSends: ["timesRepeat:", "atRandom", "assert:", "|", "="],
|
|
|
+referencedClasses: []
|
|
|
+}),
|
|
|
+smalltalk.RandomTest);
|
|
|
+
|
|
|
smalltalk.addMethod(
|
|
|
smalltalk.method({
|
|
|
selector: "textNext",
|