Skip to content

Commit 951808f

Browse files
committed
Fixed tests.
1 parent d208d1d commit 951808f

File tree

5 files changed

+85
-58
lines changed

5 files changed

+85
-58
lines changed

Diff for: gradle/wrapper/gradle-wrapper.jar

3.63 KB
Binary file not shown.

Diff for: gradle/wrapper/gradle-wrapper.properties

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-5.4-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-6.4-bin.zip
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists

Diff for: gradlew

+33-20
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,21 @@
11
#!/usr/bin/env sh
22

3+
#
4+
# Copyright 2015 the original author or authors.
5+
#
6+
# Licensed under the Apache License, Version 2.0 (the "License");
7+
# you may not use this file except in compliance with the License.
8+
# You may obtain a copy of the License at
9+
#
10+
# https://www.apache.org/licenses/LICENSE-2.0
11+
#
12+
# Unless required by applicable law or agreed to in writing, software
13+
# distributed under the License is distributed on an "AS IS" BASIS,
14+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
# See the License for the specific language governing permissions and
16+
# limitations under the License.
17+
#
18+
319
##############################################################################
420
##
521
## Gradle start up script for UN*X
@@ -28,7 +44,7 @@ APP_NAME="Gradle"
2844
APP_BASE_NAME=`basename "$0"`
2945

3046
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
31-
DEFAULT_JVM_OPTS='"-Xmx64m"'
47+
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
3248

3349
# Use the maximum available, or set MAX_FD != -1 to use that value.
3450
MAX_FD="maximum"
@@ -66,6 +82,7 @@ esac
6682

6783
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
6884

85+
6986
# Determine the Java command to use to start the JVM.
7087
if [ -n "$JAVA_HOME" ] ; then
7188
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
@@ -109,10 +126,11 @@ if $darwin; then
109126
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
110127
fi
111128

112-
# For Cygwin, switch paths to Windows format before running java
113-
if $cygwin ; then
129+
# For Cygwin or MSYS, switch paths to Windows format before running java
130+
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
114131
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
115132
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
133+
116134
JAVACMD=`cygpath --unix "$JAVACMD"`
117135

118136
# We build the pattern for arguments to be converted via cygpath
@@ -138,19 +156,19 @@ if $cygwin ; then
138156
else
139157
eval `echo args$i`="\"$arg\""
140158
fi
141-
i=$((i+1))
159+
i=`expr $i + 1`
142160
done
143161
case $i in
144-
(0) set -- ;;
145-
(1) set -- "$args0" ;;
146-
(2) set -- "$args0" "$args1" ;;
147-
(3) set -- "$args0" "$args1" "$args2" ;;
148-
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
149-
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
150-
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
151-
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
152-
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
153-
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
162+
0) set -- ;;
163+
1) set -- "$args0" ;;
164+
2) set -- "$args0" "$args1" ;;
165+
3) set -- "$args0" "$args1" "$args2" ;;
166+
4) set -- "$args0" "$args1" "$args2" "$args3" ;;
167+
5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
168+
6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
169+
7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
170+
8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
171+
9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
154172
esac
155173
fi
156174

@@ -159,14 +177,9 @@ save () {
159177
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
160178
echo " "
161179
}
162-
APP_ARGS=$(save "$@")
180+
APP_ARGS=`save "$@"`
163181

164182
# Collect all arguments for the java command, following the shell quoting and substitution rules
165183
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
166184

167-
# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
168-
if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
169-
cd "$(dirname "$0")"
170-
fi
171-
172185
exec "$JAVACMD" "$@"

Diff for: gradlew.bat

+21-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
1+
@rem
2+
@rem Copyright 2015 the original author or authors.
3+
@rem
4+
@rem Licensed under the Apache License, Version 2.0 (the "License");
5+
@rem you may not use this file except in compliance with the License.
6+
@rem You may obtain a copy of the License at
7+
@rem
8+
@rem https://www.apache.org/licenses/LICENSE-2.0
9+
@rem
10+
@rem Unless required by applicable law or agreed to in writing, software
11+
@rem distributed under the License is distributed on an "AS IS" BASIS,
12+
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
@rem See the License for the specific language governing permissions and
14+
@rem limitations under the License.
15+
@rem
16+
117
@if "%DEBUG%" == "" @echo off
218
@rem ##########################################################################
319
@rem
@@ -13,8 +29,11 @@ if "%DIRNAME%" == "" set DIRNAME=.
1329
set APP_BASE_NAME=%~n0
1430
set APP_HOME=%DIRNAME%
1531

32+
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
33+
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
34+
1635
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
17-
set DEFAULT_JVM_OPTS="-Xmx64m"
36+
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
1837

1938
@rem Find java.exe
2039
if defined JAVA_HOME goto findJavaFromJavaHome
@@ -65,6 +84,7 @@ set CMD_LINE_ARGS=%*
6584

6685
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
6786

87+
6888
@rem Execute Gradle
6989
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
7090

Diff for: src/test/java/eu/mihosoft/vvecmath/Vector3dTest.java

+30-36
Original file line numberDiff line numberDiff line change
@@ -34,31 +34,36 @@
3434
*/
3535
package eu.mihosoft.vvecmath;
3636

37+
import java.util.Random;
38+
3739
import org.junit.Test;
3840

39-
import junit.framework.Assert;
41+
import org.junit.Assert;
4042

