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

test: ExampleNamespacedMerkleTree #203

Merged
merged 1 commit into from
Jun 1, 2023

Conversation

rootulp
Copy link
Collaborator

@rootulp rootulp commented May 26, 2023

Previously the function ExampleNamespacedMerkleTree existed in nmt_test.go. AFAIK Go only runs unit tests for functions with the name Test* so I wouldn't expect ExampleNamespacedMerkleTree to run by the Go test runner. But it is run and fails here.

This PR converts the example into a test. Defer to @staheri14 if it should be deleted instead.

@rootulp rootulp added the enhancement New feature or request label May 26, 2023
@rootulp rootulp requested a review from staheri14 May 26, 2023 18:30
@rootulp rootulp self-assigned this May 26, 2023
@codecov
Copy link

codecov bot commented May 26, 2023

Codecov Report

Merging #203 (13c3278) into master (9efc9bf) will not change coverage.
The diff coverage is n/a.

@@           Coverage Diff           @@
##           master     #203   +/-   ##
=======================================
  Coverage   95.40%   95.40%           
=======================================
  Files           5        5           
  Lines         566      566           
=======================================
  Hits          540      540           
  Misses         15       15           
  Partials       11       11           

Copy link
Collaborator

@staheri14 staheri14 left a comment

Choose a reason for hiding this comment

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

Thanks for converting it to a test, I suggest keeping it.

[question] What changes made the test pass? why it was failing?

@rootulp
Copy link
Collaborator Author

rootulp commented May 26, 2023

[question] What changes made the test pass? why it was failing?

The example started failing in https://github.com/celestiaorg/nmt/actions/runs/5092193098/jobs/9153228914?pr=202#step:7:551 because the text output for the Example*s is slightly different from the new output.

The example wanted this text output:

nmt/nmt_test.go

Lines 107 to 110 in 9efc9bf

// Output:
// Min namespace: 00
// Max namespace: 01
// Successfully verified namespace: 00

and instead it got:

	// Output:
	// Min namespace: 00
	// Max namespace: 01
	// Successfully verified namespace: 3030

The changes in this PR make the example a test which use explicit asserts.

@rootulp rootulp requested a review from evan-forbes May 26, 2023 19:26
@rootulp rootulp enabled auto-merge (squash) May 26, 2023 19:26
@rootulp rootulp requested a review from cmwaters May 31, 2023 16:01
Copy link
Member

@evan-forbes evan-forbes left a comment

Choose a reason for hiding this comment

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

LGTM

@rootulp rootulp merged commit 5466a61 into celestiaorg:master Jun 1, 2023
@rootulp rootulp deleted the rp/fix-example branch June 1, 2023 18:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants