-
Notifications
You must be signed in to change notification settings - Fork 1.9k
/
TestWrapper.cs
47 lines (41 loc) · 1.36 KB
/
TestWrapper.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
using System.IO;
using cs_test;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using VW;
namespace cs_unittest
{
[TestClass]
public class TestWrapper : TestBase
{
[TestMethod]
public void VwCleanupTest()
{
new VowpalWabbit<Test1>("-k -l 20 --initial_t 128000 --power_t 1 -c --passes 8 --invariant --ngram 3 --skips 1 --holdout_off")
.Dispose();
}
[TestMethod]
public void VwCleanupTestError()
{
try
{
if (Directory.Exists("models_out"))
Directory.Delete("models_out", true);
var vw = new VowpalWabbit<Test1>("-k -l 20 --initial_t 128000 --power_t 1 -f models_out/0001.model -c --passes 8 --invariant --ngram 3 --skips 1 --holdout_off");
vw.Dispose();
Assert.Fail("Excepted exception not thrown");
}
catch (VowpalWabbitException e)
{
Assert.IsFalse(string.IsNullOrEmpty(e.Filename));
Assert.AreNotEqual(0, e.LineNumber);
Assert.IsTrue(e.Message.Contains("No such file or directory"), e.Message);
}
}
[TestMethod]
public void VwModelRefCountingTest()
{
var model = new VowpalWabbitModel("");
model.Dispose();
}
}
}