| /* | |
| * Copyright 2010-2026 JetBrains s.r.o. and Kotlin Programming Language contributors. | |
| * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. | |
| */ | |
| package test.generated.alldistinct | |
| // | |
| // NOTE: THIS FILE IS AUTO-GENERATED by the AllDistinctTestGenerator.kt | |
| // See: https://github.com/JetBrains/kotlin/tree/master/libraries/stdlib | |
| // | |
| import kotlin.test.* | |
| class AllDistinctLongArrayTest { | |
| @Test | |
| fun allDistinct() { | |
| assertTrue(longArrayOf().allDistinct()) | |
| assertTrue(longArrayOf(1L).allDistinct()) | |
| assertTrue(longArrayOf(1L, 2L).allDistinct()) | |
| assertFalse(longArrayOf(1L, 1L).allDistinct()) | |
| assertFalse(longArrayOf(2L, 2L).allDistinct()) | |
| assertFalse(longArrayOf(1L, 2L, 1L).allDistinct()) | |
| assertFalse(longArrayOf(2L, 1L, 2L).allDistinct()) | |
| } | |
| @Test | |
| fun allDistinctBy() { | |
| assertTrue(longArrayOf().allDistinctBy { it * it }) | |
| assertTrue(longArrayOf(1L).allDistinctBy { it * it }) | |
| assertTrue(longArrayOf(1L).allDistinctBy { error("should not be called") }) | |
| assertTrue(longArrayOf(1L, 2L).allDistinctBy { it * it }) | |
| assertFalse(longArrayOf(1L, -1L, 1L).allDistinctBy { it * it }) | |
| assertFalse(longArrayOf(1L, 2L).allDistinctBy { 0 }) | |
| assertFalse(longArrayOf(1L, 2L).allDistinctBy { null }) | |
| } | |
| } |