This repository has been archived by the owner on Jun 27, 2021. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Add wasi::clock_time_get tests
This adds a couple of tests for validating the behavior of wasi::clock_time_get.
- Loading branch information
1 parent
f50b8d2
commit 849624d
Showing
4 changed files
with
56 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
// { | ||
// } | ||
|
||
fn main() { | ||
unsafe { | ||
let time1 = wasi::clock_time_get(wasi::CLOCKID_MONOTONIC, 0).unwrap(); | ||
assert!(time1 > 0); | ||
|
||
let time2 = wasi::clock_time_get(wasi::CLOCKID_MONOTONIC, 1).unwrap(); | ||
assert!(time2 > 0); | ||
|
||
assert!(time1 < time2); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
// { | ||
// } | ||
|
||
fn main() { | ||
unsafe { | ||
let time1 = wasi::clock_time_get(wasi::CLOCKID_MONOTONIC, 0).unwrap(); | ||
assert!(time1 > 0); | ||
|
||
let time2 = wasi::clock_time_get(wasi::CLOCKID_PROCESS_CPUTIME_ID, 1).unwrap(); | ||
assert!(time2 > 0); | ||
|
||
assert!(time1 < time2); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
// { | ||
// } | ||
|
||
fn main() { | ||
unsafe { | ||
let time1 = wasi::clock_time_get(wasi::CLOCKID_REALTIME, 0).unwrap(); | ||
assert!(time1 > 0); | ||
|
||
let time2 = wasi::clock_time_get(wasi::CLOCKID_REALTIME, 1).unwrap(); | ||
assert!(time2 > 0); | ||
|
||
assert!(time1 < time2); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
// { | ||
// } | ||
|
||
fn main() { | ||
unsafe { | ||
let time1 = wasi::clock_time_get(wasi::CLOCKID_THREAD_CPUTIME_ID, 0).unwrap(); | ||
assert!(time1 > 0); | ||
|
||
let time2 = wasi::clock_time_get(wasi::CLOCKID_THREAD_CPUTIME_ID, 1).unwrap(); | ||
assert!(time2 > 0); | ||
|
||
assert!(time1 < time2); | ||
} | ||
} |