toml: Added test for alternating array/inline table
@@ -109,6 +109,7 @@ static void testWriteReadArrayNested (void);
static void testWriteReadInlineTable (void);
static void testWriteReadInlineTableNested (void);
static void testWriteReadInlineTableInArray (void);
+static void testWriteReadArrayInlineTableAlternating (void);
static void testWriteReadTable (void);
static void testWriteReadTableNested (void);
static void testWriteReadTableArray (void);
@@ -220,9 +221,11 @@ static void testWriteRead (void)
testWriteReadSimpleTableInTableArray ();
testWriteReadSimpleTableBeforeTableArray ();
testWriteReadInlineTableInArray ();
+ testWriteReadArrayInlineTableAlternating ();
}
-static void testWriteReadInlineTableInArray (void) {
+static void testWriteReadInlineTableInArray (void)
+{
TEST_RW_HEAD;
WRITE_KEY ("array");
@@ -265,7 +268,49 @@ static void testWriteReadInlineTableInArray (void) {
TEST_RW_FOOT;
}
-static void testWriteReadSimpleTableInTableArray (void) {
+static void testWriteReadArrayInlineTableAlternating (void)
+{
+ TEST_RW_HEAD;
+
+ WRITE_KEY ("inline");
+ SET_ORDER (0);
+ SET_TOML_TYPE ("inlinetable");
+ DUP_EXPECTED;
+
+ WRITE_KEY ("inline/array");
+ SET_ORDER (1);
+ DUP_EXPECTED;
+ SET_ARRAY ("#1");
+
+ WRITE_KEY ("inline/array/#0");
+ SET_TOML_TYPE ("inlinetable");
+ DUP_EXPECTED;
+
+ WRITE_KEY ("inline/array/#0/array2");
+ SET_ORDER (2);
+ DUP_EXPECTED;
+ SET_ARRAY ("#0");
+
+ WRITE_KV ("inline/array/#0/array2/#0", "0");
+ DUP_EXPECTED;
+
+ WRITE_KEY ("inline/array/#1");
+ SET_TOML_TYPE ("inlinetable");
+ DUP_EXPECTED;
+
+ WRITE_KEY ("inline/array/#1/array2");
+ SET_ORDER (3);
+ DUP_EXPECTED;
+ SET_ARRAY ("#0");
+
+ WRITE_KV ("inline/array/#1/array2/#0", "1");
+ DUP_EXPECTED;
+
+ TEST_RW_FOOT;
+}
+
+static void testWriteReadSimpleTableInTableArray (void)
+{
TEST_RW_HEAD;
WRITE_KEY ("ta");
@@ -303,7 +348,8 @@ static void testWriteReadSimpleTableInTableArray (void) {
TEST_RW_FOOT;
}
-static void testWriteReadSimpleTableBeforeTableArray (void) {
+static void testWriteReadSimpleTableBeforeTableArray (void)
+{
TEST_RW_HEAD;
WRITE_KEY ("table");
