remove 3 param error test for 'and' and 'or'
This commit is contained in:
parent
ef4e039998
commit
4ea0f440e9
@ -23,14 +23,14 @@ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|||||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||||
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||||
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.google.refine.tests.expr.functions.booleans;
|
package com.google.refine.tests.expr.functions.booleans;
|
||||||
|
|
||||||
import static org.mockito.Mockito.mock;
|
import static org.mockito.Mockito.mock;
|
||||||
@ -70,36 +70,36 @@ public class BooleanTests extends RefineTest {
|
|||||||
{"and","false","false","false"},
|
{"and","false","false","false"},
|
||||||
{"and","true","false","false"},
|
{"and","true","false","false"},
|
||||||
{"and","false","true","false"},
|
{"and","false","true","false"},
|
||||||
|
|
||||||
{"or","true","true","true"},
|
{"or","true","true","true"},
|
||||||
{"or","false","false","false"},
|
{"or","false","false","false"},
|
||||||
{"or","true","false","true"},
|
{"or","true","false","true"},
|
||||||
{"or","false","true","true"},
|
{"or","false","true","true"},
|
||||||
|
|
||||||
{"xor","true","true","false"},
|
{"xor","true","true","false"},
|
||||||
{"xor","false","false","false"},
|
{"xor","false","false","false"},
|
||||||
{"xor","true","false","true"},
|
{"xor","true","false","true"},
|
||||||
{"xor","false","true","true"},
|
{"xor","false","true","true"},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
static Properties bindings;
|
static Properties bindings;
|
||||||
Project project;
|
Project project;
|
||||||
Properties options;
|
Properties options;
|
||||||
JSONObject engine_config;
|
JSONObject engine_config;
|
||||||
Engine engine;
|
Engine engine;
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@BeforeTest
|
@BeforeTest
|
||||||
public void init() {
|
public void init() {
|
||||||
logger = LoggerFactory.getLogger(this.getClass());
|
logger = LoggerFactory.getLogger(this.getClass());
|
||||||
}
|
}
|
||||||
|
|
||||||
@BeforeMethod
|
@BeforeMethod
|
||||||
public void SetUp() throws IOException, ModelException {
|
public void SetUp() throws IOException, ModelException {
|
||||||
bindings = new Properties();
|
bindings = new Properties();
|
||||||
|
|
||||||
File dir = TestUtils.createTempDirectory("openrefine-test-workspace-dir");
|
File dir = TestUtils.createTempDirectory("openrefine-test-workspace-dir");
|
||||||
FileProjectManager.initialize(dir);
|
FileProjectManager.initialize(dir);
|
||||||
project = new Project();
|
project = new Project();
|
||||||
@ -110,11 +110,11 @@ public class BooleanTests extends RefineTest {
|
|||||||
int index = project.columnModel.allocateNewCellIndex();
|
int index = project.columnModel.allocateNewCellIndex();
|
||||||
Column column = new Column(index,"Column A");
|
Column column = new Column(index,"Column A");
|
||||||
project.columnModel.addColumn(index, column, true);
|
project.columnModel.addColumn(index, column, true);
|
||||||
|
|
||||||
options = mock(Properties.class);
|
options = mock(Properties.class);
|
||||||
|
|
||||||
bindings.put("project", project);
|
bindings.put("project", project);
|
||||||
|
|
||||||
// Five rows of a's and five of 1s
|
// Five rows of a's and five of 1s
|
||||||
for (int i = 0; i < 10; i++) {
|
for (int i = 0; i < 10; i++) {
|
||||||
Row row = new Row(1);
|
Row row = new Row(1);
|
||||||
@ -128,7 +128,7 @@ public class BooleanTests extends RefineTest {
|
|||||||
public void TearDown() {
|
public void TearDown() {
|
||||||
bindings = null;
|
bindings = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Lookup a control function by name and invoke it with a variable number of args
|
* Lookup a control function by name and invoke it with a variable number of args
|
||||||
*/
|
*/
|
||||||
@ -144,25 +144,25 @@ public class BooleanTests extends RefineTest {
|
|||||||
return function.call(bindings,args);
|
return function.call(bindings,args);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testInvalidParams() {
|
public void testInvalidParams() {
|
||||||
for (String op : new String[] {"and","or","xor"}) {
|
for (String op : new String[] {"and","or","xor"}) {
|
||||||
Assert.assertTrue(invoke(op) instanceof EvalError);
|
Assert.assertTrue(invoke(op) instanceof EvalError);
|
||||||
Assert.assertTrue(invoke(op, Boolean.TRUE, Boolean.TRUE, Boolean.TRUE) instanceof EvalError);
|
|
||||||
Assert.assertTrue(invoke(op, Boolean.TRUE, Integer.valueOf(1)) instanceof EvalError);
|
Assert.assertTrue(invoke(op, Boolean.TRUE, Integer.valueOf(1)) instanceof EvalError);
|
||||||
Assert.assertTrue(invoke(op, Integer.valueOf(1), Boolean.TRUE) instanceof EvalError);
|
Assert.assertTrue(invoke(op, Integer.valueOf(1), Boolean.TRUE) instanceof EvalError);
|
||||||
Assert.assertTrue(invoke(op, Boolean.TRUE,"foo") instanceof EvalError);
|
Assert.assertTrue(invoke(op, Boolean.TRUE,"foo") instanceof EvalError);
|
||||||
Assert.assertTrue(invoke(op, "foo", Boolean.TRUE) instanceof EvalError);
|
Assert.assertTrue(invoke(op, "foo", Boolean.TRUE) instanceof EvalError);
|
||||||
Assert.assertTrue(invoke(op, Boolean.TRUE) instanceof EvalError);
|
Assert.assertTrue(invoke(op, Boolean.TRUE) instanceof EvalError);
|
||||||
}
|
}
|
||||||
|
Assert.assertTrue(invoke("xor", Boolean.TRUE, Boolean.TRUE, Boolean.TRUE) instanceof EvalError);
|
||||||
String op = "not";
|
String op = "not";
|
||||||
Assert.assertTrue(invoke(op) instanceof EvalError);
|
Assert.assertTrue(invoke(op) instanceof EvalError);
|
||||||
Assert.assertTrue(invoke(op, Boolean.TRUE,Boolean.TRUE) instanceof EvalError);
|
Assert.assertTrue(invoke(op, Boolean.TRUE, Boolean.TRUE) instanceof EvalError);
|
||||||
Assert.assertTrue(invoke(op, Integer.valueOf(1)) instanceof EvalError);
|
Assert.assertTrue(invoke(op, Integer.valueOf(1)) instanceof EvalError);
|
||||||
Assert.assertTrue(invoke(op, "foo") instanceof EvalError);
|
Assert.assertTrue(invoke(op, "foo") instanceof EvalError);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testBinary() {
|
public void testBinary() {
|
||||||
for (String[] test : TRUTH_TABLE) {
|
for (String[] test : TRUTH_TABLE) {
|
||||||
|
Loading…
Reference in New Issue
Block a user