From 7538f08da87d9f5219c55be243e8263ba5586a58 Mon Sep 17 00:00:00 2001 From: Yuki Ishikawa Date: Mon, 30 Apr 2018 15:29:44 +0900 Subject: [PATCH 1/3] Improve NumericTypesSpec --- .../refined/types/NumericTypesSpec.scala | 263 +++++++++++++++++- 1 file changed, 259 insertions(+), 4 deletions(-) diff --git a/modules/core/shared/src/test/scala/eu/timepit/refined/types/NumericTypesSpec.scala b/modules/core/shared/src/test/scala/eu/timepit/refined/types/NumericTypesSpec.scala index 0603ab3ca..6d089b748 100644 --- a/modules/core/shared/src/test/scala/eu/timepit/refined/types/NumericTypesSpec.scala +++ b/modules/core/shared/src/test/scala/eu/timepit/refined/types/NumericTypesSpec.scala @@ -11,8 +11,8 @@ class NumericTypesSpec extends Properties("NumericTypes") { PosInt.from(1).isRight } - property("PosInt.from(-1)") = secure { - PosInt.from(-1) ?= Left("Predicate failed: (-1 > 0).") + property("PosInt.from(0)") = secure { + PosInt.from(0) ?= Left("Predicate failed: (0 > 0).") } property("PosInt.unapply(1)") = secure { @@ -24,67 +24,322 @@ class NumericTypesSpec extends Properties("NumericTypes") { PosInt.unsafeFrom(1) } - property("PosInt.unsafeFrom(-1)") = secure { - throws(classOf[IllegalArgumentException])(PosInt.unsafeFrom(-1)) + property("PosInt.unsafeFrom(0)") = secure { + throws(classOf[IllegalArgumentException])(PosInt.unsafeFrom(0)) } property("NonNegInt.from(0)") = secure { NonNegInt.from(0).isRight } + property("NonNegInt.from(-1)") = secure { + NonNegInt.from(-1) ?= Left("Predicate (-1 < 0) did not fail.") + } + + property("NonNegInt.unapply(0)") = secure { + val NonNegInt(x) = 0 + x ?= NonNegInt.unsafeFrom(0) + } + + property("NonNegInt.unsafeFrom(0)") = wellTyped { + NonNegInt.unsafeFrom(0) + } + + property("NonNegInt.unsafeFrom(-1)") = secure { + throws(classOf[IllegalArgumentException])(NonNegInt.unsafeFrom(-1)) + } + property("NegInt.from(-1)") = secure { NegInt.from(-1).isRight } + property("NegInt.from(0)") = secure { + NegInt.from(0) ?= Left("Predicate failed: (0 < 0).") + } + + property("NegInt.unapply(-1)") = secure { + val NegInt(x) = -1 + x ?= NegInt.unsafeFrom(-1) + } + + property("NegInt.unsafeFrom(-1)") = wellTyped { + NegInt.unsafeFrom(-1) + } + + property("NegInt.unsafeFrom(0)") = secure { + throws(classOf[IllegalArgumentException])(NegInt.unsafeFrom(0)) + } + property("NonPosInt.from(0)") = secure { NonPosInt.from(0).isRight } + property("NonPosInt.from(1)") = secure { + NonPosInt.from(1) ?= Left("Predicate (1 > 0) did not fail.") + } + + property("NonPosInt.unapply(0)") = secure { + val NonPosInt(x) = 0 + x ?= NonPosInt.unsafeFrom(0) + } + + property("NonPosInt.unsafeFrom(0)") = wellTyped { + NonPosInt.unsafeFrom(0) + } + + property("NonPosInt.unsafeFrom(1)") = secure { + throws(classOf[IllegalArgumentException])(NonPosInt.unsafeFrom(1)) + } + property("PosLong.from(1L)") = secure { PosLong.from(1L).isRight } + property("PosLong.from(0L)") = secure { + PosLong.from(0L) ?= Left("Predicate failed: (0 > 0).") + } + + property("PosLong.unapply(1L)") = secure { + val PosLong(x) = 1L + x ?= PosLong.unsafeFrom(1L) + } + + property("PosLong.unsafeFrom(1L)") = wellTyped { + PosLong.unsafeFrom(1L) + } + + property("PosLong.unsafeFrom(0L)") = secure { + throws(classOf[IllegalArgumentException])(PosLong.unsafeFrom(0L)) + } + property("NonNegLong.from(0L)") = secure { NonNegLong.from(0L).isRight } + property("NonNegLong.from(-1L)") = secure { + NonNegLong.from(-1L) ?= Left("Predicate (-1 < 0) did not fail.") + } + + property("NonNegLong.unapply(0L)") = secure { + val NonNegLong(x) = 0L + x ?= NonNegLong.unsafeFrom(0L) + } + + property("NonNegLong.unsafeFrom(0L)") = wellTyped { + NonNegLong.unsafeFrom(0L) + } + + property("NonNegLong.unsafeFrom(-1L)") = secure { + throws(classOf[IllegalArgumentException])(NonNegLong.unsafeFrom(-1L)) + } + property("NegLong.from(-1L)") = secure { NegLong.from(-1L).isRight } + property("NegLong.from(0L)") = secure { + NegLong.from(0L) ?= Left("Predicate failed: (0 < 0).") + } + + property("NegLong.unapply(-1L)") = secure { + val NegLong(x) = -1L + x ?= NegLong.unsafeFrom(-1L) + } + + property("NegLong.unsafeFrom(-1L)") = wellTyped { + NegLong.unsafeFrom(-1L) + } + + property("NegLong.unsafeFrom(0L)") = secure { + throws(classOf[IllegalArgumentException])(NegLong.unsafeFrom(0L)) + } + property("NonPosLong.from(0L)") = secure { NonPosLong.from(0L).isRight } + property("NonPosLong.from(1L)") = secure { + NonPosLong.from(1L) ?= Left("Predicate (1 > 0) did not fail.") + } + + property("NonPosLong.unapply(0L)") = secure { + val NonPosLong(x) = 0L + x ?= NonPosLong.unsafeFrom(0L) + } + + property("NonPosLong.unsafeFrom(0L)") = wellTyped { + NonPosLong.unsafeFrom(0L) + } + + property("NonPosLong.unsafeFrom(1L)") = secure { + throws(classOf[IllegalArgumentException])(NonPosLong.unsafeFrom(1L)) + } + property("PosFloat.from(0.1F)") = secure { PosFloat.from(0.1F).isRight } + property("PosFloat.from(0.0F)") = secure { + PosFloat.from(0.0F).isLeft + } + + property("PosFloat.unapply(0.1F)") = secure { + val PosFloat(x) = 0.1F + x ?= PosFloat.unsafeFrom(0.1F) + } + + property("PosFloat.unsafeFrom(0.1F)") = wellTyped { + PosFloat.unsafeFrom(0.1F) + } + + property("PosFloat.unsafeFrom(0.0F)") = secure { + throws(classOf[IllegalArgumentException])(PosFloat.unsafeFrom(0.0F)) + } + property("NonNegFloat.from(0.0F)") = secure { NonNegFloat.from(0.0F).isRight } + property("NonNegFloat.from(-0.1F)") = secure { + NonNegFloat.from(-0.1F).isLeft + } + + property("NonNegFloat.unapply(0.0F)") = secure { + val NonNegFloat(x) = 0.0F + x ?= NonNegFloat.unsafeFrom(0.0F) + } + + property("NonNegFloat.unsafeFrom(0.0F)") = wellTyped { + NonNegFloat.unsafeFrom(0.0F) + } + + property("NonNegFloat.unsafeFrom(-0.1F)") = secure { + throws(classOf[IllegalArgumentException])(NonNegFloat.unsafeFrom(-0.1F)) + } + property("NegFloat.from(-0.1F)") = secure { NegFloat.from(-0.1F).isRight } + property("NegFloat.from(0.0F)") = secure { + NegFloat.from(0.0F).isLeft + } + + property("NegFloat.unapply(-0.1F)") = secure { + val NegFloat(x) = -0.1F + x ?= NegFloat.unsafeFrom(-0.1F) + } + + property("NegFloat.unsafeFrom(-0.1F)") = wellTyped { + NegFloat.unsafeFrom(-0.1F) + } + + property("NegFloat.unsafeFrom(0.0F)") = secure { + throws(classOf[IllegalArgumentException])(NegFloat.unsafeFrom(0.0F)) + } + property("NonPosFloat.from(0.0F)") = secure { NonPosFloat.from(0.0F).isRight } + property("NonPosFloat.from(0.1F)") = secure { + NonPosFloat.from(0.1F).isLeft + } + + property("NonPosFloat.unapply(0.0F)") = secure { + val NonPosFloat(x) = 0.0F + x ?= NonPosFloat.unsafeFrom(0.0F) + } + + property("NonPosFloat.unsafeFrom(0.0F)") = wellTyped { + NonPosFloat.unsafeFrom(0.0F) + } + + property("NonPosFloat.unsafeFrom(0.1F)") = secure { + throws(classOf[IllegalArgumentException])(NonPosFloat.unsafeFrom(0.1F)) + } + property("PosDouble.from(0.1)") = secure { PosDouble.from(0.1).isRight } + property("PosDouble.from(0.0)") = secure { + PosDouble.from(0.0).isLeft + } + + property("PosDouble.unapply(0.1)") = secure { + val PosDouble(x) = 0.1 + x ?= PosDouble.unsafeFrom(0.1) + } + + property("PosDouble.unsafeFrom(0.1)") = wellTyped { + PosDouble.unsafeFrom(0.1) + } + + property("PosDouble.unsafeFrom(0.0)") = secure { + throws(classOf[IllegalArgumentException])(PosDouble.unsafeFrom(0.0)) + } + property("NonNegDouble.from(0.0)") = secure { NonNegDouble.from(0.0).isRight } + property("NonNegDouble.from(-0.1)") = secure { + NonNegDouble.from(-0.1).isLeft + } + + property("NonNegDouble.unapply(0.0)") = secure { + val NonNegDouble(x) = 0.0 + x ?= NonNegDouble.unsafeFrom(0.0) + } + + property("NonNegDouble.unsafeFrom(0.0)") = wellTyped { + NonNegDouble.unsafeFrom(0.0) + } + + property("NonNegDouble.unsafeFrom(-0.1)") = secure { + throws(classOf[IllegalArgumentException])(NonNegDouble.unsafeFrom(-0.1)) + } + property("NegDouble.from(-0.1)") = secure { NegDouble.from(-0.1).isRight } + property("NegDouble.from(0.0)") = secure { + NegDouble.from(0.0).isLeft + } + + property("NegDouble.unapply(-0.1)") = secure { + val NegDouble(x) = -0.1 + x ?= NegDouble.unsafeFrom(-0.1) + } + + property("NegDouble.unsafeFrom(-0.1)") = wellTyped { + NegDouble.unsafeFrom(-0.1) + } + + property("NegDouble.unsafeFrom(0.0)") = secure { + throws(classOf[IllegalArgumentException])(NegDouble.unsafeFrom(0.0)) + } + property("NonPosDouble.from(0.0)") = secure { NonPosDouble.from(0.0).isRight } + + property("NonPosDouble.from(0.1)") = secure { + NonPosDouble.from(0.1).isLeft + } + + property("NonPosDouble.unapply(0.0)") = secure { + val NonPosDouble(x) = 0.0 + x ?= NonPosDouble.unsafeFrom(0.0) + } + + property("NonPosDouble.unsafeFrom(0.0)") = wellTyped { + NonPosDouble.unsafeFrom(0.0) + } + + property("NonPosDouble.unsafeFrom(0.1)") = secure { + throws(classOf[IllegalArgumentException])(NonPosDouble.unsafeFrom(0.1)) + } } From 337837563766cadf2a27460f16cc56273f4753a5 Mon Sep 17 00:00:00 2001 From: Yuki Ishikawa Date: Tue, 1 May 2018 11:04:01 +0900 Subject: [PATCH 2/3] Improve CharTypesSpec --- .../scala/eu/timepit/refined/types/CharTypesSpec.scala | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/modules/core/shared/src/test/scala/eu/timepit/refined/types/CharTypesSpec.scala b/modules/core/shared/src/test/scala/eu/timepit/refined/types/CharTypesSpec.scala index c1547fb29..e4ceaa149 100644 --- a/modules/core/shared/src/test/scala/eu/timepit/refined/types/CharTypesSpec.scala +++ b/modules/core/shared/src/test/scala/eu/timepit/refined/types/CharTypesSpec.scala @@ -10,7 +10,15 @@ class CharTypesSpec extends Properties("CharTypes") { LowerCaseChar.from('a').isRight } + property("LowerCaseChar.from('A')") = secure { + LowerCaseChar.from('A') ?= Left("Predicate failed: isLower('A').") + } + property("UpperCaseChar.from('A')") = secure { UpperCaseChar.from('A').isRight } + + property("UpperCaseChar.from('a')") = secure { + UpperCaseChar.from('a') ?= Left("Predicate failed: isUpper('a').") + } } From 1a12e79ab89c7fc69787b960f9d02cef0a3ef682 Mon Sep 17 00:00:00 2001 From: Yuki Ishikawa Date: Fri, 18 May 2018 19:07:02 +0900 Subject: [PATCH 3/3] Remove tests for unsafeFrom and unapply in NumericTypesSpec --- .../refined/types/NumericTypesSpec.scala | 209 ------------------ 1 file changed, 209 deletions(-) diff --git a/modules/core/shared/src/test/scala/eu/timepit/refined/types/NumericTypesSpec.scala b/modules/core/shared/src/test/scala/eu/timepit/refined/types/NumericTypesSpec.scala index 6d089b748..d1d97a536 100644 --- a/modules/core/shared/src/test/scala/eu/timepit/refined/types/NumericTypesSpec.scala +++ b/modules/core/shared/src/test/scala/eu/timepit/refined/types/NumericTypesSpec.scala @@ -1,6 +1,5 @@ package eu.timepit.refined.types -import eu.timepit.refined.TestUtils.wellTyped import eu.timepit.refined.types.all._ import org.scalacheck.Prop._ import org.scalacheck.Properties @@ -15,19 +14,6 @@ class NumericTypesSpec extends Properties("NumericTypes") { PosInt.from(0) ?= Left("Predicate failed: (0 > 0).") } - property("PosInt.unapply(1)") = secure { - val PosInt(x) = 1 - x ?= PosInt.unsafeFrom(1) - } - - property("PosInt.unsafeFrom(1)") = wellTyped { - PosInt.unsafeFrom(1) - } - - property("PosInt.unsafeFrom(0)") = secure { - throws(classOf[IllegalArgumentException])(PosInt.unsafeFrom(0)) - } - property("NonNegInt.from(0)") = secure { NonNegInt.from(0).isRight } @@ -36,19 +22,6 @@ class NumericTypesSpec extends Properties("NumericTypes") { NonNegInt.from(-1) ?= Left("Predicate (-1 < 0) did not fail.") } - property("NonNegInt.unapply(0)") = secure { - val NonNegInt(x) = 0 - x ?= NonNegInt.unsafeFrom(0) - } - - property("NonNegInt.unsafeFrom(0)") = wellTyped { - NonNegInt.unsafeFrom(0) - } - - property("NonNegInt.unsafeFrom(-1)") = secure { - throws(classOf[IllegalArgumentException])(NonNegInt.unsafeFrom(-1)) - } - property("NegInt.from(-1)") = secure { NegInt.from(-1).isRight } @@ -57,19 +30,6 @@ class NumericTypesSpec extends Properties("NumericTypes") { NegInt.from(0) ?= Left("Predicate failed: (0 < 0).") } - property("NegInt.unapply(-1)") = secure { - val NegInt(x) = -1 - x ?= NegInt.unsafeFrom(-1) - } - - property("NegInt.unsafeFrom(-1)") = wellTyped { - NegInt.unsafeFrom(-1) - } - - property("NegInt.unsafeFrom(0)") = secure { - throws(classOf[IllegalArgumentException])(NegInt.unsafeFrom(0)) - } - property("NonPosInt.from(0)") = secure { NonPosInt.from(0).isRight } @@ -78,19 +38,6 @@ class NumericTypesSpec extends Properties("NumericTypes") { NonPosInt.from(1) ?= Left("Predicate (1 > 0) did not fail.") } - property("NonPosInt.unapply(0)") = secure { - val NonPosInt(x) = 0 - x ?= NonPosInt.unsafeFrom(0) - } - - property("NonPosInt.unsafeFrom(0)") = wellTyped { - NonPosInt.unsafeFrom(0) - } - - property("NonPosInt.unsafeFrom(1)") = secure { - throws(classOf[IllegalArgumentException])(NonPosInt.unsafeFrom(1)) - } - property("PosLong.from(1L)") = secure { PosLong.from(1L).isRight } @@ -99,19 +46,6 @@ class NumericTypesSpec extends Properties("NumericTypes") { PosLong.from(0L) ?= Left("Predicate failed: (0 > 0).") } - property("PosLong.unapply(1L)") = secure { - val PosLong(x) = 1L - x ?= PosLong.unsafeFrom(1L) - } - - property("PosLong.unsafeFrom(1L)") = wellTyped { - PosLong.unsafeFrom(1L) - } - - property("PosLong.unsafeFrom(0L)") = secure { - throws(classOf[IllegalArgumentException])(PosLong.unsafeFrom(0L)) - } - property("NonNegLong.from(0L)") = secure { NonNegLong.from(0L).isRight } @@ -120,19 +54,6 @@ class NumericTypesSpec extends Properties("NumericTypes") { NonNegLong.from(-1L) ?= Left("Predicate (-1 < 0) did not fail.") } - property("NonNegLong.unapply(0L)") = secure { - val NonNegLong(x) = 0L - x ?= NonNegLong.unsafeFrom(0L) - } - - property("NonNegLong.unsafeFrom(0L)") = wellTyped { - NonNegLong.unsafeFrom(0L) - } - - property("NonNegLong.unsafeFrom(-1L)") = secure { - throws(classOf[IllegalArgumentException])(NonNegLong.unsafeFrom(-1L)) - } - property("NegLong.from(-1L)") = secure { NegLong.from(-1L).isRight } @@ -141,19 +62,6 @@ class NumericTypesSpec extends Properties("NumericTypes") { NegLong.from(0L) ?= Left("Predicate failed: (0 < 0).") } - property("NegLong.unapply(-1L)") = secure { - val NegLong(x) = -1L - x ?= NegLong.unsafeFrom(-1L) - } - - property("NegLong.unsafeFrom(-1L)") = wellTyped { - NegLong.unsafeFrom(-1L) - } - - property("NegLong.unsafeFrom(0L)") = secure { - throws(classOf[IllegalArgumentException])(NegLong.unsafeFrom(0L)) - } - property("NonPosLong.from(0L)") = secure { NonPosLong.from(0L).isRight } @@ -162,19 +70,6 @@ class NumericTypesSpec extends Properties("NumericTypes") { NonPosLong.from(1L) ?= Left("Predicate (1 > 0) did not fail.") } - property("NonPosLong.unapply(0L)") = secure { - val NonPosLong(x) = 0L - x ?= NonPosLong.unsafeFrom(0L) - } - - property("NonPosLong.unsafeFrom(0L)") = wellTyped { - NonPosLong.unsafeFrom(0L) - } - - property("NonPosLong.unsafeFrom(1L)") = secure { - throws(classOf[IllegalArgumentException])(NonPosLong.unsafeFrom(1L)) - } - property("PosFloat.from(0.1F)") = secure { PosFloat.from(0.1F).isRight } @@ -183,19 +78,6 @@ class NumericTypesSpec extends Properties("NumericTypes") { PosFloat.from(0.0F).isLeft } - property("PosFloat.unapply(0.1F)") = secure { - val PosFloat(x) = 0.1F - x ?= PosFloat.unsafeFrom(0.1F) - } - - property("PosFloat.unsafeFrom(0.1F)") = wellTyped { - PosFloat.unsafeFrom(0.1F) - } - - property("PosFloat.unsafeFrom(0.0F)") = secure { - throws(classOf[IllegalArgumentException])(PosFloat.unsafeFrom(0.0F)) - } - property("NonNegFloat.from(0.0F)") = secure { NonNegFloat.from(0.0F).isRight } @@ -204,19 +86,6 @@ class NumericTypesSpec extends Properties("NumericTypes") { NonNegFloat.from(-0.1F).isLeft } - property("NonNegFloat.unapply(0.0F)") = secure { - val NonNegFloat(x) = 0.0F - x ?= NonNegFloat.unsafeFrom(0.0F) - } - - property("NonNegFloat.unsafeFrom(0.0F)") = wellTyped { - NonNegFloat.unsafeFrom(0.0F) - } - - property("NonNegFloat.unsafeFrom(-0.1F)") = secure { - throws(classOf[IllegalArgumentException])(NonNegFloat.unsafeFrom(-0.1F)) - } - property("NegFloat.from(-0.1F)") = secure { NegFloat.from(-0.1F).isRight } @@ -225,19 +94,6 @@ class NumericTypesSpec extends Properties("NumericTypes") { NegFloat.from(0.0F).isLeft } - property("NegFloat.unapply(-0.1F)") = secure { - val NegFloat(x) = -0.1F - x ?= NegFloat.unsafeFrom(-0.1F) - } - - property("NegFloat.unsafeFrom(-0.1F)") = wellTyped { - NegFloat.unsafeFrom(-0.1F) - } - - property("NegFloat.unsafeFrom(0.0F)") = secure { - throws(classOf[IllegalArgumentException])(NegFloat.unsafeFrom(0.0F)) - } - property("NonPosFloat.from(0.0F)") = secure { NonPosFloat.from(0.0F).isRight } @@ -246,19 +102,6 @@ class NumericTypesSpec extends Properties("NumericTypes") { NonPosFloat.from(0.1F).isLeft } - property("NonPosFloat.unapply(0.0F)") = secure { - val NonPosFloat(x) = 0.0F - x ?= NonPosFloat.unsafeFrom(0.0F) - } - - property("NonPosFloat.unsafeFrom(0.0F)") = wellTyped { - NonPosFloat.unsafeFrom(0.0F) - } - - property("NonPosFloat.unsafeFrom(0.1F)") = secure { - throws(classOf[IllegalArgumentException])(NonPosFloat.unsafeFrom(0.1F)) - } - property("PosDouble.from(0.1)") = secure { PosDouble.from(0.1).isRight } @@ -267,19 +110,6 @@ class NumericTypesSpec extends Properties("NumericTypes") { PosDouble.from(0.0).isLeft } - property("PosDouble.unapply(0.1)") = secure { - val PosDouble(x) = 0.1 - x ?= PosDouble.unsafeFrom(0.1) - } - - property("PosDouble.unsafeFrom(0.1)") = wellTyped { - PosDouble.unsafeFrom(0.1) - } - - property("PosDouble.unsafeFrom(0.0)") = secure { - throws(classOf[IllegalArgumentException])(PosDouble.unsafeFrom(0.0)) - } - property("NonNegDouble.from(0.0)") = secure { NonNegDouble.from(0.0).isRight } @@ -288,19 +118,6 @@ class NumericTypesSpec extends Properties("NumericTypes") { NonNegDouble.from(-0.1).isLeft } - property("NonNegDouble.unapply(0.0)") = secure { - val NonNegDouble(x) = 0.0 - x ?= NonNegDouble.unsafeFrom(0.0) - } - - property("NonNegDouble.unsafeFrom(0.0)") = wellTyped { - NonNegDouble.unsafeFrom(0.0) - } - - property("NonNegDouble.unsafeFrom(-0.1)") = secure { - throws(classOf[IllegalArgumentException])(NonNegDouble.unsafeFrom(-0.1)) - } - property("NegDouble.from(-0.1)") = secure { NegDouble.from(-0.1).isRight } @@ -309,19 +126,6 @@ class NumericTypesSpec extends Properties("NumericTypes") { NegDouble.from(0.0).isLeft } - property("NegDouble.unapply(-0.1)") = secure { - val NegDouble(x) = -0.1 - x ?= NegDouble.unsafeFrom(-0.1) - } - - property("NegDouble.unsafeFrom(-0.1)") = wellTyped { - NegDouble.unsafeFrom(-0.1) - } - - property("NegDouble.unsafeFrom(0.0)") = secure { - throws(classOf[IllegalArgumentException])(NegDouble.unsafeFrom(0.0)) - } - property("NonPosDouble.from(0.0)") = secure { NonPosDouble.from(0.0).isRight } @@ -329,17 +133,4 @@ class NumericTypesSpec extends Properties("NumericTypes") { property("NonPosDouble.from(0.1)") = secure { NonPosDouble.from(0.1).isLeft } - - property("NonPosDouble.unapply(0.0)") = secure { - val NonPosDouble(x) = 0.0 - x ?= NonPosDouble.unsafeFrom(0.0) - } - - property("NonPosDouble.unsafeFrom(0.0)") = wellTyped { - NonPosDouble.unsafeFrom(0.0) - } - - property("NonPosDouble.unsafeFrom(0.1)") = secure { - throws(classOf[IllegalArgumentException])(NonPosDouble.unsafeFrom(0.1)) - } }