第二题
This commit is contained in:
@@ -0,0 +1,22 @@
|
|||||||
|
package io.github.sor2171.puzzles.extend
|
||||||
|
|
||||||
|
import org.junit.jupiter.api.extension.AfterAllCallback
|
||||||
|
import org.junit.jupiter.api.extension.BeforeAllCallback
|
||||||
|
import org.junit.jupiter.api.extension.ExtensionContext
|
||||||
|
|
||||||
|
class TestLifecycleLoggerExtension : BeforeAllCallback, AfterAllCallback {
|
||||||
|
|
||||||
|
override fun beforeAll(context: ExtensionContext) {
|
||||||
|
val testClassName = context.requiredTestClass.simpleName
|
||||||
|
println()
|
||||||
|
println("=== [START] $testClassName ===")
|
||||||
|
println()
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun afterAll(context: ExtensionContext) {
|
||||||
|
val testClassName = context.requiredTestClass.simpleName
|
||||||
|
println()
|
||||||
|
println("=== [ END ] $testClassName ===")
|
||||||
|
println()
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,36 @@
|
|||||||
|
@file:SkipCompile(skip = true)
|
||||||
|
@file:Suppress("ClassName", "JoinDeclarationAndAssignment", "KotlinConstantConditions")
|
||||||
|
|
||||||
|
package io.github.sor2171.puzzles.extra
|
||||||
|
|
||||||
|
import io.github.sor2171.puzzles.annotation.SkipCompile
|
||||||
|
import org.junit.jupiter.api.Test
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 本关考察你对无符号数字的理解。
|
||||||
|
*/
|
||||||
|
class `More strange variables` {
|
||||||
|
// write start 1
|
||||||
|
|
||||||
|
// write end 1
|
||||||
|
|
||||||
|
init {
|
||||||
|
a = 0xEEBAU
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun puzzle() {
|
||||||
|
val b: Short
|
||||||
|
val c: Short
|
||||||
|
|
||||||
|
// write start 2
|
||||||
|
|
||||||
|
// write end 2
|
||||||
|
|
||||||
|
println(a)
|
||||||
|
println(b)
|
||||||
|
a = b.toUInt() * 0x10000U + c.toUInt()
|
||||||
|
assert(a == 0xFFFFFFFFU)
|
||||||
|
println(a)
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user