nomoresecrets_test.go 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. package door
  2. import (
  3. "math/rand"
  4. "testing"
  5. )
  6. func TestRandom(t *testing.T) {
  7. rand.Seed(10)
  8. var byteBuffer []byte
  9. var expectBuffer []byte = []byte{0x61, 0xb5, 0xc8, 0xac, 0x79, 0x39, 0xde, 0xda, 0x62, 0xd3, 0x90, 0x4c, 0x63, 0x72, 0xa7, 0x93, 0x9b, 0xb0, 0x9c, 0x9d, 0x31, 0xd5, 0xbb, 0x9a, 0x32, 0xc4, 0x41, 0x77, 0x9d, 0xb1, 0xc3, 0x36, 0x8e, 0x63, 0xc7, 0xdd, 0x6c, 0xab, 0x80, 0x9a, 0x32, 0xc4, 0xa5, 0x9b, 0xa9, 0x60, 0xa8, 0xaa, 0xbc, 0xca, 0x85, 0x70, 0x7e, 0xd2, 0x2a, 0x3c, 0x6f, 0xab, 0x2c, 0xa5, 0x6f, 0x33, 0x89, 0xc7, 0x47, 0x5d, 0xbf, 0x50, 0x76, 0x2b, 0xd9, 0x2e, 0xdc, 0xae, 0xbb, 0xd6, 0x59, 0xda, 0x8a, 0xde, 0x38, 0xae, 0xd4, 0xa9, 0x8d, 0x65, 0xbc, 0x7d, 0xbe, 0xd4, 0xb2, 0x88, 0xb4, 0x39, 0xce, 0xb9, 0xb8, 0x26, 0x93, 0x5b}
  10. byteBuffer = make([]byte, 100)
  11. var x int
  12. for x = 0; x < 100; x++ {
  13. byteBuffer[x] = getRandom()
  14. if expectBuffer[x] != byteBuffer[x] {
  15. t.Errorf("%d %d != %d\n", x, expectBuffer[x], byteBuffer[x])
  16. }
  17. }
  18. }
  19. func TestNoMoreSecrets(t *testing.T) {
  20. }
  21. // Benchmark / profiling
  22. // TODO: Update NoMoreSecrets so it can be benchmarked.
  23. // Currently, it needs a working door connection.
  24. func BenchmarkNoMoreSecrets(b *testing.B) {
  25. /*
  26. Unicode = true
  27. // We need a valid working Door{} object to run this.
  28. var d *Door = &Door{}
  29. for i := 0; i < b.N; i++ {
  30. var output = Goto(5, 5) + ColorText("WHITE ON BLUE") + "Secret Text Revealed!"
  31. var better NoMoreSecretsConfig = NoMoreSecretsDefault
  32. better.Jumble_Loop_Speed = 75 // 35
  33. better.Reveal_Loop_Speed = 100 // 50
  34. better.Color = ColorText("BRI CYAN ON BLUE")
  35. NoMoreSecrets(output, d, &better)
  36. }
  37. */
  38. }