X-Git-Url: http://git.treefish.org/~alex/phys/latlib.git/blobdiff_plain/6b382d09f3825aca16f33e28e479b663d22e8a43..c5c2e25140c048de78316f9d8faf01dc58509401:/neigh_test.cpp?ds=inline diff --git a/neigh_test.cpp b/neigh_test.cpp new file mode 100644 index 0000000..38a74ec --- /dev/null +++ b/neigh_test.cpp @@ -0,0 +1,49 @@ +#include "neigh.h" +#include +#include +#include + +using namespace std; + +int main() +{ + neigh *n; + srand(time(NULL)); + + while( true ) + { + int l[] = { rand()%10 + 1, rand()%10 + 1, rand()%10 + 1 , rand()%10 + 1 }; + + n = new neigh(4,l[0],l[1],l[2],l[3]); + + cout << l[0] << "x" << l[1] << "x" << l[2] << "x" << l[3] << endl; + + for(int itry=0; itry<100000; itry++) + { + int dir0 = rand()%4; + int dir1 = rand()%3; + if(dir0 <= dir1) dir1++; + + int l0 = rand()%(3*l[dir0]); + int l1 = rand()%(3*l[dir1]); + + int startpos = rand()%l[0] + (rand()%l[1])*l[0] + (rand()%l[2])*l[0]*l[1] + (rand()%l[3])*l[0]*l[1]*l[2]; + + int pos = startpos; + + for(int istep=0; istep