remove 3 param error test for 'and' and 'or'

This commit is contained in:
Bob Harper 2017-04-27 11:07:04 +01:00
parent ef4e039998
commit 4ea0f440e9

View File

@ -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
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package com.google.refine.tests.expr.functions.booleans;
import static org.mockito.Mockito.mock;
@ -70,36 +70,36 @@ public class BooleanTests extends RefineTest {
{"and","false","false","false"},
{"and","true","false","false"},
{"and","false","true","false"},
{"or","true","true","true"},
{"or","false","false","false"},
{"or","true","false","true"},
{"or","false","true","true"},
{"xor","true","true","false"},
{"xor","false","false","false"},
{"xor","true","false","true"},
{"xor","false","true","true"},
};
static Properties bindings;
Project project;
Properties options;
JSONObject engine_config;
Engine engine;
@Override
@BeforeTest
public void init() {
logger = LoggerFactory.getLogger(this.getClass());
}
@BeforeMethod
public void SetUp() throws IOException, ModelException {
bindings = new Properties();
File dir = TestUtils.createTempDirectory("openrefine-test-workspace-dir");
FileProjectManager.initialize(dir);
project = new Project();
@ -110,11 +110,11 @@ public class BooleanTests extends RefineTest {
int index = project.columnModel.allocateNewCellIndex();
Column column = new Column(index,"Column A");
project.columnModel.addColumn(index, column, true);
options = mock(Properties.class);
bindings.put("project", project);
// Five rows of a's and five of 1s
for (int i = 0; i < 10; i++) {
Row row = new Row(1);
@ -128,7 +128,7 @@ public class BooleanTests extends RefineTest {
public void TearDown() {
bindings = null;
}
/**
* 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);
}
}
@Test
public void testInvalidParams() {
for (String op : new String[] {"and","or","xor"}) {
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, Integer.valueOf(1), Boolean.TRUE) instanceof EvalError);
Assert.assertTrue(invoke(op, Boolean.TRUE,"foo") instanceof EvalError);
Assert.assertTrue(invoke(op, "foo", 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";
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, "foo") instanceof EvalError);
}
@Test
public void testBinary() {
for (String[] test : TRUTH_TABLE) {