Skip to content

Commit

Permalink
chore: remove unnecessary core
Browse files Browse the repository at this point in the history
  • Loading branch information
rach-id committed Jun 2, 2024
1 parent 661d059 commit a81b748
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 32 deletions.
5 changes: 0 additions & 5 deletions nmt.go
Original file line number Diff line number Diff line change
Expand Up @@ -669,11 +669,6 @@ func (n *NamespacedMerkleTree) ComputeSubtreeRoot(start, end int) ([]byte, error
return n.computeRoot(start, end)
}

// isPowerOfTwo checks if a number is a power of two
func isPowerOfTwo(n int) bool {
return n > 0 && (n&(n-1)) == 0
}

type LeafRange struct {
// Start and End denote the indices of a leaf in the tree.
// Start ranges from 0 up to the total number of leaves minus 1.
Expand Down
27 changes: 0 additions & 27 deletions nmt_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1190,33 +1190,6 @@ func TestForcedOutOfOrderNamespacedMerkleTree(t *testing.T) {
}
}

func TestIsPowerOfTwo(t *testing.T) {
tests := []struct {
input int
expected bool
}{
{input: 0, expected: false},
{input: 1, expected: true},
{input: 2, expected: true},
{input: 3, expected: false},
{input: 4, expected: true},
{input: 5, expected: false},
{input: 8, expected: true},
{input: 16, expected: true},
{input: -1, expected: false},
{input: -2, expected: false},
}

for _, tt := range tests {
t.Run(fmt.Sprintf("input=%d", tt.input), func(t *testing.T) {
result := isPowerOfTwo(tt.input)
if result != tt.expected {
t.Errorf("expected %v, got %v", tt.expected, result)
}
})
}
}

func TestComputeSubtreeRoot(t *testing.T) {
n := exampleNMT2(1, true, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15)
tests := []struct {
Expand Down

0 comments on commit a81b748

Please sign in to comment.