Skip to content

Commit

Permalink
feat: additional tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jenspots committed Sep 11, 2024
1 parent 109ac9f commit 724974e
Show file tree
Hide file tree
Showing 6 changed files with 62 additions and 2 deletions.
Binary file not shown.
Binary file not shown.
2 changes: 1 addition & 1 deletion src/main/kotlin/intermediate/IRRunner.kt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ data class IRRunner(
val uri: String,
val directory: File? = null,
val entrypoint: String? = null,
val type: IRRunner.Type,
val type: Type,
) {
enum class Type {
GRPC,
Expand Down
1 change: 0 additions & 1 deletion src/main/kotlin/parser/impl/jena/RDFC.kt
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ class RDFC {
val target = ResourceFactory.createProperty("${NS}target")!!
val metadata = ResourceFactory.createProperty("${NS}metadata")!!
val arguments = ResourceFactory.createProperty("${NS}arguments")!!
val kotlinRunner = ResourceFactory.createResource("${NS}Kotlin")!!
val dependency = ResourceFactory.createProperty("${NS}dependency")!!
val version = ResourceFactory.createProperty("${NS}version")!!
val author = ResourceFactory.createProperty("${NS}author")!!
Expand Down
29 changes: 29 additions & 0 deletions src/test/kotlin/extensions/ChannelTest.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package extensions

import kotlin.test.Test
import kotlin.test.assertEquals
import kotlinx.coroutines.channels.Channel
import kotlinx.coroutines.channels.ReceiveChannel
import kotlinx.coroutines.channels.SendChannel
import kotlinx.coroutines.runBlocking
import technology.idlab.extensions.map

class ChannelTest {
@Test
fun mapIntToString() = runBlocking {
val channel: Channel<String> = Channel(Channel.UNLIMITED)

// Map to the correct types using mapper function.
val sender: SendChannel<Int> = channel.map(this) { it.toString() }
val receiver: ReceiveChannel<String> = channel

sender.send(1)
sender.send(2)
sender.send(3)
sender.close()

assertEquals("1", receiver.receive())
assertEquals("2", receiver.receive())
assertEquals("3", receiver.receive())
}
}
32 changes: 32 additions & 0 deletions src/test/kotlin/extensions/FileTest.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package extensions

import java.io.File
import kotlin.test.Test
import kotlin.test.assertEquals
import technology.idlab.extensions.rawPath

class FileTest {
@Test
fun empty() {
val file = File("")
assertEquals("", file.rawPath())
}

@Test
fun slashes() {
val file = File("/////")
assertEquals("/", file.rawPath())
}

@Test
fun filePrefix() {
val file = File("file:/home/admin")
assertEquals("/home/admin", file.rawPath())
}

@Test
fun filePrefixDoubleSlash() {
val file = File("file://home/admin")
assertEquals("/home/admin", file.rawPath())
}
}

0 comments on commit 724974e

Please sign in to comment.