Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

fixed test

  • Loading branch information...
commit b6ad83f218e238d262d3ac57eea643324fcd3af2 1 parent d42a208
@eed3si9n eed3si9n authored
View
6 util/src/main/scala/tonedef/util/Note.java
@@ -11,7 +11,11 @@ public Note(List<Integer> a_tones, int a_duration) {
}
public String toString() {
- String toneString = tones.toString();
+ String toneString = "Tones(";
+ for (int tone: tones) {
+ toneString += tone + ",";
+ }
+ toneString += ")";
return String.format("Note(%s, %d)", toneString, duration);
}
}
View
1  util/src/main/scala/tonedef/util/Parser.scala
@@ -2,7 +2,6 @@ package tonedef.util
import net.liftweb.json.JsonAST._
import scala.collection.mutable
-import javax.swing.JList
class Parser {
def parse(s: String): Music = {
View
15 util/src/test/scala/PatcherSpec.scala
@@ -1,5 +1,5 @@
-import org.specs2.mutable._
import net.liftweb.json.JsonAST._
+import org.specs2.mutable._
import tonedef.util.{Parser, Patcher, Note}
import scala.collection.mutable.{Map => MMap}
import scala.collection.JavaConversions._
@@ -15,8 +15,7 @@ class PatcherSpec extends Specification {
val track0 = music.tracks.get("0")
track0.notes.size must_== 2
val notes: MMap[String, Note] = track0.notes
- // notes.toString must_== "Map(1 -> Note(0, 1), 0 -> Note(3, 3))"
- 1 must_== 1
+ notes.toString must_== "Map(1 -> Note(Tones(0,), 1), 0 -> Note(Tones(3,), 3))"
}
}
@@ -27,7 +26,7 @@ class PatcherSpec extends Specification {
val after = patcher patch(original, diff)
val s = compact(render(after))
s must =~ (""".*5.*""")
- s must not =~ (""".*"1":{"tone".*""")
+ s must not =~ (""".*"1":{"tones".*""")
}
}
@@ -39,7 +38,7 @@ class PatcherSpec extends Specification {
("notes" ->
("1" -> JNull) ~
("5" ->
- ("tone" -> 4)
+ ("tones" -> JArray(List(JInt(4))))
)
) // notes
) // "0"
@@ -57,10 +56,10 @@ class PatcherSpec extends Specification {
("instrument" -> "piano") ~
("notes" ->
("1" ->
- ("tone" -> 0)
+ ("tones" -> JArray(List(JInt(0))))
) ~ // note at 1
("0" ->
- ("tone" -> 3) ~
+ ("tones" -> JArray(List(JInt(3)))) ~
("duration" -> 3)
) // note at 0
) // notes
@@ -68,4 +67,4 @@ class PatcherSpec extends Specification {
) // tracks
) // music
}
-}
+}
Please sign in to comment.
Something went wrong with that request. Please try again.