Skip to content

Commit

Permalink
Unit tests for all markers to get ecitor action
Browse files Browse the repository at this point in the history
Since the styles are being moved to v2, and the editor actions are so important, to catch regressions during move from v1 to v2, all possible markers were tested here.
#990
  • Loading branch information
teusbenschop committed Feb 19, 2025
1 parent 5587cda commit e4aef38
Showing 1 changed file with 213 additions and 9 deletions.
222 changes: 213 additions & 9 deletions unittests/styles.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -397,15 +397,219 @@ TEST_F (styles, editors_application)
{
Webserver_Request webserver_request;
database::styles::create_database ();
Database_State database_state;
database_state.create ();
std::string action = Editor_Styles::getAction (webserver_request, "add");
EXPECT_EQ ("c", action);
action = Editor_Styles::getAction (webserver_request, "vp");
EXPECT_EQ ("c", action);
action = Editor_Styles::getAction (webserver_request, "id");
EXPECT_EQ ("m", action);
refresh_sandbox (true, {"5 Creating sample Bible", "5 Sample Bible was created"});
const std::vector<std::pair<const char*, const char*>> marker_action {
{ "add", "c"},
{ "addpn", "c"},
{ "b", "p"},
{ "bd", "c"},
{ "bdit", "c"},
{ "bk", "c"},
{ "c", "p"},
{ "ca", "m"},
{ "cat", "c"},
{ "cd", "p"},
{ "cl", "m"},
{ "cls", "p"},
{ "cp", "m"},
{ "d", "p"},
{ "dc", "c"},
{ "ef", "n"},
{ "em", "c"},
{ "esb", "p"},
{ "esbe", "p"},
{ "ex", "n"},
{ "f", "n"},
{ "fdc", "c"},
{ "fe", "n"},
{ "fig", "m"},
{ "fk", "c"},
{ "fl", "c"},
{ "fm", "c"},
{ "fp", "c"},
{ "fq", "c"},
{ "fqa", "c"},
{ "fr", "c"},
{ "ft", "c"},
{ "fv", "c"},
{ "h", "m"},
{ "h1", "m"},
{ "h2", "m"},
{ "h3", "m"},
{ "ib", "p"},
{ "id", "m"},
{ "ide", "u"},
{ "ie", "m"},
{ "iex", "p"},
{ "ili", "p"},
{ "ili1", "p"},
{ "ili2", "p"},
{ "im", "p"},
{ "imi", "p"},
{ "imq", "p"},
{ "imt", "p"},
{ "imt1", "p"},
{ "imt2", "p"},
{ "imt3", "p"},
{ "imt4", "p"},
{ "imte", "p"},
{ "imte1", "p"},
{ "imte2", "p"},
{ "io", "p"},
{ "io1", "p"},
{ "io2", "p"},
{ "io3", "p"},
{ "io4", "p"},
{ "ior", "c"},
{ "iot", "p"},
{ "ip", "p"},
{ "ipi", "p"},
{ "ipq", "p"},
{ "ipr", "p"},
{ "iq", "p"},
{ "iq1", "p"},
{ "iq2", "p"},
{ "iq3", "p"},
{ "iqt", "c"},
{ "is", "p"},
{ "is1", "p"},
{ "is2", "p"},
{ "it", "c"},
{ "jmp", "c"},
{ "k", "c"},
{ "lf", "p"},
{ "lh", "p"},
{ "li", "p"},
{ "li1", "p"},
{ "li2", "p"},
{ "li3", "p"},
{ "li4", "p"},
{ "lik", "c"},
{ "lim", "p"},
{ "lim1", "p"},
{ "lim2", "p"},
{ "lit", "p"},
{ "litl", "c"},
{ "liv", "c"},
{ "liv1", "c"},
{ "m", "p"},
{ "mi", "p"},
{ "mr", "p"},
{ "ms", "p"},
{ "ms1", "p"},
{ "ms2", "p"},
{ "mt", "p"},
{ "mt1", "p"},
{ "mt2", "p"},
{ "mt3", "p"},
{ "mt4", "p"},
{ "mte", "p"},
{ "mte1", "p"},
{ "mte2", "p"},
{ "nb", "p"},
{ "nd", "c"},
{ "ndx", "c"},
{ "no", "c"},
{ "ord", "c"},
{ "p", "p"},
{ "pb", "u"},
{ "pc", "p"},
{ "periph", "m"},
{ "pi", "p"},
{ "pi1", "p"},
{ "pi2", "p"},
{ "pi3", "p"},
{ "pm", "p"},
{ "pmc", "p"},
{ "pmo", "p"},
{ "pmr", "p"},
{ "pn", "c"},
{ "png", "c"},
{ "po", "p"},
{ "pro", "m"},
{ "q", "p"},
{ "q1", "p"},
{ "q2", "p"},
{ "q3", "p"},
{ "qa", "p"},
{ "qac", "c"},
{ "qc", "p"},
{ "qd", "p"},
{ "qm", "p"},
{ "qm1", "p"},
{ "qm2", "p"},
{ "qm3", "p"},
{ "qr", "p"},
{ "qs", "c"},
{ "qt", "c"},
{ "r", "p"},
{ "rb", "c"},
{ "rem", "m"},
{ "rq", "p"},
{ "rt", "c"},
{ "s", "p"},
{ "s1", "p"},
{ "s2", "p"},
{ "s3", "p"},
{ "s4", "p"},
{ "sc", "c"},
{ "sd", "p"},
{ "sd1", "p"},
{ "sd2", "p"},
{ "sd3", "p"},
{ "sd4", "p"},
{ "sig", "c"},
{ "sls", "c"},
{ "sp", "p"},
{ "sr", "p"},
{ "sts", "m"},
{ "sup", "c"},
{ "tc1", "m"},
{ "tc2", "m"},
{ "tc3", "m"},
{ "tc4", "m"},
{ "tcr1", "m"},
{ "tcr2", "m"},
{ "tcr3", "m"},
{ "tcr4", "m"},
{ "th1", "m"},
{ "th2", "m"},
{ "th3", "m"},
{ "th4", "m"},
{ "thr1", "m"},
{ "thr2", "m"},
{ "thr3", "m"},
{ "thr4", "m"},
{ "tl", "c"},
{ "toc", "m"},
{ "toc1", "m"},
{ "toc2", "m"},
{ "toc3", "m"},
{ "tr", "m"},
{ "v", "c"},
{ "va", "c"},
{ "vp", "c"},
{ "vp", "c"},
{ "w", "c"},
{ "wa", "c"},
{ "wg", "c"},
{ "wh", "c"},
{ "wj", "c"},
{ "x", "n"},
{ "xdc", "c"},
{ "xk", "c"},
{ "xnt", "c"},
{ "xo", "c"},
{ "xop", "c"},
{ "xot", "c"},
{ "xq", "c"},
{ "xt", "c"},
{ "xta", "c"},
};
for (const auto& pair : marker_action) {
const std::string action = Editor_Styles::getAction (webserver_request, pair.first);
if (action != pair.second)
FAIL() << "Marker " << pair.first << " got action " << action << " but the expected action is " << pair.second;
}
}


Expand Down

0 comments on commit e4aef38

Please sign in to comment.