| 1234567891011121314151617181920212223242526 |
- package mongo
- import "testing"
- func TestSimCardRunComplete(t *testing.T) {
- zero, one := uint64(0), uint64(1)
- run := simCardRun{
- SmartHubLastPage: &one, AcceleronixLastPage: &one,
- SavedPages: []string{"SmartHub:0", "SmartHub:1", "Acceleronix:1"},
- }
- if !simCardRunComplete(run) {
- t.Fatal("all pages saved should complete the run")
- }
- run.SavedPages = []string{"SmartHub:0", "Acceleronix:1"}
- if simCardRunComplete(run) {
- t.Fatal("missing page must keep run pending")
- }
- run.SmartHubLastPage = &zero
- if !simCardRunComplete(run) {
- t.Fatal("SmartHub page zero is a valid final page")
- }
- run.Sent = true
- if simCardRunComplete(run) {
- t.Fatal("sent run must not enqueue another report")
- }
- }
|