From 9fcd91afb91f3e7fb5911760de6f9827f3972caf Mon Sep 17 00:00:00 2001 From: Paul Schaub Date: Fri, 30 Jun 2023 18:06:58 +0200 Subject: [PATCH] Basic FingerprintTest --- .../wot/dijkstra/FingerprintTest.kt | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 wot-dijkstra/src/test/kotlin/org/pgpainless/wot/dijkstra/FingerprintTest.kt diff --git a/wot-dijkstra/src/test/kotlin/org/pgpainless/wot/dijkstra/FingerprintTest.kt b/wot-dijkstra/src/test/kotlin/org/pgpainless/wot/dijkstra/FingerprintTest.kt new file mode 100644 index 00000000..4959e512 --- /dev/null +++ b/wot-dijkstra/src/test/kotlin/org/pgpainless/wot/dijkstra/FingerprintTest.kt @@ -0,0 +1,30 @@ +package org.pgpainless.wot.dijkstra + +import org.junit.jupiter.api.Test +import org.pgpainless.wot.dijkstra.sq.Fingerprint +import kotlin.test.assertEquals +import kotlin.test.assertFalse + +class FingerprintTest { + + @Test + fun testConstructor() { + val finger1 = Fingerprint("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") + val finger2 = Fingerprint("AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA") + + assert(finger1 == finger2) + assertEquals("AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", finger1.fingerprint) + assertEquals(finger1.hashCode(), finger2.hashCode()) + } + + @Test + fun testEquals() { + val finger1 = Fingerprint("0000000000000000000000000000000000000000") + val finger2 = Fingerprint("1111111111111111111111111111111111111111") + + assertFalse { finger1.equals(null) } + assert(finger1 == finger1) + assert(finger1 != finger2) + assertFalse { finger1.equals("2222222222222222222222222222222222222222") } + } +} \ No newline at end of file