github.com/quickfeed/quickfeed@v0.0.0-20240507093252-ed8ca812a09c/scm/mock_internal_test.go (about) 1 package scm 2 3 import ( 4 "testing" 5 6 "github.com/quickfeed/quickfeed/qf" 7 ) 8 9 func TestIDs(t *testing.T) { 10 repos := make(map[uint64]*Repository) 11 repos[1] = &Repository{ID: 1} 12 repos[3] = &Repository{ID: 3} 13 id := generateID(repos) 14 if id != 2 { 15 t.Errorf("expected id = 2, got %d", id) 16 } 17 repos[id] = &Repository{ID: id} 18 id = generateID(repos) 19 if id != 4 { 20 t.Errorf("expected id = 4, got %d", id) 21 } 22 23 teams := make(map[uint64]*Team) 24 id = generateID(teams) 25 if id != 1 { 26 t.Errorf("expected id = 1, got %d", id) 27 } 28 teams[id] = &Team{} 29 id = generateID(teams) 30 if id != 2 { 31 t.Errorf("expected id = 2, got %d", id) 32 } 33 34 organizations := make(map[uint64]*qf.Organization) 35 organizations[2] = &qf.Organization{} 36 id = generateID(organizations) 37 if id != 1 { 38 t.Errorf("expected id = 1, got %d", id) 39 } 40 }