1   /* Copyright 2002-2025 CS GROUP
2    * Licensed to CS GROUP (CS) under one or more
3    * contributor license agreements.  See the NOTICE file distributed with
4    * this work for additional information regarding copyright ownership.
5    * CS licenses this file to You under the Apache License, Version 2.0
6    * (the "License"); you may not use this file except in compliance with
7    * the License.  You may obtain a copy of the License at
8    *
9    *   http://www.apache.org/licenses/LICENSE-2.0
10   *
11   * Unless required by applicable law or agreed to in writing, software
12   * distributed under the License is distributed on an "AS IS" BASIS,
13   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14   * See the License for the specific language governing permissions and
15   * limitations under the License.
16   */
17  package org.orekit.gnss.metric.messages.rtcm;
18  
19  import org.junit.jupiter.api.Assertions;
20  import org.junit.jupiter.api.Test;
21  import org.orekit.gnss.metric.messages.common.AccuracyProvider;
22  import org.orekit.gnss.metric.messages.common.GlonassUserRangeAccuracy;
23  
24  public class GlonassUserRangeAccuracyTest {
25  
26      private final double eps = 0.1;
27  
28      @Test
29      public void testAccuracy() {
30          AccuracyProvider ura;
31  
32          // Index = 0
33          ura = new GlonassUserRangeAccuracy(0);
34          Assertions.assertEquals(1.0, ura.getAccuracy(), eps);
35          // Index = 1
36          ura = new GlonassUserRangeAccuracy(1);
37          Assertions.assertEquals(2.0, ura.getAccuracy(), eps);
38          // Index = 2
39          ura = new GlonassUserRangeAccuracy(2);
40          Assertions.assertEquals(2.5, ura.getAccuracy(), eps);
41          // Index = 3
42          ura = new GlonassUserRangeAccuracy(3);
43          Assertions.assertEquals(4.0, ura.getAccuracy(), eps);
44          // Index = 4
45          ura = new GlonassUserRangeAccuracy(4);
46          Assertions.assertEquals(5.0, ura.getAccuracy(), eps);
47          // Index = 5
48          ura = new GlonassUserRangeAccuracy(5);
49          Assertions.assertEquals(7.0, ura.getAccuracy(), eps);
50          // Index = 6
51          ura = new GlonassUserRangeAccuracy(6);
52          Assertions.assertEquals(10.0, ura.getAccuracy(), eps);
53          // Index = 7
54          ura = new GlonassUserRangeAccuracy(7);
55          Assertions.assertEquals(12.0, ura.getAccuracy(), eps);
56          // Index = 8
57          ura = new GlonassUserRangeAccuracy(8);
58          Assertions.assertEquals(14.0, ura.getAccuracy(), eps);
59          // Index = 9
60          ura = new GlonassUserRangeAccuracy(9);
61          Assertions.assertEquals(16.0, ura.getAccuracy(), eps);
62          // Index = 10
63          ura = new GlonassUserRangeAccuracy(10);
64          Assertions.assertEquals(32.0, ura.getAccuracy(), eps);
65          // Index = 11
66          ura = new GlonassUserRangeAccuracy(11);
67          Assertions.assertEquals(64.0, ura.getAccuracy(), eps);
68          // Index = 12
69          ura = new GlonassUserRangeAccuracy(12);
70          Assertions.assertEquals(128.0, ura.getAccuracy(), eps);
71          // Index = 13
72          ura = new GlonassUserRangeAccuracy(13);
73          Assertions.assertEquals(256.0, ura.getAccuracy(), eps);
74          // Index = 14
75          ura = new GlonassUserRangeAccuracy(14);
76          Assertions.assertEquals(512.0, ura.getAccuracy(), eps);
77          // Index = 15
78          ura = new GlonassUserRangeAccuracy(15);
79          Assertions.assertEquals(1024.0, ura.getAccuracy(), eps);
80      }
81  
82  }