package door import ( "math/rand" "testing" ) func TestRandom(t *testing.T) { rand.Seed(10) var byteBuffer []byte 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} byteBuffer = make([]byte, 100) var x int for x = 0; x < 100; x++ { byteBuffer[x] = getRandom() if expectBuffer[x] != byteBuffer[x] { t.Errorf("%d %d != %d\n", x, expectBuffer[x], byteBuffer[x]) } } } // I currently can't test NMS. It's monolithic. // Need to break it up so I can test it! /* func TestNoMoreSecrets(t *testing.T) { } */ // Benchmark / profiling // TODO: Update NoMoreSecrets so it can be benchmarked. // Currently, it needs a working door connection. func BenchmarkNoMoreSecrets(b *testing.B) { /* Unicode = true // We need a valid working Door{} object to run this. var d *Door = &Door{} for i := 0; i < b.N; i++ { var output = Goto(5, 5) + ColorText("WHITE ON BLUE") + "Secret Text Revealed!" var better NoMoreSecretsConfig = NoMoreSecretsDefault better.Jumble_Loop_Speed = 75 // 35 better.Reveal_Loop_Speed = 100 // 50 better.Color = ColorText("BRI CYAN ON BLUE") NoMoreSecrets(output, d, &better) } */ }