-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add value equality to ConditionalEffect.
- Loading branch information
1 parent
0018cfb
commit 6cbd34d
Showing
2 changed files
with
39 additions
and
0 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
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,29 @@ | ||
using FluentAssertions; | ||
using RandomizerCore; | ||
using RandomizerCore.Logic; | ||
using RandomizerCore.StringItems; | ||
namespace RandomizerCoreTests | ||
{ | ||
public class StringItemEqualityTests | ||
{ | ||
[Theory] | ||
[InlineData("_ >|> _")] | ||
[InlineData("`A>1` => A++")] | ||
[InlineData("`A<1 | B<1 | A<2 + B<2` => (`A + B` => (A++ >> B++) >|> `A<1 + B>1` => A += 2 >|> B++)")] | ||
public void ItemEqualsTest(string effect) | ||
{ | ||
LogicManagerBuilder lmb = new(); | ||
lmb.GetOrAddTerm("A"); | ||
lmb.GetOrAddTerm("B"); | ||
|
||
LogicManager lm = new(lmb); | ||
|
||
LogicItem i1 = lm.FromItemString("I", effect); | ||
LogicItem i2 = lm.FromItemString("I", effect); | ||
|
||
i1.Should().Be(i2); | ||
i1.GetHashCode().Should().Be(i2.GetHashCode()); | ||
} | ||
|
||
} | ||
} |