nomoresecrets_test.go 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  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. // I currently can't test NMS. It's monolithic.
  20. // Need to break it up so I can test it!
  21. /*
  22. func TestNoMoreSecrets(t *testing.T) {
  23. }
  24. */
  25. // Benchmark / profiling
  26. // TODO: Update NoMoreSecrets so it can be benchmarked.
  27. // Currently, it needs a working door connection.
  28. func BenchmarkNoMoreSecrets(b *testing.B) {
  29. /*
  30. Unicode = true
  31. // We need a valid working Door{} object to run this.
  32. var d *Door = &Door{}
  33. for i := 0; i < b.N; i++ {
  34. var output = Goto(5, 5) + ColorText("WHITE ON BLUE") + "Secret Text Revealed!"
  35. var better NoMoreSecretsConfig = NoMoreSecretsDefault
  36. better.Jumble_Loop_Speed = 75 // 35
  37. better.Reveal_Loop_Speed = 100 // 50
  38. better.Color = ColorText("BRI CYAN ON BLUE")
  39. NoMoreSecrets(output, d, &better)
  40. }
  41. */
  42. }