-
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.
will not discover new test, no matter what! will push to server to se…
…e if build box does recognize.
- Loading branch information
Cathal McHale
committed
Jul 3, 2019
1 parent
e85e10c
commit ea8f792
Showing
3 changed files
with
60 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
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,40 @@ | ||
using System.Numerics; | ||
using Xunit; | ||
using Xunit.Gherkin.Quick; | ||
|
||
namespace Ray.Domain.Test.Tuples | ||
{ | ||
[FeatureFile("./features/tuples/BasicOperations.feature")] | ||
public sealed class BasicOperationsTests : Feature | ||
{ | ||
private Vector4 _firstTuple = new Vector4(), | ||
_secondTuple = new Vector4(); | ||
|
||
[Given(@"a1 = tuple (\d) (-\d) (\d) (\d)")] | ||
public void One(float x, float y, float z, float w) | ||
{ | ||
_firstTuple.X = x; | ||
_firstTuple.Y = y; | ||
_firstTuple.Z = z; | ||
_firstTuple.W = w; | ||
} | ||
|
||
[And(@"a2 = tuple (-\d) (\d) (\d) (\d)")] | ||
public void Two(float x, float y, float z, float w) | ||
{ | ||
_secondTuple.X = x; | ||
_secondTuple.Y = y; | ||
_secondTuple.Z = z; | ||
_secondTuple.W = w; | ||
} | ||
|
||
[Then(@"a1 plus a2 = tuple (\d) (\d) (\d) (\d)")] | ||
public void Three(float x, float y, float z, float w) | ||
{ | ||
var expectedResult = new Vector4(x, y, z, w); | ||
var actualResult = Vector4.Add(_firstTuple, _secondTuple); | ||
Assert.True(expectedResult.Equals(actualResult)); | ||
} | ||
|
||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
test/Ray.Domain.Test/features/tuples/BasicOperations.feature
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,11 @@ | ||
Feature: BasicTuplesMathFeature | ||
In order to move around 3D space | ||
As a Ray Tracer | ||
I want the ability to perform basic math on points and vectors | ||
|
||
Background: | ||
Given a1 = tuple 3 -2 5 1 | ||
|
||
Scenario: Adding two tuples | ||
And a2 = tuple -2 3 1 0 | ||
Then a1 plus a2 = tuple 1 1 6 1 |