/
NikolayIvkin
/
TheAlgorithms
Обзор
Документация
Войти
/
NikolayIvkin
/
TheAlgorithms
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
src/test/java/com/thealgorithms/ciphers/PlayfairTest.java
37 строк
1 KB
Piotr Idzik
style: enable `AvoidStarImport` in checkstyle (#5141)
05 май 2024, 21:48
Не верифицирован
05 май 2024, 21:48
414835d
Код
Авторство
О чём код?
package com.thealgorithms.ciphers; import static org.junit.jupiter.api.Assertions.assertEquals; import org.junit.jupiter.api.Test; public class PlayfairTest { @Test public void testEncryption() { PlayfairCipher playfairCipher = new PlayfairCipher("KEYWORD"); String plaintext = "HELLO"; String encryptedText = playfairCipher.encrypt(plaintext); assertEquals("GYIZSC", encryptedText); } @Test public void testDecryption() { PlayfairCipher playfairCipher = new PlayfairCipher("KEYWORD"); String encryptedText = "UDRIYP"; String decryptedText = playfairCipher.decrypt(encryptedText); assertEquals("NEBFVH", decryptedText); } @Test public void testEncryptionAndDecryption() { PlayfairCipher playfairCipher = new PlayfairCipher("KEYWORD"); String plaintext = "PLAYFAIR"; String encryptedText = playfairCipher.encrypt(plaintext); String decryptedText = playfairCipher.decrypt(encryptedText); assertEquals(plaintext, decryptedText); } }