Skip to main content

countminsketch_test.go

countminsketch_test.go - Overview

This file contains unit tests for the Count-Min Sketch functionality, covering initialization, information retrieval, incrementing, querying, and merging operations.

Detailed Documentation

TestCountMinSketch

Purpose: This function serves as the main test function for the Count-Min Sketch functionality. It calls other test functions to test different aspects of the Count-Min Sketch. Parameters:

  • t (*testing.T): Testing object for running tests. Returns: None

testCMSInitByDim

Purpose: Tests the cms.initbydim command, which initializes a Count-Min Sketch by specifying its width and depth. Parameters:

  • t (*testing.T): Testing object for running tests.
  • store (*dstore.Store): Data store for the Count-Min Sketch. Returns: None

testCMSInitByProb

Purpose: Tests the cms.initbyprob command, which initializes a Count-Min Sketch by specifying the error rate and probability. Parameters:

  • t (*testing.T): Testing object for running tests.
  • store (*dstore.Store): Data store for the Count-Min Sketch. Returns: None

testCMSInfo

Purpose: Tests the cms.info command, which retrieves information about a Count-Min Sketch, such as its width, depth, and count. Parameters:

  • t (*testing.T): Testing object for running tests.
  • store (*dstore.Store): Data store for the Count-Min Sketch. Returns: None

testCMSIncrBy

Purpose: Tests the cms.incrby command, which increments the count of specified keys in a Count-Min Sketch. Parameters:

  • t (*testing.T): Testing object for running tests.
  • store (*dstore.Store): Data store for the Count-Min Sketch. Returns: None

testCMSQuery

Purpose: Tests the cms.query command, which queries the counts of specified keys in a Count-Min Sketch. Parameters:

  • t (*testing.T): Testing object for running tests.
  • store (*dstore.Store): Data store for the Count-Min Sketch. Returns: None

testCMSMerge

Purpose: Tests the cms.merge command, which merges multiple Count-Min Sketches into one. Parameters:

  • t (*testing.T): Testing object for running tests.
  • store (*dstore.Store): Data store for the Count-Min Sketch. Returns: None

Code Examples

None

Getting Started Relevance