more tests
This commit is contained in:
		
							parent
							
								
									db7453fbb2
								
							
						
					
					
						commit
						242cc7d0f5
					
				@ -1,5 +1,11 @@
 | 
			
		||||
import kotlinx.coroutines.test.runTest
 | 
			
		||||
import net.sergeych.bintools.toDump
 | 
			
		||||
import net.sergeych.bipack.BipackEncoder
 | 
			
		||||
import net.sergeych.crypto2.BinaryId
 | 
			
		||||
import net.sergeych.crypto2.ByteChunk
 | 
			
		||||
import net.sergeych.crypto2.initCrypto
 | 
			
		||||
import kotlin.test.Test
 | 
			
		||||
import kotlin.test.assertContentEquals
 | 
			
		||||
import kotlin.test.assertEquals
 | 
			
		||||
 | 
			
		||||
class BinaryIdTest {
 | 
			
		||||
@ -13,4 +19,16 @@ class BinaryIdTest {
 | 
			
		||||
        assertEquals(4, a.id.size)
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Test
 | 
			
		||||
    fun testByteChunkSizes() = runTest {
 | 
			
		||||
        initCrypto()
 | 
			
		||||
        val x = ByteChunk.random(3)
 | 
			
		||||
        assertEquals(3, x.data.size)
 | 
			
		||||
        assertEquals(3, x.toByteArray().size)
 | 
			
		||||
        assertEquals(3, x.toUByteArray().size)
 | 
			
		||||
        println(BipackEncoder.encode(x).toDump())
 | 
			
		||||
        assertEquals(4, BipackEncoder.encode(x).size)
 | 
			
		||||
        assertContentEquals(BipackEncoder.encode(x.toByteArray()), BipackEncoder.encode(x))
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user