burrow/src/test/java/io/rudefox/burrow/coin_entropy_tests.java

62 lines
2.0 KiB
Java

package io.rudefox.burrow;
import com.bjdweck.test.CliTestFixture;
import org.junit.jupiter.api.Test;
import java.io.UnsupportedEncodingException;
class coin_entropy_tests extends CliTestFixture {
@Test
void with_arguments_interactive_coin_should_generate_mnemonic_sentence() throws UnsupportedEncodingException {
System.setProperty("picocli.ansi", "false");
withArgs("mnemonic -i2 --bits 128");
expectedOutput("Input 33 coin tosses [0-1]: ");
provideInput("000001010011100101110111000001010" + EOL);
expectedOutput(EOL);
expectedOutput("| 0 000010 1001 | 1 100101 1101 | 1 100000 1010 |" + EOL);
expectedOutput("| 1. ahead | 2. slight | 3. scout |" + EOL);
expectedOutput(EOL);
expectedOutput("Input 33 coin tosses [0-1]: ");
provideInput("000001010011100101110111000001010" + EOL);
expectedOutput(EOL);
expectedOutput("| 0 000010 1001 | 1 100101 1101 | 1 100000 1010 |" + EOL);
expectedOutput("| 4. ahead | 5. slight | 6. scout |" + EOL);
expectedOutput(EOL);
expectedOutput("Input 33 coin tosses [0-1]: ");
provideInput("000001010011100101110111000001010" + EOL);
expectedOutput(EOL);
expectedOutput("| 0 000010 1001 | 1 100101 1101 | 1 100000 1010 |" + EOL);
expectedOutput("| 7. ahead | 8. slight | 9. scout |" + EOL);
expectedOutput(EOL);
expectedOutput("Input 33 coin tosses [0-1]: ");
provideInput("000001010011100101110111000001010" + EOL);
expectedOutput(EOL);
expectedOutput("| 0 000010 1001 | 1 100101 1101 | 1 100000 ---- |" + EOL);
expectedOutput("| 10. ahead | 11. slight | 12. CHECKWORD |" + EOL);
expectedOutput(EOL);
expectedOutput("ahead slight scout ahead slight scout ahead slight scout ahead slight scan" + EOL);
doMain();
verifyOutput();
}
private void doMain() {
setInput();
RudefoxBurrow.main(getArgs());
}
}