Skip to content

Commit

Permalink
test: verify different equal objects as keys
Browse files Browse the repository at this point in the history
  • Loading branch information
lppedd authored and ftomassetti committed Aug 29, 2024
1 parent 4a5fdbc commit 35cb21c
Showing 1 changed file with 16 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,22 @@ class IdentityHashMapTests {

prev = imap.remove(a)
assertEquals("two", prev)
assertTrue(imap.isEmpty())

val one = A("same")
val two = A("same")
val three = B("same")
assertEquals(one, two)
assertEquals<Any>(two, three)

imap[one] = "one"
imap[two] = "two"
imap[three] = "three"

assertEquals(3, imap.size)
assertEquals("one", imap[one])
assertEquals("two", imap[two])
assertEquals("three", imap[three])
}

@Test
Expand Down

0 comments on commit 35cb21c

Please sign in to comment.