Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use a simple framework for test #6

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions .github/workflows/c-cpp.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
name: C/C++ CI
name: C/C++ test CI

on:
push:
branches: [ "master" ]
branches: [ "master", "test" ]
pull_request:
branches: [ "master" ]

Expand All @@ -17,4 +17,6 @@ jobs:
- uses: actions/checkout@v3
- name: make
run: cd src && sudo apt-get install libm4ri-dev && make -j dist_m4ri
- name: test
run: cd src && make test && make run-test

10 changes: 10 additions & 0 deletions src/makefile
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,15 @@ dist_cc.o: dist_cc.c util_io.h util_m4ri.h mmio.h makefile
mmio.o: mmio.c mmio.h makefile
${CC} ${CFLAGS} -c $<

test: test.c dist_m4ri.c dist_m4ri.h util_io.o util_m4ri.o mmio.o dist_cc.o makefile
${CC} ${CFLAGS} -DSTANDALONE -o test $< dist_cc.o mmio.o util_m4ri.o util_io.o -lm4ri -lm

run-test:
echo "start test"
./dist_m4ri method=1
./dist_m4ri method=2
./test method=1 debug=0
echo "finish test"

clean:
rm -f *~ *.tmp *.out *.o ../input/*~ ../examples/*~ TAGS
Expand Down Expand Up @@ -64,3 +73,4 @@ give_help:
@echo " - On a Mac, you may want to disable '\e[32m-march=native\e[0m' compiler switch by running"
@echo "\t\e[36m make dist_m4ri OPT='-g -mtune=native -O3'\e[0m"


44 changes: 44 additions & 0 deletions src/test.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@

/** **********************************************************************
* @brief distance of a classical or quantum CSS code
*
* The program implements two methods:
* 1. Random information set (random window) algorithm (upper bound).
* This works with any code (LDPC or not).
* (2) depth-first codeword enumeration (connected cluster) algorithm
* (Lower bound or actual distance if a codeword is found.)
*
* A. Dumer, A. A. Kovalev, and L. P. Pryadko "Distance verification..."
* in IEEE Trans. Inf. Th., vol. 63, p. 4675 (2017).
* doi: 10.1109/TIT.2017.2690381
*
* author: Leonid Pryadko <[email protected]>, Weilei Zeng
************************************************************************/
// #include <m4ri/config.h>
#include <inttypes.h>
#include <strings.h>
#include <stdlib.h>
#include <time.h>
#include <m4ri/m4ri.h>

#include "mmio.h"
#include "util_m4ri.h"
#include "util_io.h"
#include "dist_m4ri.h"

#ifdef STANDALONE

int main(int argc, char **argv){
params_t * const p = &prm;

var_init(argc,argv,p);

printf("# test functions here\n");

printf("# test finished\n");
var_kill(p);

return 0;
}

#endif /* STANDALONE */
Loading