give buffer length to parser
This commit is contained in:
parent
77c4f3ba94
commit
6311eeee17
@ -34,7 +34,8 @@ describe('basic', () => {
|
||||
});
|
||||
it('$version', done => {
|
||||
const cxt = lib.init();
|
||||
expect(lib.execute(cxt, Buffer.from(`
|
||||
expect(lib.execute(cxt, Buffer.from(
|
||||
`
|
||||
$version Generated by VerilatedVcd $end
|
||||
$date Wed Sep 18 22:59:07 2019
|
||||
$end
|
||||
@ -45,12 +46,12 @@ $timescale 1ns $end
|
||||
$scope module leaf $end
|
||||
$var wire 64 "}> counter [63:0] $end
|
||||
$upscope $end
|
||||
|
||||
`))).to.eq(1); expect(lib.execute(cxt, Buffer.from(`
|
||||
|
||||
$upscope $end
|
||||
|
||||
$enddefinitions $end
|
||||
`
|
||||
))).to.eq(0); expect(lib.execute(cxt, Buffer.from(
|
||||
`
|
||||
|
||||
#1
|
||||
0"}G
|
||||
@ -58,9 +59,9 @@ $enddefinitions $end
|
||||
1"}G
|
||||
#3
|
||||
0"}G
|
||||
|
||||
`))).to.eq(1);
|
||||
expect(lib.getError(cxt)).to.eq(1);
|
||||
`
|
||||
))).to.eq(0);
|
||||
expect(lib.getError(cxt)).to.eq(0);
|
||||
// expect(lib.getReason(cxt)).to.eq('Expected simulation command');
|
||||
// expect(lib.getCommand(cxt)).to.eq(100);
|
||||
done();
|
||||
|
6
vcd.c
6
vcd.c
@ -48,7 +48,7 @@
|
||||
} \
|
||||
}
|
||||
|
||||
#define ASSERT_BUFFER(name, var) \
|
||||
#define ASSERT_BUFFER(name, var, len) \
|
||||
const char * var; \
|
||||
size_t len; \
|
||||
{ \
|
||||
@ -81,9 +81,9 @@ METHOD(execute) {
|
||||
ASSERT_ARGC(2)
|
||||
struct vcd_parser_s *state;
|
||||
ASSERT_EXTERNAL(args[0], state)
|
||||
ASSERT_BUFFER(args[1], p)
|
||||
ASSERT_BUFFER(args[1], p, plen)
|
||||
|
||||
const int32_t error = vcd_parser_execute(state, p, NULL);
|
||||
const int32_t error = vcd_parser_execute(state, p, p + plen);
|
||||
|
||||
napi_value res;
|
||||
ASSERT(res, napi_create_int32(env, error, &res))
|
||||
|
Loading…
x
Reference in New Issue
Block a user