Die Suche ergab 34 Treffer

von m.hosseinian
5. Mai 2015 11:40
Forum: Archiv
Thema: problem with testing Filter function
Antworten: 8
Zugriffe: 616

Re: problem with testing Filter function

Hi, I have implemented filter function for IntSet class (using union function, it is also used in intersect function, and working well) but when I run the test file it complains about it, yielding: {1,2,3,4}.filter {x -> even(x) } - should return {2,4} *** FAILED *** 2 4 did not equal 2 4 (TreeSets...
von m.hosseinian
4. Mai 2015 23:02
Forum: Archiv
Thema: problem with testing Filter function
Antworten: 8
Zugriffe: 616

Re: problem with testing Filter function

Yes, I see the ordered implementation requirement, but notice: A: NonEmpty = { elem: Int = 2 left: IntSet = Empty right: IntSet = new NonEmpty(4, Empty, Empty) } and B: NonEmpty = { elem: Int = 4 left: IntSet = new NonEmpty(2, Empty, Empty) right: IntSet = Empty } both preserves the binary tree prin...
von m.hosseinian
4. Mai 2015 11:22
Forum: Archiv
Thema: problem with testing Filter function
Antworten: 8
Zugriffe: 616

Re: problem with testing Filter function

the problem is that the test case is expecting that elements are included in the same order it preserves, which is irrelevant according Set Theory, {2, 4} = {4, 2}
if .toString() is included to each side of equality it passes. Isn't it a better idea to change the tests this way?
von m.hosseinian
3. Mai 2015 21:41
Forum: Archiv
Thema: problem with testing Filter function
Antworten: 8
Zugriffe: 616

problem with testing Filter function

Hi, I have implemented filter function for IntSet class (using union function, it is also used in intersect function, and working well) but when I run the test file it complains about it, yielding: {1,2,3,4}.filter {x -> even(x) } - should return {2,4} *** FAILED *** 2 4 did not equal 2 4 (TreeSetsT...

Zur erweiterten Suche