-
Notifications
You must be signed in to change notification settings - Fork 6
/
tests.js
29 lines (29 loc) · 1.06 KB
/
tests.js
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
// would like to know about grouping tests within QUnit ...
test( "a basic test example", function() {
var value = "hello";
equal( value, "hello", "We expect value to be hello" );
});
test( "testing NLP", function() {
var sentence = "There is a game engine Unreal Engine";
var result = query(sentence);
equal( result, "what was that?");
// "game_engines", "Unreal Engine", {"name":"Unreal Engine","ident":"Unreal Engine"})
});
var sentences = [];
var answers = [];
sentences[0] = "There is a game engine called Unreal Engine";
answers[0] = "Unreal Engine is a game engine";
sentences[1] = "There is a horse called Matilda";
answers[1] = "Matilda is a horse";
sentences[2] = "There is a course called ML";
answers[2] = "ML is a course";
for (var i in sentences){
test( "\""+sentences[i] + "\" --> \"" + answers[i]+ "\"", function() {
var result = query(sentences[i]);
equal( result, answers[i]);
});
}
test( "testing Natural", function() {
var result = natural.SoundEx.compare('phone', 'pone');
equal( result, true, "We expect value to be true" );
});