-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #40 from graycat27/digit#38
小数の桁数を見直して、見た目を改善
- Loading branch information
Showing
8 changed files
with
95 additions
and
23 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
47 changes: 47 additions & 0 deletions
47
project/src/test/java/com/github/graycat27/flightHUDmod/guiComponent/PitchMeterTest.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,47 @@ | ||
package com.github.graycat27.flightHUDmod.guiComponent; | ||
|
||
import org.junit.Test; | ||
|
||
import static org.junit.jupiter.api.Assertions.*; | ||
|
||
public class PitchMeterTest { | ||
|
||
private final float f1 = 45.678f; | ||
private final float f0 = 0.0f; | ||
private final float fn1 = -45.678f; | ||
|
||
/* getDgrString */ | ||
@Test | ||
public void testGetDgrString(){ | ||
String s = PitchMeter.getDgrString((int)f0); | ||
assertEquals(" 0°", s); | ||
} | ||
@Test | ||
public void testGetDgrString1(){ | ||
String s = PitchMeter.getDgrString((int)f1); | ||
assertEquals("+45°", s); //intキャストで切り捨て | ||
} | ||
@Test | ||
public void testGetDgrString2(){ | ||
String s = PitchMeter.getDgrString((int)fn1); | ||
assertEquals("-45°", s); | ||
} | ||
|
||
/* getDgrStringDecimal1 */ | ||
@Test | ||
public void testGetDgrStringDecimal1(){ | ||
String s = PitchMeter.getDgrStringDecimal1(f0); | ||
assertEquals(" 0.0°", s); | ||
} | ||
@Test | ||
public void testGetDgrStringDecimal11(){ | ||
String s = PitchMeter.getDgrStringDecimal1(f1); | ||
assertEquals("+45.7°", s); //formatで四捨五入 | ||
} | ||
@Test | ||
public void testGetDgrStringDecimal12(){ | ||
String s = PitchMeter.getDgrStringDecimal1(fn1); | ||
assertEquals("-45.7°", s); | ||
} | ||
|
||
} |