diff options
Diffstat (limited to 'config-lib/src/test/resources/configdefinitions/test.function-test.def')
-rw-r--r-- | config-lib/src/test/resources/configdefinitions/test.function-test.def | 96 |
1 files changed, 96 insertions, 0 deletions
diff --git a/config-lib/src/test/resources/configdefinitions/test.function-test.def b/config-lib/src/test/resources/configdefinitions/test.function-test.def new file mode 100644 index 00000000000..73681d95544 --- /dev/null +++ b/config-lib/src/test/resources/configdefinitions/test.function-test.def @@ -0,0 +1,96 @@ +# Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +# +# This def file should test most aspects of def files that makes a difference +# for the autogenerated config classes. The goal is to trigger all blocks of +# code in the code generators. This includes: +# +# - Use all legal special characters in the def file name, to ensure that those +# that needs to be replaced in type names are actually replaced. +# - Use the same enum type twice to verify that we dont declare or define it +# twice. +# - Use the same struct type twice for the same reason. +# - Include arrays of primitives and structs. +# - Include enum primitives and array of enums. Arrays of enums must be handled +# specially by the C++ code. +# - Include enums both with and without default values. +# - Include primitive string, numbers & doubles both with and without default +# values. +# - Have an array within a struct, to verify that we correctly recurse. +# - Reuse type name further within to ensure that this works. + +namespace=test + +# Some random bool without a default value. These comments exist to check + # that comment parsing works. +bool_val bool restart + ## A bool with a default value set. +bool_with_def bool default=false restart +# An int value +# Also test that multiline comments +# work. +int_val int restart +int_with_def int default=-545 restart +long_val long restart +long_with_def long default=-50000000000 restart +double_val double restart +double_with_def double default=-6.43 restart +# Another comment +string_val string restart +stringwithdef string default="foobar" restart +enum_val enum { FOO, BAR, FOOBAR } restart +enumwithdef enum { FOO2, BAR2, FOOBAR2 } default=BAR2 restart +onechoice enum { ONLYFOO } default=ONLYFOO restart +refval reference restart +refwithdef reference default=":parent:" restart +fileVal file restart +pathVal path restart +urlVal url + +boolarr[] bool restart +intarr[] int restart +longarr[] long restart +doublearr[] double restart +stringarr[] string restart +enumarr[] enum { ARRAY, VALUES } restart +refarr[] reference restart +fileArr[] file restart +pathArr[] path restart +urlArr[] url + +#This is a map of ints. +intMap{} int restart +stringMap{} string restart +filemap{} file restart +pathMap{} path restart +urlMap{} url + +# A basic struct +basicStruct.foo string default="basic" restart +basicStruct.bar int restart +basicStruct.intArr[] int restart + +# A struct of struct +rootStruct.inner0.name string default="inner0" restart +rootStruct.inner0.index int restart +rootStruct.inner1.name string default="inner1" restart +rootStruct.inner1.index int restart +rootStruct.innerArr[].boolVal bool default=false restart +rootStruct.innerArr[].stringVal string restart + +# This is my array +myarray[].intval int default=14 restart +myarray[].stringval[] string restart +myarray[].enumval enum { INNER, ENUM, TYPE } default=TYPE restart +myarray[].refval reference # Value in array without default restart +myarray[].fileVal file restart +myarray[].urlVal url +myarray[].anotherarray[].foo int default=-4 restart +myarray[].myStruct.a int restart +myarray[].myStruct.b int default=2 restart + +myStructMap{}.myInt int restart +myStructMap{}.myString string restart +myStructMap{}.myIntDef int default=56 restart +myStructMap{}.myStringDef string default="g" restart +myStructMap{}.anotherMap{}.anInt int restart +myStructMap{}.anotherMap{}.anIntDef int default=11 restart |