1/* 2 * Copyright (c) 2023-2024 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16function test_module(): void { 17 assert new BigInt(10).operatorModule(new BigInt(3)) == (1n); 18 assert new BigInt(10).operatorModule(new BigInt(-3)) == (1n); 19 assert new BigInt(-10).operatorModule(new BigInt(3)) == (-1n); 20 assert new BigInt(-10).operatorModule(new BigInt(-3)) == (-1n); 21 assert new BigInt(100).operatorModule(new BigInt(50)) == (0n); 22 assert new BigInt(100).operatorModule(new BigInt(-50)) == (0n); 23 assert new BigInt(-100).operatorModule(new BigInt(50)) == (0n); 24 assert new BigInt(-100).operatorModule(new BigInt(-50)) == (0n); 25 assert new BigInt(3124378143267041203423n).operatorModule(new BigInt(43621978)) == (18802883n); 26 assert new BigInt(-3124378143267041203423n).operatorModule(new BigInt(43621978)) == (-18802883n); 27 assert new BigInt(3124378143267041203423n).operatorModule(new BigInt(-43621978)) == (18802883n); 28 assert new BigInt(-3124378143267041203423n).operatorModule(new BigInt(-43621978)) == (-18802883n); 29 assert new BigInt(100).operatorModule(new BigInt(250)) == (100n); 30 assert new BigInt(-100).operatorModule(new BigInt(250)) == (-100n); 31 assert new BigInt(100).operatorModule(new BigInt(-250)) == (100n); 32 assert new BigInt(-100).operatorModule(new BigInt(-250)) == (-100n); 33 assert new BigInt(0).operatorModule(new BigInt(8)) == (0n); 34} 35 36function main() : void { 37 test_module() 38} 39 40