Skip to content

Commit

Permalink
Test for incorrect cartesian product.
Browse files Browse the repository at this point in the history
  • Loading branch information
dblock committed Jan 13, 2017
1 parent 5285952 commit 4b7abfa
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ test('exhaustive vs non-exhaustive expansion', function (t) {
var slots = { "MOVIE": "LITERAL" };
var template = "{foo|bar|baz} {foo|bar|baz} {movie_names|MOVIE}";
var result = utterances(template, slots, dictionary);
t.deepEqual(result, [
t.deepEqual(result, [
"foo foo {star wars|MOVIE}",
"bar foo {inception|MOVIE}",
"baz foo {gattaca|MOVIE}",
Expand All @@ -68,7 +68,7 @@ test('exhaustive vs non-exhaustive expansion', function (t) {
]);

var result2 = utterances(template, slots, dictionary, true);
t.deepEqual(result2, [
t.deepEqual(result2, [
"foo foo {star wars|MOVIE}",
"bar foo {star wars|MOVIE}",
"baz foo {star wars|MOVIE}",
Expand Down Expand Up @@ -123,3 +123,17 @@ test('raw curly braces for custom slot types', function (t) {
]);
t.end();
});

test('cartesian product', function (t) {
var dictionary = {}
var slots = { "number": "NUMBER" };
var template = "{to |}set temperature to {1-2|number}";
var result = utterances(template, slots, dictionary);
t.deepEqual(result, [
"to set temperature to {one|number}",
"set temperature to {one|number}",
"to set temperature to {two|number}",
"set temperature to {two|number}"
]);
t.end();
});

0 comments on commit 4b7abfa

Please sign in to comment.