MCPcopy Create free account
hub / github.com/ElementsProject/lightning / main

Function main

plugins/bkpr/test/run-sql.c:31–60  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

29/* AUTOGENERATED MOCKS END */
30
31int main(int argc, char *argv[])
32{
33 common_setup(argv[0]);
34 /* No quote: should return same pointer */
35 const char *s1 = "simple";
36 const char *r1 = sql_string(tmpctx, s1);
37 assert(r1 == s1);
38
39 /* One quote: should return new string with doubled quote */
40 const char *s2 = "O'Reilly";
41 const char *r2 = sql_string(tmpctx, s2);
42 assert(strcmp(r2, "O''Reilly") == 0);
43 assert(r2 != s2); // New allocation
44
45 /* Multiple quotes */
46 const char *s3 = "'a'b'c'";
47 const char *r3 = sql_string(tmpctx, s3);
48 assert(strcmp(r3, "''a''b''c''") == 0);
49
50 /* All quotes */
51 const char *s4 = "''''";
52 const char *r4 = sql_string(tmpctx, s4);
53 assert(strcmp(r4, "''''''''") == 0);
54
55 /* Empty string: should return same pointer */
56 const char *s5 = "";
57 const char *r5 = sql_string(tmpctx, s5);
58 assert(r5 == s5);
59 common_shutdown();
60}

Callers

nothing calls this directly

Calls 3

common_setupFunction · 0.85
sql_stringFunction · 0.85
common_shutdownFunction · 0.85

Tested by

no test coverage detected