diff --git a/src/test/java/com/thealgorithms/others/CRC32Test.java b/src/test/java/com/thealgorithms/others/CRC32Test.java new file mode 100644 index 000000000000..6558454fd830 --- /dev/null +++ b/src/test/java/com/thealgorithms/others/CRC32Test.java @@ -0,0 +1,28 @@ +package com.thealgorithms.others; + +import static org.junit.jupiter.api.Assertions.assertEquals; + +import org.junit.jupiter.api.Test; + +class CRC32Test { + + @Test + void emptyString() { + assertEquals(0, CRC32.crc32("")); + } + + @Test + void singleLetter() { + assertEquals(0xE8B7BE43, CRC32.crc32("a")); + } + + @Test + void checkValue() { + assertEquals(0xCBF43926, CRC32.crc32("123456789")); + } + + @Test + void pangram() { + assertEquals(0x414FA339, CRC32.crc32("The quick brown fox jumps over the lazy dog")); + } +}