mirror of
https://github.com/ZuneDev/ZuneUIXTools.git
synced 2026-07-27 13:11:59 -07:00
Add foreach tests
This commit is contained in:
@@ -23,7 +23,19 @@ public class DecompileControlFlow
|
||||
[InlineData("cfa_if-elseif-else03")]
|
||||
[InlineData("cfa_if-elseif-else04")]
|
||||
[InlineData("cfa_if-elseif-else05")]
|
||||
public async Task IfElseIfElse(string fileNameWithoutExtension)
|
||||
public async Task IfElseIfElse(string testId) => await TestDecompile(testId);
|
||||
|
||||
[Theory]
|
||||
[InlineData("cfa_foreach01")]
|
||||
[InlineData("cfa_foreach02")]
|
||||
[InlineData("cfa_foreach03")]
|
||||
[InlineData("cfa_foreach04")]
|
||||
[InlineData("cfa_foreach05")]
|
||||
[InlineData("cfa_foreach06")]
|
||||
[InlineData("cfa_foreach07")]
|
||||
public async Task Foreach(string testId) => await TestDecompile(testId);
|
||||
|
||||
private async Task TestDecompile(string fileNameWithoutExtension)
|
||||
{
|
||||
using TempFile uixFile = new($"{fileNameWithoutExtension}.uix", ".uix");
|
||||
await uixFile.InitAsync();
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
<UIX xmlns="http://schemas.microsoft.com/2007/uix"
|
||||
xmlns:iris="assembly://UIX/Microsoft.Iris">
|
||||
<UI Name="Default">
|
||||
<Locals>
|
||||
|
||||
<iris:ArrayListDataSet Name="ArraySet">
|
||||
<Source>
|
||||
<Int32 Int32="10"/>
|
||||
<Int32 Int32="20"/>
|
||||
<Int32 Int32="30"/>
|
||||
</Source>
|
||||
</iris:ArrayListDataSet>
|
||||
</Locals>
|
||||
|
||||
<Content>
|
||||
<Text Color="Red">
|
||||
<Content>Howdy from Microsoft.Iris!</Content>
|
||||
</Text>
|
||||
</Content>
|
||||
|
||||
<Scripts>
|
||||
<Script><![CDATA[
|
||||
int sum = 0;
|
||||
|
||||
foreach (Int32 num in ArraySet)
|
||||
{
|
||||
sum = sum + num;
|
||||
}
|
||||
|
||||
int x = sum * 5;
|
||||
]]></Script>
|
||||
</Scripts>
|
||||
</UI>
|
||||
</UIX>
|
||||
@@ -0,0 +1,41 @@
|
||||
<UIX xmlns="http://schemas.microsoft.com/2007/uix"
|
||||
xmlns:iris="assembly://UIX/Microsoft.Iris">
|
||||
<UI Name="Default">
|
||||
<Locals>
|
||||
|
||||
<iris:ArrayListDataSet Name="ArraySet">
|
||||
<Source>
|
||||
<Int32 Int32="10"/>
|
||||
<Int32 Int32="20"/>
|
||||
<Int32 Int32="30"/>
|
||||
</Source>
|
||||
</iris:ArrayListDataSet>
|
||||
</Locals>
|
||||
|
||||
<Content>
|
||||
<Text Color="Red">
|
||||
<Content>Howdy from Microsoft.Iris!</Content>
|
||||
</Text>
|
||||
</Content>
|
||||
|
||||
<Scripts>
|
||||
<Script><![CDATA[
|
||||
int sum = 0;
|
||||
|
||||
foreach (Int32 num in ArraySet)
|
||||
{
|
||||
int y = num;
|
||||
|
||||
if (y % 2 == 0)
|
||||
{
|
||||
y = y / 2;
|
||||
}
|
||||
|
||||
sum = sum + y;
|
||||
}
|
||||
|
||||
int x = sum * 5;
|
||||
]]></Script>
|
||||
</Scripts>
|
||||
</UI>
|
||||
</UIX>
|
||||
@@ -0,0 +1,45 @@
|
||||
<UIX xmlns="http://schemas.microsoft.com/2007/uix"
|
||||
xmlns:iris="assembly://UIX/Microsoft.Iris">
|
||||
<UI Name="Default">
|
||||
<Locals>
|
||||
|
||||
<iris:ArrayListDataSet Name="ArraySet">
|
||||
<Source>
|
||||
<Int32 Int32="10"/>
|
||||
<Int32 Int32="20"/>
|
||||
<Int32 Int32="30"/>
|
||||
</Source>
|
||||
</iris:ArrayListDataSet>
|
||||
</Locals>
|
||||
|
||||
<Content>
|
||||
<Text Color="Red">
|
||||
<Content>Howdy from Microsoft.Iris!</Content>
|
||||
</Text>
|
||||
</Content>
|
||||
|
||||
<Scripts>
|
||||
<Script><![CDATA[
|
||||
int sum = 0;
|
||||
|
||||
foreach (Int32 num in ArraySet)
|
||||
{
|
||||
int y = num;
|
||||
|
||||
if (y % 2 == 0)
|
||||
{
|
||||
y = y / 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
y = y * 3;
|
||||
}
|
||||
|
||||
sum = sum + y;
|
||||
}
|
||||
|
||||
int x = sum * 5;
|
||||
]]></Script>
|
||||
</Scripts>
|
||||
</UI>
|
||||
</UIX>
|
||||
@@ -0,0 +1,41 @@
|
||||
<UIX xmlns="http://schemas.microsoft.com/2007/uix"
|
||||
xmlns:iris="assembly://UIX/Microsoft.Iris">
|
||||
<UI Name="Default">
|
||||
<Locals>
|
||||
|
||||
<iris:ArrayListDataSet Name="ArraySet">
|
||||
<Source>
|
||||
<Int32 Int32="10"/>
|
||||
<Int32 Int32="20"/>
|
||||
<Int32 Int32="30"/>
|
||||
</Source>
|
||||
</iris:ArrayListDataSet>
|
||||
</Locals>
|
||||
|
||||
<Content>
|
||||
<Text Color="Red">
|
||||
<Content>Howdy from Microsoft.Iris!</Content>
|
||||
</Text>
|
||||
</Content>
|
||||
|
||||
<Scripts>
|
||||
<Script><![CDATA[
|
||||
int sum = 0;
|
||||
|
||||
foreach (Int32 num in ArraySet)
|
||||
{
|
||||
int y = num;
|
||||
|
||||
if (y % 2 == 0)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
sum = sum + y;
|
||||
}
|
||||
|
||||
int x = sum * 5;
|
||||
]]></Script>
|
||||
</Scripts>
|
||||
</UI>
|
||||
</UIX>
|
||||
@@ -0,0 +1,41 @@
|
||||
<UIX xmlns="http://schemas.microsoft.com/2007/uix"
|
||||
xmlns:iris="assembly://UIX/Microsoft.Iris">
|
||||
<UI Name="Default">
|
||||
<Locals>
|
||||
|
||||
<iris:ArrayListDataSet Name="ArraySet">
|
||||
<Source>
|
||||
<Int32 Int32="10"/>
|
||||
<Int32 Int32="20"/>
|
||||
<Int32 Int32="30"/>
|
||||
</Source>
|
||||
</iris:ArrayListDataSet>
|
||||
</Locals>
|
||||
|
||||
<Content>
|
||||
<Text Color="Red">
|
||||
<Content>Howdy from Microsoft.Iris!</Content>
|
||||
</Text>
|
||||
</Content>
|
||||
|
||||
<Scripts>
|
||||
<Script><![CDATA[
|
||||
int sum = 0;
|
||||
|
||||
foreach (Int32 num in ArraySet)
|
||||
{
|
||||
int y = num;
|
||||
|
||||
if (y % 4 == 0)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
sum = sum + y;
|
||||
}
|
||||
|
||||
int x = sum * 5;
|
||||
]]></Script>
|
||||
</Scripts>
|
||||
</UI>
|
||||
</UIX>
|
||||
@@ -0,0 +1,41 @@
|
||||
<UIX xmlns="http://schemas.microsoft.com/2007/uix"
|
||||
xmlns:iris="assembly://UIX/Microsoft.Iris">
|
||||
<UI Name="Default">
|
||||
<Locals>
|
||||
|
||||
<iris:ArrayListDataSet Name="ArraySet">
|
||||
<Source>
|
||||
<Int32 Int32="10"/>
|
||||
<Int32 Int32="20"/>
|
||||
<Int32 Int32="30"/>
|
||||
</Source>
|
||||
</iris:ArrayListDataSet>
|
||||
</Locals>
|
||||
|
||||
<Content>
|
||||
<Text Color="Red">
|
||||
<Content>Howdy from Microsoft.Iris!</Content>
|
||||
</Text>
|
||||
</Content>
|
||||
|
||||
<Scripts>
|
||||
<Script><![CDATA[
|
||||
int sum = 0;
|
||||
|
||||
foreach (Int32 num in ArraySet)
|
||||
{
|
||||
int y = num;
|
||||
|
||||
if (y % 4 == 0)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
sum = sum + y;
|
||||
}
|
||||
|
||||
int x = sum * 5;
|
||||
]]></Script>
|
||||
</Scripts>
|
||||
</UI>
|
||||
</UIX>
|
||||
@@ -0,0 +1,45 @@
|
||||
<UIX xmlns="http://schemas.microsoft.com/2007/uix"
|
||||
xmlns:iris="assembly://UIX/Microsoft.Iris">
|
||||
<UI Name="Default">
|
||||
<Locals>
|
||||
|
||||
<iris:ArrayListDataSet Name="ArraySet">
|
||||
<Source>
|
||||
<Int32 Int32="10"/>
|
||||
<Int32 Int32="20"/>
|
||||
<Int32 Int32="30"/>
|
||||
</Source>
|
||||
</iris:ArrayListDataSet>
|
||||
</Locals>
|
||||
|
||||
<Content>
|
||||
<Text Color="Red">
|
||||
<Content>Howdy from Microsoft.Iris!</Content>
|
||||
</Text>
|
||||
</Content>
|
||||
|
||||
<Scripts>
|
||||
<Script><![CDATA[
|
||||
int sum = 0;
|
||||
|
||||
foreach (Int32 num in ArraySet)
|
||||
{
|
||||
int y = num;
|
||||
|
||||
if (y % 4 == 0)
|
||||
{
|
||||
break;
|
||||
}
|
||||
else if ((y / 2) + 7 == 17)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
sum = sum + y;
|
||||
}
|
||||
|
||||
int x = sum * 5;
|
||||
]]></Script>
|
||||
</Scripts>
|
||||
</UI>
|
||||
</UIX>
|
||||
Generated
+70
@@ -60,6 +60,76 @@ namespace UIX.Test {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized resource of type System.Byte[].
|
||||
/// </summary>
|
||||
internal static byte[] cfa_foreach01_uix {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("cfa_foreach01.uix", resourceCulture);
|
||||
return ((byte[])(obj));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized resource of type System.Byte[].
|
||||
/// </summary>
|
||||
internal static byte[] cfa_foreach02_uix {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("cfa_foreach02.uix", resourceCulture);
|
||||
return ((byte[])(obj));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized resource of type System.Byte[].
|
||||
/// </summary>
|
||||
internal static byte[] cfa_foreach03_uix {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("cfa_foreach03.uix", resourceCulture);
|
||||
return ((byte[])(obj));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized resource of type System.Byte[].
|
||||
/// </summary>
|
||||
internal static byte[] cfa_foreach04_uix {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("cfa_foreach04.uix", resourceCulture);
|
||||
return ((byte[])(obj));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized resource of type System.Byte[].
|
||||
/// </summary>
|
||||
internal static byte[] cfa_foreach05_uix {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("cfa_foreach05.uix", resourceCulture);
|
||||
return ((byte[])(obj));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized resource of type System.Byte[].
|
||||
/// </summary>
|
||||
internal static byte[] cfa_foreach06_uix {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("cfa_foreach06.uix", resourceCulture);
|
||||
return ((byte[])(obj));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized resource of type System.Byte[].
|
||||
/// </summary>
|
||||
internal static byte[] cfa_foreach07_uix {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("cfa_foreach07.uix", resourceCulture);
|
||||
return ((byte[])(obj));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized resource of type System.Byte[].
|
||||
/// </summary>
|
||||
|
||||
@@ -118,6 +118,27 @@
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
<data name="cfa_foreach01.uix" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>Resources\cfa_foreach01.uix;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
<data name="cfa_foreach02.uix" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>Resources\cfa_foreach02.uix;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
<data name="cfa_foreach03.uix" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>Resources\cfa_foreach03.uix;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
<data name="cfa_foreach04.uix" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>Resources\cfa_foreach04.uix;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
<data name="cfa_foreach05.uix" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>Resources\cfa_foreach05.uix;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
<data name="cfa_foreach06.uix" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>Resources\cfa_foreach06.uix;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
<data name="cfa_foreach07.uix" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>Resources\cfa_foreach07.uix;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
<data name="cfa_if-elseif-else01.uix" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>Resources\cfa_if-elseif-else01.uix;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
|
||||
Reference in New Issue
Block a user