-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
133 additions
and
24 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
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
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,35 @@ | ||
# Use the parent directories for libraries and headers. | ||
LIB = ../lib | ||
INC = ../include | ||
BUILD_MODE = debug | ||
|
||
ifdef XCHANGE | ||
XCHANGE := ../$(XCHANGE) | ||
endif | ||
|
||
# Load the common Makefile definitions... | ||
include ../config.mk | ||
|
||
.PHONY: all | ||
all: tests run | ||
|
||
.PHONY: tests | ||
tests: $(BIN)/test-hello | ||
|
||
.PHONY: run | ||
run: tests | ||
$(BIN)/test-hello | ||
|
||
$(BIN)/test-%: $(OBJ)/test-%.o $(LIB)/libredisx.a | ||
make $(BIN) | ||
$(CC) -o $@ $^ $(LDFLAGS) -lredisx | ||
|
||
.PHONY: clean-test | ||
clean-test: | ||
rm -rf bin | ||
|
||
clean: clean-test | ||
|
||
# Finally, the standard generic rules and targets... | ||
include ../build.mk | ||
|
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,53 @@ | ||
/** | ||
* @file | ||
* | ||
* @date Created on Dec 8, 2024 | ||
* @author Attila Kovacs | ||
*/ | ||
|
||
#include <stdio.h> | ||
#include <stdlib.h> | ||
#include <string.h> | ||
|
||
#include "redisx.h" | ||
#include "xchange.h" | ||
|
||
int main() { | ||
|
||
Redis *redis = redisxInit("localhost"); | ||
RedisEntry *e; | ||
int n = -1; | ||
|
||
xSetDebug(TRUE); | ||
//redisxSetVerbose(TRUE); | ||
//redisxDebugTraffic(TRUE); | ||
|
||
redisxSetProtocol(redis, REDISX_RESP3); | ||
|
||
if(redisxConnect(redis, FALSE) < 0) { | ||
perror("ERROR! connect"); | ||
return 1; | ||
} | ||
|
||
if(redisxGetProtocol(redis) != REDISX_RESP3) { | ||
fprintf(stderr, "ERROR! verify RESP3 protocol\n"); | ||
return 1; | ||
} | ||
|
||
if(redisxSetValue(redis, "_test_", "_value_", "1", TRUE) < 0) { | ||
perror("ERROR! set value"); | ||
return 1; | ||
} | ||
|
||
e = redisxGetTable(redis, "_test_", &n); | ||
if(n <= 0) return 1; | ||
|
||
redisxDestroyEntries(e, n); | ||
redisxDisconnect(redis); | ||
redisxDestroy(redis); | ||
|
||
fprintf(stderr, "OK\n"); | ||
|
||
return 0; | ||
|
||
} |