MCPcopy Create free account
hub / github.com/SIPp/sipp / TEST

Function TEST

src/actions.cpp:1085–1108  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1083#include "gtest/gtest.h"
1084
1085TEST(actions, MatchingRegexp) {
1086 AllocVariableTable vt(nullptr);
1087 int id = vt.find("1", true);
1088 int sub1_id = vt.find("2", true);
1089 int sub2_id = vt.find("3", true);
1090 int sub3_id = vt.find("4", true);
1091 int sub4_id = vt.find("5", true);
1092 CAction re(nullptr);
1093 re.setVarId(id);
1094 re.setNbSubVarId(4);
1095 re.setSubVarId(sub1_id);
1096 re.setSubVarId(sub2_id);
1097 re.setSubVarId(sub3_id);
1098 re.setSubVarId(sub4_id);
1099 re.setRegExp("(.+)(o) (.+)(d)");
1100 int results = re.executeRegExp("hello world", &vt);
1101
1102 ASSERT_EQ(5, results);
1103 ASSERT_STREQ("hello world", vt.getVar(id)->getString());
1104 ASSERT_STREQ("hell", vt.getVar(sub1_id)->getString());
1105 ASSERT_STREQ("o", vt.getVar(sub2_id)->getString());
1106 ASSERT_STREQ("worl", vt.getVar(sub3_id)->getString());
1107 ASSERT_STREQ("d", vt.getVar(sub4_id)->getString());
1108}
1109
1110TEST(actions, NonMatchingRegexp) {
1111 AllocVariableTable vt(nullptr);

Callers

nothing calls this directly

Calls 8

findMethod · 0.80
setVarIdMethod · 0.80
setNbSubVarIdMethod · 0.80
setSubVarIdMethod · 0.80
setRegExpMethod · 0.80
executeRegExpMethod · 0.80
getStringMethod · 0.80
getVarMethod · 0.80

Tested by

no test coverage detected