-
Notifications
You must be signed in to change notification settings - Fork 7
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
Set MKey as uint #34
Set MKey as uint #34
Conversation
8da15cd
to
09fcc2c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The code looks good, the testing needs to be moved from the examples to the units
ea7b1c7
to
c71d7d4
Compare
comid/measurement_test.go
Outdated
fmt.Printf("CBOR: %x\n", actual) | ||
} | ||
} | ||
func TestMkey_MarshalCBOR_uint_notok(t *testing.T) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
func TestMkey_MarshalCBOR_uint_notok(t *testing.T) { | |
func TestMkey_MarshalCBOR_uint_not_ok(t *testing.T) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this test does not seem specific to uint mkeys
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if we have one single test vector using a table is superfluous.
comid/measurement_test.go
Outdated
} | ||
} | ||
|
||
func TestMkey_UnmarshalCBOR_uint_notok(t *testing.T) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd expect the test vectors here to be such that GetKeyUint fails rather than the failure happening on the generic mkey unmarshaler
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not clear what you are saying here!
In UnMarshal CBOR a Byte stream will be passed to the decoder. If an invalid data is passed, then
it should fail Unmarshaling.
If the Unmarshal is a success, then GetKeyUint will never fail ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Anyway I think, I understood what you are trying to say, have corrected it now!
comid/measurement_test.go
Outdated
} | ||
} | ||
|
||
func TestMkey_MarshalJSON_uint_notok(t *testing.T) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same set of comments as above:
- we have one only vector therefore we don't need a full-blown table driven test
but most importantly: - there is nothing specific to the uint mkey that is tested here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For 1. I agree, that I will perhaps add one more test so that it is justified to have a table driven logic.
comid/measurement_test.go
Outdated
} | ||
} | ||
|
||
func TestMkey_UnmarshalJSON_uint_notok(t *testing.T) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd expect the test vectors here to be such that GetKeyUint fails rather than the failure happening on the generic mkey unmarshaler
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same comment here, as above!
b25061f
to
578b61e
Compare
comid/measurement_test.go
Outdated
assert.EqualError(t, err, expectedErr) | ||
} | ||
|
||
func TestMeasurement_MarshalCBOR_uint_mkey_ok(t *testing.T) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
func TestMeasurement_MarshalCBOR_uint_mkey_ok(t *testing.T) { | |
func TestMKey_MarshalCBOR_uint_ok(t *testing.T) { |
comid/measurement_test.go
Outdated
} | ||
} | ||
|
||
func TestMkey_UnmarshalCBOR_uint_not_ok(t *testing.T) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Test for Mkey as Valid but Not a Uint Mkey
Cool. One last thing: it seems that we can increase the coverage threshold to 84.4% now! |
Yes! |
can you move the needle in |
Sure will do! |
Ambit in an another PR |
No description provided.