regression fixes (was: Re: 'Path' implementation)

Pavel Holejsovsky pavel.holejsovsky at upek.com
Thu Sep 9 09:20:37 PDT 2004


Hi lee,

Lee Salzman wrote:
> I committed a small iterator/stream fix that ensures pastEndPut: uses
> addLast: on any ExtensibleSequence. Hope this helps.

yes this fixes the problem, thanks a lot (except small typo, see 
attached patch for it).

I can confirm that your collection-hash fixes also work well, now hash 
behaves as I would expect :-)

I also whipped up small regression tests for all these fixes (see 
another attached patch).  These tests failed before, now they all pass. 
  Great!

BTW: I found another small little oddity;
 > 0 clone.
will crash my vm in 100% cases. When I define:
i@(SmallInteger) clone [i].
the crash is gone and I believe that the behaviour is as expected.  But 
I'm not sure if this is the right fix and if it is, where this method 
should be defined.

OK, the final problem for me is that I'm not able to bootstrap... 
Bootstrapped vm always crashes, when compiled with debug information, I 
can see:

assertion "PSObjectHeap_includes_(oh, (unsigned long int) 
ObjectPointer_pointer(*root))" failed: file "test01.c", line 714

(gdb) bt
#0  0x0040a4d0 in __assert ()
#1  0x0040901c in PSObjectHeap_rootStackPush_ (oh=0x229f50, 
root=0x229f70) at test01.c:714
#2  0x00401abd in PSObjectHeap_initializeWithShift_ (h=0x229f50, 
shiftAmountInBytes=6815752)
     at test01.c:1248
#3  0x00401371 in main (argc=2, argv=0xa055108) at 
src/mobius/vm/platform/boot.c:93

Is it just me, or others are hit by it too? BTW, this is on cygwin 
1.5.11, compiled by gcc-3.3.3; vm's from downloads/alpha compiled and 
run by the same environment work well...

thanks
Pavel

-------------- next part --------------
Index: src/lib/iterator.slate
===================================================================
RCS file: /var/lib/cvs/slate/slate/src/lib/iterator.slate,v
retrieving revision 1.3
diff -u -r1.3 iterator.slate
--- src/lib/iterator.slate	8 Sep 2004 19:02:27 -0000	1.3
+++ src/lib/iterator.slate	9 Sep 2004 16:07:27 -0000
@@ -513,7 +513,7 @@
   obj
 ].
 
-ExtensibleSequence traints addPrototype: #ReadWriteStream
+ExtensibleSequence traits addPrototype: #ReadWriteStream
   derivedFrom: {ExtensibleSequence WriteStream. ExtensibleSequence ReadStream}.
 
 prototypes addPrototype: #LineNumberedStream derivedFrom: {Sequence ReadStream}.
-------------- next part --------------
Index: tests/init.slate
===================================================================
RCS file: /var/lib/cvs/slate/slate/tests/init.slate,v
retrieving revision 1.2
diff -u -r1.2 init.slate
--- tests/init.slate	3 Aug 2004 01:57:19 -0000	1.2
+++ tests/init.slate	9 Sep 2004 16:05:43 -0000
@@ -1,10 +1,13 @@
 load: 'src/lib/test.slate'.
 load: 'src/lib/tokenizer.slate'.
 load: 'src/lib/matrix.slate'.
+load: 'src/lib/path.slate'.
 
 load: 'tests/regression/wordcount.slate'.
+load: 'tests/regression/20040909.slate'.
 load: 'tests/dictionary.slate'.
 load: 'tests/numeric.slate'.
 load: 'tests/matrix.slate'.
 load: 'tests/range.slate'.
+load: 'tests/path.slate'.
 load: 'tests/test.slate'.

--- /dev/null	2004-09-09 18:06:38.972000000 +0200
+++ tests/regression/20040909.slate	2004-09-09 17:15:12.807345500 +0200
@@ -0,0 +1,71 @@
+RegressionTests addPrototype: #CollectionHash derivedFrom: {TestCase}.
+"Checks whether hash value for collections with same elements is equal."
+
+t@(RegressionTests CollectionHash traits) testCollection: c1 against: c2
+[
+  t assert: c1 = c2
+    description: c1 print ; ' and ' ; c2 print ; ' are not equal.'.
+  t assert: c1 hash = c2 hash
+    description: c1 print ; ' and ' ; c2 print ; ' hashes differ.'
+].
+
+t@(RegressionTests CollectionHash traits) testCollection
+[| c1 c2 |
+  c1: (Set newWith: #a).
+  c2: (Set newWith: #a).
+  t testCollection: c1 against: c2.
+  
+  { 1. 16r10000000. #a. 'string'. {0. 2}. Set. 0. 2. 3. 4. 5. 6. 7. 8.
+    9. 10. 11. 12. 13. 14. 15. 16. 17. 18. 19. 20 } do: 
+    [| :e | c1 include: e. c2 include: e].
+  t testCollection: c1 against: c2
+].
+
+t@(RegressionTests CollectionHash traits) testSequence
+[| s1 s2 |
+  s1: {0. 1. 2. #a. 'foo'}.
+  s2: {0. 1. 2. #a. 'foo'}.
+  t testCollection: s1 against: s2.
+
+  s1: (s1 as: ExtensibleArray).
+  s2: (s2 as: ExtensibleArray).
+  s1 addAll: {{}. #k. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0}.
+  s2 addAll: {{}. #k. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0}.
+  t testCollection: s1 against: s2.
+].
+
+t@(RegressionTests CollectionHash traits) suite
+[| suite |
+  suite: TestSuite newEmpty.
+  suite tests
+    addAll:
+      {
+        t newForSelector: #testCollection.
+        t newForSelector: #testSequence
+      }.
+  suite
+].
+
+RegressionTests addPrototype: #ExtSeqWriter derivedFrom: {TestCase}.
+"Checks whether writer iterator of ExtensibleSequence is actually able to
+extend the sequence."
+
+t@(RegressionTests ExtSeqWriter traits) testWriting
+[| s w |
+  s: ExtensibleArray newEmpty.
+  w: s writer.
+  w ; {#a. 0. {}. lobby}.
+  t assert: w contents = s.
+  t assert: s size = 4
+].
+
+t@(RegressionTests ExtSeqWriter traits) suite
+[| suite |
+  suite: TestSuite newEmpty.
+  suite tests
+    addAll:
+      {
+        t newForSelector: #testWriting
+      }.
+  suite
+].


More information about the Slate mailing list