diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/benchmarks/register-login/gracha.go | 9 | ||||
l--------- | tests/benchmarks/register-login/main.go | 1 | ||||
-rw-r--r-- | tests/functional/register-twice/gracha.go | 9 | ||||
l--------- | tests/functional/register-twice/main.go | 1 | ||||
-rw-r--r-- | tests/fuzz/api/gracha.go | 35 | ||||
l--------- | tests/fuzz/api/main.go | 1 | ||||
-rw-r--r-- | tests/gracha.go | 56 | ||||
-rw-r--r-- | tests/queries.sql | 0 |
8 files changed, 71 insertions, 41 deletions
diff --git a/tests/benchmarks/register-login/gracha.go b/tests/benchmarks/register-login/gracha.go new file mode 100644 index 0000000..f363b6b --- /dev/null +++ b/tests/benchmarks/register-login/gracha.go @@ -0,0 +1,9 @@ +package gracha + +import ( +) + + + +func MainTest() { +} diff --git a/tests/benchmarks/register-login/main.go b/tests/benchmarks/register-login/main.go new file mode 120000 index 0000000..f67563d --- /dev/null +++ b/tests/benchmarks/register-login/main.go @@ -0,0 +1 @@ +../../main.go
\ No newline at end of file diff --git a/tests/functional/register-twice/gracha.go b/tests/functional/register-twice/gracha.go new file mode 100644 index 0000000..f363b6b --- /dev/null +++ b/tests/functional/register-twice/gracha.go @@ -0,0 +1,9 @@ +package gracha + +import ( +) + + + +func MainTest() { +} diff --git a/tests/functional/register-twice/main.go b/tests/functional/register-twice/main.go new file mode 120000 index 0000000..f67563d --- /dev/null +++ b/tests/functional/register-twice/main.go @@ -0,0 +1 @@ +../../main.go
\ No newline at end of file diff --git a/tests/fuzz/api/gracha.go b/tests/fuzz/api/gracha.go new file mode 100644 index 0000000..6f2981a --- /dev/null +++ b/tests/fuzz/api/gracha.go @@ -0,0 +1,35 @@ +package gracha + +import ( + "os" + "testing" + "testing/internal/testdeps" +) + + + +func api(f *testing.F) { + f.Fuzz(func(t *testing.T, n int) { + // FIXME + if n > 1 { + if n < 2 { + t.Errorf("Failed n: %v\n", n) + } + } + }) +} + + + +func MainTest() { + fuzzTargets := []testing.InternalFuzzTarget{ + { "api", api }, + } + + deps := testdeps.TestDeps{} + tests := []testing.InternalTest {} + benchmarks := []testing.InternalBenchmark{} + examples := []testing.InternalExample {} + m := testing.MainStart(deps, tests, benchmarks, fuzzTargets, examples) + os.Exit(m.Run()) +} diff --git a/tests/fuzz/api/main.go b/tests/fuzz/api/main.go new file mode 120000 index 0000000..f67563d --- /dev/null +++ b/tests/fuzz/api/main.go @@ -0,0 +1 @@ +../../main.go
\ No newline at end of file diff --git a/tests/gracha.go b/tests/gracha.go index 18b54d6..0c11fac 100644 --- a/tests/gracha.go +++ b/tests/gracha.go @@ -1,15 +1,15 @@ package gracha import ( - "database/sql" + // "database/sql" - "liteq" + // "q" g "gobang" ) type testAuth struct{ - auth Auth + auth authT // registerEmail func(credentials) close func() error } @@ -18,55 +18,28 @@ func test_defaultPrefix() { g.TestStart("defaultPrefix") g.Testing("the defaultPrefix is valid", func() { - g.TAssertEqual(g.ValidSQLTablePrefix(defaultPrefix), true) - }) -} - -func test_tablesFrom() { - g.TestStart("tablesFrom()") - - g.Testing("prefix needs to be valid", func() { - _, err := tablesFrom("invalid-prefix") - g.TAssertEqual(err, g.ErrBadSQLTablePrefix) - }) - - g.Testing("the struct adds suffixes", func() { - t, err := tablesFrom(defaultPrefix) - g.TAssertEqual(err, nil) - g.TAssertEqual(t, tablesT{ - users: "gracha-users", - userChanges: "gracha-user-changes", - tokens: "gracha-tokens", - roles: "gracha-roles", - roleChanges: "gracha-role-changes", - sessions: "gracha-sessions", - attempts: "gracha-attempts", - audit: "gracha-audit", - }) + g.TErrorIf(g.ValidateSQLTablePrefix(defaultPrefix)) }) } +/* func mkauth() testAuth { - q := new(liteq.Queue) - sql.Register("sqlite-liteq", liteq.MakeDriver(q)) - - db, err := sql.Open("sqlite-liteq", "file:db?mode=memory&cache=shared") + db, err := sql.Open("acude", "file:db?mode=memory&cache=shared") g.TAssertEqual(err, nil) - *q, err = liteq.New(db) + queue, err := q.New(db) g.TAssertEqual(err, nil) - auth, err := New(db, *q) + auth, err := New(db, queue) g.TAssertEqual(err, nil) - fns := [](func() error){ - db.Close, - q.Close, - } return testAuth{ auth: auth, close: func() error { - return g.SomeFnError(fns) + return g.SomeFnError( + db.Close, + queue.Close, + ) }, } } @@ -97,11 +70,12 @@ func test_Register() { g.Testing("we can't register duplicate emails", func() { }) } +*/ func MainTest() { g.Init() test_defaultPrefix() - test_tablesFrom() - test_Register() + // test_tablesFrom() + // test_Register() } diff --git a/tests/queries.sql b/tests/queries.sql new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tests/queries.sql |