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

Max values for uint8, uint32 and int32 #151

Closed
Closed
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
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ class TypeCastFunctionsIT extends DslITSpec {
r(toUInt8(Long.MaxValue)) should be("255")

an[Exception] should be thrownBy r(toUInt8(Float.MaxValue.toString))
r(toUInt8(Float.MaxValue)) should be("0")
r(toUInt8(Float.MaxValue)) should be("255")

an[Exception] should be thrownBy r(toUInt8(Double.MaxValue.toString))
r(toUInt8(Double.MaxValue)) should be("0")
r(toUInt8(Double.MaxValue)) should be("255")
}

it should "handle UInt32" in {
Expand All @@ -48,12 +48,12 @@ class TypeCastFunctionsIT extends DslITSpec {
r(toUInt32(Long.MinValue)) should be("0")

an[Exception] should be thrownBy r(toUInt32(Float.MaxValue.toString))
r(toUInt32(Float.MaxValue)) should be("0")
r(toUInt32(Float.MaxValue)) should be("4294967295")
an[Exception] should be thrownBy r(toUInt32(Float.MinValue.toString))
r(toUInt32(Float.MinValue)) should be("0")

an[Exception] should be thrownBy r(toUInt32(Double.MaxValue.toString))
r(toUInt32(Double.MaxValue)) should be("0")
r(toUInt32(Double.MaxValue)) should be("4294967295")
an[Exception] should be thrownBy r(toUInt32(Double.MinValue.toString))
r(toUInt32(Double.MinValue)) should be("0")

Expand Down Expand Up @@ -85,12 +85,12 @@ class TypeCastFunctionsIT extends DslITSpec {
r(toInt32(Long.MinValue)) should be("0")

an[Exception] should be thrownBy r(toInt32(Float.MaxValue.toString))
r(toInt32(Float.MaxValue)) should be("-2147483648")
r(toInt32(Float.MaxValue)) should be("2147483647")
an[Exception] should be thrownBy r(toInt32(Float.MinValue.toString))
r(toInt32(Float.MinValue)) should be("-2147483648")

an[Exception] should be thrownBy r(toInt32(Double.MaxValue.toString))
r(toInt32(Double.MaxValue)) should be("-2147483648")
r(toInt32(Double.MaxValue)) should be("2147483647")
an[Exception] should be thrownBy r(toInt32(Double.MinValue.toString))
r(toInt32(Double.MinValue)) should be("-2147483648")

Expand Down
Loading