]> git.ipfire.org Git - thirdparty/chrony.git/commitdiff
test: extend frequency in ntp_adjtime() test
authorBryan Christianson <bryan@whatroute.net>
Mon, 31 Aug 2020 08:09:33 +0000 (20:09 +1200)
committerMiroslav Lichvar <mlichvar@redhat.com>
Mon, 31 Aug 2020 08:17:21 +0000 (10:17 +0200)
Extend the frequency range in the test to cover negative frequencies.

test/kernel/ntpadjtime.c

index d6be154baf9be181e5c4f01f25f2c764bad53e1b..4af96b48ee0e90b7287f98d9e720873890ca5156 100644 (file)
@@ -52,15 +52,15 @@ test_freqrange(void)
 
   printf("freq range:\n");
 
-  for (i = 0; i <= 1000; i += 50) {
+  for (i = -1000; i <= 1000; i += 50) {
     t.modes = MOD_FREQUENCY;
-    t.freq = i << 16;
+    t.freq = i * (1 << 16);
     printf("%4d ppm => ", i);
     if (try_ntpadjtime(&t) < 0)
       continue;
 
     printf("%4ld ppm : ", t.freq / (1 << 16));
-    printf("%s\n", t.freq == i << 16 ? "ok" : "fail");
+    printf("%s\n", t.freq == i * (1 << 16) ? "ok" : "fail");
   }
 }