feat: Implement a mathematical implication

This commit is contained in:
PapaTutuWawa 2022-05-13 13:46:41 +02:00
parent f92bef517f
commit e24ef0c3d5
5 changed files with 24 additions and 1 deletions

View File

@ -9,3 +9,7 @@
## 0.1.2
* Add [DeterministicFiniteAutomaton] and [MealyAutomaton]
## 0.1.3
* Add [implies] from the Moxxy main repository

4
lib/math.dart Normal file
View File

@ -0,0 +1,4 @@
/// A mathematical implication between [a] and [b] (a -> b);
bool implies(bool a, bool b) {
return !a || b;
}

View File

@ -2,3 +2,4 @@ library moxlib;
export "awaitabledatasender.dart";
export "automaton.dart";
export "math.dart";

View File

@ -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

14
test/math_test.dart Normal file
View File

@ -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);
});
});
}