-
Notifications
You must be signed in to change notification settings - Fork 1.9k
/
TestMarshallingOverflow.cs
79 lines (73 loc) · 3.2 KB
/
TestMarshallingOverflow.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
namespace cs_unittest
{
[TestClass]
public class TestMarshallingOverflow
{
[TestMethod]
[TestCategory("Vowpal Wabbit/Marshal")]
[TestCategory("Vowpal Wabbit")]
public void TestNumericInt64Overflow()
{
using (var vw = new VowpalWabbitExampleValidator<NumericExampleInt64>(string.Empty))
{
vw.Validate("| Value:9.22337203685477580700E+018", new NumericExampleInt64() { Value = Int64.MaxValue });
vw.Validate("| Value:-9.22337203685477580700E+018", new NumericExampleInt64() { Value = Int64.MinValue});
}
}
[TestMethod]
[TestCategory("Vowpal Wabbit/Marshal")]
[TestCategory("Vowpal Wabbit")]
public void TestNumericUInt64Overflow()
{
using (var vw = new VowpalWabbitExampleValidator<NumericExampleUInt64>(string.Empty))
{
vw.Validate("| Value:1.844674E+19", new NumericExampleUInt64() { Value = UInt64.MaxValue});
}
}
[TestMethod]
[TestCategory("Vowpal Wabbit/Marshal")]
[TestCategory("Vowpal Wabbit")]
public void TestNumericDoubleOverflow()
{
using (var vw = new VowpalWabbitExampleValidator<NumericExampleDouble>(string.Empty))
{
vw.Validate("| Value:1.79769313486231570000E+308", new NumericExampleDouble() { Value = double.MaxValue });
vw.Validate("| Value:-1.79769313486231570000E+308", new NumericExampleDouble() { Value = double.MinValue });
}
}
[TestMethod]
[TestCategory("Vowpal Wabbit/Marshal")]
[TestCategory("Vowpal Wabbit")]
public void TestNumericInt64OverflowArray()
{
using (var vw = new VowpalWabbitExampleValidator<NumericExampleInt64Array>(string.Empty))
{
vw.Validate("| 0:9.22337203685477580700E+018", new NumericExampleInt64Array() { Value = new [] { Int64.MaxValue } });
vw.Validate("| 0:-9.22337203685477580700E+018", new NumericExampleInt64Array() { Value = new[] { Int64.MinValue } });
}
}
[TestMethod]
[TestCategory("Vowpal Wabbit/Marshal")]
[TestCategory("Vowpal Wabbit")]
public void TestNumericUInt64OverflowArray()
{
using (var vw = new VowpalWabbitExampleValidator<NumericExampleUInt64Array>(string.Empty))
{
vw.Validate("| 0:1.844674E+19", new NumericExampleUInt64Array() { Value = new[] { UInt64.MaxValue } });
}
}
[TestMethod]
[TestCategory("Vowpal Wabbit/Marshal")]
[TestCategory("Vowpal Wabbit")]
public void TestNumericDoubleOverflowArray()
{
using (var vw = new VowpalWabbitExampleValidator<NumericExampleDoubleArray>(string.Empty))
{
vw.Validate("| 0:1.79769313486231570000E+308", new NumericExampleDoubleArray() { Value = new [] { double.MaxValue } });
vw.Validate("| 0:-1.79769313486231570000E+308", new NumericExampleDoubleArray() { Value = new [] { double.MinValue } });
}
}
}
}