[Spec tests] Add tests for expressions and statements

This commit is contained in:
anastasiia.spaseeva
2020-01-10 17:00:43 +03:00
committed by Victor Petukhov
parent 5f4a94a1b3
commit 5986ffae1e
108 changed files with 4221 additions and 26 deletions
@@ -0,0 +1,23 @@
// WITH_RUNTIME
/*
* KOTLIN CODEGEN BOX SPEC TEST (POSITIVE)
*
* SPEC VERSION: 0.1-253
* PLACE: statements, loop-statements, do-while-loop-statement -> paragraph 1 -> sentence 3
* RELEVANT PLACES: statements, loop-statements, do-while-loop-statement -> paragraph 2 -> sentence 1
* statements, loop-statements, do-while-loop-statement -> paragraph 1 -> sentence 2
* NUMBER: 1
* DESCRIPTION: do-while-loop-statement evaluates the loop condition expression after evaluating the loop body.
*/
fun box(): String {
var x = 1;
do {
x++
} while (false)
if (x == 2)
return "OK"
return "NOK"
}
@@ -0,0 +1,23 @@
// WITH_RUNTIME
/*
* KOTLIN CODEGEN BOX SPEC TEST (POSITIVE)
*
* SPEC VERSION: 0.1-253
* PLACE: statements, loop-statements, do-while-loop-statement -> paragraph 1 -> sentence 3
* RELEVANT PLACES: statements, loop-statements, do-while-loop-statement -> paragraph 2 -> sentence 1
* statements, loop-statements, do-while-loop-statement -> paragraph 1 -> sentence 2
* NUMBER: 2
* DESCRIPTION: do-while-loop-statement evaluates the loop condition expression after evaluating the loop body.
*/
fun box(): String {
var x = 1;
do {
x++
} while (x < 2)
if (x == 2)
return "OK"
return "NOK"
}
@@ -0,0 +1,40 @@
{
"1": {
"pos": {
"3": [
{
"specVersion": "0.1-253",
"casesNumber": 0,
"description": "do-while-loop-statement evaluates the loop condition expression after evaluating the loop body.",
"unexpectedBehaviour": false
},
{
"specVersion": "0.1-253",
"casesNumber": 0,
"description": "do-while-loop-statement evaluates the loop condition expression after evaluating the loop body.",
"unexpectedBehaviour": false
}
]
}
},
"2": {
"pos": {
"1": [
{
"specVersion": "0.1-253",
"casesNumber": 0,
"description": "do-while-loop-statement evaluates the loop condition expression after evaluating the loop body.",
"path": "compiler/tests-spec/testData/codegen/box/linked/statements/loop-statements/do-while-loop-statement/p-1/pos/3.1.kt",
"unexpectedBehaviour": false
},
{
"specVersion": "0.1-253",
"casesNumber": 0,
"description": "do-while-loop-statement evaluates the loop condition expression after evaluating the loop body.",
"path": "compiler/tests-spec/testData/codegen/box/linked/statements/loop-statements/do-while-loop-statement/p-1/pos/3.2.kt",
"unexpectedBehaviour": false
}
]
}
}
}
@@ -0,0 +1,23 @@
// WITH_RUNTIME
/*
* KOTLIN CODEGEN BOX SPEC TEST (POSITIVE)
*
* SPEC VERSION: 0.1-253
* PLACE: statements, loop-statements, while-loop-statement -> paragraph 1 -> sentence 2
* RELEVANT PLACES: statements, loop-statements, while-loop-statement -> paragraph 2 -> sentence 1
* NUMBER: 1
* DESCRIPTION: while-loop-statement evaluates the loop condition expression before evaluating the loop body.
*/
fun box(): String {
var x = 1;
var cond = true
while (cond) {
x++
if (x == 5) cond = false
}
if (x == 5)
return "OK"
return "NOK"
}
@@ -0,0 +1,23 @@
// WITH_RUNTIME
/*
* KOTLIN CODEGEN BOX SPEC TEST (POSITIVE)
*
* SPEC VERSION: 0.1-253
* PLACE: statements, loop-statements, while-loop-statement -> paragraph 1 -> sentence 2
* RELEVANT PLACES: statements, loop-statements, while-loop-statement -> paragraph 2 -> sentence 1
* NUMBER: 2
* DESCRIPTION: while-loop-statement evaluates the loop condition expression before evaluating the loop body.
*/
fun box(): String {
var x = 1;
var cond = true
while (cond) {
x++
cond = false
}
if (x == 2)
return "OK"
return "NOK"
}
@@ -0,0 +1,40 @@
{
"1": {
"pos": {
"2": [
{
"specVersion": "0.1-253",
"casesNumber": 0,
"description": "while-loop-statement evaluates the loop condition expression before evaluating the loop body.",
"unexpectedBehaviour": false
},
{
"specVersion": "0.1-253",
"casesNumber": 0,
"description": "while-loop-statement evaluates the loop condition expression before evaluating the loop body.",
"unexpectedBehaviour": false
}
]
}
},
"2": {
"pos": {
"1": [
{
"specVersion": "0.1-253",
"casesNumber": 0,
"description": "while-loop-statement evaluates the loop condition expression before evaluating the loop body.",
"path": "compiler/tests-spec/testData/codegen/box/linked/statements/loop-statements/while-loop-statement/p-1/pos/2.1.kt",
"unexpectedBehaviour": false
},
{
"specVersion": "0.1-253",
"casesNumber": 0,
"description": "while-loop-statement evaluates the loop condition expression before evaluating the loop body.",
"path": "compiler/tests-spec/testData/codegen/box/linked/statements/loop-statements/while-loop-statement/p-1/pos/2.2.kt",
"unexpectedBehaviour": false
}
]
}
}
}