From e4edec4e5a7b3c09852292a16d98d86a1c3b1459 Mon Sep 17 00:00:00 2001 From: Prem Prathi Date: Sat, 17 Feb 2024 06:36:08 +0000 Subject: [PATCH] chore: example testing c wrapper --- cpp/example/Makefile | 4 ++++ cpp/example/test.c | 22 ++++++++++++++++++++++ 2 files changed, 26 insertions(+) create mode 100644 cpp/example/Makefile create mode 100644 cpp/example/test.c diff --git a/cpp/example/Makefile b/cpp/example/Makefile new file mode 100644 index 0000000..fb38278 --- /dev/null +++ b/cpp/example/Makefile @@ -0,0 +1,4 @@ +.PHONY: all + +all: + g++ --std=c++20 test.c -I../ -lnegentropy -lcrypto -L../ diff --git a/cpp/example/test.c b/cpp/example/test.c new file mode 100644 index 0000000..ae877ec --- /dev/null +++ b/cpp/example/test.c @@ -0,0 +1,22 @@ +#include +#include + +#include "../negentropy_wrapper.h" + +int main(){ + void* st = storage_new("",""); + if(st == NULL){ + perror("failed to create storage"); + } + void* ngn_inst = negentropy_new(st, 153600); + if(ngn_inst == NULL){ + perror("failed to create negentropy instance"); + } + + const char* output = negentropy_initiate(ngn_inst); + if(ngn_inst == NULL){ + perror("failed to initiate negentropy instance"); + } + printf("initiated negentropy successfully with output %s \n", output); + +} \ No newline at end of file