Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed creation of logic bools #19

Merged
merged 1 commit into from
Oct 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 testForwardNotᴼ1() {
Expand Down