blob: f1cf0a1b9688e7a9daf6e730ce1d9b37c4f9b76f [file] [log] [blame]
Chris Broadfoot5d516562015-08-25 20:43:021// 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
Dave Day349848c2014-03-27 05:47:205package appengine
6
7import (
8 "testing"
9)
10
11func TestValidGeoPoint(t *testing.T) {
12 testCases := []struct {
13 desc string
14 pt GeoPoint
15 want bool
16 }{
17 {
18 "valid",
19 GeoPoint{67.21, 13.37},
20 true,
21 },
22 {
23 "high lat",
24 GeoPoint{-90.01, 13.37},
25 false,
26 },
27 {
28 "low lat",
29 GeoPoint{90.01, 13.37},
30 false,
31 },
32 {
33 "high lng",
34 GeoPoint{67.21, 182},
35 false,
36 },
37 {
38 "low lng",
39 GeoPoint{67.21, -181},
40 false,
41 },
42 }
43
44 for _, tc := range testCases {
45 if got := tc.pt.Valid(); got != tc.want {
46 t.Errorf("%s: got %v, want %v", tc.desc, got, tc.want)
47 }
48 }
49}