From 0bed934495c4f3a7eefc0433fddc1bc29b6d33c7 Mon Sep 17 00:00:00 2001
From: Viktor Kuncak <viktor.kuncak@epfl.ch>
Date: Wed, 19 Aug 2015 15:05:52 +0200
Subject: [PATCH] Added List.fill to the library. Script to run regressions

---
 library/collection/List.scala | 6 ++++++
 scripts/sbt-test-regression   | 2 ++
 2 files changed, 8 insertions(+)
 create mode 100755 scripts/sbt-test-regression

diff --git a/library/collection/List.scala b/library/collection/List.scala
index 4462aca30..be664ba81 100644
--- a/library/collection/List.scala
+++ b/library/collection/List.scala
@@ -503,6 +503,12 @@ object List {
     }
     l.reverse
   }
+
+  def fill[T](n: BigInt)(x: T) : List[T] = {
+    if (n <= 0) Nil[T]
+    else Cons[T](x, fill[T](n-1)(x))
+  } ensuring(res => (res.content == (if (n <= BigInt(0)) Set.empty[T] else Set(x))) &&
+                    res.size == (if (n <= BigInt(0)) BigInt(0) else n))
 }
 
 @library
diff --git a/scripts/sbt-test-regression b/scripts/sbt-test-regression
new file mode 100755
index 000000000..7606e7a37
--- /dev/null
+++ b/scripts/sbt-test-regression
@@ -0,0 +1,2 @@
+sbt test integration:test regression:test 2>&1 | tee regression.log
+
-- 
GitLab