This repository has been archived by the owner on Oct 12, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Poetic literals (integers) are working.
- Loading branch information
1 parent
780c833
commit af16141
Showing
10 changed files
with
180 additions
and
36 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
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
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
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
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,59 @@ | ||
using Rockstar.Engine.Expressions; | ||
|
||
namespace Rockstar.Test; | ||
|
||
public class PronounTests { | ||
|
||
private void TestPronoun(Variable variable, Value value) { | ||
var e = new TestEnvironment(); | ||
var pronoun = new Pronoun(); | ||
e.SetVariable(variable, value); | ||
var result = e.GetVariable(pronoun) as Number; | ||
result.ShouldBe(value); | ||
} | ||
|
||
|
||
[Fact] | ||
public void AssigningProperVariableSetsPronoun() | ||
=> TestPronoun(new ProperVariable("Doctor Feelgood"), new Number(123)); | ||
|
||
[Fact] | ||
public void AssigningSimpleVariableSetsPronoun() | ||
=> TestPronoun(new SimpleVariable("Doctor Feelgood"), new Number(123)); | ||
|
||
[Fact] | ||
public void AssigningCommonVariableSetsPronoun() | ||
=> TestPronoun(new CommonVariable("Doctor Feelgood"), new Number(123)); | ||
|
||
[Fact] | ||
public void LookupPronounWithoutAssigningVariableThrowsException() { | ||
var e = new TestEnvironment(); | ||
Should.Throw<Exception>(() => e.GetVariable(new("him"))); | ||
} | ||
|
||
[Fact] | ||
public void AssignPronounWithoutAssigningVariableThrowsException() { | ||
var e = new TestEnvironment(); | ||
Should.Throw<Exception>(() => e.SetVariable(new("him"), new Number(123))); | ||
} | ||
|
||
private void AssignPronounAfterAssigningVariableUpdatesVariable(Variable variable, Value value) { | ||
var e = new TestEnvironment(); | ||
e.SetVariable(variable, new Null()); | ||
e.SetVariable(new(), value); | ||
e.GetVariable(variable).ShouldBe(value); | ||
} | ||
|
||
[Fact] | ||
public void AssignPronounAfterAssigningProperVariableUpdatesVariable() | ||
=> AssignPronounAfterAssigningVariableUpdatesVariable(new ProperVariable("Mr Crowley"), new Strïng("hey")); | ||
|
||
[Fact] | ||
public void AssignPronounAfterAssigningSimpleVariableUpdatesVariable() | ||
=> AssignPronounAfterAssigningVariableUpdatesVariable(new SimpleVariable("crowley"), new Strïng("hey")); | ||
|
||
[Fact] | ||
public void AssignPronounAfterAssigningCommonVariableUpdatesVariable() | ||
=> AssignPronounAfterAssigningVariableUpdatesVariable(new CommonVariable("my humps"), new Strïng("my lady humps")); | ||
|
||
} |
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