| 1818 | |
| 1819 | #[test] |
| 1820 | fn test_heterogeneous_compare() { |
| 1821 | let context = Context::default(); |
| 1822 | |
| 1823 | let program = Program::compile("1 < uint(2)").unwrap(); |
| 1824 | let value = program.execute(&context).unwrap(); |
| 1825 | assert_eq!(value, true.into()); |
| 1826 | |
| 1827 | let program = Program::compile("1 < 1.1").unwrap(); |
| 1828 | let value = program.execute(&context).unwrap(); |
| 1829 | assert_eq!(value, true.into()); |
| 1830 | |
| 1831 | let program = Program::compile("uint(0) > -10").unwrap(); |
| 1832 | let value = program.execute(&context).unwrap(); |
| 1833 | assert_eq!( |
| 1834 | value, |
| 1835 | true.into(), |
| 1836 | "negative signed ints should be less than uints" |
| 1837 | ); |
| 1838 | } |
| 1839 | |
| 1840 | #[test] |
| 1841 | fn test_float_compare() { |