Skip to content

Commit

Permalink
blockchain: Test & Check Memory Usage
Browse files Browse the repository at this point in the history
  • Loading branch information
web3santa committed Apr 14, 2024
1 parent 569155b commit abab648
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions blockchain/utxocache_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -960,3 +960,20 @@ func TestInitConsistentState(t *testing.T) {
blocks[len(blocks)-1].Height())
}
}

func TestTotalMemoryUsage(t *testing.T) {
// Mocked utxoCache instance
s := newUtxoCache(nil, 1*1024*1024)

// Call the totalMemoryUsage method
result := s.totalMemoryUsage()

expectedSize := uint64(1 * 1024 * 1024)

resultShoulBeTrue := result == expectedSize

// Compare the expected result with the actual result
if resultShoulBeTrue {
t.Errorf("Expected memory usage %d, got %d", expectedSize, result)
}
}

0 comments on commit abab648

Please sign in to comment.