amazon-ion / ion-go

A Go implementation of Amazon Ion.
https://amazon-ion.github.io/ion-docs/
Apache License 2.0
175 stars 31 forks source link

Timestamp fractional seconds with positive exponent and non zero coefficient should return an error #182

Open desaikd opened 3 years ago

desaikd commented 3 years ago

PR #181 which addressed the issue #180 didn't include an error when timestamp fractional second has positive exponent and non zero coefficient .

// check if the scale is negative and coefficient is zero then set exponent value to 0
// otherwise set exponent value as per the scale value
if d.scale < 0 && nsec == 0 {
   exponent = uint8(0)  // if nsec != 0 && d.scale < 0 then RETURN AN ERROR
} else {
   exponent = uint8(d.scale)
}

Also, there are no tests in the test harness for timestamp fractional second with positive exponent and non zero coefficient We should add more tests for timestamp fractional seconds.