[DEV] implement more test
This commit is contained in:
parent
fd3a93e7f8
commit
10017b88a4
@ -15,6 +15,7 @@
|
||||
</classpathentry>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-14">
|
||||
<attributes>
|
||||
<attribute name="module" value="true"/>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
@ -23,11 +24,6 @@
|
||||
<attribute name="test" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="lib" path="test/lib/junit-toolbox-2.4.jar">
|
||||
<attributes>
|
||||
<attribute name="test" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
|
||||
<attributes>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
|
@ -100,7 +100,7 @@ public class Logger {
|
||||
if (values.length != 2) {
|
||||
values = value.split(":");
|
||||
if (values.length != 2) {
|
||||
values = value.split("+");
|
||||
values = value.split("\\+");
|
||||
if (values.length != 2) {
|
||||
System.err.println("Can not set the --logger-lib= with value='" + value + "' not formated name:X or name/X or name+X");
|
||||
continue;
|
||||
|
18
test/src/test/scenarium/logger/Log2.java
Normal file
18
test/src/test/scenarium/logger/Log2.java
Normal file
@ -0,0 +1,18 @@
|
||||
package test.scenarium.logger;
|
||||
|
||||
import io.scenarium.logger.LogLevel;
|
||||
import io.scenarium.logger.Logger;
|
||||
|
||||
public class Log2 {
|
||||
private static final String LIB_NAME = "sc-log-test-2";
|
||||
private static final String LIB_NAME_DRAW = Logger.getDrawableName(LIB_NAME);
|
||||
private static final boolean PRINT_DEBUG = Logger.getNeedPrint(LIB_NAME, LogLevel.DEBUG);
|
||||
|
||||
private Log2() {}
|
||||
|
||||
public static void debug(String data) {
|
||||
if (PRINT_DEBUG)
|
||||
Logger.debug(LIB_NAME_DRAW, data);
|
||||
}
|
||||
|
||||
}
|
@ -8,10 +8,58 @@
|
||||
******************************************************************************/
|
||||
package test.scenarium.logger;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import io.scenarium.logger.Logger;
|
||||
|
||||
import org.junit.jupiter.api.MethodOrderer.OrderAnnotation;
|
||||
import org.junit.jupiter.api.Order;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.TestMethodOrder;
|
||||
|
||||
@TestMethodOrder(OrderAnnotation.class)
|
||||
public class TestBasicLog {
|
||||
|
||||
@Test
|
||||
@Order(1)
|
||||
public void firstInitialisation() {
|
||||
List<String> args = new ArrayList<>();
|
||||
args.add("--logger-level=999");
|
||||
args.add("--logger-level=1");
|
||||
args.add("--logger-no-color");
|
||||
args.add("--logger-color");
|
||||
args.add("--logger-lib=sc-log-test+6");
|
||||
args.add("--logger-lib=sc-log-test/6");
|
||||
args.add("--logger-lib=sc-log-test:6");
|
||||
args.add("--logger-lib=sc-log-test:verbose");
|
||||
args.add("--logger-lib=sc-log-test2+3");
|
||||
args.add("--logger-lib=sc-log-test");
|
||||
args.add("--logger-with-stupid-parameter=sdkfjsqdlkf");
|
||||
args.add("--help");
|
||||
Logger.init(TestBasicLog.class.getCanonicalName(), args);
|
||||
}
|
||||
|
||||
@Test
|
||||
@Order(2)
|
||||
public void secondInitialisation() {
|
||||
List<String> args = new ArrayList<>();
|
||||
Logger.init(TestBasicLog.class.getCanonicalName(), args);
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
@Order(3)
|
||||
public void basicLogCall() {
|
||||
Log.print("Simple print");
|
||||
Log.todo("Simple todo");
|
||||
Log.error("Simple error");
|
||||
Log.warning("Simple warning");
|
||||
Log.info("Simple info");
|
||||
Log.debug("Simple debug");
|
||||
Log.verbose("Simple verbose");
|
||||
}
|
||||
|
||||
// TODO REFACTO REMOVE this and set it in the Test of the logger.
|
||||
public static String getAAAAAAA(int dfsdf) {
|
||||
int hhh = 0;
|
||||
@ -28,19 +76,20 @@ public class TestBasicLog {
|
||||
// test de 10 secondes contre 0.0?? second quand le niveau n'est pas assez grand ...
|
||||
long timeStart = System.currentTimeMillis();
|
||||
for (int iii = 0; iii < 100000; iii++)
|
||||
Log.debug("test direct");
|
||||
Log2.debug("test direct");
|
||||
long timeStop = System.currentTimeMillis();
|
||||
Log.print("test direct [END] : " + timeStart + " to " + timeStop + " ==> delta=" + (timeStop - timeStart));
|
||||
Log.print("test concat [START]");
|
||||
// C'est très long dans les 2 cas ...
|
||||
timeStart = System.currentTimeMillis();
|
||||
for (int iii = 0; iii < 6; iii++)
|
||||
Log.debug("test concat: non fonctionnel, il applelle le get a chaque log ... " + getAAAAAAA(iii));
|
||||
Log2.debug("test concat: non fonctionnel, il applelle le get a chaque log ... " + getAAAAAAA(iii));
|
||||
timeStop = System.currentTimeMillis();
|
||||
Log.print("test concat [END] : " + timeStart + " to " + timeStop + " ==> delta=" + (timeStop - timeStart));
|
||||
}
|
||||
|
||||
@Test
|
||||
@Order(4)
|
||||
public void testSimpleLog() {
|
||||
testLog();
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user