translator: fix test for boolean array, add print for BooleanArray

This commit is contained in:
Alexey Stepanov
2016-08-17 10:55:20 +03:00
parent bca8c5ded9
commit 7ec067d7dd
3 changed files with 37 additions and 2 deletions
+20
View File
@@ -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
+10
View File
@@ -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
}