appengine_test.go 755 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. // Copyright 2014 Google Inc. All rights reserved.
  2. // Use of this source code is governed by the Apache 2.0
  3. // license that can be found in the LICENSE file.
  4. package appengine
  5. import (
  6. "testing"
  7. )
  8. func TestValidGeoPoint(t *testing.T) {
  9. testCases := []struct {
  10. desc string
  11. pt GeoPoint
  12. want bool
  13. }{
  14. {
  15. "valid",
  16. GeoPoint{67.21, 13.37},
  17. true,
  18. },
  19. {
  20. "high lat",
  21. GeoPoint{-90.01, 13.37},
  22. false,
  23. },
  24. {
  25. "low lat",
  26. GeoPoint{90.01, 13.37},
  27. false,
  28. },
  29. {
  30. "high lng",
  31. GeoPoint{67.21, 182},
  32. false,
  33. },
  34. {
  35. "low lng",
  36. GeoPoint{67.21, -181},
  37. false,
  38. },
  39. }
  40. for _, tc := range testCases {
  41. if got := tc.pt.Valid(); got != tc.want {
  42. t.Errorf("%s: got %v, want %v", tc.desc, got, tc.want)
  43. }
  44. }
  45. }