From e24ef0c3d5fb589b8a984092ceebb8c6e2a67d49 Mon Sep 17 00:00:00 2001 From: "Alexander \"PapaTutuWawa" Date: Fri, 13 May 2022 13:46:41 +0200 Subject: [PATCH] feat: Implement a mathematical implication --- CHANGELOG.md | 4 ++++ lib/math.dart | 4 ++++ lib/moxlib.dart | 1 + pubspec.yaml | 2 +- test/math_test.dart | 14 ++++++++++++++ 5 files changed, 24 insertions(+), 1 deletion(-) create mode 100644 lib/math.dart create mode 100644 test/math_test.dart diff --git a/CHANGELOG.md b/CHANGELOG.md index aaa5df1..a5a9037 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,3 +9,7 @@ ## 0.1.2 * Add [DeterministicFiniteAutomaton] and [MealyAutomaton] + +## 0.1.3 + +* Add [implies] from the Moxxy main repository diff --git a/lib/math.dart b/lib/math.dart new file mode 100644 index 0000000..1d2444b --- /dev/null +++ b/lib/math.dart @@ -0,0 +1,4 @@ +/// A mathematical implication between [a] and [b] (a -> b); +bool implies(bool a, bool b) { + return !a || b; +} diff --git a/lib/moxlib.dart b/lib/moxlib.dart index e6c6194..25c0192 100644 --- a/lib/moxlib.dart +++ b/lib/moxlib.dart @@ -2,3 +2,4 @@ library moxlib; export "awaitabledatasender.dart"; export "automaton.dart"; +export "math.dart"; diff --git a/pubspec.yaml b/pubspec.yaml index 9e23672..3d3d14f 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: moxlib description: A collection of code for sharing between various moxxy libraries. Not inteded for outside use. -version: 0.1.2 +version: 0.1.3 homepage: https://codeberg.org/moxxy/moxlib publish_to: https://pub.polynom.me diff --git a/test/math_test.dart b/test/math_test.dart new file mode 100644 index 0000000..0e97b81 --- /dev/null +++ b/test/math_test.dart @@ -0,0 +1,14 @@ +import "package:moxlib/math.dart"; + +import "package:test/test.dart"; + +void main() { + group("implies", () { + test("Truth table test", () { + expect(implies(true, true), true); + expect(implies(true, false), false); + expect(implies(false, true), true); + expect(implies(false, false), true); + }); + }); +}