This file contains hidden or 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
| package booleanlogictests | |
| import booleanlogic.Conditional.if1 | |
| import booleanlogic.Boolean | |
| import booleanlogic.false1 | |
| import booleanlogic.true1 | |
| import org.junit.Test | |
| import scala.collection.mutable.MutableList | |
| class BooleanTest { |
This file contains hidden or 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
| package booleanlogic | |
| sealed abstract class Boolean { | |
| def ifTrue[T](doWhenTrue: => T): Option[T] | |
| def &&(other: => Boolean): Boolean | |
| def &(other: Boolean): Boolean | |
This file contains hidden or 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
| import booleanlogic.Boolean | |
| import booleanlogic.false1 | |
| import booleanlogic.true1 | |
| import org.junit.Test | |
| class BooleanTest { | |
| @Test def `equality`() { | |
| assert(true1 == true1 ) | |
| assert(true1 != false1) |
This file contains hidden or 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
| package booleanlogic | |
| sealed abstract class Boolean { | |
| def &(other: Boolean): Boolean | |
| def |(other: Boolean): Boolean | |
| def ^(other: Boolean): Boolean | |
| def unary_! : Boolean |
This file contains hidden or 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
| ... | |
| @Test def `shortcut or`() { | |
| assert((true1 || true1) == true1 ) | |
| assert((true1 || false1) == true1 ) | |
| assert((false1 || true1) == true1 ) | |
| assert((false1 || false1) == false1) | |
| } | |
| @Test def `simple or left side true`() { | |
| var evaluated = "not evaluated" |
This file contains hidden or 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
| sealed abstract class Boolean { | |
| ... | |
| def &&(other: => Boolean): Boolean | |
| def ||(other: => Boolean): Boolean | |
| ... | |
| } | |
| case object true1 extends Boolean { | |
| ... |
This file contains hidden or 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
| sealed abstract class Boolean { | |
| ... | |
| def ifTrue[T](doWhenTrue: => T): Option[T] | |
| ... | |
| } | |
| case object true1 extends Boolean { | |
| ... | |
| override def ifTrue[T](doWhenTrue: => T): Option[T] = Some(doWhenTrue) | |
| ... |
This file contains hidden or 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
| @Test def `if else if true`() { | |
| val result = if1 (true1) { | |
| "trueresult" | |
| } else1 { | |
| throw new IllegalStateException | |
| } | |
| assert(result == "trueresult") | |
| } |
This file contains hidden or 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
| package object sandbox { | |
| type ?[A] = Option[A] | |
| // val a: ?[Int] = 1 Some(1): ?[Int] | |
| implicit def instanceToOption[A](instance: A): ?[A] = Option(instance) | |
| def Some[A](instance: A): ?[A] = Option(instance) | |
| // val a: ?[List[Int]] = None None: ?[List[Int]] | |
| // val b = a(_.sum) None: ?[Int] |
This file contains hidden or 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
| import com.github.tomakehurst.wiremock.WireMockServer; | |
| import org.apache.http.client.CookieStore; | |
| import org.apache.http.client.HttpClient; | |
| import org.apache.http.client.methods.HttpHead; | |
| import org.apache.http.client.params.HttpClientParams; | |
| import org.apache.http.cookie.Cookie; | |
| import org.apache.http.impl.client.DefaultHttpClient; | |
| import org.apache.http.impl.conn.PoolingClientConnectionManager; | |
| import org.apache.http.params.BasicHttpParams; |
OlderNewer