2021-02-02 07:26:56 +03:00
|
|
|
// Copyright (C) 2019-2021 Aleo Systems Inc.
|
2020-08-18 13:50:26 +03:00
|
|
|
// This file is part of the Leo library.
|
|
|
|
|
|
|
|
// The Leo library is free software: you can redistribute it and/or modify
|
|
|
|
// it under the terms of the GNU General Public License as published by
|
|
|
|
// the Free Software Foundation, either version 3 of the License, or
|
|
|
|
// (at your option) any later version.
|
|
|
|
|
|
|
|
// The Leo library is distributed in the hope that it will be useful,
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
// GNU General Public License for more details.
|
|
|
|
|
|
|
|
// You should have received a copy of the GNU General Public License
|
|
|
|
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
|
|
|
|
2020-06-06 02:51:26 +03:00
|
|
|
use crate::{
|
2020-07-31 01:41:03 +03:00
|
|
|
assert_satisfied,
|
2020-08-17 05:14:26 +03:00
|
|
|
expect_compiler_error,
|
2020-08-01 05:39:30 +03:00
|
|
|
generate_main_input,
|
2020-08-01 00:06:01 +03:00
|
|
|
integers::{expect_parsing_error, IntegerTester},
|
2020-06-09 05:13:47 +03:00
|
|
|
parse_program,
|
2020-06-06 02:51:26 +03:00
|
|
|
};
|
2020-10-31 03:31:09 +03:00
|
|
|
use leo_ast::InputValue;
|
2020-08-06 04:13:50 +03:00
|
|
|
use leo_input::types::{IntegerType, U128Type, UnsignedIntegerType};
|
2020-06-06 02:51:26 +03:00
|
|
|
|
2020-08-06 04:13:50 +03:00
|
|
|
test_uint!(
|
|
|
|
TestU128,
|
|
|
|
u128,
|
|
|
|
IntegerType::Unsigned(UnsignedIntegerType::U128Type(U128Type {})),
|
|
|
|
UInt128
|
|
|
|
);
|
2020-06-06 02:51:26 +03:00
|
|
|
|
|
|
|
#[test]
|
2020-07-16 05:55:04 +03:00
|
|
|
fn test_u128_min() {
|
2020-07-31 01:41:03 +03:00
|
|
|
TestU128::test_min();
|
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn test_u128_min_fail() {
|
|
|
|
TestU128::test_min_fail();
|
2020-07-16 05:55:04 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn test_u128_max() {
|
2020-07-31 01:41:03 +03:00
|
|
|
TestU128::test_max();
|
2020-07-16 05:55:04 +03:00
|
|
|
}
|
2020-06-06 02:51:26 +03:00
|
|
|
|
2020-07-16 05:55:04 +03:00
|
|
|
#[test]
|
2020-07-31 01:41:03 +03:00
|
|
|
fn test_u128_max_fail() {
|
|
|
|
TestU128::test_max_fail();
|
2020-07-16 05:55:04 +03:00
|
|
|
}
|
2020-06-06 02:51:26 +03:00
|
|
|
|
2020-07-16 05:55:04 +03:00
|
|
|
#[test]
|
|
|
|
fn test_u128_add() {
|
2020-06-06 02:51:26 +03:00
|
|
|
TestU128::test_add();
|
2020-07-16 05:55:04 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn test_u128_sub() {
|
|
|
|
TestU128::test_sub();
|
|
|
|
}
|
|
|
|
|
2020-07-31 01:41:03 +03:00
|
|
|
#[test]
|
2020-07-16 05:55:04 +03:00
|
|
|
fn test_u128_mul() {
|
2020-06-06 02:51:26 +03:00
|
|
|
TestU128::test_mul();
|
2020-07-16 05:55:04 +03:00
|
|
|
}
|
|
|
|
|
2020-07-31 01:41:03 +03:00
|
|
|
#[test]
|
2020-07-16 05:55:04 +03:00
|
|
|
fn test_u128_div() {
|
2020-06-06 02:51:26 +03:00
|
|
|
TestU128::test_div();
|
2020-07-16 05:55:04 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn test_u128_pow() {
|
|
|
|
TestU128::test_pow();
|
|
|
|
}
|
2020-06-06 02:51:26 +03:00
|
|
|
|
2020-07-16 05:55:04 +03:00
|
|
|
#[test]
|
|
|
|
fn test_u128_eq() {
|
2020-06-06 02:51:26 +03:00
|
|
|
TestU128::test_eq();
|
2020-07-16 05:55:04 +03:00
|
|
|
}
|
|
|
|
|
2020-08-14 10:25:39 +03:00
|
|
|
#[test]
|
|
|
|
fn test_u128_ne() {
|
|
|
|
TestU128::test_ne();
|
|
|
|
}
|
|
|
|
|
2020-07-16 05:55:04 +03:00
|
|
|
#[test]
|
|
|
|
fn test_u128_ge() {
|
2020-06-06 02:51:26 +03:00
|
|
|
TestU128::test_ge();
|
2020-07-16 05:55:04 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn test_u128_gt() {
|
2020-06-06 02:51:26 +03:00
|
|
|
TestU128::test_gt();
|
2020-07-16 05:55:04 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn test_u128_le() {
|
2020-06-06 02:51:26 +03:00
|
|
|
TestU128::test_le();
|
2020-07-16 05:55:04 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn test_u128_lt() {
|
|
|
|
TestU128::test_lt();
|
|
|
|
}
|
2020-06-06 02:51:26 +03:00
|
|
|
|
2020-07-16 05:55:04 +03:00
|
|
|
#[test]
|
2020-08-17 05:14:26 +03:00
|
|
|
fn test_u128_console_assert() {
|
|
|
|
TestU128::test_console_assert();
|
2020-07-16 05:55:04 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn test_u128_ternary() {
|
2020-06-06 02:51:26 +03:00
|
|
|
TestU128::test_ternary();
|
|
|
|
}
|