Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
  • Loading branch information
Arc-huangjingtong committed Aug 13, 2024
1 parent c05653c commit 54d50e2
Show file tree
Hide file tree
Showing 4 changed files with 197 additions and 157 deletions.
81 changes: 42 additions & 39 deletions Arc.UniInk/Arc.UniInk.Benchmark/UniInkSpeed/NUnit_UniInkSpeed.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
using Arc.UniInk;
using System;
using System.Collections.Generic;
using JetBrains.Util;
using NUnit.Framework;


Expand Down Expand Up @@ -377,31 +378,49 @@ public static void Test_Temp()

/////////////////////////////////////////////// Extension Test ////////////////////////////////////////////////

// [Repeat(10)]
// [TestCase(" if( 1 > 2 ) "
// + " { "
// + " 123 "
// + " } "
// + " else "
// + " { "
// + " 456 "
// + " } ")]
// /////////////////////////////////////
// [TestCase(" if( 1 > 2 ) "
// + " { "
// + " 123 "
// + " } "
// + " else if (3>6) "
// + " { "
// + " 456 "
// + " } "
// + " else "
// + " { "
// + " 666 "
// + " } ")]
//[Repeat(1)]
///////////////////////////////////////
[TestCase(" if ( 1 > 2 ) "
+ " { "
+ " 123 "
+ " } "
+ " else "
+ " { "
+ " return 456 "
+ " } ")]
///////////////////////////////////////
[TestCase(" if ( 1 > 2 ) "
+ " { "
+ " 123 "
+ " } "
+ " else if ( 3 > 6 ) "
+ " { "
+ " 456 "
+ " } "
+ " else "
+ " { "
+ " return 666 "
+ " } ")]
///////////////////////////////////////
[TestCase(" if ( 1 > 2 ) "
+ " { "
+ " 123 "
+ " } "
+ " else if ( 3 > 6 ) "
+ " { "
+ " 456 "
+ " } "
+ " else if ( 3 < 6 ) "
+ " { "
+ " return 456 "
+ " } "
+ " else "
+ " { "
+ " return 666 "
+ " } ")]
public static void Test_Expression_IfStatements(string input)
{
var test = Ink.Evaluate(input);
var test = Ink.Evaluate_IfStatement(input);
if (test is InkValue value)
{
Console.WriteLine(value.Value_int); // each time , the result will be different
Expand All @@ -410,22 +429,6 @@ public static void Test_Expression_IfStatements(string input)
}
}

[TestCase("((((((()()()()()))))))")]
[TestCase("()")]
[TestCase("()()")]
[TestCase("(())(())")]
public static void Temp_Function_GetMatchOperator(string input)
{
var keys = Ink.CompileLexerAndFill(input, 0, input.Length - 1);

Console.WriteLine(keys.Count);

var res = UniInk_Speed.GetMatchOperator(keys, InkOperator.ParenthisLeft, InkOperator.ParenthisRight, 0, keys.Count - 1);

Console.WriteLine(res.StartIndex);
Console.WriteLine(res.EndIndex);
}



