Skip to content

Commit

Permalink
Adjusting tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
kristoffer-paulsson committed Jul 6, 2022
1 parent 0682004 commit c5ccebc
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 116 deletions.
79 changes: 41 additions & 38 deletions signals/src/commonTest/kotlin/org/angproj/io/sig/SigNameTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -3,59 +3,62 @@ package org.angproj.io.sig
import kotlin.test.Test
import kotlin.test.assertEquals

fun t_codeToName() {
assertEquals(SigName.codeToName(6), SigName.SIGABRT)
assertEquals(SigName.codeToName(14), SigName.SIGALRM)
assertEquals(SigName.codeToName(8), SigName.SIGFPE)
assertEquals(SigName.codeToName(1), SigName.SIGHUP)
assertEquals(SigName.codeToName(4), SigName.SIGILL)
assertEquals(SigName.codeToName(2), SigName.SIGINT)
assertEquals(SigName.codeToName(9), SigName.SIGKILL)
assertEquals(SigName.codeToName(13), SigName.SIGPIPE)
assertEquals(SigName.codeToName(3), SigName.SIGQUIT)
assertEquals(SigName.codeToName(11), SigName.SIGSEGV)
assertEquals(SigName.codeToName(15), SigName.SIGTERM)
assertEquals(SigName.codeToName(5), SigName.SIGTRAP)
}

fun t_nameToCode() {
assertEquals(SigName.nameToCode(SigName.SIGABRT), 6)
assertEquals(SigName.nameToCode(SigName.SIGALRM), 14)
assertEquals(SigName.nameToCode(SigName.SIGFPE), 8)
assertEquals(SigName.nameToCode(SigName.SIGHUP), 1)
assertEquals(SigName.nameToCode(SigName.SIGILL), 4)
assertEquals(SigName.nameToCode(SigName.SIGINT), 2)
assertEquals(SigName.nameToCode(SigName.SIGKILL), 9)
assertEquals(SigName.nameToCode(SigName.SIGPIPE), 13)
assertEquals(SigName.nameToCode(SigName.SIGQUIT), 3)
assertEquals(SigName.nameToCode(SigName.SIGSEGV), 11)
assertEquals(SigName.nameToCode(SigName.SIGTERM), 15)
assertEquals(SigName.nameToCode(SigName.SIGTRAP), 5)
}

fun t_toString() {
assertEquals(SigName.SIGINT.toString(), "SIGINT")
}

/**
* Signal name test class.
*
* @constructor Create empty Sig name test
*/
expect class SigNameTest {
class SigNameTest {

/**
* Test for SigName.codeToName()
*/
@Test
fun codeToName()
fun codeToName() {
if (Internals.sigAbbr(10) == "FAKE")
return

assertEquals(SigName.codeToName(6), SigName.SIGABRT)
assertEquals(SigName.codeToName(14), SigName.SIGALRM)
assertEquals(SigName.codeToName(8), SigName.SIGFPE)
assertEquals(SigName.codeToName(1), SigName.SIGHUP)
assertEquals(SigName.codeToName(4), SigName.SIGILL)
assertEquals(SigName.codeToName(2), SigName.SIGINT)
assertEquals(SigName.codeToName(9), SigName.SIGKILL)
assertEquals(SigName.codeToName(13), SigName.SIGPIPE)
assertEquals(SigName.codeToName(3), SigName.SIGQUIT)
assertEquals(SigName.codeToName(11), SigName.SIGSEGV)
assertEquals(SigName.codeToName(15), SigName.SIGTERM)
assertEquals(SigName.codeToName(5), SigName.SIGTRAP)
}

/**
* Test for SigName.nameToCode()
*/
@Test
fun nameToCode()
fun nameToCode() {
if (Internals.sigAbbr(10) == "FAKE")
return

assertEquals(SigName.nameToCode(SigName.SIGABRT), 6)
assertEquals(SigName.nameToCode(SigName.SIGALRM), 14)
assertEquals(SigName.nameToCode(SigName.SIGFPE), 8)
assertEquals(SigName.nameToCode(SigName.SIGHUP), 1)
assertEquals(SigName.nameToCode(SigName.SIGILL), 4)
assertEquals(SigName.nameToCode(SigName.SIGINT), 2)
assertEquals(SigName.nameToCode(SigName.SIGKILL), 9)
assertEquals(SigName.nameToCode(SigName.SIGPIPE), 13)
assertEquals(SigName.nameToCode(SigName.SIGQUIT), 3)
assertEquals(SigName.nameToCode(SigName.SIGSEGV), 11)
assertEquals(SigName.nameToCode(SigName.SIGTERM), 15)
assertEquals(SigName.nameToCode(SigName.SIGTRAP), 5)
}

@Test
fun testToString()
fun testToString() {
if (Internals.sigAbbr(10) == "FAKE")
return

assertEquals(SigName.SIGINT.toString(), "SIGINT")
}
}
24 changes: 0 additions & 24 deletions signals/src/jsTest/kotlin/org/angproj/io/sig/SigNameTest.kt

This file was deleted.

27 changes: 0 additions & 27 deletions signals/src/jvmTest/kotlin/org/angproj/io/sig/SigNameTest.kt

This file was deleted.

27 changes: 0 additions & 27 deletions signals/src/nativeTest/kotlin/org/angproj/io/sig/SigNameTest.kt

This file was deleted.

0 comments on commit c5ccebc

Please sign in to comment.