Skip to content

Commit

Permalink
update UUID unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
sunny-chung committed Apr 18, 2024
1 parent 0f3de63 commit 5d2972c
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions stdlib/src/commonTest/kotlin/UuidLibTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,15 @@ class UuidLibTest {
}
val interpreter = interpreter("""
val uuids = mutableSetOf<String>()
repeat(20) {
repeat(1000) {
uuids += uuid4().toString()
}
val n = uuids.size
val f = uuids.first()
""".trimIndent(), executionEnvironment = env)
interpreter.eval()
val symbolTable = interpreter.symbolTable()
assertEquals(20, (symbolTable.findPropertyByDeclaredName("n") as IntValue).value)
assertEquals(1000, (symbolTable.findPropertyByDeclaredName("n") as IntValue).value)
assertEquals(36, (symbolTable.findPropertyByDeclaredName("f") as StringValue).value.length)
assertTrue("[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}".toRegex()
.matches((symbolTable.findPropertyByDeclaredName("f") as StringValue).value))
Expand All @@ -48,15 +48,15 @@ class UuidLibTest {
}
val interpreter = interpreter("""
val uuids = mutableSetOf<String>()
repeat(20) {
repeat(1000) {
uuids += uuidString()
}
val n = uuids.size
val f = uuids.first()
""".trimIndent(), executionEnvironment = env)
interpreter.eval()
val symbolTable = interpreter.symbolTable()
assertEquals(20, (symbolTable.findPropertyByDeclaredName("n") as IntValue).value)
assertEquals(1000, (symbolTable.findPropertyByDeclaredName("n") as IntValue).value)
assertEquals(36, (symbolTable.findPropertyByDeclaredName("f") as StringValue).value.length)
assertTrue("[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}".toRegex()
.matches((symbolTable.findPropertyByDeclaredName("f") as StringValue).value))
Expand Down

0 comments on commit 5d2972c

Please sign in to comment.