Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cleanup #7

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cleanem.sh
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@

rm -rf allMethodTestsInOneFile allTestsInOneFile assertTestsInOneFile dataTables tenTestsPerFile testsIn100Files allClassTestsInOneFile scalautilsScalaz shapelessTables
rm -rf allMethodTestsInOneFile allTestsInOneFile assertTestsInOneFile dataTables tenTestsPerFile testsIn100Files scalautilsScalaz #allClassTestsInOneFile
54 changes: 28 additions & 26 deletions dataTables.scala
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,13 @@ def generateSourceFile(testCount: Int, targetDir: File): File = {
val targetOut = new BufferedWriter(new FileWriter(targetFile))

try {
targetOut.write("package WordSpecMust\n\n")
targetOut.write("package WordSpec\n\n")

targetOut.write("import org.scalatest._\n")
targetOut.write("import Matchers._\n")
targetOut.write("import prop.TableDrivenPropertyChecks._\n\n")

targetOut.write("class ExampleSpec extends WordSpec with Matchers {\n\n")
targetOut.write("class ExampleSpec extends WordSpec {\n\n")

targetOut.write(" \"Scala\" can {\n")
targetOut.write(" \"increment integers\" in {\n\n")
Expand Down Expand Up @@ -108,10 +109,11 @@ def generateShapelessSourceFile(testCount: Int, targetDir: File): File = {
targetOut.write("package shapelessTables\n\n")

targetOut.write("import org.scalatest._\n")
targetOut.write("import Matchers._\n")
targetOut.write("import shapeless.TableChecker._\n")
targetOut.write("import shapelessTable._\n\n")

targetOut.write("class ExampleSpec extends WordSpec with Matchers {\n\n")
targetOut.write("class ExampleSpec extends WordSpec {\n\n")

targetOut.write(" \"Scala\" can {\n")
targetOut.write(" \"increment integers\" in {\n\n")
Expand Down Expand Up @@ -288,7 +290,7 @@ if (scalaVersion != "unknown") {
deleteDir(baseDir)

val shapelessTableJar = new File("shapeless-table.jar")
if (!shapelessTableJar.exists) {
if (!shapelessTableJar.exists || shapelessTableJar.lastModified < new File("ShapelessTable.scala").lastModified) {
val shapelessTableSource = new File("ShapelessTable.scala")
val shapelessTableClassDir = new File(baseDir, "shapeless-table")
shapelessTableClassDir.mkdirs()
Expand All @@ -307,7 +309,7 @@ if (scalaVersion != "unknown") {

val specs2Classpath = specs2Jar.getName + File.pathSeparator + specs2ScalazJar.getName

val shapelessClasspath = scalatestJar.getName + File.pathSeparator + shapelessJar.getName + File.pathSeparator + shapelessTableJar.getName
val shapelessClasspath = scalaTestClasspath + File.pathSeparator + shapelessJar.getName + File.pathSeparator + shapelessTableJar.getName

val baseOutputDir = new File(baseDir, "output")
baseOutputDir.mkdirs()
Expand Down Expand Up @@ -356,12 +358,12 @@ if (scalaVersion != "unknown") {
val outputDir = getOutputDir(baseOutputDir, testCount)
val generatedDir = new File(baseGeneratedDir, "generated-" + testCount)

val generatedSrc = generateSourceFile(testCount, new File(generatedDir, "WordSpecMust"))
val generatedSrc = generateSourceFile(testCount, new File(generatedDir, "WordSpec"))
val duration = compile(generatedSrc.getAbsolutePath, scalaTestClasspath, outputDir.getAbsolutePath)
durationFile.write("," + duration)
durationFile.flush()

val (fileCount, fileSize) = getFileAndByteCount(new File(outputDir, "WordSpecMust"))
val (fileCount, fileSize) = getFileAndByteCount(new File(outputDir, "WordSpec"))
fileCountFile.write("," + fileCount)
fileCountFile.flush()
fileSizeFile.write("," + fileSize)
Expand All @@ -381,33 +383,34 @@ if (scalaVersion != "unknown") {
fileSizeFile.flush()
}

// Specs2 mutable
durationFile.write("specs2.mutable.Specification")
// Shapeless Table
durationFile.write("shapeless")
durationFile.flush()
fileCountFile.write("specs2.mutable.Specification")
fileCountFile.write("shapeless")
fileCountFile.flush()
fileSizeFile.write("specs2.mutable.Specification")
fileSizeFile.write("shapeless")
fileSizeFile.flush()

try {
testCounts.foreach { testCount =>
println("Working on specs2.mutable.Specification test count " + testCount + "...")
println("Working on Shapeless test count " + testCount + "...")
val outputDir = getOutputDir(baseOutputDir, testCount)
val generatedDir = new File(baseGeneratedDir, "generated-" + testCount)

val generatedSrc = generateSpecs2Mutable(testCount, new File(generatedDir, "mSpecification"))
val duration = compile(generatedSrc.getAbsolutePath, specs2Classpath, outputDir.getAbsolutePath)
val generatedSrc = generateShapelessSourceFile(testCount, new File(generatedDir, "shapelessTables"))
val duration = compile(generatedSrc.getAbsolutePath, shapelessClasspath, outputDir.getAbsolutePath)
durationFile.write("," + duration)
durationFile.flush()

val (fileCount, fileSize) = getFileAndByteCount(new File(outputDir, "mSpecification"))
val (fileCount, fileSize) = getFileAndByteCount(new File(outputDir, "shapelessTables"))
fileCountFile.write("," + fileCount)
fileCountFile.flush()
fileSizeFile.write("," + fileSize)
fileSizeFile.flush()
}
}
catch {
case e: Throwable =>
case e: Throwable =>
e.printStackTrace()
}
finally {
Expand All @@ -419,34 +422,33 @@ if (scalaVersion != "unknown") {
fileSizeFile.flush()
}

// Shapeless Table
durationFile.write("shapeless")
// Specs2 mutable
durationFile.write("specs2.mutable.Specification")
durationFile.flush()
fileCountFile.write("shapeless")
fileCountFile.write("specs2.mutable.Specification")
fileCountFile.flush()
fileSizeFile.write("shapeless")
fileSizeFile.write("specs2.mutable.Specification")
fileSizeFile.flush()

try {
testCounts.foreach { testCount =>
println("Working on Shapeless test count " + testCount + "...")
println("Working on specs2.mutable.Specification test count " + testCount + "...")
val outputDir = getOutputDir(baseOutputDir, testCount)
val generatedDir = new File(baseGeneratedDir, "generated-" + testCount)

val generatedSrc = generateShapelessSourceFile(testCount, new File(generatedDir, "shapelessTables"))
val duration = compile(generatedSrc.getAbsolutePath, shapelessClasspath, outputDir.getAbsolutePath)
val generatedSrc = generateSpecs2Mutable(testCount, new File(generatedDir, "mSpecification"))
val duration = compile(generatedSrc.getAbsolutePath, specs2Classpath, outputDir.getAbsolutePath)
durationFile.write("," + duration)
durationFile.flush()

val (fileCount, fileSize) = getFileAndByteCount(new File(outputDir, "shapelessTables"))
val (fileCount, fileSize) = getFileAndByteCount(new File(outputDir, "mSpecification"))
fileCountFile.write("," + fileCount)
fileCountFile.flush()
fileSizeFile.write("," + fileSize)
fileSizeFile.flush()
}
}
catch {
case e: Throwable =>
case e: Throwable =>
e.printStackTrace()
}
finally {
Expand Down
3 changes: 1 addition & 2 deletions runem.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ scala testsIn100Files.scala
scala dataTables.scala
scala allMethodTestsInOneFile.scala
scala assertTestsInOneFile.scala
scala allClassTestsInOneFile.scala
//scala allClassTestsInOneFile.scala
scala scalautilsScalaz.scala
scala shapelessTables.scala
scala google-chart.scala
Loading