nex_test.go 411 B

1234567891011121314151617181920212223242526
  1. package main
  2. import (
  3. "bytes"
  4. "crypto/md5"
  5. "fmt"
  6. "testing"
  7. )
  8. var testinput = `
  9. /a|A/ { return A }
  10. //
  11. package main
  12. `
  13. func TestGenStable(t *testing.T) {
  14. for i := 0; i < 100; i++ {
  15. var out bytes.Buffer
  16. process(&out, bytes.NewBufferString(testinput))
  17. e := "13f760d2f0dc1743dd7165781f2a318d"
  18. if x := fmt.Sprintf("%x", md5.Sum(out.Bytes())); x != e {
  19. t.Errorf("got: %s wanted: %s", x, e)
  20. }
  21. }
  22. }