1/* 2 * Copyright (c) 2021-2025 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 16class A{} 17 18function main(): void { 19 ClassEquality(); 20 NullEquality(); 21 ArrayEquality(); 22} 23 24function ClassEquality(): void { 25 let a : A = new A(); 26 let b = a; 27 assertTrue(a === b) 28 let c : A = new A(); 29 assertTrue(a !== c) 30} 31 32 33function NullEquality(): void { 34 let a : A | null = null; 35 let b = a; 36 assertTrue(a === b) 37 let c : A | null = null; 38 assertTrue(c === null) 39 assertTrue(null === null) 40} 41 42 43function ArrayEquality(): void { 44 let a : int[] = [1, 2, 3]; 45 let b = a; 46 assertTrue(a === b) 47 let c : int[] = [1, 2, 3]; 48 assertTrue(a !== c) 49} 50 51function NumericEquality(): void { 52 let a : Int = 1; 53 let b = a; 54 assertTrue(a === b) 55 let c : Int = 1; 56 assertTrue(a !== c) 57 let d : Double = 1.0; 58 assertTrue(a !== c) 59} 60