Skip to content

Commit

Permalink
Added tests for equality of Value objects
Browse files Browse the repository at this point in the history
Doesn’t test ValueArray yet

Signed-off-by: Stefan Marr <git@stefan-marr.de>
  • Loading branch information
smarr committed Oct 7, 2016
1 parent b1f15f3 commit 9100758
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions TestSuite/LanguageTests.som
@@ -1,6 +1,7 @@
class LanguageTests usingPlatform: platform testFramework: minitest = Value (
| private TestContext = minitest TestContext.
private Array = platform kernel Array.
private ValueArray = platform kernel ValueArray.
private ObjectMirror = platform mirrors ObjectMirror.
private Set = platform collections Set.
private kernel = platform kernel.
Expand Down Expand Up @@ -371,6 +372,28 @@ class LanguageTests usingPlatform: platform testFramework: minitest = Value (
)
) : ( TEST_CONTEXT = () )

public class EqualsTests = TestContext <: Value ()(
public testEquals = (
| arr |
arr := Array new: 9.
arr at: 1 put: true.
arr at: 2 put: false.
arr at: 3 put: nil.
arr at: 4 put: 1.
arr at: 5 put: 1 << 70.
arr at: 6 put: 5.55555.
arr at: 7 put: 'foo'.
arr at: 8 put: #barr.
(* arr at: 9 put: (ValueArray new: 3 withAll: 1). *)

1 to: 8 do: [:i |
1 to: 8 do: [:j |
i = j
ifTrue: [ assert: (arr at: i) equals: (arr at: j) ]
ifFalse: [ deny: (arr at: i) = (arr at: j) ] ] ]
)
) : ( TEST_CONTEXT = () )

public class ValueTests = TestContext <: Value ()(
class Mutable new: obj = (
| public mut ::= obj. |
Expand Down

0 comments on commit 9100758

Please sign in to comment.