-
Notifications
You must be signed in to change notification settings - Fork 128
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
86 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
/** | ||
* Created on 6/26/2017 by fr1kin | ||
*/ | ||
package com.matt.forgehax; |
13 changes: 13 additions & 0 deletions
13
src/test/java/com/matt/forgehax/util/command/CommandTest.java
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,13 @@ | ||
package com.matt.forgehax.util.command; | ||
|
||
/** | ||
* Created on 6/26/2017 by fr1kin | ||
*/ | ||
public class CommandTest { | ||
public void testBuildCommand() { | ||
Command command = CommandBuilders.getInstance().newCommandBuilder() | ||
.name("testCommand") | ||
.description("a test command") | ||
.build(); | ||
} | ||
} |
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,69 @@ | ||
package com.matt.forgehax.util.math; | ||
|
||
import org.junit.Assert; | ||
import org.junit.Test; | ||
|
||
/** | ||
* Created on 6/26/2017 by fr1kin | ||
*/ | ||
public class TestAngleN { | ||
/* | ||
If any of these tests fail, it maybe because of the precision set inside AngleHelper.java | ||
being too high. By default it 9 decimal places | ||
*/ | ||
|
||
@Test | ||
public void testEquals() { | ||
AngleN rad = AngleN.radians(Math.PI / 2.D, Math.PI / 4.D); | ||
AngleN deg = AngleN.degrees(90, 45); | ||
|
||
Assert.assertTrue(rad.equals(deg)); | ||
Assert.assertTrue(rad.equals(deg.toRadians())); | ||
Assert.assertTrue(rad.toDegrees().equals(deg)); | ||
Assert.assertTrue(rad.toDegrees().equals(deg.toRadians())); | ||
} | ||
|
||
@Test | ||
public void testEqualsNonNormalAngle() { | ||
AngleN rad = AngleN.radians(4.D * Math.PI, (11.D * Math.PI) / 4.D); | ||
AngleN deg = AngleN.degrees(720, 495); | ||
|
||
Assert.assertTrue(rad.equals(deg)); | ||
Assert.assertTrue(rad.equals(deg.toRadians())); | ||
Assert.assertTrue(rad.toDegrees().equals(deg)); | ||
Assert.assertTrue(rad.toDegrees().equals(deg.toRadians())); | ||
} | ||
|
||
@Test | ||
public void testNotEquals() { | ||
AngleN rad = AngleN.radians(Math.PI / 2.D, Math.PI / 4.D); | ||
AngleN deg = AngleN.degrees(180, 45); | ||
|
||
Assert.assertFalse(rad.equals(deg)); | ||
Assert.assertFalse(rad.equals(deg.toRadians())); | ||
Assert.assertFalse(rad.toDegrees().equals(deg)); | ||
Assert.assertFalse(rad.toDegrees().equals(deg.toRadians())); | ||
} | ||
|
||
@Test | ||
public void testNotEqualsNonNormalAngle() { | ||
AngleN rad = AngleN.radians(4.D * Math.PI, (11.D * Math.PI) / 4.D); | ||
AngleN deg = AngleN.degrees(810, 495); | ||
|
||
Assert.assertFalse(rad.equals(deg)); | ||
Assert.assertFalse(rad.equals(deg.toRadians())); | ||
Assert.assertFalse(rad.toDegrees().equals(deg)); | ||
Assert.assertFalse(rad.toDegrees().equals(deg.toRadians())); | ||
} | ||
|
||
@Test | ||
public void testHashCodeEquals() { | ||
AngleN rad = AngleN.radians(Math.PI / 2.D, Math.PI / 4.D); | ||
AngleN deg = AngleN.degrees(90, 45); | ||
|
||
Assert.assertTrue(rad.hashCode() == deg.hashCode()); | ||
Assert.assertTrue(rad.hashCode() == deg.toRadians().hashCode()); | ||
Assert.assertTrue(rad.toDegrees().hashCode() == deg.hashCode()); | ||
Assert.assertTrue(rad.toDegrees().hashCode() == deg.toRadians().hashCode()); | ||
} | ||
} |