Initial implementation of OVSDB.
[sliver-openvswitch.git] / tests / ovsdb-table.at
diff --git a/tests/ovsdb-table.at b/tests/ovsdb-table.at
new file mode 100644 (file)
index 0000000..ebc5992
--- /dev/null
@@ -0,0 +1,31 @@
+AT_BANNER([OVSDB -- tables])
+
+OVSDB_CHECK_POSITIVE([table with one column],
+  [[parse-table mytable '{"columns": {"name": {"type": "string"}}}']],
+  [[{"columns":{"name":{"type":"string"}}}]])
+
+OVSDB_CHECK_POSITIVE([immutable table with one column],
+  [[parse-table mytable \
+    '{"columns": {"name": {"type": "string"}},
+      "mutable": false}']],
+  [[{"columns":{"name":{"type":"string"}},"mutable":false}]])
+
+OVSDB_CHECK_POSITIVE([table with comment],
+  [[parse-table mytable \
+    '{"columns": {"name": {"type": "string"}},
+      "comment": "description of table"}']],
+  [[{"columns":{"name":{"type":"string"}},"comment":"description of table"}]])
+
+OVSDB_CHECK_NEGATIVE([column names may not begin with _],
+  [[parse-table mytable \
+    '{"columns": {"_column": {"type": "integer"}}}']],
+  [[names beginning with "_" are reserved]],
+  [table])
+
+OVSDB_CHECK_NEGATIVE([table must have at least one column (1)],
+  [[parse-table mytable '{}']],
+  [[Parsing table schema for table mytable failed: Required 'columns' member is missing.]])
+
+OVSDB_CHECK_NEGATIVE([table must have at least one column (2)],
+  [[parse-table mytable '{"columns": {}}']],
+  [[table must have at least one column]])