-
Notifications
You must be signed in to change notification settings - Fork 347
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c2c6bb3
commit b2079a3
Showing
6 changed files
with
75 additions
and
78 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
quill-core/src/main/scala/io/getquill/norm/TriviallyCheckable.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
51 changes: 51 additions & 0 deletions
51
quill-core/src/test/scala/io/getquill/norm/TriviallyCheckableSpec.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
package io.getquill.norm | ||
|
||
import io.getquill.Spec | ||
import io.getquill.ast.Implicits._ | ||
import io.getquill.ast.{ Ast, Constant, Ident } | ||
|
||
class TriviallyCheckableSpec extends Spec { | ||
|
||
def ua(ast: Ast) = TriviallyCheckable.unapply(ast) | ||
val other = Ident("something") | ||
|
||
val True = Constant(true) | ||
val False = Constant(false) | ||
|
||
"const/const" - { | ||
"const == const => true" in { ua(Constant(123) +==+ Constant(123)) mustEqual Some(True) } | ||
"const == const => false" in { ua(Constant(123) +==+ Constant(456)) mustEqual Some(False) } | ||
"const != const => true" in { ua(Constant(123) +!=+ Constant(123)) mustEqual Some(False) } | ||
"const != const => false" in { ua(Constant(123) +!=+ Constant(456)) mustEqual Some(True) } | ||
|
||
"const == other => true" in { ua(Constant(123) +==+ other) mustEqual None } | ||
"const != other => true" in { ua(Constant(123) +!=+ other) mustEqual None } | ||
"other == const => true" in { ua(other +==+ Constant(123)) mustEqual None } | ||
"other != const => true" in { ua(other +!=+ Constant(123)) mustEqual None } | ||
() | ||
} | ||
|
||
"exp/exp" - { | ||
"true || true => true" in { ua(True +||+ True) mustEqual Some(True) } | ||
"true || false => false" in { ua(True +||+ False) mustEqual Some(True) } | ||
"const || const => false" in { ua(False +||+ True) mustEqual Some(True) } | ||
"true && true => true" in { ua(True +&&+ True) mustEqual Some(True) } | ||
"true && false => false" in { ua(True +&&+ False) mustEqual Some(False) } | ||
"false && true => false" in { ua(False +&&+ True) mustEqual Some(False) } | ||
|
||
"false && other => false" in { ua(False +&&+ other) mustEqual Some(False) } | ||
"other && false => false" in { ua(other +&&+ False) mustEqual Some(False) } | ||
"true && const => none" in { ua(True +&&+ other) mustEqual None } | ||
"other && true => none" in { ua(other +&&+ True) mustEqual None } | ||
"other && other => none" in { ua(other +&&+ other) mustEqual None } | ||
|
||
"true || other => true" in { ua(True +||+ other) mustEqual Some(True) } | ||
"other || true => true" in { ua(other +||+ True) mustEqual Some(True) } | ||
"false || other => none" in { ua(False +||+ other) mustEqual None } | ||
"other || false => none" in { ua(other +||+ False) mustEqual None } | ||
"other || other => none" in { ua(other +||+ other) mustEqual None } | ||
() | ||
} | ||
|
||
// TODO Finish testing | ||
} |
50 changes: 0 additions & 50 deletions
50
quill-core/src/test/scala/io/getquill/norm/capture/TriviallyCheckableSpec.scala
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters