import utime
try:
    utime.sleep_ms
except AttributeError:
    print("SKIP")
    raise SystemExit

utime.sleep_ms(1)
utime.sleep_us(1)
print(utime.ticks_diff(utime.ticks_ms(), utime.ticks_ms()) <= 1)
print(utime.ticks_diff(utime.ticks_us(), utime.ticks_us()) <= 500)

# ticks_cpu may not be implemented, at least make sure it doesn't decrease
print(utime.ticks_diff(utime.ticks_cpu(), utime.ticks_cpu()) >= 0)

@@ -129,22 +129,22 @@
 p_us(1)%0A
-print(
+%0At0 = 
 utime.ti
@@ -139,37 +139,42 @@
 0 = utime.ticks_
-diff(
+ms()%0At1 = 
 utime.ticks_ms()
@@ -173,17 +173,27 @@
 cks_ms()
-,
+%0Aprint(0 %3C=
  utime.t
@@ -201,20 +201,27 @@
 cks_
-ms()
+diff(t1, t0
 ) %3C= 1)%0A
 prin
@@ -216,22 +216,22 @@
 ) %3C= 1)%0A
-print(
+%0At0 = 
 utime.ti
@@ -226,37 +226,42 @@
 0 = utime.ticks_
-diff(
+us()%0At1 = 
 utime.ticks_us()
@@ -260,17 +260,27 @@
 cks_us()
-,
+%0Aprint(0 %3C=
  utime.t
@@ -284,20 +284,27 @@
 e.ticks_
-us()
+diff(t1, t0
 ) %3C= 500
@@ -381,22 +381,21 @@
 ecrease%0A
-print(
+t0 = 
 utime.ti
@@ -398,21 +398,27 @@
 e.ticks_
-diff(
+cpu()%0At1 = 
 utime.ti
@@ -426,18 +426,23 @@
 ks_cpu()
-, 
+%0Aprint(
 utime.ti
@@ -445,21 +445,27 @@
 e.ticks_
-cpu()
+diff(t1, t0
 ) %3E= 0)%0A

Fix ticks tests, ticks_diff args are reversed.