cid_test.go 708 B

1234567891011121314151617181920212223242526272829303132
  1. // Copyright (C) 2014 Jakob Borg and other contributors. All rights reserved.
  2. // Use of this source code is governed by an MIT-style license that can be
  3. // found in the LICENSE file.
  4. package cid
  5. import "testing"
  6. func TestGet(t *testing.T) {
  7. m := NewMap()
  8. if i := m.Get("foo"); i != 1 {
  9. t.Errorf("Unexpected id %d != 1", i)
  10. }
  11. if i := m.Get("bar"); i != 2 {
  12. t.Errorf("Unexpected id %d != 2", i)
  13. }
  14. if i := m.Get("foo"); i != 1 {
  15. t.Errorf("Unexpected id %d != 1", i)
  16. }
  17. if i := m.Get("bar"); i != 2 {
  18. t.Errorf("Unexpected id %d != 2", i)
  19. }
  20. if LocalID != 0 {
  21. t.Error("LocalID should be 0")
  22. }
  23. if i := m.Get(LocalName); i != LocalID {
  24. t.Errorf("Unexpected id %d != %c", i, LocalID)
  25. }
  26. }