diff options
| author | Gloria Mundi <gloria@gloria-mundi.eu> | 2024-03-15 01:25:09 +0100 |
|---|---|---|
| committer | Gloria Mundi <gloria@gloria-mundi.eu> | 2024-03-15 01:25:09 +0100 |
| commit | 7e24d9d392aff890981f13c299b283189d94a75d (patch) | |
| tree | 6e608a59fc2887240145d678f8be2f8a0356393d /datastructures/test/monotonicConvexHull.cpp | |
| parent | 8bad05892517601c7161b34a5ab775290d254938 (diff) | |
too many changes for one commit
- simplify envelope code
- add more files as optional
- allow compiling optional without editing tcr.tex
- formatting changes
Diffstat (limited to 'datastructures/test/monotonicConvexHull.cpp')
| -rw-r--r-- | datastructures/test/monotonicConvexHull.cpp | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/datastructures/test/monotonicConvexHull.cpp b/datastructures/test/monotonicConvexHull.cpp new file mode 100644 index 0000000..62ea4cd --- /dev/null +++ b/datastructures/test/monotonicConvexHull.cpp @@ -0,0 +1,26 @@ +#include "../monotonicConvexHull.cpp" + +int main() { + { + Envelope env; + env.add(10, 0); + assert(env.query(0) == 0); + assert(env.query(1) == 10); + env.add(8, 5); + assert(env.query(1) == 10); + assert(env.query(2) == 20); + assert(env.query(3) == 29); + env.add(7, 10); + assert(env.query(10) == 80); + env.add(0, 0); + assert(env.query(11) == 0); + } + + { + Envelope env; + env.add(1, 0); + env.add(0, 10); + env.add(-1, 10); + assert(env.query(7) == 3); + } +} |
