Files
autosqeal/src/test/java/wtf/beatrice/autosqueal/util/SystemUtilTest.java
T
bea ed90b246d6 add first unit tests
the ci has always had a 'mvn test' step, but there was nothing to
test. add junit 6 and pin surefire 3.6.0, extract the os detection
into a testable fromOsName method, and cover the movement step math
- including the axis-aligned cases that used to produce infinite
steps and never converge.
2026-09-29 11:51:13 +02:00

34 lines
959 B
Java

package wtf.beatrice.autosqueal.util;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertEquals;
class SystemUtilTest
{
@Test
void detectsWindows() {
assertEquals(SystemUtil.OperatingSystem.WINDOWS, SystemUtil.fromOsName("Windows 11"));
}
@Test
void detectsLinux() {
assertEquals(SystemUtil.OperatingSystem.LINUX, SystemUtil.fromOsName("Linux"));
assertEquals(SystemUtil.OperatingSystem.LINUX, SystemUtil.fromOsName("GNU/Linux"));
}
@Test
void detectsMacOS() {
assertEquals(SystemUtil.OperatingSystem.MAC_OS, SystemUtil.fromOsName("Mac OS X"));
}
@Test
void unknownForOtherSystems() {
assertEquals(SystemUtil.OperatingSystem.UNKNOWN, SystemUtil.fromOsName("SunOS"));
}
@Test
void hostSystemMatchesOsName() {
assertEquals(SystemUtil.fromOsName(System.getProperty("os.name")), SystemUtil.getHostSystem());
}
}