[webml/NNAPI] No exception is thrown when passing an invalid argument to addOperand() #80
Description
Test Env:
Chromium Version : nightly build 65.0.3324.0 (revision f9e1a31)
OS : Android 8.1.0;Pixel 2
Expected Result:
Pass an invalid argument to addOperand(), it should throw an exception
Actual Result:
No exception is thrown when passing an invalid argument to addOperand()
How to reproduce:
Pass the following invalid arguments to addOperand():
TENSOR_FLOAT32 type: no "dimensions"
TENSOR_INT32 type: no "dimensions"
TENSOR_QUANT8_ASYMM type: no "dimensions"
TENSOR_QUANT8_ASYMM type: no "scale"
TENSOR_QUANT8_ASYMM type: no "zeroPoint"
TENSOR_QUANT8_ASYMM type: no "scale" and "zeroPoint"
TENSOR_QUANT8_ASYMM type: "zeroPoint" < 0
TENSOR_QUANT8_ASYMM type: "zeroPoint" > 255
TENSOR_QUANT8_ASYMM type: "scale" is negative
addOperand() only requires one argument, passing two arguments should raise an error: two scalars or two tensors
For example:
1.TENSOR_FLOAT32 type: no "dimensions":
it('raise error when passing a TENSOR_FLOAT32 tensor not having "dimensions" option', function() {
return nn.createModel(options).then((model)=>{
assert.throws(() => {
model.addOperand({type: nn.TENSOR_FLOAT32});
});
});
});
2.addOperand() only requires one argument, passing two arguments should raise an error: pass two scalars
it('raise error when passing two scalars', function() {
return nn.createModel(options).then((model)=>{
assert.throws(() => {
model.addOperand({type: nn.INT32}, {type: nn.INT32});
});
});
});