summaryrefslogtreecommitdiff
path: root/test/files/pos/scan.scala
diff options
context:
space:
mode:
Diffstat (limited to 'test/files/pos/scan.scala')
-rw-r--r--test/files/pos/scan.scala18
1 files changed, 18 insertions, 0 deletions
diff --git a/test/files/pos/scan.scala b/test/files/pos/scan.scala
new file mode 100644
index 0000000000..98361b9167
--- /dev/null
+++ b/test/files/pos/scan.scala
@@ -0,0 +1,18 @@
+
+
+
+
+object Test {
+
+ def main(args: Array[String]) {
+ val lst = List(1, 2, 3, 4, 5)
+
+ assert(lst.scanLeft(0)(_ + _) == List(0, 1, 3, 6, 10, 15))
+ assert(lst.scanRight(0)(_ + _) == List(0, 5, 9, 12, 14, 15))
+
+ val emp = List[Int]()
+ assert(emp.scanLeft(0)(_ + _) == List(0))
+ assert(emp.scanRight(0)(_ + _) == List(0))
+ }
+
+} \ No newline at end of file