diff options
Diffstat (limited to 'ql/test/semantic_analysis/valid')
21 files changed, 147 insertions, 0 deletions
diff --git a/ql/test/semantic_analysis/valid/test001.ql b/ql/test/semantic_analysis/valid/test001.ql new file mode 100644 index 0000000..d9d037f --- /dev/null +++ b/ql/test/semantic_analysis/valid/test001.ql @@ -0,0 +1,9 @@ +// Identifier reference in condition +form testForm { + "First Question" + testIdentifier : boolean + if (testIdentifier) { + "Second Question" + anotherIdentifier : integer + } +}
\ No newline at end of file diff --git a/ql/test/semantic_analysis/valid/test002.ql b/ql/test/semantic_analysis/valid/test002.ql new file mode 100644 index 0000000..afe1f5c --- /dev/null +++ b/ql/test/semantic_analysis/valid/test002.ql @@ -0,0 +1,7 @@ +// Identifier reference in computed question +form testForm { + "First Question" + testIdentifier : integer + "Second Question" + anotherIdentifier : integer = testIdentifier +}
\ No newline at end of file diff --git a/ql/test/semantic_analysis/valid/test003.ql b/ql/test/semantic_analysis/valid/test003.ql new file mode 100644 index 0000000..b89d0c1 --- /dev/null +++ b/ql/test/semantic_analysis/valid/test003.ql @@ -0,0 +1,9 @@ +// Identifier declared after reference in condition +form testForm { + if (testIdentifier) { + "First Question" + anotherIdentifier : integer + } + "Second Question" + testIdentifier : boolean +}
\ No newline at end of file diff --git a/ql/test/semantic_analysis/valid/test004.ql b/ql/test/semantic_analysis/valid/test004.ql new file mode 100644 index 0000000..8f4feb0 --- /dev/null +++ b/ql/test/semantic_analysis/valid/test004.ql @@ -0,0 +1,7 @@ +// Identifier declared after reference in computed question +form testForm { + "First Question" + anotherIdentifier : integer = testIdentifier + 1 + "Second Question" + testIdentifier : integer +}
\ No newline at end of file diff --git a/ql/test/semantic_analysis/valid/test005.ql b/ql/test/semantic_analysis/valid/test005.ql new file mode 100644 index 0000000..8620dc9 --- /dev/null +++ b/ql/test/semantic_analysis/valid/test005.ql @@ -0,0 +1,15 @@ +// Identifier reference in nested condition +form testForm { + "First Question" + firstCondition : boolean + "Second Question" + secondCondition : boolean + if (firstCondition) { + "Third Question" + anotherIdentifier : integer + if (secondCondition) { + "Fourth Question" + yetAnotherIdentifier : decimal + } + } +}
\ No newline at end of file diff --git a/ql/test/semantic_analysis/valid/test006.ql b/ql/test/semantic_analysis/valid/test006.ql new file mode 100644 index 0000000..855332e --- /dev/null +++ b/ql/test/semantic_analysis/valid/test006.ql @@ -0,0 +1,13 @@ +// Identifier reference in nested computed question +form testForm { + "First Question" + firstCondition : boolean + "Second Question" + firstInteger : integer + if (firstCondition) { + "Third Question" + anotherIdentifier : integer + "Fourth Question" + yetAnotherIdentifier : integer = firstInteger + 1 + } +}
\ No newline at end of file diff --git a/ql/test/semantic_analysis/valid/test007.ql b/ql/test/semantic_analysis/valid/test007.ql new file mode 100644 index 0000000..1338a82 --- /dev/null +++ b/ql/test/semantic_analysis/valid/test007.ql @@ -0,0 +1,9 @@ +// Identifier reference in both condition and computed question +form testForm { + "First Question" + someInteger : integer + if (someInteger > 10) { + "Second Question" + computedInteger : integer = someInteger - 10 + } +}
\ No newline at end of file diff --git a/ql/test/semantic_analysis/valid/test008.ql b/ql/test/semantic_analysis/valid/test008.ql new file mode 100644 index 0000000..80205a5 --- /dev/null +++ b/ql/test/semantic_analysis/valid/test008.ql @@ -0,0 +1,9 @@ +// Identifier dependant on second, second dependant on third +form testForm { + "First Question" + firstIdentifier : integer = secondIdentifier + 1 + "Second Question" + secondIdentifier : integer = thirdIdentifier + 1 + "Third Question" + thirdIdentifier : integer +}
\ No newline at end of file diff --git a/ql/test/semantic_analysis/valid/test009.ql b/ql/test/semantic_analysis/valid/test009.ql new file mode 100644 index 0000000..7e92ad7 --- /dev/null +++ b/ql/test/semantic_analysis/valid/test009.ql @@ -0,0 +1,7 @@ +// Different questions with equal labels +form testForm { + "First Question" + someIdentifier : integer + "First Question" + anotherIdentifier : decimal +}
\ No newline at end of file diff --git a/ql/test/semantic_analysis/valid/test010.ql b/ql/test/semantic_analysis/valid/test010.ql new file mode 100644 index 0000000..eca4ad4 --- /dev/null +++ b/ql/test/semantic_analysis/valid/test010.ql @@ -0,0 +1,5 @@ +// Compatible types for addition operation +form testForm { + "First Question" + someIdentifier : decimal = 10.0 + 10 +}
\ No newline at end of file diff --git a/ql/test/semantic_analysis/valid/test011.ql b/ql/test/semantic_analysis/valid/test011.ql new file mode 100644 index 0000000..f47b435 --- /dev/null +++ b/ql/test/semantic_analysis/valid/test011.ql @@ -0,0 +1,5 @@ +// Compatible types for subtraction operation +form testForm { + "First Question" + someIdentifier : decimal = 10.0 - 10 +}
\ No newline at end of file diff --git a/ql/test/semantic_analysis/valid/test012.ql b/ql/test/semantic_analysis/valid/test012.ql new file mode 100644 index 0000000..2e7e278 --- /dev/null +++ b/ql/test/semantic_analysis/valid/test012.ql @@ -0,0 +1,5 @@ +// Compatible types for greater equals operation +form testForm { + "First Question" + someIdentifier : boolean = 10.0 == 10 +}
\ No newline at end of file diff --git a/ql/test/semantic_analysis/valid/test013.ql b/ql/test/semantic_analysis/valid/test013.ql new file mode 100644 index 0000000..a34566c --- /dev/null +++ b/ql/test/semantic_analysis/valid/test013.ql @@ -0,0 +1,5 @@ +// Compatible types for greater than operation +form testForm { + "First Question" + someIdentifier : boolean = 10.0 > 10 +}
\ No newline at end of file diff --git a/ql/test/semantic_analysis/valid/test014.ql b/ql/test/semantic_analysis/valid/test014.ql new file mode 100644 index 0000000..7ee1b86 --- /dev/null +++ b/ql/test/semantic_analysis/valid/test014.ql @@ -0,0 +1,5 @@ +// Compatible types for less equals operation +form testForm { + "First Question" + someIdentifier : boolean = 10.0 <= 10 +}
\ No newline at end of file diff --git a/ql/test/semantic_analysis/valid/test015.ql b/ql/test/semantic_analysis/valid/test015.ql new file mode 100644 index 0000000..431c1f0 --- /dev/null +++ b/ql/test/semantic_analysis/valid/test015.ql @@ -0,0 +1,5 @@ +// Compatible types for less than operation +form testForm { + "First Question" + someIdentifier : boolean = 10.0 < 10 +}
\ No newline at end of file diff --git a/ql/test/semantic_analysis/valid/test016.ql b/ql/test/semantic_analysis/valid/test016.ql new file mode 100644 index 0000000..8b0bdde --- /dev/null +++ b/ql/test/semantic_analysis/valid/test016.ql @@ -0,0 +1,5 @@ +// Compatible types for and operation +form testForm { + "First Question" + someIdentifier : boolean = True && False +}
\ No newline at end of file diff --git a/ql/test/semantic_analysis/valid/test017.ql b/ql/test/semantic_analysis/valid/test017.ql new file mode 100644 index 0000000..851e5ff --- /dev/null +++ b/ql/test/semantic_analysis/valid/test017.ql @@ -0,0 +1,5 @@ +// Compatible types for or operation +form testForm { + "First Question" + someIdentifier : boolean = False || True +}
\ No newline at end of file diff --git a/ql/test/semantic_analysis/valid/test018.ql b/ql/test/semantic_analysis/valid/test018.ql new file mode 100644 index 0000000..41d439f --- /dev/null +++ b/ql/test/semantic_analysis/valid/test018.ql @@ -0,0 +1,5 @@ +// Compatible types for multiplication operation +form testForm { + "First Question" + someIdentifier : decimal = 10.0 * 10 +}
\ No newline at end of file diff --git a/ql/test/semantic_analysis/valid/test019.ql b/ql/test/semantic_analysis/valid/test019.ql new file mode 100644 index 0000000..36ba458 --- /dev/null +++ b/ql/test/semantic_analysis/valid/test019.ql @@ -0,0 +1,5 @@ +// Compatible types for division operation +form testForm { + "First Question" + someIdentifier : decimal = 10.0 / 10 +} diff --git a/ql/test/semantic_analysis/valid/test020.ql b/ql/test/semantic_analysis/valid/test020.ql new file mode 100644 index 0000000..9fff193 --- /dev/null +++ b/ql/test/semantic_analysis/valid/test020.ql @@ -0,0 +1,7 @@ +// Complex condition with mixed types +form testForm { + if ((15.5 >= 15) && ((3.0 * 3) - 15 > -10 / 2)) { + "First Question" + someIdentifier : integer + } +}
\ No newline at end of file diff --git a/ql/test/semantic_analysis/valid/test021.ql b/ql/test/semantic_analysis/valid/test021.ql new file mode 100644 index 0000000..01ec35c --- /dev/null +++ b/ql/test/semantic_analysis/valid/test021.ql @@ -0,0 +1,5 @@ +// Complex computed question with mixed types +form testForm { + "First Question" + someIdentifier : boolean = (25.5 >= 10) && ((10.0 / 3) - 15 < -10 * 2) +}
\ No newline at end of file |