mirror of
https://github.com/logos-messaging/negentropy.git
synced 2026-01-13 03:13:12 +00:00
chore: example testing c wrapper
This commit is contained in:
parent
68ca46408e
commit
e4edec4e5a
4
cpp/example/Makefile
Normal file
4
cpp/example/Makefile
Normal file
@ -0,0 +1,4 @@
|
||||
.PHONY: all
|
||||
|
||||
all:
|
||||
g++ --std=c++20 test.c -I../ -lnegentropy -lcrypto -L../
|
||||
22
cpp/example/test.c
Normal file
22
cpp/example/test.c
Normal file
@ -0,0 +1,22 @@
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#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);
|
||||
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user