nitsaf: add tests
authorAlexandre Terrasa <alexandre@moz-code.org>
Fri, 16 Oct 2015 23:20:18 +0000 (19:20 -0400)
committerAlexandre Terrasa <alexandre@moz-code.org>
Sat, 19 Dec 2015 08:40:58 +0000 (03:40 -0500)
Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

tests/nitsaf.args [new file with mode: 0644]
tests/sav/nitsaf.res [new file with mode: 0644]
tests/sav/nitsaf_args1.res [new file with mode: 0644]
tests/sav/nitsaf_args2.res [new file with mode: 0644]
tests/test_saf/simple1.nit [new file with mode: 0644]
tests/test_saf/simple2.nit [new file with mode: 0644]

diff --git a/tests/nitsaf.args b/tests/nitsaf.args
new file mode 100644 (file)
index 0000000..457c2de
--- /dev/null
@@ -0,0 +1,2 @@
+--analysis reaching-defs test_saf/simple1.nit
+--analysis reaching-defs test_saf/simple2.nit
diff --git a/tests/sav/nitsaf.res b/tests/sav/nitsaf.res
new file mode 100644 (file)
index 0000000..fd8dbb5
--- /dev/null
@@ -0,0 +1,2 @@
+Usage: [OPTION]... <file.nit>...
+Use --help for help
diff --git a/tests/sav/nitsaf_args1.res b/tests/sav/nitsaf_args1.res
new file mode 100644 (file)
index 0000000..434717a
--- /dev/null
@@ -0,0 +1,37 @@
+15: {x: 15} out of AListExprs
+15: {x: 15} out of ACallExpr
+15: {x: 15} out of AVardeclExpr
+16: {x: 15} out of TKwvar
+16: {x: 15} out of TId
+16: {x: 15} out of TAssign
+16: {x: 15} out of AImplicitSelfExpr
+16: {x: 15} out of TId
+16: {x: 15} out of AQid
+16: {x: 15} out of AListExprs
+16: {x: 15} out of ACallExpr
+16: {x: 15} out of TId
+16: {x: 15} out of AQid
+16: {x: 15}, {y: 16} out of AListExprs
+16: {x: 15}, {y: 16} out of ACallExpr
+16: {x: 15}, {y: 16} out of AVardeclExpr
+17: {x: 15}, {y: 16} out of TKwvar
+17: {x: 15}, {y: 16} out of TId
+17: {x: 15}, {y: 16} out of TAssign
+17: {x: 15}, {y: 16} out of TId
+17: {x: 15}, {y: 16} out of AVarExpr
+17: {x: 15}, {y: 16} out of TPlus
+17: {x: 15}, {y: 16}, {z: 17} out of TId
+17: {x: 15}, {y: 16}, {z: 17} out of AVarExpr
+17: {x: 15}, {y: 16}, {z: 17} out of APlusExpr
+17: {x: 15}, {y: 16}, {z: 17} out of AVardeclExpr
+18: {x: 15}, {y: 16}, {z: 17} out of AImplicitSelfExpr
+18: {x: 15}, {y: 16}, {z: 17} out of TId
+18: {x: 15}, {y: 16}, {z: 17} out of AQid
+18: {x: 15}, {y: 16}, {z: 17} out of TId
+18: {x: 15}, {y: 16}, {z: 17} out of AVarExpr
+18: {x: 15}, {y: 16}, {z: 17} out of AListExprs
+18: {x: 15}, {y: 16}, {z: 17} out of ACallExpr
+18: {x: 15}, {y: 16}, {z: 17} out of ABlockExpr
+18: {x: 15}, {y: 16}, {z: 17} out of AMainMethPropdef
+18: {x: 15}, {y: 16}, {z: 17} out of AMainClassdef
+18: {x: 15}, {y: 16}, {z: 17} out of AModule
diff --git a/tests/sav/nitsaf_args2.res b/tests/sav/nitsaf_args2.res
new file mode 100644 (file)
index 0000000..a3b56e5
--- /dev/null
@@ -0,0 +1,42 @@
+15: {x: 15} out of AListExprs
+15: {x: 15} out of ACallExpr
+15: {x: 15} out of AVardeclExpr
+16: {x: 15} out of TId
+16: {x: 15} out of TAssign
+16: {x: 15} out of AImplicitSelfExpr
+16: {x: 15} out of TId
+16: {x: 15} out of AQid
+16: {x: 15} out of AListExprs
+16: {x: 15} out of ACallExpr
+16: {x: 15} out of TId
+16: {x: 15} out of AQid
+16: {x: 16} out of AListExprs
+16: {x: 16} out of ACallExpr
+16: {x: 16} out of AVarAssignExpr
+17: {x: 16} out of TKwvar
+17: {x: 16} out of TId
+17: {x: 16} out of TAssign
+17: {x: 16} out of TId
+17: {x: 16} out of AVarExpr
+17: {x: 16} out of TPlus
+17: {x: 16}, {y: 17} out of TId
+17: {x: 16}, {y: 17} out of AVarExpr
+17: {x: 16}, {y: 17} out of APlusExpr
+17: {x: 16}, {y: 17} out of AVardeclExpr
+18: {x: 16}, {y: 17} out of TId
+18: {x: 16}, {y: 17} out of TPluseq
+18: {x: 16}, {y: 17} out of APlusAssignOp
+18: {x: 18}, {y: 17} out of TId
+18: {x: 18}, {y: 17} out of AVarExpr
+18: {x: 18}, {y: 17} out of AVarReassignExpr
+19: {x: 18}, {y: 17} out of AImplicitSelfExpr
+19: {x: 18}, {y: 17} out of TId
+19: {x: 18}, {y: 17} out of AQid
+19: {x: 18}, {y: 17} out of TId
+19: {x: 18}, {y: 17} out of AVarExpr
+19: {x: 18}, {y: 17} out of AListExprs
+19: {x: 18}, {y: 17} out of ACallExpr
+19: {x: 18}, {y: 17} out of ABlockExpr
+19: {x: 18}, {y: 17} out of AMainMethPropdef
+19: {x: 18}, {y: 17} out of AMainClassdef
+19: {x: 18}, {y: 17} out of AModule
diff --git a/tests/test_saf/simple1.nit b/tests/test_saf/simple1.nit
new file mode 100644 (file)
index 0000000..1941e61
--- /dev/null
@@ -0,0 +1,18 @@
+# This file is part of NIT ( http://www.nitlanguage.org ).
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+var x = gets.to_i
+var y = gets.to_i
+var z = x + y
+print z
diff --git a/tests/test_saf/simple2.nit b/tests/test_saf/simple2.nit
new file mode 100644 (file)
index 0000000..1dcd7a8
--- /dev/null
@@ -0,0 +1,19 @@
+# This file is part of NIT ( http://www.nitlanguage.org ).
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+var x = gets.to_i
+x = gets.to_i
+var y = x + x
+x += y
+print x