feat: Implement a mathematical implication
This commit is contained in:
parent
f92bef517f
commit
e24ef0c3d5
@ -9,3 +9,7 @@
|
|||||||
## 0.1.2
|
## 0.1.2
|
||||||
|
|
||||||
* Add [DeterministicFiniteAutomaton] and [MealyAutomaton]
|
* Add [DeterministicFiniteAutomaton] and [MealyAutomaton]
|
||||||
|
|
||||||
|
## 0.1.3
|
||||||
|
|
||||||
|
* Add [implies] from the Moxxy main repository
|
||||||
|
4
lib/math.dart
Normal file
4
lib/math.dart
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
/// A mathematical implication between [a] and [b] (a -> b);
|
||||||
|
bool implies(bool a, bool b) {
|
||||||
|
return !a || b;
|
||||||
|
}
|
@ -2,3 +2,4 @@ library moxlib;
|
|||||||
|
|
||||||
export "awaitabledatasender.dart";
|
export "awaitabledatasender.dart";
|
||||||
export "automaton.dart";
|
export "automaton.dart";
|
||||||
|
export "math.dart";
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
name: moxlib
|
name: moxlib
|
||||||
description: A collection of code for sharing between various moxxy libraries. Not inteded for outside use.
|
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
|
homepage: https://codeberg.org/moxxy/moxlib
|
||||||
publish_to: https://pub.polynom.me
|
publish_to: https://pub.polynom.me
|
||||||
|
|
||||||
|
14
test/math_test.dart
Normal file
14
test/math_test.dart
Normal 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);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user