Skip to content

Commit

Permalink
Fix Parse Unit Tests (#170)
Browse files Browse the repository at this point in the history
***NO_CI***
  • Loading branch information
josesimoes authored Jan 20, 2022
1 parent 3e6dea5 commit edb8714
Showing 1 changed file with 26 additions and 17 deletions.
43 changes: 26 additions & 17 deletions Tests/NFUnitTestSystemLib/UnitTestParseTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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;
}

Expand Down

0 comments on commit edb8714

Please sign in to comment.