From 3953e3a5d34fa7caffc3e32eae4270b2d810d966 Mon Sep 17 00:00:00 2001 From: Laszlo Ersek Date: Tue, 20 Aug 2013 00:35:40 +0200 Subject: OptsVisitor: introduce unit tests, with test cases for range flattening According to commit 4f193e34 ("tests: Use qapi-schema-test.json as schema parser test") the "tests/qapi-schema/qapi-schema-test.out" file must be updated as well. Signed-off-by: Laszlo Ersek Tested-by: Wanlong Gao Signed-off-by: Luiz Capitulino --- tests/qapi-schema/qapi-schema-test.json | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'tests/qapi-schema/qapi-schema-test.json') diff --git a/tests/qapi-schema/qapi-schema-test.json b/tests/qapi-schema/qapi-schema-test.json index 4434fa3961..fe5af756c5 100644 --- a/tests/qapi-schema/qapi-schema-test.json +++ b/tests/qapi-schema/qapi-schema-test.json @@ -51,3 +51,18 @@ { 'command': 'user_def_cmd', 'data': {} } { 'command': 'user_def_cmd1', 'data': {'ud1a': 'UserDefOne'} } { 'command': 'user_def_cmd2', 'data': {'ud1a': 'UserDefOne', 'ud1b': 'UserDefOne'}, 'returns': 'UserDefTwo' } + +# For testing integer range flattening in opts-visitor. The following schema +# corresponds to the option format: +# +# -userdef i64=3-6,i64=-5--1,u64=2,u16=1,u16=7-12 +# +# For simplicity, this example doesn't use [type=]discriminator nor optargs +# specific to discriminator values. +{ 'type': 'UserDefOptions', + 'data': { + '*i64' : [ 'int' ], + '*u64' : [ 'uint64' ], + '*u16' : [ 'uint16' ], + '*i64x': 'int' , + '*u64x': 'uint64' } } -- cgit v1.2.1