Skip to main content

zadd_test

File Name: zadd_test.go

Overview

This file contains tests for the ZADD command in the ironhawk package. It tests various scenarios, including different flags and edge cases, to ensure the correct behavior of the ZADD command.

Detailed Documentation

TestZADD(t *testing.T)

Purpose: Tests the ZADD command with various arguments and flags.

Parameters:

  • t: *testing.T - Testing object for running test cases.

Returns:

  • None. The function tests various scenarios and reports errors using the t parameter.

The test cases cover scenarios such as:

  • Calling ZADD with incorrect number of arguments.
  • Using NX, XX, and CH flags.
  • Using GT and LT flags.
  • Using the INCR flag.
  • Using invalid flag combinations.
  • Using the CH flag with multiple changes.

The function iterates through a slice of TestCase structs, each defining a test scenario with commands and expected results. The runTestcases function (not defined in this file) is used to execute these test cases against a local Redis connection.

Getting Started Relevance: YES