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

Feature/test vector gen #248

Merged
merged 1 commit into from
Jan 24, 2020
Merged

Feature/test vector gen #248

merged 1 commit into from
Jan 24, 2020

Conversation

arnaubennassar
Copy link
Contributor

Automate test vector generator.
At the moment this refactor only applies to the core package, but it's generic so it can be used for other packages.

@ed255
Copy link
Contributor

ed255 commented Jan 24, 2020

It seems that the function checkClaim takes a prefix as an argument, but it's never used. Maybe this prefix is not needed, and it can be removed from the arguments?

c1 := NewClaimAssignNameFromEntry(e)
c2, err := NewClaimFromEntry(e)
assert.Nil(t, err)
assert.Equal(t, c0, c1)
assert.Equal(t, c0, c2)
// Stop test (write new test vector if needed)
err = testgen.StopTest()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

// Avoids reinitializing tests
var testInitialized = false

func initializeTest() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a perfect place for a test main. Let's do it in #249

assert.Nil(t, err)
idj, err := json.Marshal(&id)
assert.Nil(t, err)
assert.Equal(t, `"11AVZrKNJVqDJoyKrdyaAgEynyBEjksV5z2NjZoPxf"`, string(idj))

testgen.CheckTestValue("idString2", strings.Replace(string(idj), "\"", "", 2), t)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's revisit this in the future, see if we can improve it.

@ed255 ed255 merged commit b156c3a into master Jan 24, 2020
@OBrezhniev OBrezhniev deleted the feature/test-vector-gen branch May 31, 2021 11:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants