aboutsummaryrefslogtreecommitdiffstats
path: root/lib/erl_interface/test
diff options
context:
space:
mode:
authorSverker Eriksson <[email protected]>2013-02-08 16:21:07 +0100
committerSverker Eriksson <[email protected]>2013-02-08 16:21:07 +0100
commit7d1060c624676c5dde532d1cb59fa177329f4178 (patch)
treef7595f06dfb9553b11faf2656aefc175f6915178 /lib/erl_interface/test
parent9a476f1c86845c4bd15ed849f07fc788b593e2fa (diff)
parentf822540687d16eecfcd2d74b55091593c674d478 (diff)
downloadotp-7d1060c624676c5dde532d1cb59fa177329f4178.tar.gz
otp-7d1060c624676c5dde532d1cb59fa177329f4178.tar.bz2
otp-7d1060c624676c5dde532d1cb59fa177329f4178.zip
Merge branch 'sverk/r16/erl_interface-fixup'
* sverk/r16/erl_interface-fixup: erl_interface: Fix ei_skip_term
Diffstat (limited to 'lib/erl_interface/test')
-rw-r--r--lib/erl_interface/test/ei_decode_encode_SUITE_data/ei_decode_encode_test.c33
1 files changed, 31 insertions, 2 deletions
diff --git a/lib/erl_interface/test/ei_decode_encode_SUITE_data/ei_decode_encode_test.c b/lib/erl_interface/test/ei_decode_encode_SUITE_data/ei_decode_encode_test.c
index 996d923ffc..6472cf8db4 100644
--- a/lib/erl_interface/test/ei_decode_encode_SUITE_data/ei_decode_encode_test.c
+++ b/lib/erl_interface/test/ei_decode_encode_SUITE_data/ei_decode_encode_test.c
@@ -52,7 +52,8 @@ typedef struct
int ei_decode_my_atom(const char *buf, int *index, my_atom* a)
{
- return ei_decode_atom_as(buf, index, a->name, sizeof(a->name), ERLANG_UTF8, &a->enc, NULL);
+ return ei_decode_atom_as(buf, index, (a ? a->name : NULL), sizeof(a->name),
+ ERLANG_UTF8, (a ? &a->enc : NULL), NULL);
}
int ei_encode_my_atom(char *buf, int *index, my_atom* a)
{
@@ -77,7 +78,7 @@ void decode_encode(struct Type* t, void* obj)
MESSAGE("ei_decode_%s, arg is type %s", t->name, t->type);
buf = read_packet(NULL);
- err = t->ei_decode_fp(buf+1, &size1, obj);
+ err = t->ei_decode_fp(buf+1, &size1, NULL);
if (err != 0) {
if (err != -1) {
fail("decode returned non zero but not -1");
@@ -96,7 +97,35 @@ void decode_encode(struct Type* t, void* obj)
return;
}
+ err = t->ei_decode_fp(buf+1, &size2, obj);
+ if (err != 0) {
+ if (err != -1) {
+ fail("decode returned non zero but not -1");
+ } else {
+ fail("decode returned non zero");
+ }
+ return;
+ }
+ if (size1 != size2) {
+ MESSAGE("size1 = %d, size2 = %d\n",size1,size2);
+ fail("decode sizes differs");
+ return;
+ }
+
+ size2 = 0;
+ err = ei_skip_term(buf+1, &size2);
+ if (err != 0) {
+ fail("ei_skip_term returned non zero");
+ return;
+ }
+ if (size1 != size2) {
+ MESSAGE("size1 = %d, size2 = %d\n",size1,size2);
+ fail("skip size differs");
+ return;
+ }
+
MESSAGE("ei_encode_%s buf is NULL, arg is type %s", t->name, t->type);
+ size2 = 0;
err = t->ei_encode_fp(NULL, &size2, obj);
if (err != 0) {
if (err != -1) {