File: incrementor_test.go

package info (click to toggle)
golang-github-go-llsqlite-crawshaw 0.6.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 10,188 kB
  • sloc: ansic: 168,433; makefile: 36
file content (31 lines) | stat: -rw-r--r-- 549 bytes parent folder | download | duplicates (2)
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
27
28
29
30
31
package sqlite

import (
	"testing"
)

func TestIncrementor(t *testing.T) {
	start := 5
	i := NewIncrementor(start)
	if i == nil {
		t.Fatal("Incrementor returned nil")
	}
	if i() != start {
		t.Fatalf("first call did not start at %v", start)
	}
	for j := 1; j < 10; j++ {
		if i() != start+j {
			t.Fatalf("%v call did not return %v+%v", j, start, j)
		}
	}

	b := BindIncrementor()
	if b() != 1 {
		t.Fatal("BindIncrementor does not start at 1")
	}

	c := ColumnIncrementor()
	if c() != 0 {
		t.Fatal("ColumnIncrementor does not start at 0")
	}
}