Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Parse Unit Tests #170

Merged
merged 1 commit into from
Jan 20, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 26 additions & 17 deletions Tests/NFUnitTestSystemLib/UnitTestParseTests.cs
Original file line number Diff line number Diff line change
@@ -37,22 +37,25 @@ public string[] GetRandomStringArray(int max, bool signed)
"100"
};

string[] arr2 = new string[10];

string[] arr2 = new string[arr1.Length];

intArr = new int[] {
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
123,
123,
123,
123,
0,
56,
62,
100,
0,
0,
0,
@@ -62,30 +65,36 @@ public string[] GetRandomStringArray(int max, bool signed)
0,
0,
0,
56,
62,
100
0,
0,
0,
0,
0,
0
};

// sanity check for when the test arrays above change
Debug.Assert(intArr.Length == 2 * arr1.Length);

for (int i = 0; i < arr2.Length; i++)
{
if (signed && ((i % 2) == 0))
{
intArr[i + 12] = -(random.Next(max));
arr2[i] = (intArr[i + 12].ToString());
intArr[i + arr1.Length] = -(random.Next(max));
arr2[i] = (intArr[i + arr1.Length].ToString());
}
else
{
intArr[i + 12] = random.Next(max);
arr2[i] = intArr[i + 12].ToString();
intArr[i + arr1.Length] = random.Next(max);
arr2[i] = intArr[i + arr1.Length].ToString();
}
}

string[] arr = new string[22];
string[] arr = new string[intArr.Length];

Array.Copy(arr1, arr, arr1.Length);
Array.Copy(arr2, 0, arr, arr1.Length, arr2.Length);

return arr;
}