Skip to content

Commit

Permalink
added the real checksum as a final assert to increase confidence
Browse files Browse the repository at this point in the history
  • Loading branch information
compscidr committed Nov 6, 2024
1 parent af1a8b9 commit b12ab68
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/test/kotlin/com/jasonernst/knet/ChecksumTests.kt
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import org.junit.jupiter.api.assertThrows
import org.slf4j.LoggerFactory
import java.io.FileNotFoundException
import kotlin.math.min
import org.junit.jupiter.api.Assertions.assertEquals

class ChecksumTests {
private val logger = LoggerFactory.getLogger(javaClass)
Expand Down Expand Up @@ -118,7 +119,8 @@ class ChecksumTests {
val payload = ByteArray(remainingPayloadSize)
stream.get(payload)

udpHeader.computeChecksum(ipHeader, payload, true)
val checksum = udpHeader.computeChecksum(ipHeader, payload, true)
assertEquals(0xd9f0.toUShort(), checksum)
}

@Test fun ipv6TcpBadChecksum() {
Expand Down

0 comments on commit b12ab68

Please sign in to comment.