log colors changed to match DtsodC tests
This commit is contained in:
parent
756a0494af
commit
56a97b14f9
@ -12,6 +12,6 @@ public static class Tester
|
|||||||
operation();
|
operation();
|
||||||
clock.Stop();
|
clock.Stop();
|
||||||
double time=(double)(clock.ElapsedTicks)/Stopwatch.Frequency/repeats;
|
double time=(double)(clock.ElapsedTicks)/Stopwatch.Frequency/repeats;
|
||||||
LogNoTime("c",$"operation {op_name} took {time} seconds");
|
LogNoTime("y",$"operation ","b",op_name,"y"," took ","b",time.ToString(),"y"," seconds");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1,4 +1,5 @@
|
|||||||
using static DTLib.Experimental.Tester;
|
using static DTLib.Experimental.Tester;
|
||||||
|
using static TestProgram.Program;
|
||||||
|
|
||||||
namespace TestProgram;
|
namespace TestProgram;
|
||||||
|
|
||||||
@ -16,7 +17,7 @@ static class DictTest
|
|||||||
}
|
}
|
||||||
|
|
||||||
static public void Test(){
|
static public void Test(){
|
||||||
Console.WriteLine("----------------[dict.cs]----------------");
|
Info.Log("c","--------------[DictTest]---------------");
|
||||||
Dictionary<string,long> dict=new();
|
Dictionary<string,long> dict=new();
|
||||||
LogOperationTime("fill",1,()=>Fill(dict));
|
LogOperationTime("fill",1,()=>Fill(dict));
|
||||||
LogOperationTime("gett",1,()=>Gett(dict));
|
LogOperationTime("gett",1,()=>Gett(dict));
|
||||||
|
|||||||
@ -16,15 +16,15 @@ public static class TestDtsodV23
|
|||||||
|
|
||||||
public static void TestBaseTypes()
|
public static void TestBaseTypes()
|
||||||
{
|
{
|
||||||
Info.Log("b", "[TestDtsodV23/TestBaseTypes]");
|
Info.Log("c", "-----[TestDtsodV23/TestBaseTypes]------");
|
||||||
DtsodV23 dtsod = new(File.ReadAllText($"DtsodV2X{Path.Sep}base_types.dtsod"));
|
DtsodV23 dtsod = new(File.ReadAllText($"DtsodV2X{Path.Sep}base_types.dtsod"));
|
||||||
foreach (var pair in dtsod)
|
foreach (var pair in dtsod)
|
||||||
Info.LogNoTime("b", pair.Value.GetType().Name + ' ', "w", pair.Key + ' ', "c", pair.Value.ToString());
|
Info.LogNoTime("b", pair.Value.GetType().Name + ' ', "w", pair.Key + ' ', "c", pair.Value.ToString());
|
||||||
Info.Log("g", "[test completed]");
|
Info.Log("g", "test completed");
|
||||||
}
|
}
|
||||||
public static void TestLists()
|
public static void TestLists()
|
||||||
{
|
{
|
||||||
Info.Log("b", "[TestDtsodV23/TestLists]");
|
Info.Log("c", "-------[TestDtsodV23/TestLists]--------");
|
||||||
DtsodV23 dtsod = new(File.ReadAllText($"DtsodV2X{Path.Sep}lists.dtsod"));
|
DtsodV23 dtsod = new(File.ReadAllText($"DtsodV2X{Path.Sep}lists.dtsod"));
|
||||||
foreach (var pair in dtsod)
|
foreach (var pair in dtsod)
|
||||||
{
|
{
|
||||||
@ -33,12 +33,12 @@ public static class TestDtsodV23
|
|||||||
foreach (var el in pair.Value)
|
foreach (var el in pair.Value)
|
||||||
Info.LogNoTime("b", '\t'+el.GetType().Name + ' ', "c", el.ToString());
|
Info.LogNoTime("b", '\t'+el.GetType().Name + ' ', "c", el.ToString());
|
||||||
}
|
}
|
||||||
Info.Log("g", "[test completed]");
|
Info.Log("g", "test completed");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void TestComplexes()
|
public static void TestComplexes()
|
||||||
{
|
{
|
||||||
Info.Log("b", "[TestDtsodV23/TestComplexes]");
|
Info.Log("c", "-----[TestDtsodV23/TestComplexes]------");
|
||||||
DtsodV23 dtsod = new(File.ReadAllText($"DtsodV2X{Path.Sep}complexes.dtsod"));
|
DtsodV23 dtsod = new(File.ReadAllText($"DtsodV2X{Path.Sep}complexes.dtsod"));
|
||||||
foreach (var pair in dtsod)
|
foreach (var pair in dtsod)
|
||||||
{
|
{
|
||||||
@ -46,33 +46,33 @@ public static class TestDtsodV23
|
|||||||
"b", " length: ", "c", pair.Value.Keys.Count.ToString() + "\n\t",
|
"b", " length: ", "c", pair.Value.Keys.Count.ToString() + "\n\t",
|
||||||
"y", pair.Value.ToString().Replace("\n","\n\t"));
|
"y", pair.Value.ToString().Replace("\n","\n\t"));
|
||||||
}
|
}
|
||||||
Info.Log("g", "[test completed]");
|
Info.Log("g", "test completed");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void TestReSerialization()
|
public static void TestReSerialization()
|
||||||
{
|
{
|
||||||
Info.Log("b", "[TestDtsodV23/TestReSerialization]");
|
Info.Log("c", "---[TestDtsodV23/TestReSerialization]--");
|
||||||
DtsodV23 dtsod = new DtsodV23(new DtsodV23(new DtsodV23(
|
DtsodV23 dtsod = new DtsodV23(new DtsodV23(new DtsodV23(
|
||||||
new DtsodV23(File.ReadAllText($"DtsodV2X{Path.Sep}complexes.dtsod")).ToString()).ToString()).ToString());
|
new DtsodV23(File.ReadAllText($"DtsodV2X{Path.Sep}complexes.dtsod")).ToString()).ToString()).ToString());
|
||||||
Info.Log("y", dtsod.ToString());
|
Info.Log("y", dtsod.ToString());
|
||||||
Info.Log("g", "[test completed]");
|
Info.Log("g", "test completed");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void TestSpeed()
|
public static void TestSpeed()
|
||||||
{
|
{
|
||||||
Info.Log("b", "[TestDtsodV23/TestSpeed]");
|
Info.Log("c", "--------[TestDtsodV23/TestSpeed]-------");
|
||||||
IDtsod dtsod=null;
|
IDtsod dtsod=null;
|
||||||
string text = File.ReadAllText($"DtsodV2X{Path.Sep}messages.dtsod");
|
string text = File.ReadAllText($"DtsodV2X{Path.Sep}messages.dtsod");
|
||||||
Tester.LogOperationTime("V21 deserialization",100,()=>dtsod=new DtsodV21(text));
|
Tester.LogOperationTime("V21 deserialization",100,()=>dtsod=new DtsodV21(text));
|
||||||
Tester.LogOperationTime("V21 serialization", 100, () => _=dtsod.ToString());
|
Tester.LogOperationTime("V21 serialization", 100, () => _=dtsod.ToString());
|
||||||
Tester.LogOperationTime("V23 deserialization", 100, () => dtsod = new DtsodV23(text));
|
Tester.LogOperationTime("V23 deserialization", 100, () => dtsod = new DtsodV23(text));
|
||||||
Tester.LogOperationTime("V23 serialization", 100, () => _ = dtsod.ToString());
|
Tester.LogOperationTime("V23 serialization", 100, () => _ = dtsod.ToString());
|
||||||
Info.Log("g", "[test completed]");
|
Info.Log("g", "test completed");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void TestMemoryConsumption()
|
public static void TestMemoryConsumption()
|
||||||
{
|
{
|
||||||
Info.Log("b", "[TestDtsodV23/TestMemoryConsumption]");
|
Info.Log("c", "-----[TestDtsodV23/TestMemConsumpt]----");
|
||||||
string text = File.ReadAllText($"DtsodV2X{Path.Sep}messages.dtsod");
|
string text = File.ReadAllText($"DtsodV2X{Path.Sep}messages.dtsod");
|
||||||
var a = GC.GetTotalMemory(true);
|
var a = GC.GetTotalMemory(true);
|
||||||
DtsodV23[] dtsods = new DtsodV23[100];
|
DtsodV23[] dtsods = new DtsodV23[100];
|
||||||
@ -81,6 +81,6 @@ public static class TestDtsodV23
|
|||||||
var b = GC.GetTotalMemory(true);
|
var b = GC.GetTotalMemory(true);
|
||||||
Info.Log("b", "at the start: ","c",$"{a/1024} kb\n",
|
Info.Log("b", "at the start: ","c",$"{a/1024} kb\n",
|
||||||
"b", "at the end: ", "c", $"{b / 1024} kb\n{dtsods.Count()}","b"," dtsods initialized");
|
"b", "at the end: ", "c", $"{b / 1024} kb\n{dtsods.Count()}","b"," dtsods initialized");
|
||||||
Info.Log("g", "[test completed]");
|
Info.Log("g", "test completed");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -29,7 +29,7 @@ static class Program
|
|||||||
Console.Title="tester";
|
Console.Title="tester";
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
Info.Log("g","-------[DTLib tester]-------");
|
Info.Log("c", "-------------[TestProgram]-------------");
|
||||||
//TestDtsodV23.TestAll();
|
//TestDtsodV23.TestAll();
|
||||||
DictTest.Test();
|
DictTest.Test();
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user