Commit 72323e4
Contracts & Harnesses for
Towards / Resolves #59
(Resolved) Depends on [this Kani
Issue](model-checking/kani#3629) and [this
PR](model-checking/kani#3660), as discussed in
[this
thread](#59 (comment))
in #59
(Resolved) Depends on [this Kani
Issue](model-checking/kani#3711) and [this
PR](model-checking/kani#3742)
(Resolved) Waiting for Kani PR#3742 merged into
`feature/verify-rust-std`
f16 and f128 are in #163
### Changes
* Added contracts for `f{32,64}::to_int_unchecked` (located in
`library/core/src/num/f{32,64}.rs`)
* Added a macro for generating `to_int_unchecked` harnesses
* Added harnesses for `f{32,64}to_int_unchecked` of each integer type
* `i8`, `i16`, `i32`, `i64`, `i128`, `isize`, `u8`, `u16`, `u32`, `u64`,
`u128`, `usize` --- 12 harnesses in total.
### Verification Results
To compile, we need to add the `-Z float-lib` flag.
```
Checking harness num::verify::checked_f32_to_int_unchecked_usize...
VERIFICATION RESULT:
** 0 of 136 failed
VERIFICATION:- SUCCESSFUL
Verification Time: 6.424911s
Checking harness num::verify::checked_f64_to_int_unchecked_u128...
VERIFICATION RESULT:
** 0 of 136 failed
VERIFICATION:- SUCCESSFUL
Verification Time: 6.8557353s
Checking harness num::verify::checked_f32_to_int_unchecked_u16...
VERIFICATION RESULT:
** 0 of 136 failed
VERIFICATION:- SUCCESSFUL
Verification Time: 6.195041s
Checking harness num::verify::checked_f32_to_int_unchecked_i8...
VERIFICATION RESULT:
** 0 of 136 failed
VERIFICATION:- SUCCESSFUL
Verification Time: 6.2361426s
Checking harness num::verify::checked_f64_to_int_unchecked_i32...
VERIFICATION RESULT:
** 0 of 136 failed
VERIFICATION:- SUCCESSFUL
Verification Time: 6.3952055s
Checking harness num::verify::checked_f64_to_int_unchecked_i128...
VERIFICATION RESULT:
** 0 of 136 failed
VERIFICATION:- SUCCESSFUL
Verification Time: 7.5295496s
Checking harness num::verify::checked_f64_to_int_unchecked_u16...
VERIFICATION RESULT:
** 0 of 136 failed
VERIFICATION:- SUCCESSFUL
Verification Time: 6.2897367s
Checking harness num::verify::checked_f32_to_int_unchecked_i64...
VERIFICATION RESULT:
** 0 of 136 failed
VERIFICATION:- SUCCESSFUL
Verification Time: 6.58576s
Checking harness num::verify::checked_f64_to_int_unchecked_i16...
VERIFICATION RESULT:
** 0 of 136 failed
VERIFICATION:- SUCCESSFUL
Verification Time: 6.2046432s
Checking harness num::verify::checked_f32_to_int_unchecked_i128...
VERIFICATION RESULT:
** 0 of 136 failed
VERIFICATION:- SUCCESSFUL
Verification Time: 6.8473463s
Checking harness num::verify::checked_f32_to_int_unchecked_u8...
VERIFICATION RESULT:
** 0 of 136 failed
VERIFICATION:- SUCCESSFUL
Verification Time: 6.131122s
Checking harness num::verify::checked_f32_to_int_unchecked_i16...
VERIFICATION RESULT:
** 0 of 136 failed
VERIFICATION:- SUCCESSFUL
Verification Time: 6.436728s
Checking harness num::verify::checked_f32_to_int_unchecked_u128...
VERIFICATION RESULT:
** 0 of 136 failed
VERIFICATION:- SUCCESSFUL
Verification Time: 6.666422s
Checking harness num::verify::checked_f64_to_int_unchecked_u8...
VERIFICATION RESULT:
** 0 of 136 failed
VERIFICATION:- SUCCESSFUL
Verification Time: 6.17829s
Checking harness num::verify::checked_f32_to_int_unchecked_i32...
VERIFICATION RESULT:
** 0 of 136 failed
VERIFICATION:- SUCCESSFUL
Verification Time: 6.6507607s
Checking harness num::verify::checked_f64_to_int_unchecked_i64...
VERIFICATION RESULT:
** 0 of 136 failed
VERIFICATION:- SUCCESSFUL
Verification Time: 7.3081775s
Checking harness num::verify::checked_f64_to_int_unchecked_u64...
VERIFICATION RESULT:
** 0 of 136 failed
VERIFICATION:- SUCCESSFUL
Verification Time: 7.0912967s
Checking harness num::verify::checked_f64_to_int_unchecked_i8...
VERIFICATION RESULT:
** 0 of 136 failed
VERIFICATION:- SUCCESSFUL
Verification Time: 6.4602604s
Checking harness num::verify::checked_f64_to_int_unchecked_usize...
VERIFICATION RESULT:
** 0 of 136 failed
VERIFICATION:- SUCCESSFUL
Verification Time: 6.9098988s
Checking harness num::verify::checked_f64_to_int_unchecked_u32...
VERIFICATION RESULT:
** 0 of 136 failed
VERIFICATION:- SUCCESSFUL
Verification Time: 6.557031s
Checking harness num::verify::checked_f64_to_int_unchecked_isize...
VERIFICATION RESULT:
** 0 of 136 failed
VERIFICATION:- SUCCESSFUL
Verification Time: 7.1193557s
Checking harness num::verify::checked_f32_to_int_unchecked_u64...
VERIFICATION RESULT:
** 0 of 136 failed
VERIFICATION:- SUCCESSFUL
Verification Time: 6.7919626s
Checking harness num::verify::checked_f32_to_int_unchecked_u32...
VERIFICATION RESULT:
** 0 of 136 failed
VERIFICATION:- SUCCESSFUL
Verification Time: 6.557074s
Checking harness num::verify::checked_f32_to_int_unchecked_isize...
VERIFICATION RESULT:
** 0 of 136 failed
VERIFICATION:- SUCCESSFUL
Verification Time: 6.710118s
Complete - 24 successfully verified harnesses, 0 failures, 24 total.
```
By submitting this pull request, I confirm that my contribution is made
under the terms of the Apache 2.0 and MIT licenses.
---------
Co-authored-by: rajathmCMU <rajathkotyal@gmail.com>
Co-authored-by: MWDZ <jinjunfeng721@gmail.com>
Co-authored-by: Zyad Hassan <zyadh@amazon.com>f{32,64}::to_int_unchecked (#134)1 parent d9780d6 commit 72323e4
File tree
5 files changed
+88
-2
lines changed- library/core/src
- num
- scripts
5 files changed
+88
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
21 | 29 | | |
22 | 30 | | |
23 | 31 | | |
| |||
1054 | 1062 | | |
1055 | 1063 | | |
1056 | 1064 | | |
| 1065 | + | |
| 1066 | + | |
1057 | 1067 | | |
1058 | 1068 | | |
1059 | 1069 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
20 | 27 | | |
21 | 28 | | |
22 | 29 | | |
| |||
1055 | 1062 | | |
1056 | 1063 | | |
1057 | 1064 | | |
| 1065 | + | |
| 1066 | + | |
1058 | 1067 | | |
1059 | 1068 | | |
1060 | 1069 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1831 | 1831 | | |
1832 | 1832 | | |
1833 | 1833 | | |
| 1834 | + | |
| 1835 | + | |
| 1836 | + | |
| 1837 | + | |
| 1838 | + | |
| 1839 | + | |
| 1840 | + | |
| 1841 | + | |
| 1842 | + | |
| 1843 | + | |
| 1844 | + | |
| 1845 | + | |
| 1846 | + | |
| 1847 | + | |
| 1848 | + | |
1834 | 1849 | | |
1835 | 1850 | | |
1836 | 1851 | | |
| |||
2128 | 2143 | | |
2129 | 2144 | | |
2130 | 2145 | | |
| 2146 | + | |
| 2147 | + | |
| 2148 | + | |
| 2149 | + | |
| 2150 | + | |
| 2151 | + | |
| 2152 | + | |
| 2153 | + | |
| 2154 | + | |
| 2155 | + | |
| 2156 | + | |
| 2157 | + | |
| 2158 | + | |
| 2159 | + | |
| 2160 | + | |
| 2161 | + | |
| 2162 | + | |
| 2163 | + | |
| 2164 | + | |
| 2165 | + | |
| 2166 | + | |
| 2167 | + | |
| 2168 | + | |
| 2169 | + | |
| 2170 | + | |
| 2171 | + | |
| 2172 | + | |
| 2173 | + | |
| 2174 | + | |
| 2175 | + | |
| 2176 | + | |
| 2177 | + | |
| 2178 | + | |
| 2179 | + | |
| 2180 | + | |
| 2181 | + | |
| 2182 | + | |
| 2183 | + | |
| 2184 | + | |
| 2185 | + | |
| 2186 | + | |
| 2187 | + | |
2131 | 2188 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
219 | 219 | | |
220 | 220 | | |
221 | 221 | | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
222 | 231 | | |
223 | 232 | | |
224 | 233 | | |
225 | 234 | | |
226 | 235 | | |
227 | 236 | | |
| 237 | + | |
228 | 238 | | |
229 | 239 | | |
230 | 240 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
214 | 214 | | |
215 | 215 | | |
216 | 216 | | |
| 217 | + | |
217 | 218 | | |
218 | 219 | | |
219 | 220 | | |
220 | 221 | | |
221 | 222 | | |
222 | 223 | | |
223 | | - | |
| 224 | + | |
224 | 225 | | |
225 | 226 | | |
226 | 227 | | |
227 | 228 | | |
228 | | - | |
0 commit comments