@@ -101,3 +101,54 @@ func TestOptionsAddFloatValsAsVariadic(t *testing.T) {
101101 opts .addFloat ("foo" , 1.1231312 , 2.1233 )
102102 assert .Equal (t , "foo=1.1231312;2.1233" , opts .encode ())
103103}
104+
105+ func TestGeneralOptions (t * testing.T ) {
106+ cases := []struct {
107+ name string
108+ options GeneralOptions
109+ expectedURI string
110+ }{
111+ {
112+ name : "empty" ,
113+ options : GeneralOptions {},
114+ expectedURI : "" ,
115+ },
116+ {
117+ name : "with bearings" ,
118+ options : GeneralOptions {
119+ Bearings : []Bearing {
120+ {0 , 20 }, {10 , 20 },
121+ },
122+ },
123+ expectedURI : "bearings=0%2C20%3B10%2C20" ,
124+ },
125+ {
126+ name : "with radiuses" ,
127+ options : GeneralOptions {
128+ Radiuses : []float64 {0.123123 , 0.12312 },
129+ },
130+ expectedURI : "radiuses=0.123123;0.12312" ,
131+ },
132+ {
133+ name : "generate hints disabled" ,
134+ options : GeneralOptions {
135+ Radiuses : []float64 {0.123123 , 0.12312 },
136+ GenerateHintsDisabled : true ,
137+ },
138+ expectedURI : "generate_hints=false&radiuses=0.123123;0.12312" ,
139+ },
140+ {
141+ name : "with approaches and exclude" ,
142+ options : GeneralOptions {
143+ Exclude : []string {"toll" , "highway" },
144+ Approaches : []string {"a" , "b" },
145+ },
146+ expectedURI : "approaches=a;b&exclude=toll;highway" ,
147+ },
148+ }
149+ for _ , c := range cases {
150+ t .Run (c .name , func (t * testing.T ) {
151+ assert .Equal (t , c .expectedURI , c .options .options (options {}).encode ())
152+ })
153+ }
154+ }
0 commit comments