4143
public class Vector3dTest {
4244

4345
private final double EPSILON = 1e-12;
44-
private static final Random random = new Random();
46+
private static final Random random;
47+
48+
static {
49+
long seed = System.currentTimeMillis();
50+
System.out.println(">> Performing tests with seed " + seed);
51+
random = new Random(seed);
52+
}
4553

46-
private static Transform RandomRotation()
47-
{
54+
private static Transform RandomRotation() {
4855
return Transform.unity().rot(
4956
360.0 * random.nextDouble(),
5057
360.0 * random.nextDouble(),
5158
360.0 * random.nextDouble());
5259
}
5360

54-
private static Vector3d RandomVector()
55-
{
61+
private static Vector3d RandomVector() {
5662
return Vector3d.xyz(random.nextDouble(), random.nextDouble(), random.nextDouble());
5763
}
5864

5965
@Test
60-
public void getterTest()
61-
{
66+
public void getterTest() {
6267
double x = 100.0 * random.nextDouble();
6368
double y = 100.0 * random.nextDouble();
6469
double z = 100.0 * random.nextDouble();
@@ -99,8 +104,8 @@ public void getterTest()
99104
}
100105

101106
@Test
102-
public void plusMinusAddedSubtractedTest()
103-
{
107+
public void plusMinusAddedSubtractedTest() {
108+
104109
Transform randRot = RandomRotation();
105110
Transform angleTrans = Transform.unity().rotZ(180.0 * random.nextDouble());
106111

@@ -135,8 +140,8 @@ public void plusMinusAddedSubtractedTest()
135140
}
136141

137142
@Test
138-
public void timesMultipliedDividedTest()
139-
{
143+
public void timesMultipliedDividedTest() {
144+
140145
Transform randRot = RandomRotation();
141146
Transform angleTrans = Transform.unity().rotZ(180.0 * random.nextDouble());
142147
double alpha = 100.0 * random.nextDouble();
@@ -177,8 +182,7 @@ public void timesMultipliedDividedTest()
177182
}
178183

179184
@Test
180-
public void dotTest()
181-
{
185+
public void dotTest() {
182186
Transform randRot = RandomRotation();
183187

184188
Vector3d va = randRot.transform(Vector3d.X_ONE.times(100.0 * random.nextDouble()));
@@ -203,12 +207,10 @@ public void dotTest()
203207
}
204208

205209
@Test
206-
public void crossedTest()
207-
{
210+
public void crossedTest() {
208211

209212
Transform randRot = RandomRotation();
210213

211-
212214
double a = random.nextDouble();
213215
double b = random.nextDouble();
214216
double c = random.nextDouble();
@@ -241,8 +243,8 @@ public void crossedTest()
241243
}
242244

243245
@Test
244-
public void magnitudeTest()
245-
{
246+
public void magnitudeTest() {
247+
246248
Transform randRot = RandomRotation();
247249

248250
double a = 100.0 * random.nextDouble();
@@ -258,8 +260,7 @@ public void magnitudeTest()
258260
}
259261

260262
@Test
261-
public void normalizedTest()
262-
{
263+
public void normalizedTest() {
263264
Transform randRot = RandomRotation();
264265

265266
double a = 100.0 * random.nextDouble();
@@ -275,8 +276,7 @@ public void normalizedTest()
275276
}
276277

277278
@Test
278-
public void negatedTest()
279-
{
279+
public void negatedTest() {
280280
Vector3d v = RandomVector().times(100.0);
281281
Vector3d n = v.negated();
282282

@@ -291,8 +291,7 @@ public void negatedTest()
291291
}
292292

293293
@Test
294-
public void orthogonalTest()
295-
{
294+
public void orthogonalTest() {
296295
Transform randRot = RandomRotation();
297296

298297
double a = 100.0 * random.nextDouble();
@@ -301,12 +300,10 @@ public void orthogonalTest()
301300

302301
double delta = Math.abs(oa.dot(va));
303302
Assert.assertEquals(String.format("dotproduct of orthogonal vector diverges from zero! Delta:%f", delta), 0, oa.dot(va), EPSILON);
304-
305303
}
306304

307305
@Test
308-
public void angleTest()
309-
{
306+
public void angleTest() {
310307
double angle = 180.0 * random.nextDouble();
311308
Transform angleTrans = Transform.unity().rotZ(angle);
312309
Transform randRot = RandomRotation();
@@ -328,8 +325,7 @@ public void angleTest()
328325
}
329326

330327
@Test
331-
public void distanceTest()
332-
{
328+
public void distanceTest() {
333329
Transform randTrans = RandomRotation();
334330
double distance = 100.0*random.nextDouble();
335331
Vector3d d = randTrans.transform(Vector3d.X_ONE.times(distance));
@@ -341,13 +337,11 @@ public void distanceTest()
341337

342338

343339
Assert.assertEquals(String.format("calculated distance diverges from generated distance! Delta: %f", delta), distance, calcDistance, EPSILON);
344-
345-
346340
}
347341

348342
@Test
349-
public void lerpTest()
350-
{
343+
public void lerpTest() {
344+
351345
double t = random.nextDouble();
352346
Vector3d va = RandomVector();
353347
Vector3d vb = RandomVector();
@@ -359,8 +353,8 @@ public void lerpTest()
359353
}
360354

361355
@Test
362-
public void projectTest()
363-
{
356+
public void projectTest() {
357+
364358
Transform randRot = RandomRotation();
365359

366360
double a = 100.0 * random.nextDouble();

0 commit comments

Comments
 (0)