Skip to content

Commit b69e6a9

Browse files
MannarAmuthanyouknowone
authored andcommitted
Added missed tests in int_tests of jit
1 parent b9ee0b6 commit b69e6a9

File tree

1 file changed

+46
-0
lines changed

1 file changed

+46
-0
lines changed

jit/tests/int_tests.rs

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,52 @@ fn test_gt() {
160160
assert_eq!(gt(1, -1), Ok(1));
161161
}
162162

163+
#[test]
164+
fn test_lt() {
165+
let lt = jit_function! { lt(a:i64, b:i64) -> i64 => r##"
166+
def lt(a: int, b: int):
167+
if a < b:
168+
return 1
169+
return 0
170+
"## };
171+
172+
assert_eq!(lt(-1, -5), Ok(0));
173+
assert_eq!(lt(10, 0), Ok(0));
174+
assert_eq!(lt(0, 1), Ok(1));
175+
assert_eq!(lt(-10, -1), Ok(1));
176+
assert_eq!(lt(100, 100), Ok(0));
177+
}
178+
179+
#[test]
180+
fn test_gte() {
181+
let gte = jit_function! { gte(a:i64, b:i64) -> i64 => r##"
182+
def gte(a: int, b: int):
183+
if a >= b:
184+
return 1
185+
return 0
186+
"## };
187+
188+
assert_eq!(gte(-64, -64), Ok(1));
189+
assert_eq!(gte(100, -1), Ok(1));
190+
assert_eq!(gte(1, 2), Ok(0));
191+
assert_eq!(gte(1, 0), Ok(1));
192+
}
193+
194+
#[test]
195+
fn test_lte() {
196+
let lte = jit_function! { lte(a:i64, b:i64) -> i64 => r##"
197+
def lte(a: int, b: int):
198+
if a <= b:
199+
return 1
200+
return 0
201+
"## };
202+
203+
assert_eq!(lte(-100, -100), Ok(1));
204+
assert_eq!(lte(-100, 100), Ok(1));
205+
assert_eq!(lte(10, 1), Ok(0));
206+
assert_eq!(lte(0, -2), Ok(0));
207+
}
208+
163209
#[test]
164210
fn test_minus() {
165211
let minus = jit_function! { minus(a:i64) -> i64 => r##"

0 commit comments

Comments
 (0)