| /* | |
| * 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 AllDistinctCharArrayTest { | |
| @Test | |
| fun allDistinct() { | |
| assertTrue(charArrayOf().allDistinct()) | |
| assertTrue(charArrayOf('a').allDistinct()) | |
| assertTrue(charArrayOf('a', 'b').allDistinct()) | |
| assertFalse(charArrayOf('a', 'a').allDistinct()) | |
| assertFalse(charArrayOf('b', 'b').allDistinct()) | |
| assertFalse(charArrayOf('a', 'b', 'a').allDistinct()) | |
| assertFalse(charArrayOf('b', 'a', 'b').allDistinct()) | |
| } | |
| @Test | |
| fun allDistinctBy() { | |
| assertTrue(charArrayOf().allDistinctBy { it.uppercaseChar() }) | |
| assertTrue(charArrayOf('a').allDistinctBy { it.uppercaseChar() }) | |
| assertTrue(charArrayOf('a').allDistinctBy { error("should not be called") }) | |
| assertTrue(charArrayOf('a', 'B').allDistinctBy { it.uppercaseChar() }) | |
| assertFalse(charArrayOf('a', 'A', 'a').allDistinctBy { it.uppercaseChar() }) | |
| assertFalse(charArrayOf('a', 'b').allDistinctBy { 0 }) | |
| assertFalse(charArrayOf('a', 'b').allDistinctBy { null }) | |
| } | |
| @Test | |
| fun allDistinctValueDomainBounds() { | |
| assertTrue(CharArray(65536) { it.toChar() }.allDistinct()) | |
| assertFalse(CharArray(65536) { (it / 2).toChar() }.allDistinct()) | |
| assertFalse(CharArray(65537) { it.toChar() }.allDistinct()) | |
| } | |
| } |