Skip to content

Commit

Permalink
Fixed creation of logic bools (#19)
Browse files Browse the repository at this point in the history
  • Loading branch information
Damtev authored Oct 4, 2023
1 parent e17613a commit 6588257
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
2 changes: 1 addition & 1 deletion buildSrc/src/main/kotlin/org.klogic.klogic-base.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ plugins {
}

group = "org.klogic"
version = "0.2.0"
version = "0.2.1"

repositories {
mavenCentral()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ sealed class LogicBool : EmptyTerm<LogicBool>() {
override fun toString(): String = toBool().toString()

companion object {
fun Boolean.toLogicBool(): LogicBool = if (this) LogicFals else LogicTru
fun Boolean.toLogicBool(): LogicBool = if (this) LogicTru else LogicFals
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,24 @@
package org.klogic.utils.terms

import org.junit.jupiter.api.Assertions.assertEquals
import org.junit.jupiter.api.Assertions.assertSame
import org.junit.jupiter.api.DisplayName
import org.junit.jupiter.api.Test
import org.klogic.core.*
import org.klogic.core.Var.Companion.createTypedVar
import org.klogic.utils.singleReifiedTerm
import org.klogic.utils.terms.LogicBool.Companion.toLogicBool
import org.klogic.utils.terms.LogicFalsᴼ.falsᴼ
import org.klogic.utils.terms.LogicTruᴼ.truᴼ
import org.klogic.utils.withEmptyContext

class LogicBoolTest {
@Test
fun testLogicBoolsCreation() {
assertSame(falsᴼ, false.toLogicBool())
assertSame(truᴼ, true.toLogicBool())
}

@Test
@DisplayName("Forward !false = true")
fun testForwardNot1() {
Expand Down

0 comments on commit 6588257

Please sign in to comment.