translator: fix test for boolean array, add print for BooleanArray
This commit is contained in:
@@ -46,6 +46,26 @@ class BooleanArray(var size: Int) {
|
||||
|
||||
}
|
||||
|
||||
fun BooleanArray.print() {
|
||||
var index = 0
|
||||
print('[')
|
||||
while (index < size) {
|
||||
print(get(index))
|
||||
index++
|
||||
if (index < size){
|
||||
print(';')
|
||||
print(' ')
|
||||
}
|
||||
}
|
||||
print(']')
|
||||
}
|
||||
|
||||
fun BooleanArray.println() {
|
||||
this.print()
|
||||
println()
|
||||
}
|
||||
|
||||
|
||||
fun BooleanArray.copyOf(newSize: Int): BooleanArray {
|
||||
val newInstance = BooleanArray(newSize)
|
||||
var index = 0
|
||||
|
||||
@@ -75,6 +75,11 @@ fun print(message: ByteArray) {
|
||||
message.print()
|
||||
}
|
||||
|
||||
/** Prints the given message and newline to the standard output stream. */
|
||||
fun print(message: BooleanArray) {
|
||||
message.print()
|
||||
}
|
||||
|
||||
/** Prints the given message and newline to the standard output stream. */
|
||||
fun print(message: IntArray) {
|
||||
message.print()
|
||||
@@ -131,6 +136,11 @@ fun println(message: ByteArray) {
|
||||
message.println()
|
||||
}
|
||||
|
||||
/** Prints the given message and newline to the standard output stream. */
|
||||
fun println(message: BooleanArray) {
|
||||
message.println()
|
||||
}
|
||||
|
||||
/** Prints the given message and newline to the standard output stream. */
|
||||
fun println(message: IntArray) {
|
||||
message.println()
|
||||
|
||||
@@ -1,5 +1,10 @@
|
||||
fun booleanarray_1(x: Boolean): Boolean {
|
||||
fun booleanarray_1_slave(x: Boolean): Boolean {
|
||||
val z = BooleanArray(10)
|
||||
z.set(1, x)
|
||||
return z.get(1)
|
||||
}
|
||||
}
|
||||
|
||||
fun booleanarray_1(x: Boolean): Int {
|
||||
return if (booleanarray_1_slave(x)) 1 else 0
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user