/////////////////////////////////////////////// Helper Object ////////////////////////////////////////////////
Expand Down
20 changes: 16 additions & 4 deletions Arc.UniInk/Arc.UniInk.sln.DotSettings.user
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,26 @@
&lt;Assembly Path="F:\UniInk-CSharpInterpreter4AOT\Arc.UniInk\packages\BenchmarkDotNet.Annotations.0.13.12\lib\netstandard2.0\BenchmarkDotNet.Annotations.dll" /&gt;&#xD;
&lt;/AssemblyExplorer&gt;</s:String>
<s:Boolean x:Key="/Default/Environment/Hierarchy/Build/SolBuilderDuo/RunBuildOnSolutionLoaded/@EntryValue">True</s:Boolean>
<s:String x:Key="/Default/Environment/UnitTesting/UnitTestSessionStore/Sessions/=ab0ed1c5_002D26e8_002D4e0f_002D9202_002Dc0fb63750077/@EntryIndexedValue">&lt;SessionState ContinuousTestingMode="0" IsActive="True" Name="Test_Expression_IfStatements" xmlns="urn:schemas-jetbrains-com:jetbrains-ut-session"&gt;&#xD;
<s:String x:Key="/Default/Environment/UnitTesting/UnitTestSessionStore/Sessions/=6d15cb44_002D6204_002D4717_002D87b7_002D8ab35692c1d4/@EntryIndexedValue">&lt;SessionState ContinuousTestingMode="0" IsActive="True" Name="Test_Expression_IfStatements" xmlns="urn:schemas-jetbrains-com:jetbrains-ut-session"&gt;&#xD;
&lt;TestAncestor&gt;&#xD;
&lt;TestId&gt;NUnit3x::1BA70864-1706-44D0-9D58-669FD5703A14::.NETFramework,Version=v4.8::Arc.UniInk.NUnitTest.NUnit_UniInkSpeed.Test_Arithmetic_Float&lt;/TestId&gt;&#xD;
&lt;TestId&gt;NUnit3x::1BA70864-1706-44D0-9D58-669FD5703A14::.NETFramework,Version=v4.8::Arc.UniInk.NUnitTest.NUnit_UniInkSpeed.Test_Arithmetic_Int("9*((1+(2+3)*(4+5))+6+7)")&lt;/TestId&gt;&#xD;
&lt;TestId&gt;NUnit3x::1BA70864-1706-44D0-9D58-669FD5703A14::.NETFramework,Version=v4.8::Arc.UniInk.NUnitTest.NUnit_UniInkSpeed.Test_Arithmetic_Int&lt;/TestId&gt;&#xD;
&lt;TestId&gt;NUnit3x::1BA70864-1706-44D0-9D58-669FD5703A14::.NETFramework,Version=v4.8::Arc.UniInk.NUnitTest.NUnit_UniInkSpeed.Test_Expression_IfStatements&lt;/TestId&gt;&#xD;
&lt;/TestAncestor&gt;&#xD;
&lt;/SessionState&gt;</s:String>

<s:String x:Key="/Default/Environment/UnitTesting/UnitTestSessionStore/Sessions/=a4ecf6a9_002D9e4b_002D442e_002Daddf_002D7fb249d66a75/@EntryIndexedValue">&lt;SessionState ContinuousTestingMode="0" Name="Test_Expression_IfStatements #3" xmlns="urn:schemas-jetbrains-com:jetbrains-ut-session"&gt;&#xD;
&lt;TestAncestor&gt;&#xD;
&lt;TestId&gt;NUnit3x::1BA70864-1706-44D0-9D58-669FD5703A14::.NETFramework,Version=v4.8::Arc.UniInk.NUnitTest.NUnit_UniInkSpeed.Test_Expression_IfStatements&lt;/TestId&gt;&#xD;
&lt;/TestAncestor&gt;&#xD;
&lt;/SessionState&gt;</s:String>
<s:String x:Key="/Default/Environment/UnitTesting/UnitTestSessionStore/Sessions/=d396c8fc_002D988e_002D482f_002Da9cf_002D769711abf32e/@EntryIndexedValue">&lt;SessionState ContinuousTestingMode="0" Name="Test_Expression_IfStatements #2" xmlns="urn:schemas-jetbrains-com:jetbrains-ut-session"&gt;&#xD;
&lt;TestAncestor&gt;&#xD;
&lt;TestId&gt;NUnit3x::1BA70864-1706-44D0-9D58-669FD5703A14::.NETFramework,Version=v4.8::Arc.UniInk.NUnitTest.NUnit_UniInkSpeed.Test_Expression_IfStatements&lt;/TestId&gt;&#xD;
&lt;/TestAncestor&gt;&#xD;
&lt;/SessionState&gt;</s:String>







Expand Down
Loading

0 comments on commit 54d50e2

Please sign in to comment.