diff --git a/README.md b/README.md index f863b4c..31bac44 100644 --- a/README.md +++ b/README.md @@ -9,5 +9,6 @@ The usage instructions are provided in the comments. A complete test suite is provided in `test.cpp`; it includes an exhaustive randomized test. For development-related instructions please refer to the CI configuration file. +To release a new version, simply create a new tag. ![Tree](randomized_test_tree.png "Random tree generated by the test suite") diff --git a/cavl.h b/cavl.h index c439d0b..fced134 100644 --- a/cavl.h +++ b/cavl.h @@ -1,7 +1,7 @@ /// Source: https://github.com/pavel-kirienko/cavl /// /// Cavl is a single-header C library providing an implementation of AVL tree suitable for deeply embedded systems. -/// To integrate it into your project, simply copy this file into your source tree. +/// To integrate it into your project, simply copy this file into your source tree. Read the API docs below. /// /// See also O1Heap -- a deterministic memory manager for hard-real-time /// high-integrity embedded systems. @@ -39,7 +39,7 @@ extern "C" { /// The tree node/root. The user data is to be added through composition/inheritance. /// The memory layout of this type is compatible with void*[4], which is useful if this type cannot be exposed in API. -/// Per standard convention, nodes that compare smaLLer are put on the Left; those that are laRgeR are on the Right. +/// Per standard convention, nodes that compare smaller are put on the left. typedef struct Cavl Cavl; struct Cavl { diff --git a/randomized_test_tree.png b/randomized_test_tree.png index 1f945fe..71165c8 100644 Binary files a/randomized_test_tree.png and b/randomized_test_tree.png differ diff --git a/test.cpp b/test.cpp index f985611..2c5c29a 100644 --- a/test.cpp +++ b/test.cpp @@ -150,21 +150,23 @@ void printGraphviz(const Node* const nd) std::puts("digraph {"); std::puts( "node [style=filled,shape=circle,fontcolor=white,penwidth=0,fontname=\"monospace\",fixedsize=1,fontsize=18];"); - std::puts("nodesep=0.1;ranksep=0.3;"); + std::puts("edge [arrowhead=none,penwidth=2];"); + std::puts("nodesep=0.0;ranksep=0.3;splines=false;"); traverse(nd, [](const Node* const x) { const char* const fill_color = (x->bf == 0) ? "black" : ((x->bf > 0) ? "orange" : "blue"); - std::printf("\"%u\"[fillcolor=%s];", unsigned(x->value), fill_color); + std::printf("%u[fillcolor=%s];", unsigned(x->value), fill_color); }); + std::puts(""); traverse(nd, [](const Node* const x) { if (x->lr[0] != nullptr) { - std::printf("\"%u\":w->\"%u\":n;", + std::printf("%u:sw->%u:n;", unsigned(x->value), unsigned(reinterpret_cast*>(x->lr[0])->value)); } if (x->lr[1] != nullptr) { - std::printf("\"%u\":e->\"%u\":n;", + std::printf("%u:se->%u:n;", unsigned(x->value), unsigned(reinterpret_cast*>(x->lr[1])->value)); }