| /* |
| * Licensed to the Apache Software Foundation (ASF) under one or more |
| * contributor license agreements. See the NOTICE file distributed with |
| * this work for additional information regarding copyright ownership. |
| * The ASF licenses this file to You under the Apache License, Version 2.0 |
| * (the "License"); you may not use this file except in compliance with |
| * the License. You may obtain a copy of the License at |
| * |
| * https://www.apache.org/licenses/LICENSE-2.0 |
| * |
| * Unless required by applicable law or agreed to in writing, software |
| * distributed under the License is distributed on an "AS IS" BASIS, |
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| * See the License for the specific language governing permissions and |
| * limitations under the License. |
| */ |
| let results = [...] |
| |
| function expect(const left, const right, const equal) { |
| let correct = (left == right) === equal && !(left != right) === equal; |
| results.add(correct ?: `${left} ?= ${right}`); |
| return results; |
| } |
| |
| function expectStrict(const left, const right, const equal) { |
| let correct = (left === right) === equal && !(left !== right) === equal; |
| results.add(correct ?: `${left} ?== ${right}`); |
| return results; |
| } |
| |
| |
| expect(1.0, 1, true); |
| expect(1.1, 1, false); |
| expect(1.1, 1.1d, true); |
| expect(1.1, 1.1f, false); |
| expect('a', 'a', true); |
| expect('a', 'b', false); |
| expect('1', 1, true); |
| |
| expectStrict(1.0, 1.0, true); |
| expectStrict(1.0, 1.0d, true); |
| expectStrict(1.0, 1.0f, false); |
| expectStrict(1.0, 1, false); |
| expectStrict(1, '1', false); |