gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] [libeufin] branch master updated: Test simulating keys comp


From: gnunet
Subject: [GNUnet-SVN] [libeufin] branch master updated: Test simulating keys comparison.
Date: Thu, 24 Oct 2019 18:01:33 +0200

This is an automated email from the git hooks/post-receive script.

marcello pushed a commit to branch master
in repository libeufin.

The following commit(s) were added to refs/heads/master by this push:
     new 7c5040b  Test simulating keys comparison.
7c5040b is described below

commit 7c5040b810fcabc5229f1583922023b368fb6348
Author: Marcello Stanisci <address@hidden>
AuthorDate: Thu Oct 24 18:01:14 2019 +0200

    Test simulating keys comparison.
---
 sandbox/src/test/kotlin/KeyCmpTest.kt | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

diff --git a/sandbox/src/test/kotlin/KeyCmpTest.kt 
b/sandbox/src/test/kotlin/KeyCmpTest.kt
new file mode 100644
index 0000000..10a799a
--- /dev/null
+++ b/sandbox/src/test/kotlin/KeyCmpTest.kt
@@ -0,0 +1,24 @@
+package tech.libeufin.sandbox
+
+import org.junit.Test
+import java.math.BigInteger
+import junit.framework.TestCase.assertTrue
+
+class KeyCmpTest {
+
+    /**
+     * This test simulates the way keys are compared when they get
+     * confirmed via the "keyletter".  The scenario has one format
+     * (ByteArray) for keys stored in the database, and another (hexadecimanl
+     * string) for keys communicated in the keyletter.
+     */
+    @Test
+    fun bytesCmp() {
+
+        val HEX_STRING = "AA" // as coming from the keyletter
+        val ba = byteArrayOf(0xAA.toByte()) // as coming from the database
+
+
+        assertTrue(BigInteger(1, ba).equals(HEX_STRING.toBigInteger(16)))
+    }
+}
\ No newline at end of file

-- 
To stop receiving notification emails like this one, please contact
address@hidden.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]