-
Notifications
You must be signed in to change notification settings - Fork 206
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #679 from Permify/tests
Tests
- Loading branch information
Showing
3 changed files
with
58 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package ristretto | ||
|
||
import ( | ||
"testing" | ||
) | ||
|
||
func TestMaxCostOption(t *testing.T) { | ||
// Create a Ristretto instance with a default value. | ||
r := &Ristretto{} | ||
|
||
// Apply the MaxCost option. | ||
MaxCost("100")(r) | ||
|
||
// Check if the maxCost field is set correctly. | ||
if r.maxCost != "100" { | ||
t.Errorf("Expected maxCost to be 100, but got %v", r.maxCost) | ||
} | ||
} | ||
|
||
func TestNumberOfCountersOption(t *testing.T) { | ||
// Create a Ristretto instance with a default value. | ||
r := &Ristretto{} | ||
|
||
// Apply the NumberOfCounters option. | ||
NumberOfCounters(50)(r) | ||
|
||
// Check if the numCounters field is set correctly. | ||
if r.numCounters != 50 { | ||
t.Errorf("Expected numCounters to be 50, but got %v", r.numCounters) | ||
} | ||
} |