File: nex_test.go

package info (click to toggle)
golang-github-blynn-nex 0.0.0%2Bgit.2021.03.30.1a3320dab9-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 232 kB
  • sloc: yacc: 60; makefile: 22; sh: 4
file content (26 lines) | stat: -rw-r--r-- 411 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
package main

import (
	"bytes"
	"crypto/md5"
	"fmt"
	"testing"
)

var testinput = `
/a|A/ { return A }
//
package main
`

func TestGenStable(t *testing.T) {
	for i := 0; i < 100; i++ {
		var out bytes.Buffer

		process(&out, bytes.NewBufferString(testinput))
		e := "13f760d2f0dc1743dd7165781f2a318d"
		if x := fmt.Sprintf("%x", md5.Sum(out.Bytes())); x != e {
			t.Errorf("got: %s wanted: %s", x, e)
		}
	}
}