uint8_t raw_pppoe[] = { 0x11, 0x00, 0x00, 0x00, 0x00 };
Packet *p = PacketGetFromAlloc();
if (unlikely(p == NULL))
- return 0;
+ FAIL;
ThreadVars tv;
DecodeThreadVars dtv;
DecodePPPOESession(&tv, &dtv, p, raw_pppoe, sizeof(raw_pppoe));
- if (ENGINE_ISSET_EVENT(p,PPPOE_PKT_TOO_SMALL)) {
+ if (!ENGINE_ISSET_EVENT(p, PPPOE_PKT_TOO_SMALL)) {
SCFree(p);
- return 1;
+ FAIL;
}
SCFree(p);
- return 0;
+ PASS;
}
/** DecodePPPOEtest02
Packet *p = PacketGetFromAlloc();
if (unlikely(p == NULL))
- return 0;
+ FAIL;
ThreadVars tv;
DecodeThreadVars dtv;
int ret = 0;
end:
FlowShutdown();
SCFree(p);
- return ret;
+ FAIL_IF(ret == 0);
+ PASS;
}
Packet *p = PacketGetFromAlloc();
if (unlikely(p == NULL))
- return 0;
+ FAIL;
ThreadVars tv;
DecodeThreadVars dtv;
DecodePPPOEDiscovery(&tv, &dtv, p, raw_pppoe, sizeof(raw_pppoe));
if (p->pppoedh == NULL) {
SCFree(p);
- return 0;
+ FAIL;
}
SCFree(p);
- return 1;
+ PASS;
}
/** DecodePPPOEtest04
Packet *p = PacketGetFromAlloc();
if (unlikely(p == NULL))
- return 0;
+ FAIL;
ThreadVars tv;
DecodeThreadVars dtv;
DecodePPPOEDiscovery(&tv, &dtv, p, raw_pppoe, sizeof(raw_pppoe));
- if(ENGINE_ISSET_EVENT(p,PPPOE_WRONG_CODE)) {
+ if (!ENGINE_ISSET_EVENT(p, PPPOE_WRONG_CODE)) {
SCFree(p);
- return 1;
+ FAIL;
}
SCFree(p);
- return 0;
+ PASS;
}
/** DecodePPPOEtest05
Packet *p = PacketGetFromAlloc();
if (unlikely(p == NULL))
- return 0;
+ FAIL;
ThreadVars tv;
DecodeThreadVars dtv;
DecodePPPOEDiscovery(&tv, &dtv, p, raw_pppoe, sizeof(raw_pppoe));
- if(ENGINE_ISSET_EVENT(p,PPPOE_MALFORMED_TAGS)) {
+ if (!ENGINE_ISSET_EVENT(p, PPPOE_MALFORMED_TAGS)) {
SCFree(p);
- return 1;
+ FAIL;
}
SCFree(p);
- return 0;
+ PASS;
}
/** DecodePPPOEtest06
if (PPPOE_SESSION_GET_VERSION(&pppoesh) != 0x0A) {
printf("Error, PPPOE macro pppoe_session_get_version failed: ");
- return 0;
+ FAIL;
}
if (PPPOE_SESSION_GET_TYPE(&pppoesh) != 0x0B) {
printf("Error, PPPOE macro pppoe_session_get_type failed: ");
- return 0;
+ FAIL;
}
if (PPPOE_DISCOVERY_GET_VERSION(&pppoedh) != 0x0C) {
printf("Error, PPPOE macro pppoe_discovery_get_version failed: ");
- return 0;
+ FAIL;
}
if (PPPOE_DISCOVERY_GET_TYPE(&pppoedh) != 0x0D) {
printf("Error, PPPOE macro pppoe_discovery_get_type failed: ");
- return 0;
+ FAIL;
}
-
- return 1;
+ PASS;
}
#endif /* UNITTESTS */