testEdgeMinifySlices.c 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311
  1. #include "testBase.h"
  2. typedef struct
  3. {
  4. const char *name;
  5. const char *input;
  6. const char *expect;
  7. } minifyTextSliceCase_t;
  8. typedef struct
  9. {
  10. const char *name;
  11. const uint8_t *input;
  12. uint32_t len;
  13. const char *expect;
  14. } minifyBinarySliceCase_t;
  15. static void assertMinifyTextSliceCase(const minifyTextSliceCase_t *testCase)
  16. {
  17. const size_t len = strlen(testCase->input);
  18. const size_t expectLen = strlen(testCase->expect);
  19. char *buf = (char *)malloc(len + 2U);
  20. TEST_ASSERT_NOT_NULL(buf);
  21. memcpy(buf, testCase->input, len);
  22. buf[len] = '#';
  23. buf[len + 1U] = '\0';
  24. uint32_t outLen = RyanJsonMinify(buf, (int32_t)len);
  25. if (outLen < (uint32_t)len)
  26. {
  27. buf[outLen] = '\0';
  28. TEST_ASSERT_EQUAL_STRING_MESSAGE(testCase->expect, buf, testCase->name);
  29. }
  30. else
  31. {
  32. TEST_ASSERT_EQUAL_UINT32_MESSAGE((uint32_t)expectLen, outLen, testCase->name);
  33. TEST_ASSERT_EQUAL_MEMORY_MESSAGE(testCase->expect, buf, outLen, testCase->name);
  34. }
  35. TEST_ASSERT_EQUAL_UINT8_MESSAGE((uint8_t)'#', (uint8_t)buf[len], testCase->name);
  36. free(buf);
  37. }
  38. static void assertMinifyBinarySliceCase(const minifyBinarySliceCase_t *testCase)
  39. {
  40. char *buf = (char *)malloc((size_t)testCase->len + 2U);
  41. TEST_ASSERT_NOT_NULL(buf);
  42. memcpy(buf, testCase->input, testCase->len);
  43. buf[testCase->len] = '#';
  44. buf[testCase->len + 1U] = '\0';
  45. uint32_t outLen = RyanJsonMinify(buf, (int32_t)testCase->len);
  46. if (outLen < testCase->len) { buf[outLen] = '\0'; }
  47. TEST_ASSERT_EQUAL_STRING_MESSAGE(testCase->expect, buf, testCase->name);
  48. TEST_ASSERT_EQUAL_UINT8_MESSAGE((uint8_t)'#', (uint8_t)buf[testCase->len], testCase->name);
  49. free(buf);
  50. }
  51. #define MINIFY_TEXT_SLICE_CASE(name, label, input, expect) \
  52. static void name(void) \
  53. { \
  54. const minifyTextSliceCase_t testCase = {label, input, expect}; \
  55. assertMinifyTextSliceCase(&testCase); \
  56. }
  57. #define MINIFY_BINARY_SLICE_CASE(name, label, expect, ...) \
  58. static void name(void) \
  59. { \
  60. static const uint8_t input[] = {__VA_ARGS__}; \
  61. const minifyBinarySliceCase_t testCase = {label, input, (uint32_t)sizeof(input), expect}; \
  62. assertMinifyBinarySliceCase(&testCase); \
  63. }
  64. // 块注释: Object token 边界
  65. MINIFY_TEXT_SLICE_CASE(testEdgeMinifySliceBlockObjectLeadingComment, "leading block comment before object", "/*c*/{\"a\":1,\"b\":2}",
  66. "{\"a\":1,\"b\":2}")
  67. MINIFY_TEXT_SLICE_CASE(testEdgeMinifySliceBlockObjectAfterOpenBrace, "block comment after object start", "{/*c*/\"a\":1,\"b\":2}",
  68. "{\"a\":1,\"b\":2}")
  69. MINIFY_TEXT_SLICE_CASE(testEdgeMinifySliceBlockObjectBetweenKeyAndColon, "block comment between key and colon", "{\"a\"/*c*/:1,\"b\":2}",
  70. "{\"a\":1,\"b\":2}")
  71. MINIFY_TEXT_SLICE_CASE(testEdgeMinifySliceBlockObjectBetweenColonAndValue, "block comment between colon and value",
  72. "{\"a\":/*c*/1,\"b\":2}", "{\"a\":1,\"b\":2}")
  73. MINIFY_TEXT_SLICE_CASE(testEdgeMinifySliceBlockObjectAfterFirstValue, "block comment after first value", "{\"a\":1/*c*/,\"b\":2}",
  74. "{\"a\":1,\"b\":2}")
  75. MINIFY_TEXT_SLICE_CASE(testEdgeMinifySliceBlockObjectAfterMemberComma, "block comment after member comma", "{\"a\":1,/*c*/\"b\":2}",
  76. "{\"a\":1,\"b\":2}")
  77. MINIFY_TEXT_SLICE_CASE(testEdgeMinifySliceBlockObjectBeforeSecondMemberColon, "block comment before second member colon",
  78. "{\"a\":1,\"b\"/*c*/:2}", "{\"a\":1,\"b\":2}")
  79. MINIFY_TEXT_SLICE_CASE(testEdgeMinifySliceBlockObjectBeforeSecondMemberValue, "block comment before second member value",
  80. "{\"a\":1,\"b\":/*c*/2}", "{\"a\":1,\"b\":2}")
  81. MINIFY_TEXT_SLICE_CASE(testEdgeMinifySliceBlockObjectBeforeCloseBrace, "block comment before object close", "{\"a\":1,\"b\":2/*c*/}",
  82. "{\"a\":1,\"b\":2}")
  83. MINIFY_TEXT_SLICE_CASE(testEdgeMinifySliceBlockObjectTrailingComment, "trailing block comment after object", "{\"a\":1,\"b\":2}/*c*/",
  84. "{\"a\":1,\"b\":2}")
  85. // 行注释: Object token 边界
  86. MINIFY_TEXT_SLICE_CASE(testEdgeMinifySliceLineObjectLeadingComment, "leading line comment before object", "//c\n{\"a\":1,\"b\":2}",
  87. "{\"a\":1,\"b\":2}")
  88. MINIFY_TEXT_SLICE_CASE(testEdgeMinifySliceLineObjectAfterOpenBrace, "line comment after object start", "{//c\n\"a\":1,\"b\":2}",
  89. "{\"a\":1,\"b\":2}")
  90. MINIFY_TEXT_SLICE_CASE(testEdgeMinifySliceLineObjectBetweenKeyAndColon, "line comment between key and colon", "{\"a\"//c\n:1,\"b\":2}",
  91. "{\"a\":1,\"b\":2}")
  92. MINIFY_TEXT_SLICE_CASE(testEdgeMinifySliceLineObjectBetweenColonAndValue, "line comment between colon and value", "{\"a\"://c\n1,\"b\":2}",
  93. "{\"a\":1,\"b\":2}")
  94. MINIFY_TEXT_SLICE_CASE(testEdgeMinifySliceLineObjectAfterFirstValue, "line comment after first value", "{\"a\":1//c\n,\"b\":2}",
  95. "{\"a\":1,\"b\":2}")
  96. MINIFY_TEXT_SLICE_CASE(testEdgeMinifySliceLineObjectAfterMemberComma, "line comment after member comma", "{\"a\":1,//c\n\"b\":2}",
  97. "{\"a\":1,\"b\":2}")
  98. MINIFY_TEXT_SLICE_CASE(testEdgeMinifySliceLineObjectBeforeSecondMemberColon, "line comment before second member colon",
  99. "{\"a\":1,\"b\"//c\n:2}", "{\"a\":1,\"b\":2}")
  100. MINIFY_TEXT_SLICE_CASE(testEdgeMinifySliceLineObjectBeforeSecondMemberValue, "line comment before second member value",
  101. "{\"a\":1,\"b\"://c\n2}", "{\"a\":1,\"b\":2}")
  102. MINIFY_TEXT_SLICE_CASE(testEdgeMinifySliceLineObjectBeforeCloseBrace, "line comment before object close", "{\"a\":1,\"b\":2//c\n}",
  103. "{\"a\":1,\"b\":2}")
  104. MINIFY_TEXT_SLICE_CASE(testEdgeMinifySliceLineObjectTrailingComment, "trailing line comment after object", "{\"a\":1,\"b\":2}//c\n",
  105. "{\"a\":1,\"b\":2}")
  106. // 注释: Array token 边界
  107. MINIFY_TEXT_SLICE_CASE(testEdgeMinifySliceBlockArrayLeadingComment, "leading block comment before array", "/*c*/[1,2,3]", "[1,2,3]")
  108. MINIFY_TEXT_SLICE_CASE(testEdgeMinifySliceBlockArrayAfterOpenBracket, "block comment after array start", "[/*c*/1,2,3]", "[1,2,3]")
  109. MINIFY_TEXT_SLICE_CASE(testEdgeMinifySliceBlockArrayAfterFirstItem, "block comment after first item", "[1/*c*/,2,3]", "[1,2,3]")
  110. MINIFY_TEXT_SLICE_CASE(testEdgeMinifySliceBlockArrayBeforeSecondItem, "block comment before second item", "[1,/*c*/2,3]", "[1,2,3]")
  111. MINIFY_TEXT_SLICE_CASE(testEdgeMinifySliceBlockArrayAfterSecondItem, "block comment after second item", "[1,2/*c*/,3]", "[1,2,3]")
  112. MINIFY_TEXT_SLICE_CASE(testEdgeMinifySliceBlockArrayBeforeThirdItem, "block comment before third item", "[1,2,/*c*/3]", "[1,2,3]")
  113. MINIFY_TEXT_SLICE_CASE(testEdgeMinifySliceBlockArrayBeforeCloseBracket, "block comment before array close", "[1,2,3/*c*/]", "[1,2,3]")
  114. MINIFY_TEXT_SLICE_CASE(testEdgeMinifySliceBlockArrayTrailingComment, "trailing block comment after array", "[1,2,3]/*c*/", "[1,2,3]")
  115. MINIFY_TEXT_SLICE_CASE(testEdgeMinifySliceBlockArrayMultipleInteriorComments, "multiple block comments inside array",
  116. "[1/*c*/,/*d*/2,/*e*/3]", "[1,2,3]")
  117. MINIFY_TEXT_SLICE_CASE(testEdgeMinifySliceBlockArrayTailComments, "block comments near array tail", "[1,2/*c*/,3/*d*/]", "[1,2,3]")
  118. MINIFY_TEXT_SLICE_CASE(testEdgeMinifySliceLineArrayLeadingComment, "leading line comment before array", "//c\n[1,2,3]", "[1,2,3]")
  119. MINIFY_TEXT_SLICE_CASE(testEdgeMinifySliceLineArrayAfterOpenBracket, "line comment after array start", "[//c\n1,2,3]", "[1,2,3]")
  120. MINIFY_TEXT_SLICE_CASE(testEdgeMinifySliceLineArrayAfterFirstItem, "line comment after first item", "[1//c\n,2,3]", "[1,2,3]")
  121. MINIFY_TEXT_SLICE_CASE(testEdgeMinifySliceLineArrayBeforeSecondItem, "line comment before second item", "[1,//c\n2,3]", "[1,2,3]")
  122. MINIFY_TEXT_SLICE_CASE(testEdgeMinifySliceLineArrayAfterSecondItem, "line comment after second item", "[1,2//c\n,3]", "[1,2,3]")
  123. MINIFY_TEXT_SLICE_CASE(testEdgeMinifySliceLineArrayBeforeThirdItem, "line comment before third item", "[1,2,//c\n3]", "[1,2,3]")
  124. MINIFY_TEXT_SLICE_CASE(testEdgeMinifySliceLineArrayBeforeCloseBracket, "line comment before array close", "[1,2,3//c\n]", "[1,2,3]")
  125. MINIFY_TEXT_SLICE_CASE(testEdgeMinifySliceLineArrayTrailingComment, "trailing line comment after array", "[1,2,3]//c\n", "[1,2,3]")
  126. MINIFY_TEXT_SLICE_CASE(testEdgeMinifySliceLineArrayMultipleInteriorComments, "multiple line comments inside array", "[1//c\n,2//d\n,3]",
  127. "[1,2,3]")
  128. MINIFY_TEXT_SLICE_CASE(testEdgeMinifySliceLineArrayTailComments, "line comments near array tail", "[1,2//c\n,3//d\n]", "[1,2,3]")
  129. // 注释: 嵌套容器
  130. MINIFY_TEXT_SLICE_CASE(testEdgeMinifySliceBlockNestedBeforeArrayValue, "block comment before nested array value",
  131. "{\"a\":/*c*/[1,2],\"b\":{\"c\":3}}", "{\"a\":[1,2],\"b\":{\"c\":3}}")
  132. MINIFY_TEXT_SLICE_CASE(testEdgeMinifySliceBlockNestedInsideArray, "block comment inside nested array", "{\"a\":[1,/*c*/2],\"b\":{\"c\":3}}",
  133. "{\"a\":[1,2],\"b\":{\"c\":3}}")
  134. MINIFY_TEXT_SLICE_CASE(testEdgeMinifySliceBlockNestedBetweenTopLevelMembers, "block comment between top-level members",
  135. "{\"a\":[1,2],/*c*/\"b\":{\"c\":3}}", "{\"a\":[1,2],\"b\":{\"c\":3}}")
  136. MINIFY_TEXT_SLICE_CASE(testEdgeMinifySliceBlockNestedBeforeObjectKey, "block comment before nested object key",
  137. "{\"a\":[1,2],\"b\":{/*c*/\"c\":3}}", "{\"a\":[1,2],\"b\":{\"c\":3}}")
  138. MINIFY_TEXT_SLICE_CASE(testEdgeMinifySliceBlockNestedBeforeObjectValue, "block comment before nested object value",
  139. "{\"a\":[1,2],\"b\":{\"c\":/*c*/3}}", "{\"a\":[1,2],\"b\":{\"c\":3}}")
  140. MINIFY_TEXT_SLICE_CASE(testEdgeMinifySliceBlockNestedLeadingAndTrailingDocComments, "leading and trailing block comments around document",
  141. "/*c*/{\"a\":[1,2],\"b\":{\"c\":3}}/*d*/", "{\"a\":[1,2],\"b\":{\"c\":3}}")
  142. MINIFY_TEXT_SLICE_CASE(testEdgeMinifySliceBlockNestedBeforeRootClose, "block comment before root close",
  143. "{\"a\":[1,2],\"b\":{\"c\":3}/*c*/}", "{\"a\":[1,2],\"b\":{\"c\":3}}")
  144. MINIFY_TEXT_SLICE_CASE(testEdgeMinifySliceBlockNestedAcrossMultipleTokens, "multiple block comments across nested tokens",
  145. "{\"a\":/*c*/[1/*d*/,2/*e*/],\"b\":{/*f*/\"c\":3}}", "{\"a\":[1,2],\"b\":{\"c\":3}}")
  146. MINIFY_TEXT_SLICE_CASE(testEdgeMinifySliceBlockNestedBeforeFirstArrayItem, "block comment before first nested array item",
  147. "{\"a\":[/*c*/1,2],\"b\":{\"c\":3}}", "{\"a\":[1,2],\"b\":{\"c\":3}}")
  148. MINIFY_TEXT_SLICE_CASE(testEdgeMinifySliceBlockNestedAroundObjectKeyToken, "block comments around nested object key token",
  149. "{\"a\":[1,2],\"b\":{/*c*/\"c\"/*d*/:3}}", "{\"a\":[1,2],\"b\":{\"c\":3}}")
  150. MINIFY_TEXT_SLICE_CASE(testEdgeMinifySliceLineNestedBeforeArrayValue, "line comment before nested array value",
  151. "{\"a\"://c\n[1,2],\"b\":{\"c\":3}}", "{\"a\":[1,2],\"b\":{\"c\":3}}")
  152. MINIFY_TEXT_SLICE_CASE(testEdgeMinifySliceLineNestedInsideArray, "line comment inside nested array", "{\"a\":[1,//c\n2],\"b\":{\"c\":3}}",
  153. "{\"a\":[1,2],\"b\":{\"c\":3}}")
  154. MINIFY_TEXT_SLICE_CASE(testEdgeMinifySliceLineNestedBetweenTopLevelMembers, "line comment between top-level members",
  155. "{\"a\":[1,2],//c\n\"b\":{\"c\":3}}", "{\"a\":[1,2],\"b\":{\"c\":3}}")
  156. MINIFY_TEXT_SLICE_CASE(testEdgeMinifySliceLineNestedBeforeObjectValue, "line comment before nested object value",
  157. "{\"a\":[1,2],\"b\"://c\n{\"c\":3}}", "{\"a\":[1,2],\"b\":{\"c\":3}}")
  158. MINIFY_TEXT_SLICE_CASE(testEdgeMinifySliceLineNestedAfterObjectValue, "line comment after nested object value",
  159. "{\"a\":[1,2],\"b\":{\"c\":3//c\n}}", "{\"a\":[1,2],\"b\":{\"c\":3}}")
  160. MINIFY_TEXT_SLICE_CASE(testEdgeMinifySliceLineNestedTrailingDocComment, "trailing line comment after document",
  161. "{\"a\":[1,2],\"b\":{\"c\":3}}//c\n", "{\"a\":[1,2],\"b\":{\"c\":3}}")
  162. MINIFY_TEXT_SLICE_CASE(testEdgeMinifySliceLineNestedLeadingDocComment, "leading line comment before document",
  163. "//c\n{\"a\":[1,2],\"b\":{\"c\":3}}", "{\"a\":[1,2],\"b\":{\"c\":3}}")
  164. MINIFY_TEXT_SLICE_CASE(testEdgeMinifySliceLineNestedBeforeObjectKey, "line comment before nested object key",
  165. "{\"a\":[1,2],\"b\":{\n//c\n\"c\":3}}", "{\"a\":[1,2],\"b\":{\"c\":3}}")
  166. MINIFY_TEXT_SLICE_CASE(testEdgeMinifySliceLineNestedAfterObjectValueBeforeClose, "line comment after nested object value before close",
  167. "{\"a\":[1,2],\"b\":{\n\"c\":3//c\n}}", "{\"a\":[1,2],\"b\":{\"c\":3}}")
  168. MINIFY_TEXT_SLICE_CASE(testEdgeMinifySliceLineNestedBetweenInnerObjectAndRootClose, "line comment between nested object and root close",
  169. "{\"a\":[1,2],\"b\":{\n\"c\":3}\n//c\n}", "{\"a\":[1,2],\"b\":{\"c\":3}}")
  170. // String 中的注释标记必须保留
  171. MINIFY_TEXT_SLICE_CASE(testEdgeMinifySliceStringMarkerLiteralSlashesAndBlock, "double slash and block marker strings",
  172. "{\"s\":\"//\",\"t\":\"/* */\"}", "{\"s\":\"//\",\"t\":\"/* */\"}")
  173. MINIFY_TEXT_SLICE_CASE(testEdgeMinifySliceStringMarkerLiteralSplitBlock, "block marker split across strings",
  174. "{\"s\":\"a/*b\",\"t\":\"c*/d\"}", "{\"s\":\"a/*b\",\"t\":\"c*/d\"}")
  175. MINIFY_TEXT_SLICE_CASE(testEdgeMinifySliceStringMarkerLiteralLineAndEscapedQuote, "line marker and escaped quote",
  176. "{\"s\":\"a//b\",\"t\":\"c\\\"//d\"}", "{\"s\":\"a//b\",\"t\":\"c\\\"//d\"}")
  177. MINIFY_TEXT_SLICE_CASE(testEdgeMinifySliceStringMarkerLiteralEscapedSlashBeforeMarkers, "escaped slash before comment markers",
  178. "{\"s\":\"a\\\\//b\",\"t\":\"a\\\\/*b*/\"}", "{\"s\":\"a\\\\//b\",\"t\":\"a\\\\/*b*/\"}")
  179. MINIFY_TEXT_SLICE_CASE(testEdgeMinifySliceStringMarkerLiteralUrlAndEscapedBlock, "url slashes and escaped block markers",
  180. "{\"s\":\"http:\\/\\/x\",\"t\":\"x\\/*y*\\/z\"}", "{\"s\":\"http:\\/\\/x\",\"t\":\"x\\/*y*\\/z\"}")
  181. MINIFY_TEXT_SLICE_CASE(testEdgeMinifySliceStringMarkerLiteralUnicodeSlashes, "unicode slash escapes",
  182. "{\"s\":\"\\u002F\\u002F\",\"t\":\"\\u002F*\"}", "{\"s\":\"\\u002F\\u002F\",\"t\":\"\\u002F*\"}")
  183. MINIFY_TEXT_SLICE_CASE(testEdgeMinifySliceStringMarkerLiteralUnicodeSlashAndStar, "unicode slash and star escapes",
  184. "{\"s\":\"\\u002F\\/\",\"t\":\"\\u002A\\/\"}", "{\"s\":\"\\u002F\\/\",\"t\":\"\\u002A\\/\"}")
  185. MINIFY_TEXT_SLICE_CASE(testEdgeMinifySliceStringMarkerLiteralEscapedQuoteBeforeLine, "escaped quote before line marker",
  186. "{\"s\":\"\\\"//\",\"t\":\"\\\\/*\"}", "{\"s\":\"\\\"//\",\"t\":\"\\\\/*\"}")
  187. MINIFY_TEXT_SLICE_CASE(testEdgeMinifySliceStringMarkerLiteralMixedBlockAndLine, "mixed block and line markers in string",
  188. "{\"s\":\"x/*y*/z//w\",\"t\":\"x\\/\\/y\"}", "{\"s\":\"x/*y*/z//w\",\"t\":\"x\\/\\/y\"}")
  189. MINIFY_TEXT_SLICE_CASE(testEdgeMinifySliceStringMarkerLiteralTripleEscapedSlash, "triple escaped slash before markers",
  190. "{\"s\":\"x\\\\\\//y\",\"t\":\"x\\\\\\/*y*/\"}", "{\"s\":\"x\\\\\\//y\",\"t\":\"x\\\\\\/*y*/\"}")
  191. // 内嵌 NUL: 显式长度 slice
  192. MINIFY_BINARY_SLICE_CASE(testEdgeMinifySliceEmbeddedNulCompleteObjectTail, "embedded NUL after complete object", "{\"a\":1}", '{', '"', 'a',
  193. '"', ':', '1', '}', '\0', 'X')
  194. MINIFY_BINARY_SLICE_CASE(testEdgeMinifySliceEmbeddedNulCompleteArrayTail, "embedded NUL after complete array", "[1,2]", '[', '1', ',', '2',
  195. ']', '\0', '!')
  196. MINIFY_BINARY_SLICE_CASE(testEdgeMinifySliceEmbeddedNulAfterLineCommentObjectStart, "embedded NUL after line comment opens object", "{",
  197. '/', '/', 'c', '\n', '{', '\0')
  198. MINIFY_BINARY_SLICE_CASE(testEdgeMinifySliceEmbeddedNulAfterEscapedQuoteInString, "embedded NUL after escaped quote inside string",
  199. "{\"s\":\"a\\\"b\"}", '{', '"', 's', '"', ':', '"', 'a', '\\', '"', 'b', '"', '}', '\0')
  200. MINIFY_BINARY_SLICE_CASE(testEdgeMinifySliceEmbeddedNulAfterBlockCommentBeforeObject, "embedded NUL after block comment then object", "{",
  201. '/', '*', 'c', '*', '/', '{', '\0', 'x')
  202. MINIFY_BINARY_SLICE_CASE(testEdgeMinifySliceEmbeddedNulAfterObjectComma, "embedded NUL after comma in object", "{\"a\":1,", '{', '"', 'a',
  203. '"', ':', '1', ',', '\0', '2')
  204. MINIFY_BINARY_SLICE_CASE(testEdgeMinifySliceEmbeddedNulAfterArrayComma, "embedded NUL after comma in array", "[1,", '[', '1', ',', '\0',
  205. '2', '3')
  206. MINIFY_BINARY_SLICE_CASE(testEdgeMinifySliceEmbeddedNulInsideStringLiteral, "embedded NUL inside string literal", "{\"k\":\"x", '{', '"',
  207. 'k', '"', ':', '"', 'x', '\0', 'y', '"')
  208. MINIFY_BINARY_SLICE_CASE(testEdgeMinifySliceEmbeddedNulInsideBareString, "embedded NUL in bare string slice", "\"a", '"', 'a', '\0', 'b')
  209. MINIFY_BINARY_SLICE_CASE(testEdgeMinifySliceEmbeddedNulInsideBlockCommentOpener, "embedded NUL inside block comment opener", "/{", '/', '*',
  210. 'c', '\0', '*', '/', '{')
  211. void testEdgeMinifySlicesRunner(void)
  212. {
  213. UnitySetTestFile(__FILE__);
  214. RUN_TEST(testEdgeMinifySliceBlockObjectLeadingComment);
  215. RUN_TEST(testEdgeMinifySliceBlockObjectAfterOpenBrace);
  216. RUN_TEST(testEdgeMinifySliceBlockObjectBetweenKeyAndColon);
  217. RUN_TEST(testEdgeMinifySliceBlockObjectBetweenColonAndValue);
  218. RUN_TEST(testEdgeMinifySliceBlockObjectAfterFirstValue);
  219. RUN_TEST(testEdgeMinifySliceBlockObjectAfterMemberComma);
  220. RUN_TEST(testEdgeMinifySliceBlockObjectBeforeSecondMemberColon);
  221. RUN_TEST(testEdgeMinifySliceBlockObjectBeforeSecondMemberValue);
  222. RUN_TEST(testEdgeMinifySliceBlockObjectBeforeCloseBrace);
  223. RUN_TEST(testEdgeMinifySliceBlockObjectTrailingComment);
  224. RUN_TEST(testEdgeMinifySliceLineObjectLeadingComment);
  225. RUN_TEST(testEdgeMinifySliceLineObjectAfterOpenBrace);
  226. RUN_TEST(testEdgeMinifySliceLineObjectBetweenKeyAndColon);
  227. RUN_TEST(testEdgeMinifySliceLineObjectBetweenColonAndValue);
  228. RUN_TEST(testEdgeMinifySliceLineObjectAfterFirstValue);
  229. RUN_TEST(testEdgeMinifySliceLineObjectAfterMemberComma);
  230. RUN_TEST(testEdgeMinifySliceLineObjectBeforeSecondMemberColon);
  231. RUN_TEST(testEdgeMinifySliceLineObjectBeforeSecondMemberValue);
  232. RUN_TEST(testEdgeMinifySliceLineObjectBeforeCloseBrace);
  233. RUN_TEST(testEdgeMinifySliceLineObjectTrailingComment);
  234. RUN_TEST(testEdgeMinifySliceBlockArrayLeadingComment);
  235. RUN_TEST(testEdgeMinifySliceBlockArrayAfterOpenBracket);
  236. RUN_TEST(testEdgeMinifySliceBlockArrayAfterFirstItem);
  237. RUN_TEST(testEdgeMinifySliceBlockArrayBeforeSecondItem);
  238. RUN_TEST(testEdgeMinifySliceBlockArrayAfterSecondItem);
  239. RUN_TEST(testEdgeMinifySliceBlockArrayBeforeThirdItem);
  240. RUN_TEST(testEdgeMinifySliceBlockArrayBeforeCloseBracket);
  241. RUN_TEST(testEdgeMinifySliceBlockArrayTrailingComment);
  242. RUN_TEST(testEdgeMinifySliceBlockArrayMultipleInteriorComments);
  243. RUN_TEST(testEdgeMinifySliceBlockArrayTailComments);
  244. RUN_TEST(testEdgeMinifySliceLineArrayLeadingComment);
  245. RUN_TEST(testEdgeMinifySliceLineArrayAfterOpenBracket);
  246. RUN_TEST(testEdgeMinifySliceLineArrayAfterFirstItem);
  247. RUN_TEST(testEdgeMinifySliceLineArrayBeforeSecondItem);
  248. RUN_TEST(testEdgeMinifySliceLineArrayAfterSecondItem);
  249. RUN_TEST(testEdgeMinifySliceLineArrayBeforeThirdItem);
  250. RUN_TEST(testEdgeMinifySliceLineArrayBeforeCloseBracket);
  251. RUN_TEST(testEdgeMinifySliceLineArrayTrailingComment);
  252. RUN_TEST(testEdgeMinifySliceLineArrayMultipleInteriorComments);
  253. RUN_TEST(testEdgeMinifySliceLineArrayTailComments);
  254. RUN_TEST(testEdgeMinifySliceBlockNestedBeforeArrayValue);
  255. RUN_TEST(testEdgeMinifySliceBlockNestedInsideArray);
  256. RUN_TEST(testEdgeMinifySliceBlockNestedBetweenTopLevelMembers);
  257. RUN_TEST(testEdgeMinifySliceBlockNestedBeforeObjectKey);
  258. RUN_TEST(testEdgeMinifySliceBlockNestedBeforeObjectValue);
  259. RUN_TEST(testEdgeMinifySliceBlockNestedLeadingAndTrailingDocComments);
  260. RUN_TEST(testEdgeMinifySliceBlockNestedBeforeRootClose);
  261. RUN_TEST(testEdgeMinifySliceBlockNestedAcrossMultipleTokens);
  262. RUN_TEST(testEdgeMinifySliceBlockNestedBeforeFirstArrayItem);
  263. RUN_TEST(testEdgeMinifySliceBlockNestedAroundObjectKeyToken);
  264. RUN_TEST(testEdgeMinifySliceLineNestedBeforeArrayValue);
  265. RUN_TEST(testEdgeMinifySliceLineNestedInsideArray);
  266. RUN_TEST(testEdgeMinifySliceLineNestedBetweenTopLevelMembers);
  267. RUN_TEST(testEdgeMinifySliceLineNestedBeforeObjectValue);
  268. RUN_TEST(testEdgeMinifySliceLineNestedAfterObjectValue);
  269. RUN_TEST(testEdgeMinifySliceLineNestedTrailingDocComment);
  270. RUN_TEST(testEdgeMinifySliceLineNestedLeadingDocComment);
  271. RUN_TEST(testEdgeMinifySliceLineNestedBeforeObjectKey);
  272. RUN_TEST(testEdgeMinifySliceLineNestedAfterObjectValueBeforeClose);
  273. RUN_TEST(testEdgeMinifySliceLineNestedBetweenInnerObjectAndRootClose);
  274. RUN_TEST(testEdgeMinifySliceStringMarkerLiteralSlashesAndBlock);
  275. RUN_TEST(testEdgeMinifySliceStringMarkerLiteralSplitBlock);
  276. RUN_TEST(testEdgeMinifySliceStringMarkerLiteralLineAndEscapedQuote);
  277. RUN_TEST(testEdgeMinifySliceStringMarkerLiteralEscapedSlashBeforeMarkers);
  278. RUN_TEST(testEdgeMinifySliceStringMarkerLiteralUrlAndEscapedBlock);
  279. RUN_TEST(testEdgeMinifySliceStringMarkerLiteralUnicodeSlashes);
  280. RUN_TEST(testEdgeMinifySliceStringMarkerLiteralUnicodeSlashAndStar);
  281. RUN_TEST(testEdgeMinifySliceStringMarkerLiteralEscapedQuoteBeforeLine);
  282. RUN_TEST(testEdgeMinifySliceStringMarkerLiteralMixedBlockAndLine);
  283. RUN_TEST(testEdgeMinifySliceStringMarkerLiteralTripleEscapedSlash);
  284. RUN_TEST(testEdgeMinifySliceEmbeddedNulCompleteObjectTail);
  285. RUN_TEST(testEdgeMinifySliceEmbeddedNulCompleteArrayTail);
  286. RUN_TEST(testEdgeMinifySliceEmbeddedNulAfterLineCommentObjectStart);
  287. RUN_TEST(testEdgeMinifySliceEmbeddedNulAfterEscapedQuoteInString);
  288. RUN_TEST(testEdgeMinifySliceEmbeddedNulAfterBlockCommentBeforeObject);
  289. RUN_TEST(testEdgeMinifySliceEmbeddedNulAfterObjectComma);
  290. RUN_TEST(testEdgeMinifySliceEmbeddedNulAfterArrayComma);
  291. RUN_TEST(testEdgeMinifySliceEmbeddedNulInsideStringLiteral);
  292. RUN_TEST(testEdgeMinifySliceEmbeddedNulInsideBareString);
  293. RUN_TEST(testEdgeMinifySliceEmbeddedNulInsideBlockCommentOpener);
  294. }