-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add types to OppositeMonoid and OppositeSemigroup
needed to conform with interface
- Loading branch information
Showing
3 changed files
with
24 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
use Marcosh\LamPHPda\Instances\LinkedList\LinkedListMonoid; | ||
use Marcosh\LamPHPda\Instances\OppositeMonoid; | ||
use Marcosh\LamPHPda\Instances\OppositeSemigroup; | ||
use Marcosh\LamPHPda\LinkedList; | ||
|
||
describe('ListTOppositeMonoid', function () { | ||
it('has the same empty element', function () { | ||
expect((new OppositeMonoid(new LinkedListMonoid()))->mempty())->toEqual((new LinkedListMonoid())->mempty()); | ||
}); | ||
}); | ||
|
||
describe('ListTOppositeSemigroup', function () { | ||
it('reverses the result of append', function () { | ||
expect((new OppositeSemigroup(new LinkedListMonoid()))->append(LinkedList::fromList([1]), LinkedList::fromList([2]))) | ||
->toEqual((new LinkedListMonoid())->append(LinkedList::fromList([2]), LinkedList::fromList([1]))); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters