Skip to content

Commit 15540a5

Browse files
committed
[test] added test
1 parent a3f623b commit 15540a5

File tree

1 file changed

+22
-7
lines changed

1 file changed

+22
-7
lines changed

VSharp.Test/Tests/Unsafe.cs

Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -833,23 +833,23 @@ public static int DoubleWrite(long[] arr, int i, int v, byte v2)
833833
}
834834
}
835835

836-
[TestSvm]
836+
[TestSvm(100)]
837837
public static int EncodeLongToIntReinterpretation(long x)
838838
{
839839
int r = *(int*)&x;
840840
if (r > 10) return *(int*) &x;
841841
return -10;
842842
}
843843

844-
[TestSvm]
844+
[TestSvm(100)]
845845
public static int EncodeDoubleReinterpretation1(double x)
846846
{
847847
int r = *(int*)&x;
848848
if (r > 10) return *(int*) &x;
849849
return -10;
850850
}
851851

852-
[TestSvm]
852+
[TestSvm(100)]
853853
public static int EncodeDoubleReinterpretation2(double x)
854854
{
855855
byte* a = (byte*)&x + 1;
@@ -858,14 +858,14 @@ public static int EncodeDoubleReinterpretation2(double x)
858858
return 0;
859859
}
860860

861-
[TestSvm]
861+
[TestSvm(100)]
862862
public static int EncodeDoubleReinterpretation3(double x)
863863
{
864864
if (*(long*)((byte*)&x + 1) == 175767216) return 0;
865865
return -1;
866866
}
867867

868-
[TestSvm]
868+
[TestSvm(100)]
869869
public static int EncodeDoubleReinterpretation4(double x)
870870
{
871871
byte* a = (byte*)&x + 1;
@@ -874,7 +874,7 @@ public static int EncodeDoubleReinterpretation4(double x)
874874
return 0;
875875
}
876876

877-
[TestSvm]
877+
[TestSvm(100)]
878878
public static int EncodeDoubleReinterpretation5(double x)
879879
{
880880
byte* a = (byte*)&x + 1;
@@ -883,7 +883,7 @@ public static int EncodeDoubleReinterpretation5(double x)
883883
return 0;
884884
}
885885

886-
[TestSvm]
886+
[TestSvm(100)]
887887
public static int EncodeDoubleReinterpretation6(double x)
888888
{
889889
byte* a = (byte*)&x + 1;
@@ -892,6 +892,21 @@ public static int EncodeDoubleReinterpretation6(double x)
892892
return 0;
893893
}
894894

895+
[TestSvm(94)]
896+
public static int CombineIntoDouble(int[] arr)
897+
{
898+
fixed (int* p = arr)
899+
{
900+
var ptr = (double*) p;
901+
if (arr[0] == 1 && arr[1] == 3 && *ptr != 6.3659873734E-314)
902+
{
903+
return -1;
904+
}
905+
906+
return arr[1];
907+
}
908+
}
909+
895910
[Ignore("Insufficient information")]
896911
public static int ReturnIntFromIntPtr(int myFavouriteParameter)
897912
{

0 commit comments

Comments
 (0)