Test that IDs > 128 are handled

This commit is contained in:
boosh 2017-07-28 20:00:34 +01:00
parent 4afab65089
commit a463837612
1 changed files with 24 additions and 0 deletions

View File

@ -127,6 +127,30 @@ func TestWriteAutoIdAndRead(t *testing.T) {
destroySchool()
}
// Test that it parses ints > 128
func TestWriteAutoIdOverflow(t *testing.T) {
createDB()
string128 := fmt.Sprintf("%08d", 128)
if err := db.Write(collection, string128, redfish); err != nil {
t.Error("Create fish failed: ", err.Error())
}
// add fish to database
autoId, err := db.WriteAutoId(collection, redfish);
if err != nil {
t.Error("Create fish failed: ", err.Error())
}
if autoId != 129 {
t.Error("Auto-generated ID should have been 129")
}
destroySchool()
}
//
func TestReadall(t *testing.T) {