diff --git a/CHANGELOG.md b/CHANGELOG.md index e3f413178..01f0b877d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,54 +4,129 @@ ## New Features -- Added new overloads for many functions of Adiar's API that use [1] (pure) label predicates, [2] (stateful) label generator functions (coroutines), and [3] iterators. For example, `bdd_exists` is now overloaded with the following alternatives - - `bdd_exists(f, pred)`: quantify all variables *i* in *f* where *pred(i)* evaluates to true. - - `bdd_exists(f, gen)`: quantify all variables *i* generated by *gen()*. Here it is important that *gen()* provides the variables in descending order. - - `bdd_exists(f, begin, end)`: quantify all variables *i* from *begin* to *end* (assuming these are sorted in descending order). -- In a similar way, functions that create non-diagram outputs, e.g. `bdd_satmin(...)` and `bdd_varprofile(...)`, now take a *consumer* function as an argument, such that they are compatible with any data structure you desire. -- `adiar_set_domain(...)` - Add overload to set domain given a number of variables, a *generator function*, or an *iterator*. +- Added new overloads for many functions of Adiar's API that use [1] (pure) + label predicates, [2] (stateful) label generator functions (coroutines), and + [3] iterators. For example, `bdd_exists` is now overloaded with the following + alternatives + + - `bdd_exists(f, pred)`: quantify all variables *i* in *f* where *pred(i)* + evaluates to true. + + - `bdd_exists(f, gen)`: quantify all variables *i* generated by *gen()*. Here + it is important that *gen()* provides the variables in descending order. + + - `bdd_exists(f, begin, end)`: quantify all variables *i* from *begin* to + *end* (assuming these are sorted in descending order). + +- In a similar way, functions that create non-diagram outputs, e.g. + `bdd_satmin(...)` and `bdd_varprofile(...)`, now take a *consumer* function or + iterators as an argument, such that they are compatible with any data + structure you desire. + +- `domain_set(...)` Add overload to set domain given a number of variables, a + *generator*, or an *iterator*. ## Optimisations -- The `access_mode` enum has been added as a new global setting. If set to *AUTO* or to *RA* then `bdd_apply`, `zdd_binop`, and their derivatives will use random access on one of the input (if possible). This circumvents using an entire priority queue, thereby drastically improving performance. This is especially beneficial when applying an operator to a very large decision diagram together with a narrow one. -- Added proper algoritms for the quantification of multi-variable quantificiation. To this end, there are now three separate algorithms. The `quantify_mode` enum can be used to pick what algorithm to use (the default is a heuristic that picks between all three algorithms) - 1. The *v1.x* approach of quantifying a single variable at a time still persists (`quantify_mode::SINGLETON`). - 2. The *v1.x* algorithm has been generalized to (partially) handle multiple variables at once in a single sweep (`quantify_mode::PARTIAL`). Furthermore, this generalized sweep can be rerun on its own unreduced result (skipping the possibly costly and unecessary Reduce sweep). - 3. Implemented the *nested sweeping* framework to add support for an I/O-efficient simulation of BDD operations that (may) recurse on intermediate results. This provides a completely new multi-variable quantification operations that is similar to the one in other BDD packages (`quantify_mode::NESTED`). +- The `access_mode` enum has been added as a new global setting. If set to + *AUTO* or to *Random_Access* then `bdd_apply`, `zdd_binop`, and their + derivatives will use random access on one of the input (if possible). This + circumvents using an entire priority queue, thereby drastically improving + performance. This is especially beneficial when applying an operator to a very + large decision diagram together with a narrow one. + +- Added proper algoritms for the quantification of multi-variable + quantificiation. To this end, there are now three separate algorithms. The + `quantify_mode` enum can be used to pick what algorithm to use (the default is + a heuristic that picks between all three algorithms) + + 1. The *v1.x* approach of quantifying a single variable at a time still + persists (`quantify_mode::Singleton`). + + 2. The *v1.x* algorithm has been generalized to (partially) handle multiple + variables at once in a single sweep (`quantify_mode::Partial`). + Furthermore, this generalized sweep can be rerun on its own unreduced + result (skipping the possibly costly and unecessary Reduce sweep). + + 3. Implemented the *nested sweeping* framework to add support for an + I/O-efficient simulation of BDD operations that (may) recurse on + intermediate results. This provides a completely new multi-variable + quantification operations that is similar to the one in other BDD packages + (`quantify_mode::Nested`). ## Bug Fixes -- The result of `adiar_stats()` is now fixed such that the values for *reduce* and *substitute* are correct. -- Many small fixes to make Adiar compile with GCC, Clang, and MSVC on Linux, Mac, and Windows. Simultaneously, we have now set up continuous integration, such that we can truly ensure we support all platforms. +- The result of `statistics_get()` is now fixed such that the values for + *reduce* and *substitute* are correct. + +- Many small fixes to make Adiar compile with GCC, Clang, and MSVC on Linux, + Mac, and Windows. Simultaneously, we have now set up continuous integration, + such that we can truly ensure we support all platforms. ## Breaking Changes -There has been a major rewrite of the internal logic of Adiar to pay off technical debt and to get Adiar ready for implementing the I/O-efficient version of the much more complex BDD operations. At the same time, this also brings Adiar much closer to support other types of decision diagrams (e.g. QMDDs) and to store BDDs on disk and loading them again later. +There has been a major rewrite of the internal logic of Adiar to pay off +technical debt and to get Adiar ready for implementing the I/O-efficient version +of the much more complex BDD operations. At the same time, this also brings +Adiar much closer to support other types of decision diagrams (e.g. QMDDs) and +to store BDDs on disk and loading them again later. + +- All internal logic in ** has been moved into its nested + namespace `adiar::internal`. If you use anything from this namespace (e.g. the + *node* and the *node_writer* classes) then you are not guaranteed non-breaking + changes. + +- The entire public API has been overhauled to have a consistent + `{prefix}_{nocase}` naming scheme. For example, `adiar::adiar_set_domain(...)` + has been renamed into `adiar::domain_set(...)`. + +- Fundamental data types in ** have been moved to each their own + file (most of which are placed in the **). + These have been converted from C-like structs with manipulating functions to + C++ (immutable) classes. That is, the entire interface for *node*, *arc* etc. + have completely changed. -- All internal logic in ** has been moved into its nested namespace `adiar::internal`. If you use anything from this namespace (e.g. the *node* and the *node_writer* classes) then you are not guaranteed non-breaking changes. -- Fundamental data types in ** have been moved to each their own file (most of which are placed in the **). These have been converted from C-like structs with manipulating functions to C++ (immutable) classes. That is, the entire interface for *node*, *arc* etc. have completely changed. - Files, streams and their writers have been moved, rewritten, and renamed. - - They have been moved to **, leaving ** only to expose the public parts of the API. - - If you have been using a *label_file* or an *assignment_file* you should now use the *shared_file\* template instead. To read from it use the *file_stream\* and to write use the *file_writer\*. - - The *node_file* class is replaced with the *adiar::internal::shared_levelized_file\*. You can read from it with the -*adiar::internal::node_stream* and write to it with the *adiar::internal::node_writer* as before. But, we highly encourage you to transition over to using the *adiar::bdd_builder* and *adiar::zdd_builder* instead. + Since the v2.0 API uses *predicates* and *generator* functions, Adiar's files + do not need to be used directly. Hence, these have been delegated to the + *adiar::internal* namespace. -That is, this rewrite only results in breaking changes if you have been interacting with Adiar's files directly, e.g. you have used the `bdd_restrict`, `bdd_exists`, `bdd_forall` functions or have created BDDs by hand with the *node_writer*. +That is, this rewrite only results in breaking changes if you have been +interacting with Adiar's files directly, e.g. you have used the `bdd_restrict`, +`bdd_exists`, `bdd_forall` functions or have created BDDs by hand with the +*node_writer*. Other breaking changes are: - `zdd_ithvar(i)` - - The semantics have been changed to be more akin to the BDD semantics. That is, `zdd_ithvar(i)` is the set of all bitvectors where *i* is true. Symmetrically, the `zdd_nithvar(i)` function has been added. - - The original semantics of `zdd_ithvar` is still provided with the `zdd_singleton` function. + - The semantics have been changed to be more akin to the BDD semantics. That + is, `zdd_ithvar(i)` is the set of all bitvectors where *i* is true. + Symmetrically, the `zdd_nithvar(i)` function has been added. + + - The original semantics of `zdd_ithvar` is still provided with the + `zdd_singleton` function. + - `bdd_satmin(f)` and `bdd_satmax(f)`, resp. `zdd_minelem(A)` and `zdd_maxelem(A)`: - - The return type when called without a *callback function* has been turned into a `bdd`, resp. `zdd`. This ought to make their return type more usable in a symbolic context. - - Semantics has been changed if the global domain has been set. If so, then it will return the assignment to the variables in the domain rather than specifically the levels present in the BDD. -- Every deprecated function from *v1.x* that was moved to ** has been removed. -- The two-level granularity of statistics has been removed. If you want to compile Adiar with statistics you just have to set the CMake variable `ADIAR_STATS` to *ON*; the CMake variable `ADIAR_STATS_EXTRA` has been removed as its highly detailed statistics is now included within `ADIAR_STATS`. + - The return type when called without a *callback function* has been turned + into a `bdd`, resp. `zdd`. This ought to make their return type more usable + in a symbolic context. + + - Semantics has been changed if the global domain has been set. If so, then it + will return the assignment to the variables in the domain rather than + specifically the levels present in the BDD. + +- Every deprecated function from *v1.x* that was moved to ** + has been removed. + +- The two-level granularity of statistics has been removed. If you want to + compile Adiar with statistics you just have to set the CMake variable + `ADIAR_STATS` to *ON*; the CMake variable `ADIAR_STATS_EXTRA` has been removed + as its highly detailed statistics is now included within `ADIAR_STATS`. ## License -Adiar 1.0.0 is distributed under the MIT license. But, notice that it depends on the TPIE library which is licensed under LGPL v3. So, by extension any binary file of Adiar is covered by the very same license. +Adiar 2.0.0 is distributed under the MIT license. But, notice that it depends on +the TPIE library which is licensed under LGPL v3. So, by extension any binary +file of Adiar is covered by the very same license. # v1.2.2 @@ -61,9 +136,12 @@ Adiar 1.0.0 is distributed under the MIT license. But, notice that it depends on ## Bug Fixes - `zdd_project(A, dom)` - An accidental swapping of arguments for a helper function resulted in the generated recursion requests are for the wrong elements and hence the wrong ZDD was constructed. + An accidental swapping of arguments for a helper function resulted in the + generated recursion requests are for the wrong elements and hence the wrong + ZDD was constructed. -- Fixes C++ and CMake such that Adiar compiles and runs on Mac computers with default Clang. +- Fixes C++ and CMake such that Adiar compiles and runs on Mac computers with + default Clang. # v1.2.1 @@ -73,7 +151,8 @@ Adiar 1.0.0 is distributed under the MIT license. But, notice that it depends on ## Bug Fixes - `adiar_printstats()` - Makes sure to print levelized priority queue statistics, when only the unbucketed priority queue has been used. + Makes sure to print levelized priority queue statistics, when only the + unbucketed priority queue has been used. ## Deprecations @@ -85,7 +164,10 @@ Adiar 1.0.0 is distributed under the MIT license. But, notice that it depends on ## Binary Decision Diagrams - `bdd_satcount(bdd f)` - If the global domain is set, then that value will take precedence over the number of levels in *f* (assuming *f* has fewer levels than the domain claims to exist). + If the global domain is set, then that value will take precedence over the + number of levels in *f* (assuming *f* has fewer levels than the domain claims + to exist). + - `bdd_printdot(bdd f, std::ostream out)` Added to allow more flexibility when outputting DOT files. @@ -96,7 +178,9 @@ Adiar 1.0.0 is distributed under the MIT license. But, notice that it depends on ## Documentation -Instead of separate Markdown files, the documentation is generated directly from the C++ codebase with Doxygen. You can generate the documentation (assuming Doxygen is intalled) with the `docs` Makefile target. +Instead of separate Markdown files, the documentation is generated directly from +the C++ codebase with Doxygen. You can generate the documentation (assuming +Doxygen is intalled) with the `docs` Makefile target. # v1.2.0 @@ -105,38 +189,57 @@ Instead of separate Markdown files, the documentation is generated directly from ## Performance -This new release's primary focus is to drastically improve performance for smaller instances. To this end, we still use the very same algorithms, but if the input is small enough then we can safely use purely internal memory auxiliary data structures within each algorithm. Prior to this version we could only guarantee up to a 4x performance difference compared to other BDD libraries when the largest constructed decision diagram is 113 MiB or larger (for benchmarks where the base cases are manually constructed, i.e. also have some considerable size). Now, we are able to now guarantee the same when the largest is only 3.2 MiB or larger! +This new release's primary focus is to drastically improve performance for +smaller instances. To this end, we still use the very same algorithms, but if +the input is small enough then we can safely use purely internal memory +auxiliary data structures within each algorithm. Prior to this version we could +only guarantee up to a 4x performance difference compared to other BDD libraries +when the largest constructed decision diagram is 113 MiB or larger (for +benchmarks where the base cases are manually constructed, i.e. also have some +considerable size). Now, we are able to now guarantee the same when the largest +is only 3.2 MiB or larger! ## Domain -A *file* can globally be set as the problem domain, i.e. the set of variables you are using. +A *file* can globally be set as the problem domain, i.e. the set of +variables you are using. - `adiar_set_domain(file dom)` sets the global domain variable. - `adiar_has_domain()` checks whether a global domain already is set. -- `adiar_get_domain()` - provides the current *file* that acts as the global domain (assuming `adiar_has_domain()` evaluates to `true`). +- `domain_get()` + provides the current *file* that acts as the global domain (assuming + `adiar_has_domain()` evaluates to `true`). ## Binary Decision Diagrams ### New Features - `bdd_builder` - is a new class to replace using the *node_writer* directly. This enables a much more natural construction of BDDs bottom-up by hiding away several details. Furthermore, it makes use of exceptions rather than immediately terminating assertions. + is a new class to replace using the *node_writer* directly. This enables a + much more natural construction of BDDs bottom-up by hiding away several + details. Furthermore, it makes use of exceptions rather than immediately + terminating assertions. + - `bdd_from(zdd A)` converts from a ZDD to a BDD using the global domain. + - `bdd_equal(bdd f, bdd g)` is an alternative to using the `==` operator. + - `bdd_unequal(bdd f, bdd g)` is an alternative to using the `!=` operator. + - `bdd_varprofile(bdd f)` - obtains a *file* containing all of the variables present in a BDD. + obtains a *file* containing all of the variables present in a BDD. ### Bug Fixes -- Results from `bdd_nithvar(label_t i)` and `bdd_ithvar(label_t i)` - are now marked as *canonical* and so can be used with the linear-scan equality checking. +- Results from `bdd_nithvar(label_t i)` and `bdd_ithvar(label_t i)` are now + marked as *canonical* and so can be used with the linear-scan equality + checking. + - Fixed the reduction phase may use 2 MiB more memory than is available. ## Zero-suppressed Decision Diagrams @@ -144,57 +247,81 @@ A *file* can globally be set as the problem domain, i.e. the set of var ### New Features - `zdd_builder` - is a new class to replace using the *node_writer* directly. This enables a much more natural construction of ZDDs bottom-up by hiding away several details. Furthermore, it makes use of exceptions rather than immediately terminating assertions. + is a new class to replace using the *node_writer* directly. This enables a + much more natural construction of ZDDs bottom-up by hiding away several + details. Furthermore, it makes use of exceptions rather than immediately + terminating assertions. + - `zdd_complement(zdd A)` Complementation within the global domain. + - `zdd_from(bdd f)` Converts from a BDD to a ZDD using the global domain. + - `zdd_varprofile(zdd A)` Obtain a *file* containing all of the variables present in a ZDD. ### Bug Fixes - `zdd_ithvar(label_t i)` - Is now marked as *canonical* and so can be used with the linear-scan equality checking. + Is now marked as *canonical* and so can be used with the linear-scan equality + checking. + - Fixed the reduction phase may use 2 MiB more memory than is available. + - DOT files are now with the terminals properly printed as *Ø* and *{Ø}*. ## Statistics ### New Features -- Statistics have been heavily extended with information on how often each type of auxiliary data structures (internal or external) have been used. -- All statistics variables are now fixed-precision numbers (using the [CNL library](https://github.com/johnmcfarlane/cnl)) making sure there are no overflows in the provided numbers. +- Statistics have been heavily extended with information on how often each type + of auxiliary data structures (internal or external) have been used. + +- All statistics variables are now fixed-precision numbers (using the [CNL + library](https://github.com/johnmcfarlane/cnl)) making sure there are no + overflows in the provided numbers. + - `adiar_statsreset()` resets all statistics values back to 0. ### Bug Fixes -- Fixed fine grained statistics (`ADIAR_STATS_EXTRA`) are turned on even though only the coarse-grained statistics (`ADIAR_STATS`) was desired. +- Fixed fine grained statistics (`ADIAR_STATS_EXTRA`) are turned on even though + only the coarse-grained statistics (`ADIAR_STATS`) was desired. ## Deprecations -The word *sink* has been replaced with the word *terminal* that is more commonly used in the context of decision diagrams. +The word *sink* has been replaced with the word *terminal* that is more commonly +used in the context of decision diagrams. - *adiar/data.h* - `create_sink_uid(bool val)` -> `create_terminal_uid(bool val)` - `create_sink_ptr(bool val)` -> `create_terminal_ptr(bool val)` - `create_sink(bool val)` -> `create_terminal(bool val)` + - *adiar/bdd.h* - `is_sink(bdd f)` -> `is_terminal(bdd f)` - `bdd_sink(bool val)` -> `bdd_terminal(bool val)` + - *adiar/zdd.h* - `is_sink(zdd A)` -> `is_terminal(zdd A)` - `zdd_sink(bool val)` -> `zdd_terminal(bool val)` ## Breaking Changes -The *terminal predicates* `is_any`, `is_true` and `is_false` with the prior `is_sink(zdd A, pred)` functions were too complicated. The above performance improvements allows us for a much simpler (and faster) implementation. Deprecation was not possible due to name conflicts with their replacements below. +The *terminal predicates* `is_any`, `is_true` and `is_false` with the prior +`is_sink(zdd A, pred)` functions were too complicated. The above performance +improvements allows us for a much simpler (and faster) implementation. +Deprecation was not possible due to name conflicts with their replacements +below. - *adiar/data.h* - `is_sink(ptr_t p)`, `is_true(ptr_t p)`, and `is_false(ptr_t p)`. + - *adiar/bdd.h* - `is_sink(bdd f)`, `is_true(bdd f)` and `is_false(bdd f)`. + - *adiar/zdd.h* - `is_sink(zdd A)`, `is_null(zdd A)` and `is_empty(zdd A)`. @@ -205,50 +332,89 @@ The *terminal predicates* `is_any`, `is_true` and `is_false` with the prior `is_ ## Zero-suppressed Decision Diagrams -Adds support for *zero-suppressed* decision diagrams with the `zdd` class. All operations on *ZDD*s are based on the family of sets semantics as in the original paper by Minato. +Adds support for *zero-suppressed* decision diagrams with the `zdd` class. All +operations on *ZDD*s are based on the family of sets semantics as in the +original paper by Minato. ### Constructors - `zdd zdd_sink(bool v)` (and `zdd_empty()` and `zdd_null()` as alternatives) + - `zdd zdd_ithvar(label_t i)` -- `zdd zdd_vars(file vars)`, `zdd zdd_singletons(file vars)`, and `zdd zdd_powerset(file vars)` to respectively construct an *and*, *or*, and the *don't care* chain. -- `zdd zdd_sized_set(file vars, k, pred)` to construct the sets of variables in *vars* whose size satisfies the given predicate in relation to *k*. + +- `zdd zdd_vars(file vars)`, `zdd zdd_singletons(file vars)`, + and `zdd zdd_powerset(file vars)` to respectively construct an *and*, + *or*, and the *don't care* chain. + +- `zdd zdd_sized_set(file vars, k, pred)` to construct the sets + of variables in *vars* whose size satisfies the given predicate in relation to + *k*. ### Basic Manipulation -- `zdd zdd_binop(zdd A, zdd B, bool_op op)` to apply a binary operator to two families of sets (also includes aliases for the _or_, _and_, and _diff_ operators). -- `zdd zdd_change(zdd A, file vars)` to compute the symmetric difference. +- `zdd zdd_binop(zdd A, zdd B, bool_op op)` to apply a binary operator to two + families of sets (also includes aliases for the _or_, _and_, and _diff_ + operators). + +- `zdd zdd_change(zdd A, file vars)` to compute the symmetric + difference. + - `zdd zdd_complement(zdd A, file dom)` to construct the complement. -- `zdd zdd_expand(zdd A, file vars)` to expand the domain with new variables. -- `zdd zdd_offset(zdd A, file vars)` to compute the subset without the given variables. -- `zdd zdd_onset(zdd A, file vars)` to compute the subset with the given variables. + +- `zdd zdd_expand(zdd A, file vars)` to expand the domain with new + variables. + +- `zdd zdd_offset(zdd A, file vars)` to compute the subset without the + given variables. + +- `zdd zdd_onset(zdd A, file vars)` to compute the subset with the + given variables. + - `zdd zdd_project(zdd A, file is)` to project onto a (smaller) domain. ### Counting Operations - `uint64_t zdd_nodecount(zdd A)` the number of (non-terminal) nodes. + - `uint64_t zdd_varcount(zdd A)` the number of levels present (i.e. variables). + - `uint64_t bdd_size(bdd A)` the number of elements in the family of sets. ### Predicates - `bool zdd_equal(zdd A, zdd B)` to check for set equality. + - `bool zdd_unequal(zdd A, zdd B)` to check set inequality. + - `bool zdd_subseteq(zdd A, zdd B)` to check for weak subset inclusion. + - `bool zdd_subset(zdd A, zdd B)` to check for strict subset inclusion. + - `bool zdd_disjoint(zdd A, zdd B)` to check for the sets being disjoint. ### Set Elements - `bool zdd_contains(zdd A, file a)` + - `std::optional> zdd_minelem(zdd A)` + - `std::optional> zdd_maxelem(zdd A)` ### Other Functions -- `output_dot(bdd f, std::string filename)` to output a visualizable _*.dot* file. -- `zdd zdd_from(bdd f, file dom)` and `bdd bdd_from(zdd f, file dom)` to convert between *BDD*s and *ZDD*s interpreted in the given domain. +- `output_dot(bdd f, std::string filename)` to output a visualizable _*.dot* + file. + +- `zdd zdd_from(bdd f, file dom)` and `bdd bdd_from(zdd f, + file dom)` to convert between *BDD*s and *ZDD*s interpreted in the + given domain. ## Statistics -Compile Adiar with `ADIAR_STATS` or `ADIAR_STATS_EXTRA` to gather statistics about the execution of the internal algorithms. With `ADIAR_STATS`, Adiar will record all statistics that only introduce a small constant time overhead to every operation. `ADIAR_STATS_EXTRA` also gathers much more detailed information, such as the bucket-hits of the levelized priority queue, which does introduce a linear-time overhead to every operation. +Compile Adiar with `ADIAR_STATS` or `ADIAR_STATS_EXTRA` to gather statistics +about the execution of the internal algorithms. With `ADIAR_STATS`, Adiar will +record all statistics that only introduce a small constant time overhead to +every operation. `ADIAR_STATS_EXTRA` also gathers much more detailed +information, such as the bucket-hits of the levelized priority queue, which does +introduce a linear-time overhead to every operation. - `stats_t adiar_stats()` to obtain a copy of the raw data values. -- `void adiar_printstat(std::ostream)` to print all statistics to an output stream. + +- `void stats_print(std::ostream)` to print all statistics to an output stream. # v1.0.1 @@ -258,20 +424,40 @@ Compile Adiar with `ADIAR_STATS` or `ADIAR_STATS_EXTRA` to gather statistics abo ## Bug fixes - `bdd_apply`: - - Fix tuples have their ties on `std::min` or `std::max` not broken correctly. This resulted in that the same recursion request could potentially be handled multiple times independently, since all its "calls" ended up interleaving with other tied requests in the priority queues. This bug fix ensures the algorithm runs in quadratic time. - - Slightly improve performance of some boolean operators. Most likely this is negligible. + - Fix tuples have their ties on `std::min` or `std::max` not broken correctly. + This resulted in that the same recursion request could potentially be + handled multiple times independently, since all its "calls" ended up + interleaving with other tied requests in the priority queues. This bug fix + ensures the algorithm runs in quadratic time. + + - Slightly improve performance of some boolean operators. Most likely this is + negligible. + - `bdd_counter`: - Fix returns trivially false cases as *true*. + - *CMake* - - Now Adiar compiles with C++17 regardless of its parent project. This allows the user to omit the use of `set_target_properties( PROPERTIES CXX_STANDARD 17)` in their own CMake settings. + - Now Adiar compiles with C++17 regardless of its parent project. This allows + the user to omit the use of `set_target_properties( PROPERTIES + CXX_STANDARD 17)` in their own CMake settings. ## Changes - `adiar_init`: - It now takes its memory argument in *bytes* rather than in *MiB*. -- *Equality Checking* (`==`): Improved performance from its prior *O(N2 log N2)* time comparison. - - If both given BDDs are *canonical* (definition: as it would be output by Adiar's *reduce* algorithm) and have the same value in their *negation flag*, then equality checking is done with a simple (and much faster) linear scan. - - In all other cases the prior time-forward processing algorithm is used. But this one has been improved to be an *O(N log N)* time comparison algorithm. That is, equality checking is not only a constant improvement computing `~(f ^ g) == bdd_true()` but it is provably faster (both in terms of time and I/Os). + +- *Equality Checking* (`==`): Improved performance from its prior + *O(N2 log N2)* time comparison. + - If both given BDDs are *canonical* (definition: as it would be output by + Adiar's *reduce* algorithm) and have the same value in their *negation + flag*, then equality checking is done with a simple (and much faster) linear + scan. + + - In all other cases the prior time-forward processing algorithm is used. But + this one has been improved to be an *O(N log N)* time comparison algorithm. + That is, equality checking is not only a constant improvement computing `~(f + ^ g) == bdd_true()` but it is provably faster (both in terms of time and + I/Os). # v1.0.0 @@ -280,35 +466,59 @@ Compile Adiar with `ADIAR_STATS` or `ADIAR_STATS_EXTRA` to gather statistics abo ## Binary Decision Diagrams -`bdd` class to hide away management of files and running the _reduce_ algorithm. This takes care of reference counting and optimal garbage collection. +`bdd` class to hide away management of files and running the _reduce_ algorithm. +This takes care of reference counting and optimal garbage collection. ### Constructors - `bdd_sink(bool v)` (and `bdd_true()` and `bdd_false()` as alternatives) + - `bdd_ithvar(label_t i)` and `bdd_nithvar(label_t i)` -- `bdd_and(file ls)` and `bdd_or(file ls)` to construct an *and*/*or* chain. -- `bdd_counter(label_t min_var, label_t max_var, label_t threshold)` to construct whether exactly *threshold* many variables in the given interval are true. -Furthermore, the `node_writer` class is also provided as a means to construct a BDD manually bottom-up. +- `bdd_and(file ls)` and `bdd_or(file ls)` to construct an + *and*/*or* chain. + +- `bdd_counter(label_t min_var, label_t max_var, label_t threshold)` to + construct whether exactly *threshold* many variables in the given interval are + true. + +Furthermore, the `node_writer` class is also provided as a means to construct a +BDD manually bottom-up. ### Basic Manipulation -- `bdd_apply(bdd f, bdd g, bool_op op)` to combine two BDDs with a binary operator (also includes aliases for every possible *op*) +- `bdd_apply(bdd f, bdd g, bool_op op)` to combine two BDDs with a binary + operator (also includes aliases for every possible *op*) + - `bdd_ite(bdd f, bdd g, bdd h)` to compute the if-then-else + - `bdd_not(bdd f)` to negate a bdd -- `bdd_restrict(bdd f, assignment_file as)` to fix the value of one or more variables -- `bdd_exists(bdd f, label_t i)` and `bdd_forall(bdd f, label_t i)` to existentially or forall quantify a single variable (also includes versions with the second argument being multiple labels in a `file`). + +- `bdd_restrict(bdd f, assignment_file as)` to fix the value of one or more + variables + +- `bdd_exists(bdd f, label_t i)` and `bdd_forall(bdd f, label_t i)` to + existentially or forall quantify a single variable (also includes versions + with the second argument being multiple labels in a `file`). ### Counting Operations - `bdd_nodecount(bdd f)` the number of (non-terminal) nodes. + - `bdd_varcount(bdd f)` the number of levels present (i.e. variables). + - `bdd_pathcount(bdd f)` the number of unique paths to the *true* terminal. + - `bdd_satcount(bdd f, size_t varcount)` the number of satisfying assignments. ### Input variables - `bdd_eval(bdd f, assignment_file x)` computes *f(x)*. -- `bdd_satmin(bdd f)`, resp. `bdd_satmax(bdd f)`, to find the lexicographical smallest, resp. largest, satisfying assignment. + +- `bdd_satmin(bdd f)`, resp. `bdd_satmax(bdd f)`, to find the lexicographical + smallest, resp. largest, satisfying assignment. ### Other Functions -- `output_dot(bdd f, std::string filename)` to output a visualizable *.dot* file. +- `output_dot(bdd f, std::string filename)` to output a visualizable *.dot* + file. ## License -Adiar 1.0.0 is distributed under the MIT license. But, notice that it depends on the TPIE library which is licensed under LGPL v3. So, by extension any binary file of Adiar is covered by the very same license. +Adiar 1.0.0 is distributed under the MIT license. But, notice that it depends on +the TPIE library which is licensed under LGPL v3. So, by extension any binary +file of Adiar is covered by the very same license. diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 551aee3b4..15a219500 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -161,12 +161,48 @@ CPP source file. ### §3 Naming Scheme -All functions and classes and their member functions should follow the rules -below. +The codebase uses [snake case](https://en.wikipedia.org/wiki/Snake_case) as much +as possible. This nicely aligns Adiar's codebase with the *std* (and the +*tpie*) namespace that the developers are used to anyway. Furthermore, this way +of writing might be easier to read. -- Use [snake case](https://en.wikipedia.org/wiki/Snake_case). -- All Decision Diagram functions in the public API are prefixed with the type of - the decision diagram, e.g. the Apply function for a `bdd` is called `bdd_apply`. +- For *namespaces*, *classes*, *variables*, and *functions* use `snake_case`. + The only other exceptions are *enum* values and the public API (see below). + + - Preprocessing variables use *SNAKE_CASE*. + + - We cannot use *snake_case* or *SNAKE_CASE* for enum values since that may + clash with keywords or preprocessing variables. Hence, we have settled on + `Snake_Case`. + + - Yet, in the public *BDD* API we run into some problems. What we really want + is to have the `bdd` and `zdd` "class" prefix all functions as a namespace, + e.g. we would write `adiar::bdd h = adiar::bdd::and(f,g)`. Yet we cannot do + so since `and`, `or`, and `xor` are keywords in C++. + + So we need some alternative. Yet, each is a compromise in some way. + Currently, we have chosen to stick with a naming scheme that aligns with the + C API of *BuDDy* and *Sylvan* and does not clash too much with the use of + *snake_case*: + + All functions of the public API are of the form `{prefix}_{functionname}`, + e.g. `bdd_and(f,g)` by prepending `bdd_` onto the `and(f,g)` function name. + Functions names that consist of multiple words, e.g. *is true*, is written + in *nocase*, e.g. `bdd_istrue(f)`. + +- Type variables exposed from a class have their names suffixed with `_type`. + Template type parameters are suffixed with `_t`. Global types are *not* + suffixed with anything (except if there is a good reason to do it). + + This aligns with *std* and prevents shadowing between the two. + +- Private class member variables are prefixed with a single `_`; non-static + public ones may also be prefixed as such. + +The entire public API, i.e. everything in the *adiar* namespace, should adhere +to the above. Yet, the internal logic in *adiar::internal* may still . Please +fix these when you see them. But, do those changes in an independent commit of +one changing/adding logic. ### §4 No Almost Always Auto! @@ -179,17 +215,17 @@ reader and (3) to provide all the information necessary to debug the code. As Adiar grows larger and more complex, one submodule is the foundation on which others are built. Hence, **all** functions, data structures, classes, and -variables - even the ones in *src/adiar/internal/* that are not part of the -public API - should be well documented for both the *end users* and also the +variables - even the ones in *adiar::internal* that are not part of the public +API - should be well documented for both the *end users* and especially also the *developers*. ### §6 Test Everything Thoroughly Adiar's Decision Diagrams are to be used in the context of verification of -critical software. At the same time, the Adiar's algorithms are much more -complex than other BDD implementations and have multiple layers from which an -error could originate. +critical software. At the same time, Adiar's algorithms are much more complex +than other BDD implementations and have multiple layers from which an error +could originate. Hence, it is vital we can ensure correctness of Adiar by having as thorough unit -testing as possible. This also applies to everything within -*src/adiar/internal/* that is not part of the public API. +testing as possible. This also applies to everything within *adiar::internal* +that is not part of the public API. diff --git a/docs/Doxyfile.in b/docs/Doxyfile.in index ccacc0b13..3b0a2042c 100644 --- a/docs/Doxyfile.in +++ b/docs/Doxyfile.in @@ -872,10 +872,10 @@ INPUT = @CMAKE_SOURCE_DIR@/docs/index.md \ @CMAKE_SOURCE_DIR@/docs/cite.md \ @CMAKE_SOURCE_DIR@/docs/ \ @CMAKE_SOURCE_DIR@/src/adiar/adiar.h \ - @CMAKE_SOURCE_DIR@/src/adiar/functional.h \ @CMAKE_SOURCE_DIR@/src/adiar/access_mode.h \ @CMAKE_SOURCE_DIR@/src/adiar/memory_mode.h \ @CMAKE_SOURCE_DIR@/src/adiar/quantify_mode.h \ + @CMAKE_SOURCE_DIR@/src/adiar/functional.h \ @CMAKE_SOURCE_DIR@/src/adiar/bdd.h \ @CMAKE_SOURCE_DIR@/src/adiar/bdd/bdd.h \ @CMAKE_SOURCE_DIR@/src/adiar/zdd.h \ diff --git a/example/knights_tour.cpp b/example/knights_tour.cpp index 15b2aaba6..46e700792 100644 --- a/example/knights_tour.cpp +++ b/example/knights_tour.cpp @@ -25,7 +25,7 @@ size_t largest_nodes = 1; * finally by time. Most importantly, this means that any "snapshot" of the * board at a specific time-step are grouped together. */ -inline typename adiar::zdd::label_t int_of_position(int N, int r, int c, int t = 0) +inline typename adiar::zdd::label_type int_of_position(int N, int r, int c, int t = 0) { return (N * N * t) + (N * r) + c; } @@ -425,7 +425,7 @@ int main(int argc, char* argv[]) // ===== ADIAR ===== // Print statistics, if compiled with those flags. - adiar::adiar_printstat(); + adiar::statistics_print(); // Close all of Adiar down again adiar::adiar_deinit(); diff --git a/example/queens.cpp b/example/queens.cpp index 076fd6d68..22b20147e 100644 --- a/example/queens.cpp +++ b/example/queens.cpp @@ -20,7 +20,7 @@ size_t largest_nodes = 0; * * N*i + j. */ -inline typename adiar::bdd::label_t label_of_position(uint64_t N, uint64_t i, uint64_t j) +inline typename adiar::bdd::label_type label_of_position(uint64_t N, uint64_t i, uint64_t j) { return (N * i) + j; } @@ -83,7 +83,7 @@ adiar::bdd n_queens_S(int i, int j) // On row of the queen in question int column = N - 1; do { - typename adiar::bdd::label_t label = label_of_position(N, row, column); + typename adiar::bdd::label_type label = label_of_position(N, row, column); // If (row, column) == (i,j), then the chain goes through high because // then we need to check the queen actually is placed here. @@ -220,12 +220,12 @@ void n_queens_print_solution(std::vector& assignment) /* At this point, we now also need to convert an assignment back into a position * on the board. So, we'll also need the following two small functions. */ -inline uint64_t i_of_label(uint64_t N, typename adiar::bdd::label_t label) +inline uint64_t i_of_label(uint64_t N, typename adiar::bdd::label_type label) { return label / N; } -inline uint64_t j_of_label(uint64_t N, typename adiar::bdd::label_t label) +inline uint64_t j_of_label(uint64_t N, typename adiar::bdd::label_type label) { return label % N; } @@ -237,7 +237,7 @@ uint64_t n_queens_list(uint64_t N, uint64_t column, std::vector& partial_assignment, const adiar::bdd& constraints) { - if (adiar::is_false(constraints)) { + if (adiar::bdd_isfalse(constraints)) { return 0; } deepest_column = std::max(deepest_column, column); @@ -248,15 +248,15 @@ uint64_t n_queens_list(uint64_t N, uint64_t column, partial_assignment.push_back(row_q); // Construct the assignment for this entire column - adiar::shared_file> column_assignment; + adiar::shared_file> column_assignment; { // The assignment_writer has to be detached, before we call any bdd // functions. It is automatically detached upon destruction, hence we have // it in this little scope. - adiar::file_writer> aw(column_assignment); + adiar::file_writer> aw(column_assignment); for (uint64_t row = 0; row < N; row++) { - aw << adiar::map_pair(label_of_position(N, row, column), row == row_q); + aw << adiar::map_pair(label_of_position(N, row, column), row == row_q); } } @@ -272,7 +272,7 @@ uint64_t n_queens_list(uint64_t N, uint64_t column, // Obtain the lexicographically minimal true assignment. Well, only one // exists, so we get the only one left. - adiar::bdd_satmin(restricted_constraints, [&N, &partial_assignment](adiar::bdd::label_t x, bool v) { + adiar::bdd_satmin(restricted_constraints, [&N, &partial_assignment](adiar::bdd::label_type x, bool v) { // Skip all empty (false) locations if (!v) { return; } @@ -284,7 +284,7 @@ uint64_t n_queens_list(uint64_t N, uint64_t column, for (uint64_t c = N-1; c > column; c--) { partial_assignment.pop_back(); } - } else if (adiar::is_true(restricted_constraints)) { + } else if (adiar::bdd_istrue(restricted_constraints)) { n_queens_print_solution(partial_assignment); solutions += 1; } else { @@ -412,7 +412,7 @@ int main(int argc, char* argv[]) // ===== ADIAR ===== // Print statistics, if compiled with those flags. - adiar::adiar_printstat(); + adiar::statistics_print(); // Close all of Adiar down again adiar::adiar_deinit(); diff --git a/src/adiar/CMakeLists.txt b/src/adiar/CMakeLists.txt index 23d5305cd..706c7c9cb 100644 --- a/src/adiar/CMakeLists.txt +++ b/src/adiar/CMakeLists.txt @@ -10,7 +10,6 @@ set(HEADERS assignment.h bool_op.h builder.h - data.h deprecated.h domain.h exception.h @@ -34,6 +33,7 @@ set(HEADERS # adiar/internal internal/assert.h + internal/bool_op.h internal/block_size.h internal/cnl.h internal/cut.h diff --git a/src/adiar/access_mode.cpp b/src/adiar/access_mode.cpp index e3db4d3ca..f4fd20cad 100644 --- a/src/adiar/access_mode.cpp +++ b/src/adiar/access_mode.cpp @@ -2,5 +2,5 @@ namespace adiar { - access_mode_t access_mode = access_mode_t::AUTO; + access_mode_t access_mode = access_mode_t::Auto; } diff --git a/src/adiar/access_mode.h b/src/adiar/access_mode.h index 4dada3f76..b8c035b01 100644 --- a/src/adiar/access_mode.h +++ b/src/adiar/access_mode.h @@ -19,21 +19,21 @@ namespace adiar /// \{ ////////////////////////////////////////////////////////////////////////////// - /// \brief Whether Adiar should exclusively use random access (RA) or - /// priority queues (PQ) or automatically pick either way based on - /// size of input. + /// \brief Whether Adiar should exclusively use random access + /// (`Random_Access`) or priority queues (`Priority_Queue`) or + /// automatically pick either way based on the width of inputs. /// /// \details - /// | Enum Value | Effect | - /// |------------|------------------------------------------------| - /// | `AUTO` | Automatically decide on type of access to use. | - /// | `RA` | Always use *random access*. | - /// | `PQ` | Always use *priority queues*. | + /// | Enum Value | Effect | + /// |------------------|------------------------------------------------| + /// | `Auto` | Automatically decide on type of access to use. | + /// | `Random_Access` | Always use *random access*. | + /// | `Priority_Queue` | Always use *priority queues*. | ////////////////////////////////////////////////////////////////////////////// - enum class access_mode_t { AUTO, RA, PQ }; + enum class access_mode_t { Auto, Random_Access, Priority_Queue }; ////////////////////////////////////////////////////////////////////////////// - /// \brief The current access mode (default: `AUTO`). + /// \brief The current access mode (default: `Auto`). /// /// \details /// If you want to force *Adiar* to a specific access mode then you should @@ -41,11 +41,11 @@ namespace adiar /// values. For example, one can force *Adiar* always use random access with /// the following piece of code. /// ```cpp - /// adiar::access_mode = adiar::access_mode_t::RA + /// adiar::access_mode = adiar::access_mode_t::Random_Access /// ``` /// - /// \warning Using `RA` may lead to crashes if all inputs are too wide or - /// input to random access is not canonical! + /// \warning Using `Random_Access` may lead to crashes if all inputs are too + /// wide or input to random access is not canonical! ////////////////////////////////////////////////////////////////////////////// extern access_mode_t access_mode; diff --git a/src/adiar/adiar.cpp b/src/adiar/adiar.cpp index fb4c975a7..66edb510c 100644 --- a/src/adiar/adiar.cpp +++ b/src/adiar/adiar.cpp @@ -6,7 +6,6 @@ #include #include -#include #include #include #include @@ -27,9 +26,9 @@ namespace adiar if (!_adiar_initialized && _tpie_initialized) { throw runtime_error("Adiar cannot be initialized after call to 'adiar_deinit()'"); } - if (memory_limit_bytes < MINIMUM_MEMORY) { + if (memory_limit_bytes < minimum_memory) { throw invalid_argument("Adiar requires at least " - + std::to_string(MINIMUM_MEMORY / 1024 / 1024) + + std::to_string(minimum_memory / 1024 / 1024) + " MiB of memory"); } @@ -54,12 +53,14 @@ namespace adiar // Initialise Adiar state // - reset statistics - adiar_statsreset(); + statistics_reset(); - // - reset memory moyde - memory_mode = memory_mode_t::AUTO; + // - reset enum settings + access_mode = access_mode_t::Auto; + memory_mode = memory_mode_t::Auto; + quantify_mode = quantify_mode_t::Auto; - // - all done, mark iniitialized + // - all done, mark initialized _adiar_initialized = true; } catch (const std::exception &e) { // LCOV_EXCL_START @@ -85,7 +86,7 @@ namespace adiar { if (!_adiar_initialized) return; - adiar_unset_domain(); + domain_unset(); tpie::tpie_finish(tpie::ALL); _adiar_initialized = false; diff --git a/src/adiar/adiar.h b/src/adiar/adiar.h index f10602486..b55164098 100644 --- a/src/adiar/adiar.h +++ b/src/adiar/adiar.h @@ -10,21 +10,26 @@ #include //////////////////////////////////////////////////////////////////////////////// -/// Core -#include -#include -#include -#include +/// Core types #include -#include #include +#include // <-- TODO: Remove! + +//////////////////////////////////////////////////////////////////////////////// +/// Core Settings +#include #include #include +//////////////////////////////////////////////////////////////////////////////// +/// Global Domain +#include + //////////////////////////////////////////////////////////////////////////////// /// Decision Diagrams #include #include +#include //////////////////////////////////////////////////////////////////////////////// /// Statistics @@ -54,21 +59,21 @@ namespace adiar ////////////////////////////////////////////////////////////////////////////// /// \brief Minimum value of 128 MiB for the memory limit. ////////////////////////////////////////////////////////////////////////////// - constexpr size_t MINIMUM_MEMORY = 128 * 1024 * 1024; + constexpr size_t minimum_memory = 128 * 1024 * 1024; ////////////////////////////////////////////////////////////////////////////// /// \brief Initiates Adiar with the given amount of memory (given in bytes) /// /// \param memory_limit_bytes /// The amount of internal memory (in bytes) that Adiar is allowed to use. - /// This has to be at least MINIMUM_BYTES. + /// This has to be at least minimum_memory. /// /// \param temp_dir /// The directory in which to place all temporary files. Default on Linux is /// the */tmp* library. /// /// \throws invalid_argument If `memory_limit_bytes` is set to a value less - /// than the `MINIMUM_MEMORY` required. + /// than the `minimum_memory` required. /// /// \throws runtime_error If `adiar_init()` and then `adiar_deinit()` have /// been called previously. diff --git a/src/adiar/bdd.h b/src/adiar/bdd.h index e6fffff1a..c8eb0cb47 100644 --- a/src/adiar/bdd.h +++ b/src/adiar/bdd.h @@ -25,8 +25,6 @@ #include #include -#include - namespace adiar { ////////////////////////////////////////////////////////////////////////////// @@ -77,37 +75,39 @@ namespace adiar /// \brief The BDD representing the i'th variable. /// /// \param var The label of the desired variable. This value must be smaller - /// or equals to `bdd::MAX_LABEL`. + /// or equals to `bdd::max_label`. /// /// \returns \f$ x_{var} \f$ /// /// \throws invalid_argument If `var` is a too large value. ////////////////////////////////////////////////////////////////////////////// - bdd bdd_ithvar(bdd::label_t var); + bdd bdd_ithvar(bdd::label_type var); ////////////////////////////////////////////////////////////////////////////// /// \brief The BDD representing the negation of the i'th variable. /// /// \param var The label of the desired variable. This value must be smaller - /// or equals to `bdd::MAX_LABEL`. + /// or equals to `bdd::max_label`. /// /// \returns \f$ \neg x_{var} \f$ /// /// \throws invalid_argument If `var` is a too large value. ////////////////////////////////////////////////////////////////////////////// - bdd bdd_nithvar(bdd::label_t var); + bdd bdd_nithvar(bdd::label_type var); ////////////////////////////////////////////////////////////////////////////// /// \brief The BDD representing the logical 'and' of all the given /// variables, i.e. a *term* of variables. /// - /// \param vars Generator of labels of variables in descending order + /// \param vars Generator of labels of variables in *descending* order. When + /// none are left it must return a value greater than + /// `bdd::max_label`. /// /// \returns \f$ \bigwedge_{x \in \mathit{vars}} x \f$ /// /// \throws invalid_argument If `vars` are not in descending order. ////////////////////////////////////////////////////////////////////////////// - bdd bdd_and(const generator &vars); + bdd bdd_and(const generator &vars); ////////////////////////////////////////////////////////////////////////////// /// \brief The BDD representing the logical 'and' of all the given @@ -133,13 +133,15 @@ namespace adiar /// \details Creates a BDD with a chain of nodes on the 'low' arc to the /// true child, and false otherwise. /// - /// \param vars Generator of labels of variables in descending order + /// \param vars Generator of labels of variables in *descending* order. When + /// none are left it must return a value greater than + /// `bdd::max_label`. /// /// \returns \f$ \bigvee_{x \in \mathit{vars}} x \f$ /// /// \throws invalid_argument If `vars` are not in descending order. ////////////////////////////////////////////////////////////////////////////// - bdd bdd_or(const generator &vars); + bdd bdd_or(const generator &vars); ////////////////////////////////////////////////////////////////////////////// /// \brief The BDD representing the logical 'or' of all the given @@ -219,9 +221,9 @@ namespace adiar /// \see bdd_and /// /// \remark Since `bdd_and(begin, end)` has precedence over the implicit - /// conversion from `bdd::shared_nodes_t` to `bdd`, we have to do it + /// conversion from `bdd::shared_node_file_type` to `bdd`, we have to do it /// explicitly ourselves. - inline __bdd bdd_and(const bdd::shared_nodes_t &f, const bdd::shared_nodes_t &g) + inline __bdd bdd_and(const bdd::shared_node_file_type &f, const bdd::shared_node_file_type &g) { return bdd_apply(bdd(f), bdd(g), and_op); } /// \endcond @@ -261,9 +263,9 @@ namespace adiar /// \see bdd_or /// /// \remark Since `bdd_or(begin, end)` has precedence over the implicit - /// conversion from `bdd::shared_nodes_t` to `bdd`, we have to do it + /// conversion from `bdd::shared_node_file_type` to `bdd`, we have to do it /// explicitly ourselves. - inline __bdd bdd_or(const bdd::shared_nodes_t &f, const bdd::shared_nodes_t &g) + inline __bdd bdd_or(const bdd::shared_node_file_type &f, const bdd::shared_node_file_type &g) { return bdd_apply(bdd(f), bdd(g), or_op); } /// \endcond @@ -408,7 +410,7 @@ namespace adiar ////////////////////////////////////////////////////////////////////////////// // TODO v2.0 : Replace with `generator>`. __bdd bdd_restrict(const bdd &f, - const shared_file> &xs); + const shared_file> &xs); ////////////////////////////////////////////////////////////////////////////// /// \brief Existential quantification of a single variable. @@ -422,10 +424,10 @@ namespace adiar /// /// \returns \f$ \exists x_{var} : f \f$ ////////////////////////////////////////////////////////////////////////////// - __bdd bdd_exists(const bdd &f, bdd::label_t var); + __bdd bdd_exists(const bdd &f, bdd::label_type var); /// \cond - inline __bdd bdd_exists(bdd &&f, bdd::label_t var) + inline __bdd bdd_exists(bdd &&f, bdd::label_type var) { return bdd_exists(f, var); } /// \endcond @@ -444,10 +446,10 @@ namespace adiar /// /// \returns \f$ \exists x_i \in \texttt{vars} : f \f$ ////////////////////////////////////////////////////////////////////////////// - __bdd bdd_exists(const bdd &f, const predicate &vars); + __bdd bdd_exists(const bdd &f, const predicate &vars); /// \cond - __bdd bdd_exists(bdd &&f, const predicate &vars); + __bdd bdd_exists(bdd &&f, const predicate &vars); /// \endcond ////////////////////////////////////////////////////////////////////////////// @@ -460,14 +462,14 @@ namespace adiar /// /// \param gen Generator function, that produces variables to be quantified in /// *descending* order. When none are left to-be quantified, it - /// returns a value larger than `bdd::MAX_LABEL`. + /// returns a value larger than `bdd::max_label`. /// /// \returns \f$ \exists x_i \in \texttt{gen()} : f \f$ ////////////////////////////////////////////////////////////////////////////// - __bdd bdd_exists(const bdd &f, const generator &vars); + __bdd bdd_exists(const bdd &f, const generator &vars); /// \cond - __bdd bdd_exists(bdd &&f, const generator &vars); + __bdd bdd_exists(bdd &&f, const generator &vars); /// \endcond ////////////////////////////////////////////////////////////////////////////// @@ -508,10 +510,10 @@ namespace adiar /// /// \returns \f$ \forall x_{var} : f \f$ ////////////////////////////////////////////////////////////////////////////// - __bdd bdd_forall(const bdd &f, bdd::label_t var); + __bdd bdd_forall(const bdd &f, bdd::label_type var); /// \cond - inline __bdd bdd_forall(bdd &&f, bdd::label_t var) + inline __bdd bdd_forall(bdd &&f, bdd::label_type var) { return bdd_forall(f, var); } /// \endcond @@ -530,10 +532,10 @@ namespace adiar /// /// \returns \f$ \exists x_i \in \texttt{vars} : f \f$ ////////////////////////////////////////////////////////////////////////////// - __bdd bdd_forall(const bdd &f, const predicate &vars); + __bdd bdd_forall(const bdd &f, const predicate &vars); /// \cond - __bdd bdd_forall(bdd &&f, const predicate &vars); + __bdd bdd_forall(bdd &&f, const predicate &vars); /// \endcond ////////////////////////////////////////////////////////////////////////////// @@ -546,14 +548,14 @@ namespace adiar /// /// \param gen Generator function, that produces variables to be quantified in /// *descending* order. When none are left to-be quantified, it - /// returns a value larger than `bdd::MAX_LABEL`, e.g. -1. + /// returns a value larger than `bdd::max_label`, e.g. -1. /// /// \returns \f$ \forall x_i \in \texttt{gen()} : f \f$ ////////////////////////////////////////////////////////////////////////////// - __bdd bdd_forall(const bdd &f, const generator &vars); + __bdd bdd_forall(const bdd &f, const generator &vars); /// \cond - __bdd bdd_forall(bdd &&f, const generator &vars); + __bdd bdd_forall(bdd &&f, const generator &vars); /// \endcond ////////////////////////////////////////////////////////////////////////////// @@ -590,28 +592,26 @@ namespace adiar /// \{ ////////////////////////////////////////////////////////////////////////////// - /// \copydoc adiar::internal::is_canonical + /// \brief Check whether a given BDD is canonical. + /// + /// \copydetails adiar::internal::dd_iscanonical ////////////////////////////////////////////////////////////////////////////// - inline bool is_canonical(const bdd& f) - { return internal::is_canonical(f); } + bool bdd_iscanonical(const bdd& f); ////////////////////////////////////////////////////////////////////////////// /// \brief Whether this BDD represents a terminal. ////////////////////////////////////////////////////////////////////////////// - inline bool is_terminal(const bdd& f) - { return internal::is_terminal(f); } + bool bdd_isterminal(const bdd& f); ////////////////////////////////////////////////////////////////////////////// /// \brief Whether this BDD represents false terminal. ////////////////////////////////////////////////////////////////////////////// - inline bool is_false(const bdd& f) - { return internal::is_false(f); } + bool bdd_isfalse(const bdd& f); ////////////////////////////////////////////////////////////////////////////// /// \brief Whether this BDD represents true terminal. ////////////////////////////////////////////////////////////////////////////// - inline bool is_true(const bdd& f) - { return internal::is_true(f); } + bool bdd_istrue(const bdd& f); ////////////////////////////////////////////////////////////////////////////// /// \brief Whether f and g represent the same function. @@ -631,12 +631,13 @@ namespace adiar ////////////////////////////////////////////////////////////////////////////// /// \brief Whether f and g represent different functions. + /// + /// \see bdd_equal ////////////////////////////////////////////////////////////////////////////// - inline bool bdd_unequal(const bdd& f, const bdd& g) - { return !bdd_equal(f, g); } + bool bdd_unequal(const bdd& f, const bdd& g); ////////////////////////////////////////////////////////////////////////////// - /// \see bdd_unequal + /// \see bdd_equal bdd_unequal ////////////////////////////////////////////////////////////////////////////// bool operator!= (const bdd& f, const bdd& g); @@ -663,7 +664,7 @@ namespace adiar /// \brief The number of variables that influence the outcome of f, i.e. the /// number of levels in the BDD. ////////////////////////////////////////////////////////////////////////////// - bdd::label_t bdd_varcount(const bdd &f); + bdd::label_type bdd_varcount(const bdd &f); ////////////////////////////////////////////////////////////////////////////// /// \brief Count all unique (but not necessarily disjoint) paths to the true @@ -687,7 +688,7 @@ namespace adiar /// \throws invalid_argument If varcount is not larger than the number of /// levels in the BDD. ////////////////////////////////////////////////////////////////////////////// - uint64_t bdd_satcount(const bdd &f, bdd::label_t varcount); + uint64_t bdd_satcount(const bdd &f, bdd::label_type varcount); ////////////////////////////////////////////////////////////////////////////// /// \brief Count the number of assignments x that make f(x) true. @@ -696,7 +697,7 @@ namespace adiar /// the size of the global domain or the number of variables within /// the given BDD. /// - /// \see adiar_set_domain bdd_varcount + /// \see domain_set bdd_varcount ////////////////////////////////////////////////////////////////////////////// uint64_t bdd_satcount(const bdd &f); @@ -712,14 +713,12 @@ namespace adiar ////////////////////////////////////////////////////////////////////////////// /// \brief Get the minimal occurring variable in this BDD. ////////////////////////////////////////////////////////////////////////////// - inline bdd::label_t min_var(const bdd &f) - { return internal::min_var(f); } + bdd::label_type bdd_minvar(const bdd &f); ////////////////////////////////////////////////////////////////////////////// /// \brief Get the maximal occurring variable in this BDD. ////////////////////////////////////////////////////////////////////////////// - inline bdd::label_t max_var(const bdd &f) - { return internal::max_var(f); } + bdd::label_type bdd_maxvar(const bdd &f); ////////////////////////////////////////////////////////////////////////////// /// \brief The lexicographically smallest x such that f(x) is true. @@ -728,7 +727,7 @@ namespace adiar /// resulting assignment is lexicographically smallest, where every /// variable is treated as a digit and \f$ x_0 > x_1 > \dots \f$. /// - /// \remark If `adiar_has_domain() == true` then the assignment is to the + /// \remark If `domain_isset() == true` then the assignment is to the /// domain variables (and the visited bdd variables). If only the /// variables that exist within `f` is of interest, please unset the /// domain first. @@ -741,7 +740,7 @@ namespace adiar ////////////////////////////////////////////////////////////////////////////// /// \brief The lexicographically smallest x such that f(x) is true. /// - /// \remark If `adiar_has_domain() == true` then the assignment is to the + /// \remark If `domain_isset() == true` then the assignment is to the /// domain variables (and the visited bdd variables). If only the /// variables that exist within `f` is of interest, please unset the /// domain first. @@ -749,7 +748,7 @@ namespace adiar /// \param cb Callback function that is called in ascending order of the bdd's /// levels with the (var, value) pairs of the assignment. ////////////////////////////////////////////////////////////////////////////// - void bdd_satmin(const bdd &f, const consumer &cb); + void bdd_satmin(const bdd &f, const consumer &cb); ////////////////////////////////////////////////////////////////////////////// // TODO: Iterator-based output @@ -764,7 +763,7 @@ namespace adiar /// resulting assignment is lexicographically largest, where every /// variable is treated as a digit and \f$ x_0 > x_1 > \dots \f$. /// - /// \remark If `adiar_has_domain() == true` then the assignment is to the + /// \remark If `domain_isset() == true` then the assignment is to the /// domain variables (and the visited bdd variables). If only the /// variables that exist within `f` is of interest, please unset the /// domain first. @@ -777,7 +776,7 @@ namespace adiar ////////////////////////////////////////////////////////////////////////////// /// \brief The lexicographically largest x such that f(x) is true. /// - /// \remark If `adiar_has_domain() == true` then the assignment is to the + /// \remark If `domain_isset() == true` then the assignment is to the /// domain variables (and the visited bdd variables). If only the /// variables that exist within `f` is of interest, please unset the /// domain first. @@ -785,7 +784,7 @@ namespace adiar /// \param cb Callback function that is called in ascending order of the bdd's /// levels with the (var, value) pairs of the assignment. ////////////////////////////////////////////////////////////////////////////// - void bdd_satmax(const bdd &f, const consumer &cb); + void bdd_satmax(const bdd &f, const consumer &cb); ////////////////////////////////////////////////////////////////////////////// // TODO: Iterator-based output @@ -804,7 +803,7 @@ namespace adiar /// \param xs An assignment function of the type \f$ \texttt{label\_t} /// \rightarrow \texttt{bool} \f$. ////////////////////////////////////////////////////////////////////////////// - bool bdd_eval(const bdd &f, const predicate &xs); + bool bdd_eval(const bdd &f, const predicate &xs); ////////////////////////////////////////////////////////////////////////////// /// \brief Evaluate a BDD according to an assignment to its variables. @@ -822,7 +821,7 @@ namespace adiar ////////////////////////////////////////////////////////////////////////////// // TODO v2.0 : Replace with `generator>` bool bdd_eval(const bdd &f, - const shared_file> &xs); + const shared_file> &xs); ////////////////////////////////////////////////////////////////////////////// /// \brief Get the labels of the levels of the BDD. @@ -831,7 +830,7 @@ namespace adiar /// /// \param cb Callback function that consumes the levels (in ascending order). ////////////////////////////////////////////////////////////////////////////// - void bdd_varprofile(const bdd &f, const consumer &cb); + void bdd_varprofile(const bdd &f, const consumer &cb); ////////////////////////////////////////////////////////////////////////////// /// \brief Write the labels of the BDD's levels into the given container. @@ -868,12 +867,14 @@ namespace adiar /// /// \param A Family of a set (within the given domain) /// - /// \param dom Generator function of domain variables in ascending order + /// \param dom Generator function of domain variables in *ascending* order. + /// When none are left it must return a value greater than + /// `bdd::max_label`. /// /// \returns BDD that is true for the exact same assignments to variables in /// the given domain. ////////////////////////////////////////////////////////////////////////////// - __bdd bdd_from(const zdd &A, const generator &dom); + __bdd bdd_from(const zdd &A, const generator &dom); ////////////////////////////////////////////////////////////////////////////// /// \brief Obtains the BDD that represents the same function/set as the @@ -898,7 +899,7 @@ namespace adiar /// \returns BDD that is true for the exact same assignments to variables in /// the global domain. /// - /// \see adiar_set_domain adiar_has_domain + /// \see domain_set domain_isset /// /// \pre The global \ref module__domain is set to a set of variables /// that is equals to or a superset of the variables in `A`. diff --git a/src/adiar/bdd/apply.cpp b/src/adiar/bdd/apply.cpp index 8fd4afeaf..4594c083a 100644 --- a/src/adiar/bdd/apply.cpp +++ b/src/adiar/bdd/apply.cpp @@ -3,6 +3,7 @@ #include #include +#include #include #include #include @@ -17,12 +18,12 @@ namespace adiar static __bdd resolve_same_file(const bdd &bdd_1, const bdd &bdd_2, const bool_op &op) { - bdd::ptr_t terminal_1_F = bdd::ptr_t(bdd_1.negate); - bdd::ptr_t terminal_2_F = bdd::ptr_t(bdd_2.negate); + bdd::pointer_type terminal_1_F = bdd::pointer_type(bdd_1.negate); + bdd::pointer_type terminal_2_F = bdd::pointer_type(bdd_2.negate); // Compute the results on all children. - bdd::ptr_t op_F = op(terminal_1_F, terminal_2_F); - bdd::ptr_t op_T = op(negate(terminal_1_F), negate(terminal_2_F)); + bdd::pointer_type op_F = op(terminal_1_F, terminal_2_F); + bdd::pointer_type op_T = op(negate(terminal_1_F), negate(terminal_2_F)); // Does it collapse to a terminal? if (op_F == op_T) { @@ -37,29 +38,29 @@ namespace adiar const bdd& bdd_2, const bool_op &op) { - adiar_assert(is_terminal(bdd_1) || is_terminal(bdd_2)); + adiar_assert(bdd_isterminal(bdd_1) || bdd_isterminal(bdd_2)); - if (is_terminal(bdd_1) && is_terminal(bdd_2)) { - const bdd::ptr_t p1 = bdd::ptr_t(value_of(bdd_1)); - const bdd::ptr_t p2 = bdd::ptr_t(value_of(bdd_2)); + if (bdd_isterminal(bdd_1) && bdd_isterminal(bdd_2)) { + const bdd::pointer_type p1 = bdd::pointer_type(dd_valueof(bdd_1)); + const bdd::pointer_type p2 = bdd::pointer_type(dd_valueof(bdd_2)); return bdd_terminal(op(p1, p2).value()); - } else if (is_terminal(bdd_1)) { - const bdd::ptr_t p1 = bdd::ptr_t(value_of(bdd_1)); + } else if (bdd_isterminal(bdd_1)) { + const bdd::pointer_type p1 = bdd::pointer_type(dd_valueof(bdd_1)); if (can_left_shortcut(op, p1)) { - return bdd_terminal(op(p1, bdd::ptr_t(false)).value()); + return bdd_terminal(op(p1, bdd::pointer_type(false)).value()); } if (is_left_irrelevant(op, p1)) { return bdd_2; } // if (is_left_negating(op, p1)) return bdd_not(bdd_2); - } else { // if (is_terminal(bdd_2)) { - const bdd::ptr_t p2 = bdd::ptr_t(value_of(bdd_2)); + } else { // if (bdd_isterminal(bdd_2)) { + const bdd::pointer_type p2 = bdd::pointer_type(dd_valueof(bdd_2)); if (can_right_shortcut(op, p2)) { - return bdd_terminal(op(bdd::ptr_t(false), p2).value()); + return bdd_terminal(op(bdd::pointer_type(false), p2).value()); } if (is_right_irrelevant(op, p2)) { return bdd_1; @@ -71,32 +72,32 @@ namespace adiar } public: - static internal::cut_type left_cut(const bool_op &op) + static internal::cut left_cut(const bool_op &op) { - const bool incl_false = !can_left_shortcut(op, bdd::ptr_t(false)); - const bool incl_true = !can_left_shortcut(op, bdd::ptr_t(true)); + const bool incl_false = !can_left_shortcut(op, bdd::pointer_type(false)); + const bool incl_true = !can_left_shortcut(op, bdd::pointer_type(true)); - return internal::cut_type_with(incl_false, incl_true); + return internal::cut(incl_false, incl_true); } - static internal::cut_type right_cut(const bool_op &op) + static internal::cut right_cut(const bool_op &op) { - const bool incl_false = !can_right_shortcut(op, bdd::ptr_t(false)); - const bool incl_true = !can_right_shortcut(op, bdd::ptr_t(true)); + const bool incl_false = !can_right_shortcut(op, bdd::pointer_type(false)); + const bool incl_true = !can_right_shortcut(op, bdd::pointer_type(true)); - return internal::cut_type_with(incl_false, incl_true); + return internal::cut(incl_false, incl_true); } private: - static internal::tuple + static internal::tuple __resolve_request(const bool_op &op, - const internal::tuple &r) + const internal::tuple &r) { if (r[0].is_terminal() && can_left_shortcut(op, r[0])) { - return { r[0], bdd::ptr_t(true) }; + return { r[0], bdd::pointer_type(true) }; } if (r[1].is_terminal() && can_right_shortcut(op, r[1])) { - return { bdd::ptr_t(true), r[1] }; + return { bdd::pointer_type(true), r[1] }; } return r; } @@ -104,8 +105,8 @@ namespace adiar public: static internal::prod2_rec resolve_request(const bool_op &op, - const internal::tuple &r_low, - const internal::tuple &r_high) + const internal::tuple &r_low, + const internal::tuple &r_high) { return internal::prod2_rec_output { __resolve_request(op, r_low), diff --git a/src/adiar/bdd/bdd.cpp b/src/adiar/bdd/bdd.cpp index 782f0db2f..385a2bd30 100644 --- a/src/adiar/bdd/bdd.cpp +++ b/src/adiar/bdd/bdd.cpp @@ -21,11 +21,11 @@ namespace adiar : internal::__dd() { } - __bdd::__bdd(const internal::__dd::shared_nodes_t &f) + __bdd::__bdd(const internal::__dd::shared_node_file_type &f) : internal::__dd(f) { } - __bdd::__bdd(const internal::__dd::shared_arcs_t &f) + __bdd::__bdd(const internal::__dd::shared_arc_file_type &f) : internal::__dd(f) { } @@ -35,45 +35,45 @@ namespace adiar ////////////////////////////////////////////////////////////////////////////// // 'bdd' Constructors - bdd::bdd(const internal::dd::shared_nodes_t &f, bool negate) - : internal::dd(f, negate) + bdd::bdd(bool t) + : bdd(bdd_terminal(t)) { } - bdd::bdd(const bdd &o) - : internal::dd(o) + bdd::bdd() + : bdd(false) { } - bdd::bdd(bdd &&o) - : internal::dd(o) + bdd::bdd(const internal::dd::shared_node_file_type &f, bool negate) + : internal::dd(f, negate) { } - bdd::bdd(__bdd &&o) - : internal::dd(internal::reduce(std::forward<__bdd>(o))) + bdd::bdd(const bdd &f) + : internal::dd(f) { } - bdd::bdd(bool v) - : bdd(bdd_terminal(v)) + bdd::bdd(bdd &&f) + : internal::dd(f) { } - bdd::bdd() - : bdd(false) + bdd::bdd(__bdd &&f) + : internal::dd(internal::reduce(std::move(f))) { } ////////////////////////////////////////////////////////////////////////////// // Operators - bdd operator~ (__bdd &&in) { return ~bdd(std::forward<__bdd>(in)); } + bdd operator~ (__bdd &&in) { return ~bdd(std::move(in)); } #define __bdd_oper(out_t, op) \ out_t operator op (__bdd &&lhs, __bdd &&rhs) { \ - return bdd(std::forward<__bdd>(lhs)) op bdd(std::forward<__bdd>(rhs)); \ + return bdd(std::move(lhs)) op bdd(std::move(rhs)); \ } \ \ out_t operator op (const bdd &lhs, __bdd &&rhs) { \ - return lhs op bdd(std::forward<__bdd>(rhs)); \ + return lhs op bdd(std::move(rhs)); \ } \ \ out_t operator op (__bdd &&lhs, const bdd &rhs) { \ - return bdd(std::forward<__bdd>(lhs)) op rhs; \ + return bdd(std::move(lhs)) op rhs; \ } __bdd_oper(__bdd, &) @@ -92,7 +92,7 @@ namespace adiar bdd& bdd::operator= (__bdd &&other) { deref(); - return (*this = internal::reduce(std::forward<__bdd>(other))); + return (*this = internal::reduce(std::move(other))); } bdd& bdd::operator&= (const bdd &other) @@ -156,14 +156,24 @@ namespace adiar ////////////////////////////////////////////////////////////////////////////// // Input variables - void bdd_varprofile(const bdd &f, const consumer &cb) + bdd::label_type bdd_minvar(const bdd &f) + { + return internal::dd_minvar(f); + } + + bdd::label_type bdd_maxvar(const bdd &f) + { + return internal::dd_maxvar(f); + } + + void bdd_varprofile(const bdd &f, const consumer &cb) { return internal::dd_varprofile(f, cb); } ////////////////////////////////////////////////////////////////////////////// // Conversion - __bdd bdd_from(const zdd &A, const generator &dom) + __bdd bdd_from(const zdd &A, const generator &dom) { return internal::intercut> (A, dom); @@ -171,8 +181,8 @@ namespace adiar __bdd bdd_from(const zdd &A) { - const shared_file dom = adiar_get_domain(); - internal::file_stream ds(dom); + const shared_file dom = domain_get(); + internal::file_stream ds(dom); return internal::intercut> (A, make_generator(ds)); @@ -182,11 +192,11 @@ namespace adiar // Debug void bdd_printdot(const bdd &f, std::ostream &out) { - internal::output_dot(f, out); + internal::print_dot(f, out); } void bdd_printdot(const bdd &f, const std::string &file_name) { - internal::output_dot(f, file_name); + internal::print_dot(f, file_name); } } diff --git a/src/adiar/bdd/bdd.h b/src/adiar/bdd/bdd.h index a91f2eae3..e7fc9b499 100644 --- a/src/adiar/bdd/bdd.h +++ b/src/adiar/bdd/bdd.h @@ -3,7 +3,6 @@ #include -#include #include namespace adiar @@ -26,10 +25,10 @@ namespace adiar __bdd(); //////////////////////////////////////////////////////////////////////////// - __bdd(const internal::__dd::shared_nodes_t &f); + __bdd(const internal::__dd::shared_node_file_type &f); //////////////////////////////////////////////////////////////////////////// - __bdd(const internal::__dd::shared_arcs_t &f); + __bdd(const internal::__dd::shared_arc_file_type &f); //////////////////////////////////////////////////////////////////////////// __bdd(const bdd &bdd); @@ -56,7 +55,7 @@ namespace adiar friend bdd bdd_not(const bdd&); friend bdd bdd_not(bdd&&); friend size_t bdd_nodecount(const bdd&); - friend typename internal::dd::label_t bdd_varcount(const bdd&); + friend typename bdd::label_type bdd_varcount(const bdd&); friend __bdd bdd_ite(const bdd &bdd_if, const bdd &bdd_then, const bdd &bdd_else); @@ -76,23 +75,51 @@ namespace adiar //////////////////////////////////////////////////////////////////////////// // Constructors public: + //////////////////////////////////////////////////////////////////////////// + /// \brief Default construction, creating the false terminal. + /// + /// \see bdd_false //////////////////////////////////////////////////////////////////////////// bdd(); //////////////////////////////////////////////////////////////////////////// - bdd(const internal::dd::shared_nodes_t &f, bool negate = false); + /// \brief Implicit conversion from a terminal value to construct the + /// `false` and `true` terminals. + /// + /// \see bdd_terminal, bdd_false, bdd_true + //////////////////////////////////////////////////////////////////////////// + bdd(bdd::terminal_type t); + /// \cond + //////////////////////////////////////////////////////////////////////////// + /// \brief Constructor to wrap the node-based result of an algorithm. //////////////////////////////////////////////////////////////////////////// - bdd(const bdd &o); + bdd(const bdd::shared_node_file_type &f, bool negate = false); + /// \endcond //////////////////////////////////////////////////////////////////////////// - bdd(bdd &&o); + /// \brief Copy construction, incrementing the reference count on the file + /// underneath. + //////////////////////////////////////////////////////////////////////////// + bdd(const bdd &f); //////////////////////////////////////////////////////////////////////////// - bdd(__bdd &&o); + /// \brief Move construction, taking over ownership of the files underneath. + //////////////////////////////////////////////////////////////////////////// + bdd(bdd &&f); //////////////////////////////////////////////////////////////////////////// - bdd(bool v); + /// \brief Implicit move conversion from a possibly to-be reduced result + /// from an algorithm to a `bdd`. + /// + /// \details Since the `adiar::internal::reduce` algorithm is run as part of + /// this constructor, the scoping rules ensure we garbage collect + /// irrelevant files as early as possible. + /// + /// \remark Since the value `o` is forced to be moved, we force the content + /// of `o` to be destructed after finishing the *Reduce* algorithm. + //////////////////////////////////////////////////////////////////////////// + bdd(__bdd &&f); //////////////////////////////////////////////////////////////////////////// // Assignment operator overloadings diff --git a/src/adiar/bdd/bdd_policy.h b/src/adiar/bdd/bdd_policy.h index 61c1aa7a8..6fb8a4198 100644 --- a/src/adiar/bdd/bdd_policy.h +++ b/src/adiar/bdd/bdd_policy.h @@ -12,11 +12,11 @@ namespace adiar ////////////////////////////////////////////////////////////////////////////// /// \brief Logic related to being a 'Binary' Decision Diagram. ////////////////////////////////////////////////////////////////////////////// - typedef internal::dd_policy bdd_policy; + using bdd_policy = internal::dd_policy; template<> - inline bdd::ptr_t - bdd_policy::reduction_rule(const bdd::node_t &n) + inline bdd::pointer_type + bdd_policy::reduction_rule(const bdd::node_type &n) { // If adding attributed edges, i.e. complement edges: // remove the 'unflag' below. Currently, it removes any forwarding of @@ -26,8 +26,8 @@ namespace adiar } template<> - inline bdd_policy::children_t - bdd_policy::reduction_rule_inv(const bdd::ptr_t &child) + inline bdd_policy::children_type + bdd_policy::reduction_rule_inv(const bdd::pointer_type &child) { return { child, child }; } @@ -36,13 +36,13 @@ namespace adiar template<> inline void bdd_policy::compute_cofactor(const bool /*on_level*/, - /*const*/ bdd::ptr_t &, - /*const*/ bdd::ptr_t &) + /*const*/ bdd::pointer_type &, + /*const*/ bdd::pointer_type &) { /* do nothing */ } template<> - inline bdd_policy::children_t - bdd_policy::compute_cofactor(const bool /*on_level*/, const bdd_policy::children_t &children) + inline bdd_policy::children_type + bdd_policy::compute_cofactor(const bool /*on_level*/, const bdd_policy::children_type &children) { return children; } } diff --git a/src/adiar/bdd/build.cpp b/src/adiar/bdd/build.cpp index f15568272..2d98cd2f5 100644 --- a/src/adiar/bdd/build.cpp +++ b/src/adiar/bdd/build.cpp @@ -18,37 +18,37 @@ namespace adiar return internal::build_terminal(value); } - bdd bdd_true() + bdd bdd_false() { - return internal::build_terminal(true); + return internal::build_terminal(false); } - bdd bdd_false() + bdd bdd_true() { - return internal::build_terminal(false); + return internal::build_terminal(true); } ////////////////////////////////////////////////////////////////////////////// - bdd bdd_ithvar(bdd::label_t label) + bdd bdd_ithvar(bdd::label_type label) { return internal::build_ithvar(label); } ////////////////////////////////////////////////////////////////////////////// - bdd bdd_nithvar(bdd::label_t label) + bdd bdd_nithvar(bdd::label_type label) { return bdd_not(internal::build_ithvar(label)); } ////////////////////////////////////////////////////////////////////////////// - bdd bdd_and(const generator &vars) + bdd bdd_and(const generator &vars) { internal::chain_high p; return internal::build_chain<>(p, vars); } ////////////////////////////////////////////////////////////////////////////// - bdd bdd_or(const generator &vars) + bdd bdd_or(const generator &vars) { internal::chain_low p; return internal::build_chain<>(p, vars); diff --git a/src/adiar/bdd/count.cpp b/src/adiar/bdd/count.cpp index ce78684aa..fcdf1f7b0 100644 --- a/src/adiar/bdd/count.cpp +++ b/src/adiar/bdd/count.cpp @@ -6,6 +6,7 @@ #include #include #include +#include #include namespace adiar @@ -14,7 +15,7 @@ namespace adiar // Data structures struct sat_sum : internal::path_sum { - bdd::label_t levels_visited = 0u; + bdd::label_type levels_visited = 0u; }; ////////////////////////////////////////////////////////////////////////////// @@ -33,12 +34,12 @@ namespace adiar class sat_count_policy : public bdd_policy { public: - typedef sat_sum queue_t; + using queue_t = sat_sum; template inline static uint64_t forward_request(count_pq_t &count_pq, - const bdd::label_t varcount, - const bdd::ptr_t child_to_resolve, + const bdd::label_type varcount, + const bdd::pointer_type child_to_resolve, const queue_t &request) { adiar_assert(request.sum > 0, "No 'empty' request should be created"); @@ -46,7 +47,7 @@ namespace adiar adiar_assert(request.levels_visited < varcount, "Cannot have already visited more levels than are expected"); - bdd::label_t levels_visited = request.levels_visited + 1u; + bdd::label_type levels_visited = request.levels_visited + 1u; if (child_to_resolve.is_terminal()) { return child_to_resolve.value() @@ -75,40 +76,40 @@ namespace adiar }; ////////////////////////////////////////////////////////////////////////////// - size_t bdd_nodecount(const bdd &bdd) + size_t bdd_nodecount(const bdd &f) { - return is_terminal(bdd) ? 0u : bdd->size(); + return internal::dd_nodecount(f); } - bdd::label_t bdd_varcount(const bdd &bdd) + bdd::label_type bdd_varcount(const bdd &f) { - return bdd->levels(); + return internal::dd_varcount(f); } - uint64_t bdd_pathcount(const bdd &bdd) + uint64_t bdd_pathcount(const bdd &f) { - return is_terminal(bdd) + return bdd_isterminal(f) ? 0 - : internal::count>(bdd, bdd_varcount(bdd)); + : internal::count>(f, bdd_varcount(f)); } - uint64_t bdd_satcount(const bdd& bdd, bdd::label_t varcount) + uint64_t bdd_satcount(const bdd& f, bdd::label_type varcount) { - if (varcount < bdd_varcount(bdd)) { + if (varcount < bdd_varcount(f)) { throw invalid_argument("'varcount' ought to be at least the number of levels in the BDD"); } - if (is_terminal(bdd)) { - return value_of(bdd) ? std::min(1u, varcount) << varcount : 0u; + if (bdd_isterminal(f)) { + return dd_valueof(f) ? std::min(1u, varcount) << varcount : 0u; } - return internal::count(bdd, varcount); + return internal::count(f, varcount); } uint64_t bdd_satcount(const bdd &f) { - const bdd::label_t domain_size = adiar_has_domain() ? adiar_get_domain()->size() : 0; - const bdd::label_t varcount = bdd_varcount(f); + const bdd::label_type domain_size = domain_isset() ? domain_get()->size() : 0; + const bdd::label_type varcount = bdd_varcount(f); return bdd_satcount(f, std::max(domain_size, varcount)); }; } diff --git a/src/adiar/bdd/evaluate.cpp b/src/adiar/bdd/evaluate.cpp index bc85130cb..9b1192ec1 100644 --- a/src/adiar/bdd/evaluate.cpp +++ b/src/adiar/bdd/evaluate.cpp @@ -16,15 +16,15 @@ namespace adiar { class bdd_eval_func_visitor { - const predicate ⁡ + const predicate ⁡ bool result = false; public: - bdd_eval_func_visitor(const predicate& f) + bdd_eval_func_visitor(const predicate& f) : af(f) { } - inline bdd::ptr_t visit(const bdd::node_t &n) + inline bdd::pointer_type visit(const bdd::node_type &n) { const bool a = af(n.label()); return a ? n.high() : n.low(); @@ -37,7 +37,7 @@ namespace adiar { return result; } }; - bool bdd_eval(const bdd &bdd, const predicate &af) + bool bdd_eval(const bdd &bdd, const predicate &af) { bdd_eval_func_visitor v(af); traverse(bdd, v); @@ -47,19 +47,19 @@ namespace adiar ////////////////////////////////////////////////////////////////////////////// class bdd_eval_file_visitor { - internal::file_stream> mps; - map_pair mp; + internal::file_stream> mps; + map_pair mp; bool result = false; public: - bdd_eval_file_visitor(const shared_file>& msf) + bdd_eval_file_visitor(const shared_file>& msf) : mps(msf) { if (mps.can_pull()) { mp = mps.pull(); } } - inline bdd::ptr_t visit(const bdd::node_t &n) + inline bdd::pointer_type visit(const bdd::node_type &n) { - const bdd::label_t level = n.label(); + const bdd::label_type level = n.label(); while (mp.level() < level) { if (!mps.can_pull()) { throw out_of_range("Labels are insufficient to traverse BDD"); @@ -86,7 +86,7 @@ namespace adiar }; bool bdd_eval(const bdd &bdd, - const shared_file> &mpf) + const shared_file> &mpf) { bdd_eval_file_visitor v(mpf); internal::traverse(bdd, v); @@ -97,7 +97,7 @@ namespace adiar class bdd_sat_bdd_callback { // TODO: replace with TPIE's external stack - using e = map_pair; + using e = map_pair; shared_file ef; internal::file_writer ew; @@ -106,8 +106,8 @@ namespace adiar bdd_sat_bdd_callback() : ew(ef) { } - void operator() (bdd::label_t x, bool v) - { ew << map_pair(x, v); } + void operator() (bdd::label_type x, bool v) + { ew << map_pair(x, v); } bdd get_bdd() { @@ -115,17 +115,17 @@ namespace adiar ew.detach(); internal::file_stream es(ef); - internal::shared_levelized_file nf; + internal::shared_levelized_file nf; internal::node_writer nw(nf); - bdd::ptr_t latest = bdd::ptr_t(true); + bdd::pointer_type latest = bdd::pointer_type(true); while (es.can_pull()) { const e kv = es.pull(); - const bdd::node_t n(kv.key(), bdd::MAX_ID, - kv.value() ? bdd::ptr_t(false) : latest, - kv.value() ? latest : bdd::ptr_t(false)); + const bdd::node_type n(kv.key(), bdd::max_id, + kv.value() ? bdd::pointer_type(false) : latest, + kv.value() ? latest : bdd::pointer_type(false)); nw.unsafe_push(n); nw.unsafe_push(internal::level_info(kv.key(), 1u)); @@ -133,10 +133,10 @@ namespace adiar latest = n.uid(); } - nf->max_1level_cut[internal::cut_type::INTERNAL] = 1u; - nf->max_1level_cut[internal::cut_type::INTERNAL_FALSE] = nf->number_of_terminals[false]; - nf->max_1level_cut[internal::cut_type::INTERNAL_TRUE] = 1u; // == nf->number_of_terminals[true] - nf->max_1level_cut[internal::cut_type::ALL] = nf->number_of_terminals[false] + 1u; + nf->max_1level_cut[internal::cut::Internal] = 1u; + nf->max_1level_cut[internal::cut::Internal_False] = nf->number_of_terminals[false]; + nf->max_1level_cut[internal::cut::Internal_True] = 1u; // == nf->number_of_terminals[true] + nf->max_1level_cut[internal::cut::All] = nf->number_of_terminals[false] + 1u; return nf; } @@ -144,14 +144,14 @@ namespace adiar class bdd_sat_lambda_callback { - const consumer &_c; + const consumer &_c; public: - bdd_sat_lambda_callback(const consumer &lambda) + bdd_sat_lambda_callback(const consumer &lambda) : _c(lambda) { } - void operator() (bdd::label_t x, bool v) const + void operator() (bdd::label_type x, bool v) const { _c(x,v); } }; @@ -162,7 +162,7 @@ namespace adiar visitor_t _visitor; callback_t& _callback; - bdd::label_t _lvl = bdd::MAX_LABEL+1u; + bdd::label_type _lvl = bdd::max_label+1u; lvl_stream_t _lvls; public: @@ -174,17 +174,17 @@ namespace adiar : _callback(cb), _lvls(lvl) { } - bdd::ptr_t visit(const bdd::node_t &n) + bdd::pointer_type visit(const bdd::node_type &n) { - const bdd::ptr_t next_ptr = _visitor.visit(n); + const bdd::pointer_type next_ptr = _visitor.visit(n); _lvl = n.label(); // set default to all skipped levels - while (_lvls.can_pull() && internal::__level_of(_lvls.peek()) < _lvl) { - _callback(internal::__level_of(_lvls.pull()), visitor_t::default_direction); + while (_lvls.can_pull() && internal::level_of(_lvls.peek()) < _lvl) { + _callback(internal::level_of(_lvls.pull()), visitor_t::default_direction); } // skip visited level (if exists) - if (_lvls.can_pull() && internal::__level_of(_lvls.peek()) == _lvl) { + if (_lvls.can_pull() && internal::level_of(_lvls.peek()) == _lvl) { _lvls.pull(); } @@ -197,8 +197,8 @@ namespace adiar _visitor.visit(s); while (_lvls.can_pull()) { - if (internal::__level_of(_lvls.peek()) <= _lvl) { _lvls.pull(); continue; }; - _callback(internal::__level_of(_lvls.pull()), visitor_t::default_direction); + if (internal::level_of(_lvls.peek()) <= _lvl) { _lvls.pull(); continue; }; + _callback(internal::level_of(_lvls.pull()), visitor_t::default_direction); } } }; @@ -206,9 +206,9 @@ namespace adiar template inline void __bdd_satX(const bdd &f, callback_t &_cb) { - if (adiar_has_domain()) { - bdd_sat_visitor, internal::shared_file> - v(_cb, adiar_get_domain()); + if (domain_isset()) { + bdd_sat_visitor, internal::shared_file> + v(_cb, domain_get()); internal::traverse(f,v); } else { bdd_sat_visitor, bdd> @@ -219,14 +219,14 @@ namespace adiar bdd bdd_satmin(const bdd &f) { - if (is_terminal(f)) { return f; } + if (bdd_isterminal(f)) { return f; } bdd_sat_bdd_callback _cb; __bdd_satX(f, _cb); return _cb.get_bdd(); } - void bdd_satmin(const bdd &f, const consumer &cb) + void bdd_satmin(const bdd &f, const consumer &cb) { bdd_sat_lambda_callback _cb(cb); __bdd_satX(f, _cb); @@ -234,14 +234,14 @@ namespace adiar bdd bdd_satmax(const bdd &f) { - if (is_terminal(f)) { return f; } + if (bdd_isterminal(f)) { return f; } bdd_sat_bdd_callback _cb; __bdd_satX(f, _cb); return _cb.get_bdd(); } - void bdd_satmax(const bdd &f, const consumer &cb) + void bdd_satmax(const bdd &f, const consumer &cb) { bdd_sat_lambda_callback _cb(cb); __bdd_satX(f, _cb); diff --git a/src/adiar/bdd/if_then_else.cpp b/src/adiar/bdd/if_then_else.cpp index eca0c4c62..d2acdbab0 100644 --- a/src/adiar/bdd/if_then_else.cpp +++ b/src/adiar/bdd/if_then_else.cpp @@ -5,6 +5,7 @@ #include #include #include +#include #include #include #include @@ -21,7 +22,7 @@ namespace adiar { ////////////////////////////////////////////////////////////////////////////// // Struct to hold statistics - stats_t::prod3_t stats_prod3; + statistics::prod3_t stats_prod3; ////////////////////////////////////////////////////////////////////////////// // Data structures @@ -36,11 +37,11 @@ namespace adiar template using ite_request = internal::request_data<3, internal::with_parent, nodes_carried>; - template + template using ite_priority_queue_1_t = internal::levelized_node_priority_queue, internal::request_data_first_lt>, - LOOK_AHEAD, mem_mode, 3>; + look_ahead, mem_mode, 3>; template using ite_priority_queue_2_t = @@ -56,7 +57,7 @@ namespace adiar ////////////////////////////////////////////////////////////////////////////// // Helper functions - internal::shared_levelized_file + internal::shared_levelized_file __ite_zip_bdds(const bdd &bdd_if, const bdd &bdd_then, const bdd &bdd_else) { // TODO: What is the performance of '<<' rather than 'unsafe_push'? If there @@ -67,10 +68,10 @@ namespace adiar // It can be approximated as: // max(bdd_if.max_1level_cut, bdd_then.max_1level_cut + bdd_else.max_1level_cut) - internal::node::ptr_t root_then = internal::node::ptr_t::NIL(); - internal::node::ptr_t root_else = internal::node::ptr_t::NIL(); + internal::node::pointer_type root_then = internal::node::pointer_type::nil(); + internal::node::pointer_type root_else = internal::node::pointer_type::nil(); - internal::shared_levelized_file out_nodes; + internal::shared_levelized_file out_nodes; internal::node_writer nw(out_nodes); // zip 'then' and 'else' cases @@ -99,23 +100,23 @@ namespace adiar while (in_nodes_if.can_pull()) { const internal::node n = in_nodes_if.pull(); - const internal::node::ptr_t low = n.low().is_terminal() + const internal::node::pointer_type low = n.low().is_terminal() ? (n.low().value() ? root_then : root_else) : n.low(); - const internal::node::ptr_t high = n.high().is_terminal() + const internal::node::pointer_type high = n.high().is_terminal() ? (n.high().value() ? root_then : root_else) : n.high(); nw << internal::node(n.uid(), low, high); } - for(size_t ct = 0u; ct < internal::CUT_TYPES; ct++) { + for(size_t ct = 0u; ct < internal::cut::size; ct++) { out_nodes->max_1level_cut[ct] = - std::max(bdd_if->max_1level_cut[internal::cut_type::ALL], + std::max(bdd_if->max_1level_cut[internal::cut::All], bdd_then->max_1level_cut[ct] + bdd_else->max_1level_cut[ct]); out_nodes->max_2level_cut[ct] = - std::max(bdd_if->max_2level_cut[internal::cut_type::ALL], + std::max(bdd_if->max_2level_cut[internal::cut::All], bdd_then->max_2level_cut[ct] + bdd_else->max_2level_cut[ct]); } @@ -123,9 +124,9 @@ namespace adiar } inline bool ite_must_forward(internal::node v, - internal::node::ptr_t t, - internal::node::label_t out_label, - internal::node::ptr_t t_seek) + internal::node::pointer_type t, + internal::node::label_type out_label, + internal::node::pointer_type t_seek) { return // is it a node at this level? @@ -138,9 +139,9 @@ namespace adiar inline void ite_init_request(internal::node_stream<> &in_nodes, internal::node &v, - const internal::node::label_t out_label, - internal::node::ptr_t &low, - internal::node::ptr_t &high) + const internal::node::label_type out_label, + internal::node::pointer_type &low, + internal::node::pointer_type &high) { if (v.label() == out_label) { low = v.low(); @@ -155,10 +156,10 @@ namespace adiar template inline void __ite_resolve_request(pq_1_t &ite_pq_1, internal::arc_writer &aw, - const internal::node::ptr_t source, - internal::node::ptr_t r_if, - internal::node::ptr_t r_then, - internal::node::ptr_t r_else) + const internal::node::pointer_type source, + internal::node::pointer_type r_if, + internal::node::pointer_type r_then, + internal::node::pointer_type r_else) { // Early shortcut an ite, if the terminals of both cases have collapsed to the // same anyway @@ -171,14 +172,14 @@ namespace adiar // Remove irrelevant parts of a request to prune requests similar to // shortcutting the operator in bdd_apply. - r_then = r_if.is_false() ? internal::node::ptr_t::NIL() : r_then; - r_else = r_if.is_true() ? internal::node::ptr_t::NIL() : r_else; + r_then = r_if.is_false() ? internal::node::pointer_type::nil() : r_then; + r_else = r_if.is_true() ? internal::node::pointer_type::nil() : r_else; if (r_if.is_terminal() && r_then.is_terminal()) { - // => ~internal::node::ptr_t::NIL() => r_if is a terminal with the 'true' value + // => ~internal::node::pointer_type::nil() => r_if is a terminal with the 'true' value aw.push_terminal(internal::arc(source, r_then)); } else if (r_if.is_terminal() && r_else.is_terminal()) { - // => ~internal::node::ptr_t::NIL() => r_if is a terminal with the 'false' value + // => ~internal::node::pointer_type::nil() => r_if is a terminal with the 'false' value aw.push_terminal(internal::arc(source, r_else)); } else { ite_pq_1.push({ {r_if, r_then, r_else}, {}, {source} }); @@ -210,8 +211,8 @@ namespace adiar // If the levels of 'then' and 'else' are disjoint and the 'if' BDD is above // the two others, then we can merely zip the 'then' and 'else' BDDs. This // is only O((N1+N2+N3)/B) I/Os! - if (max_var(bdd_if) < v_then.label() && - max_var(bdd_if) < v_else.label() && + if (bdd_maxvar(bdd_if) < v_then.label() && + bdd_maxvar(bdd_if) < v_else.label() && internal::disjoint_levels(bdd_then, bdd_else)) { return __ite_zip_bdds(bdd_if,bdd_then,bdd_else); } @@ -226,16 +227,16 @@ namespace adiar pq_3_t ite_pq_3(pq_3_memory, max_pq_3_size); // Process root and create initial recursion requests - internal::node::label_t out_label = first(v_if.uid(), v_then.uid(), v_else.uid()).label(); - internal::node::id_t out_id = 0; + internal::node::label_type out_label = first(v_if.uid(), v_then.uid(), v_else.uid()).label(); + internal::node::id_type out_id = 0; - internal::node::ptr_t low_if, low_then, low_else, high_if, high_then, high_else; + internal::node::pointer_type low_if, low_then, low_else, high_if, high_then, high_else; ite_init_request(in_nodes_if, v_if, out_label, low_if, high_if); ite_init_request(in_nodes_then, v_then, out_label, low_then, high_then); ite_init_request(in_nodes_else, v_else, out_label, low_else, high_else); { - const internal::node::uid_t out_uid(out_label, out_id++); + const internal::node::uid_type out_uid(out_label, out_id++); __ite_resolve_request(ite_pq_1, aw, out_uid.with(false), low_if, low_then, low_else); __ite_resolve_request(ite_pq_1, aw, out_uid.with(true), high_if, high_then, high_else); } @@ -262,8 +263,8 @@ namespace adiar && (ite_pq_2.empty() || ite_pq_1.top().target.first() < ite_pq_2.top().target.second()) && (ite_pq_3.empty() || ite_pq_1.top().target.first() < ite_pq_3.top().target.third())) { req = { ite_pq_1.top().target, - {{ { internal::node::ptr_t::NIL(), internal::node::ptr_t::NIL() }, - { internal::node::ptr_t::NIL(), internal::node::ptr_t::NIL() } }}, + {{ { internal::node::pointer_type::nil(), internal::node::pointer_type::nil() }, + { internal::node::pointer_type::nil(), internal::node::pointer_type::nil() } }}, ite_pq_1.top().data }; ite_pq_1.pop(); @@ -273,7 +274,7 @@ namespace adiar req = { ite_pq_2.top().target , { ite_pq_2.top().node_carry[0], - { internal::node::ptr_t::NIL(), internal::node::ptr_t::NIL() } }, + { internal::node::pointer_type::nil(), internal::node::pointer_type::nil() } }, ite_pq_2.top().data }; ite_pq_2.pop(); @@ -286,11 +287,11 @@ namespace adiar } // Seek request partially in stream - internal::node::ptr_t t_first = req.target.first(); - internal::node::ptr_t t_second = req.target.second(); - internal::node::ptr_t t_third = req.target.third(); + internal::node::pointer_type t_first = req.target.first(); + internal::node::pointer_type t_second = req.target.second(); + internal::node::pointer_type t_third = req.target.third(); - internal::node::ptr_t t_seek = with_data_2 ? t_third + internal::node::pointer_type t_seek = with_data_2 ? t_third : with_data_1 ? t_second : t_first; @@ -333,8 +334,8 @@ namespace adiar adiar_assert(!(with_data_1 && (number_of_elements_to_forward == 2)), "cannot have forwarded an element, hold two unforwarded items, and still need to forward for something"); - internal::node::children_t children_1; - internal::node::children_t children_2; + internal::node::children_type children_1; + internal::node::children_type children_2; if (with_data_1) { if (req.target[0] < t_seek || forward_else) { children_1 = req.node_carry[0]; @@ -366,7 +367,7 @@ namespace adiar : forward_then ? v_then : v_else; - internal::node::children_t v1_children = v1.children(); + internal::node::children_type v1_children = v1.children(); ite_pq_2.push({ req.target, { v1_children }, req.data }); while (ite_pq_1.can_pull() && ite_pq_1.top().target == req.target) { @@ -415,14 +416,14 @@ namespace adiar } // Resolve request - adiar_assert(out_id < bdd::MAX_ID, "Has run out of ids"); - const internal::node::uid_t out_uid(out_label, out_id++); + adiar_assert(out_id < bdd::max_id, "Has run out of ids"); + const internal::node::uid_type out_uid(out_label, out_id++); __ite_resolve_request(ite_pq_1, aw, out_uid.with(false), low_if, low_then, low_else); __ite_resolve_request(ite_pq_1, aw, out_uid.with(true), high_if, high_then, high_else); // Output ingoing arcs - internal::node::ptr_t source = req.data.source; + internal::node::pointer_type source = req.data.source; while (true) { internal::arc out_arc = { source, out_uid }; aw.push_internal(out_arc); @@ -458,21 +459,21 @@ namespace adiar const internal::dd &in_else) { // 2-level cuts for 'if', where we split the false and true arcs away. - const safe_size_t if_cut_internal = cut::get(in_if, internal::cut_type::INTERNAL); - const safe_size_t if_cut_falses = cut::get(in_if, internal::cut_type::INTERNAL_FALSE) - if_cut_internal; - const safe_size_t if_cut_trues = cut::get(in_if, internal::cut_type::INTERNAL_TRUE) - if_cut_internal; + const safe_size_t if_cut_internal = cut::get(in_if, internal::cut::Internal); + const safe_size_t if_cut_falses = cut::get(in_if, internal::cut::Internal_False) - if_cut_internal; + const safe_size_t if_cut_trues = cut::get(in_if, internal::cut::Internal_True) - if_cut_internal; // 2-level cuts for 'then' - const safe_size_t then_cut_internal = cut::get(in_then, internal::cut_type::INTERNAL); - const safe_size_t then_cut_falses = cut::get(in_then, internal::cut_type::INTERNAL_FALSE) - then_cut_internal; - const safe_size_t then_cut_trues = cut::get(in_then, internal::cut_type::INTERNAL_TRUE) - then_cut_internal; - const safe_size_t then_cut_all = cut::get(in_then, internal::cut_type::ALL); + const safe_size_t then_cut_internal = cut::get(in_then, internal::cut::Internal); + const safe_size_t then_cut_falses = cut::get(in_then, internal::cut::Internal_False) - then_cut_internal; + const safe_size_t then_cut_trues = cut::get(in_then, internal::cut::Internal_True) - then_cut_internal; + const safe_size_t then_cut_all = cut::get(in_then, internal::cut::All); // 2-level cuts for 'else' - const safe_size_t else_cut_internal = cut::get(in_else, internal::cut_type::INTERNAL); - const safe_size_t else_cut_falses = cut::get(in_else, internal::cut_type::INTERNAL_FALSE) - else_cut_internal; - const safe_size_t else_cut_trues = cut::get(in_else, internal::cut_type::INTERNAL_TRUE) - else_cut_internal; - const safe_size_t else_cut_all = cut::get(in_else, internal::cut_type::ALL); + const safe_size_t else_cut_internal = cut::get(in_else, internal::cut::Internal); + const safe_size_t else_cut_falses = cut::get(in_else, internal::cut::Internal_False) - else_cut_internal; + const safe_size_t else_cut_trues = cut::get(in_else, internal::cut::Internal_True) - else_cut_internal; + const safe_size_t else_cut_all = cut::get(in_else, internal::cut::All); // Compute 2-level cut where irrelevant pairs of terminals are not paired return to_size((if_cut_internal * (then_cut_all * else_cut_internal + then_cut_internal * else_cut_all @@ -531,14 +532,14 @@ namespace adiar } // Resolve being given a terminal in one of the cases - if (is_terminal(bdd_then)) { - return bdd_apply(value_of(bdd_then) ? bdd_if : bdd_not(bdd_if), + if (bdd_isterminal(bdd_then)) { + return bdd_apply(dd_valueof(bdd_then) ? bdd_if : bdd_not(bdd_if), bdd_else, - value_of(bdd_then) ? or_op : and_op); - } else if (is_terminal(bdd_else)) { + dd_valueof(bdd_then) ? or_op : and_op); + } else if (bdd_isterminal(bdd_else)) { return bdd_apply(bdd_if, bdd_then, - value_of(bdd_else) ? imp_op : and_op); + dd_valueof(bdd_else) ? imp_op : and_op); } // Compute amount of memory available for auxiliary data structures after @@ -554,13 +555,13 @@ namespace adiar - internal::arc_writer::memory_usage(); constexpr size_t data_structures_in_pq_1 = - ite_priority_queue_1_t::DATA_STRUCTURES; + ite_priority_queue_1_t::data_structures; constexpr size_t data_structures_in_pq_2 = - ite_priority_queue_2_t::DATA_STRUCTURES; + ite_priority_queue_2_t::data_structures; constexpr size_t data_structures_in_pq_3 = - ite_priority_queue_3_t::DATA_STRUCTURES; + ite_priority_queue_3_t::data_structures; const size_t pq_1_internal_memory = (aux_available_memory / (data_structures_in_pq_1 + data_structures_in_pq_2 + data_structures_in_pq_3)) * data_structures_in_pq_1; @@ -572,16 +573,16 @@ namespace adiar aux_available_memory - pq_1_internal_memory - pq_2_internal_memory; const size_t pq_1_memory_fits = - ite_priority_queue_1_t::memory_fits(pq_1_internal_memory); + ite_priority_queue_1_t::memory_fits(pq_1_internal_memory); const size_t pq_2_memory_fits = - ite_priority_queue_2_t::memory_fits(pq_2_internal_memory); + ite_priority_queue_2_t::memory_fits(pq_2_internal_memory); const size_t pq_3_memory_fits = - ite_priority_queue_3_t::memory_fits(pq_3_internal_memory); + ite_priority_queue_3_t::memory_fits(pq_3_internal_memory); - const bool internal_only = memory_mode == memory_mode_t::INTERNAL; - const bool external_only = memory_mode == memory_mode_t::EXTERNAL; + const bool internal_only = memory_mode == memory_mode_t::Internal; + const bool external_only = memory_mode == memory_mode_t::External; const size_t pq_1_bound = std::min({__ite_ilevel_upper_bound(bdd_if, bdd_then, bdd_else), __ite_ilevel_upper_bound(bdd_if, bdd_then, bdd_else)}); @@ -600,9 +601,9 @@ namespace adiar #ifdef ADIAR_STATS stats_prod3.lpq.unbucketed += 1u; #endif - return __bdd_ite, - ite_priority_queue_2_t, - ite_priority_queue_3_t> + return __bdd_ite, + ite_priority_queue_2_t, + ite_priority_queue_3_t> (bdd_if, bdd_then, bdd_else, pq_1_internal_memory, max_pq_1_size, pq_2_internal_memory, max_pq_2_size, pq_3_internal_memory, max_pq_3_size); } else if(!external_only && max_pq_1_size <= pq_1_memory_fits @@ -611,9 +612,9 @@ namespace adiar #ifdef ADIAR_STATS stats_prod3.lpq.internal += 1u; #endif - return __bdd_ite, - ite_priority_queue_2_t, - ite_priority_queue_3_t> + return __bdd_ite, + ite_priority_queue_2_t, + ite_priority_queue_3_t> (bdd_if, bdd_then, bdd_else, pq_1_internal_memory, max_pq_1_size, pq_2_internal_memory, max_pq_2_size, pq_3_internal_memory, max_pq_3_size); } else { @@ -624,9 +625,9 @@ namespace adiar const size_t pq_2_memory = pq_1_memory; const size_t pq_3_memory = pq_1_memory; - return __bdd_ite, - ite_priority_queue_2_t, - ite_priority_queue_3_t> + return __bdd_ite, + ite_priority_queue_2_t, + ite_priority_queue_3_t> (bdd_if, bdd_then, bdd_else, pq_1_memory, max_pq_1_size, pq_2_memory, max_pq_2_size, pq_3_memory, max_pq_3_size); } diff --git a/src/adiar/bdd/if_then_else.h b/src/adiar/bdd/if_then_else.h index 0c8b8651a..eac000344 100644 --- a/src/adiar/bdd/if_then_else.h +++ b/src/adiar/bdd/if_then_else.h @@ -5,7 +5,7 @@ namespace adiar { ////////////////////////////////////////////////////////////////////////////// /// Struct to hold statistics - extern stats_t::prod3_t stats_prod3; + extern statistics::prod3_t stats_prod3; } #endif //ADIAR_BDD_IF_THEN_ELSE_H \ No newline at end of file diff --git a/src/adiar/bdd/pred.cpp b/src/adiar/bdd/pred.cpp index 18d018c8d..1579b1959 100644 --- a/src/adiar/bdd/pred.cpp +++ b/src/adiar/bdd/pred.cpp @@ -4,8 +4,33 @@ namespace adiar { - bool bdd_equal(const bdd &f, const bdd &g) - { - return internal::is_isomorphic(f, g); - } + bool bdd_iscanonical(const bdd& f) + { + return internal::dd_iscanonical(f); + } + + bool bdd_isterminal(const bdd& f) + { + return internal::dd_isterminal(f); + } + + bool bdd_isfalse(const bdd& f) + { + return internal::dd_isfalse(f); + } + + bool bdd_istrue(const bdd& f) + { + return internal::dd_istrue(f); + } + + bool bdd_equal(const bdd &f, const bdd &g) + { + return internal::is_isomorphic(f, g); + } + + bool bdd_unequal(const bdd &f, const bdd &g) + { + return !bdd_equal(f, g); + } } diff --git a/src/adiar/bdd/quantify.cpp b/src/adiar/bdd/quantify.cpp index c83064ccd..af02f5618 100644 --- a/src/adiar/bdd/quantify.cpp +++ b/src/adiar/bdd/quantify.cpp @@ -3,8 +3,8 @@ #include -#include #include +#include #include #include #include @@ -18,8 +18,8 @@ namespace adiar class bdd_quantify_policy : public bdd_policy { public: - static inline bdd::ptr_t - resolve_root(const bdd::node_t &r, const bool_op &op) + static inline bdd::pointer_type + resolve_root(const bdd::node_type &r, const bool_op &op) { // TODO: should all but the last case not have a 'suppression taint'? @@ -45,27 +45,27 @@ namespace adiar public: static inline bool - keep_terminal(const bool_op &op, const bdd::ptr_t &p) + keep_terminal(const bool_op &op, const bdd::pointer_type &p) { // `op` is commutative, so we can check irrelevancy from either side. return !is_right_irrelevant(op, p); } static inline bool - collapse_to_terminal(const bool_op &op, const bdd::ptr_t &p) + collapse_to_terminal(const bool_op &op, const bdd::pointer_type &p) { // `op` is commutative, so we can check shortcutting from either side. return can_right_shortcut(op, p); } public: - static inline internal::cut_type + static inline internal::cut cut_with_terminals(const bool_op &op) { - const bool incl_false = !can_right_shortcut(op, bdd::ptr_t(false)); - const bool incl_true = !can_right_shortcut(op, bdd::ptr_t(true)); + const bool incl_false = !can_right_shortcut(op, bdd::pointer_type(false)); + const bool incl_true = !can_right_shortcut(op, bdd::pointer_type(true)); - return internal::cut_type_with(incl_false, incl_true); + return internal::cut(incl_false, incl_true); } public: @@ -73,53 +73,53 @@ namespace adiar }; ////////////////////////////////////////////////////////////////////////////// - __bdd bdd_exists(const bdd &f, bdd::label_t var) + __bdd bdd_exists(const bdd &f, bdd::label_type var) { return internal::quantify(f, var, or_op); } - __bdd bdd_exists(const bdd &f, const predicate &vars) + __bdd bdd_exists(const bdd &f, const predicate &vars) { return internal::quantify(f, vars, or_op); } - __bdd bdd_exists(bdd &&f, const predicate &vars) + __bdd bdd_exists(bdd &&f, const predicate &vars) { return internal::quantify(std::forward(f), vars, or_op); } - __bdd bdd_exists(const bdd &f, const generator &vars) + __bdd bdd_exists(const bdd &f, const generator &vars) { return internal::quantify(f, vars, or_op); } - __bdd bdd_exists(bdd &&f, const generator &vars) + __bdd bdd_exists(bdd &&f, const generator &vars) { return internal::quantify(std::forward(f), vars, or_op); } ////////////////////////////////////////////////////////////////////////////// - __bdd bdd_forall(const bdd &f, bdd::label_t var) + __bdd bdd_forall(const bdd &f, bdd::label_type var) { return internal::quantify(f, var, and_op); } - __bdd bdd_forall(const bdd &f, const predicate &vars) + __bdd bdd_forall(const bdd &f, const predicate &vars) { return internal::quantify(f, vars, and_op); } - __bdd bdd_forall(bdd &&f, const predicate &vars) + __bdd bdd_forall(bdd &&f, const predicate &vars) { return internal::quantify(std::forward(f), vars, and_op); } - __bdd bdd_forall(const bdd &f, const generator &vars) + __bdd bdd_forall(const bdd &f, const generator &vars) { return internal::quantify(f, vars, and_op); } - __bdd bdd_forall(bdd &&f, const generator &vars) + __bdd bdd_forall(bdd &&f, const generator &vars) { return internal::quantify(std::forward(f), vars, and_op); } diff --git a/src/adiar/bdd/restrict.cpp b/src/adiar/bdd/restrict.cpp index c45f88a84..fe1227cdb 100644 --- a/src/adiar/bdd/restrict.cpp +++ b/src/adiar/bdd/restrict.cpp @@ -12,17 +12,17 @@ namespace adiar { class substitute_assignment_file_mgr { - file_stream> mps; - map_pair mp; + file_stream> mps; + map_pair mp; public: - substitute_assignment_file_mgr(const shared_file> &mpf) + substitute_assignment_file_mgr(const shared_file> &mpf) : mps(mpf) { mp = mps.pull(); } - assignment assignment_for_level(bdd::label_t level) { + assignment assignment_for_level(bdd::label_type level) { while (mp.level() < level && mps.can_pull()) { mp = mps.pull(); } @@ -36,13 +36,13 @@ namespace adiar class bdd_restrict_policy : public bdd_policy { public: - static internal::substitute_rec keep_node(const bdd::node_t &n, substitute_assignment_file_mgr &/*amgr*/) + static internal::substitute_rec keep_node(const bdd::node_type &n, substitute_assignment_file_mgr &/*amgr*/) { return internal::substitute_rec_output { n }; } - static internal::substitute_rec fix_false(const bdd::node_t &n, substitute_assignment_file_mgr &/*amgr*/) + static internal::substitute_rec fix_false(const bdd::node_type &n, substitute_assignment_file_mgr &/*amgr*/) { return internal::substitute_rec_skipto { n.low() }; } - static internal::substitute_rec fix_true(const bdd::node_t &n, substitute_assignment_file_mgr &/*amgr*/) + static internal::substitute_rec fix_true(const bdd::node_type &n, substitute_assignment_file_mgr &/*amgr*/) { return internal::substitute_rec_skipto { n.high() }; } public: @@ -51,13 +51,19 @@ namespace adiar }; ////////////////////////////////////////////////////////////////////////////// + template<> + struct internal::level_stream_t>> + { + template + using stream_t = internal::file_stream>; + }; + __bdd bdd_restrict(const bdd &dd, - const shared_file> &a) + const shared_file> &a) { if (a->size() == 0 - || is_terminal(dd) - || internal::disjoint_levels>, - internal::file_stream>>(a, dd)) { + || bdd_isterminal(dd) + || internal::disjoint_levels(a, dd)) { return dd; } diff --git a/src/adiar/bool_op.h b/src/adiar/bool_op.h index 56e9607bd..dd0b1fb0b 100644 --- a/src/adiar/bool_op.h +++ b/src/adiar/bool_op.h @@ -23,65 +23,65 @@ namespace adiar ////////////////////////////////////////////////////////////////////////////// /// \brief Logical 'and' operator, i.e. the truth table: [1,0,0,0]. ////////////////////////////////////////////////////////////////////////////// - const bool_op and_op = [](const internal::ptr_uint64 &terminal1, const internal::ptr_uint64 &terminal2) -> internal::uid_uint64 + const bool_op and_op = [](const internal::ptr_uint64 &a, const internal::ptr_uint64 &b) -> internal::uid_uint64 { - return essential(terminal1 & terminal2); + return essential(a & b); }; ////////////////////////////////////////////////////////////////////////////// /// \brief Logical 'not and' operator, i.e. the truth table: [0,1,1,1]. ////////////////////////////////////////////////////////////////////////////// - const bool_op nand_op = [](const internal::ptr_uint64 &terminal1, const internal::ptr_uint64 &terminal2) -> internal::uid_uint64 + const bool_op nand_op = [](const internal::ptr_uint64 &a, const internal::ptr_uint64 &b) -> internal::uid_uint64 { - return negate(and_op(terminal1, terminal2)); + return negate(and_op(a, b)); }; ////////////////////////////////////////////////////////////////////////////// /// \brief Logical 'or' operator, i.e. the truth table: [1,1,1,0]. ////////////////////////////////////////////////////////////////////////////// - const bool_op or_op = [](const internal::ptr_uint64 &terminal1, const internal::ptr_uint64 &terminal2) -> internal::uid_uint64 + const bool_op or_op = [](const internal::ptr_uint64 &a, const internal::ptr_uint64 &b) -> internal::uid_uint64 { - return essential(terminal1 | terminal2); + return essential(a | b); }; ////////////////////////////////////////////////////////////////////////////// /// \brief Logical 'not or' operator, i.e. the truth table: [0,0,0,1]. ////////////////////////////////////////////////////////////////////////////// - const bool_op nor_op = [](const internal::ptr_uint64 &terminal1, const internal::ptr_uint64 &terminal2) -> internal::uid_uint64 + const bool_op nor_op = [](const internal::ptr_uint64 &a, const internal::ptr_uint64 &b) -> internal::uid_uint64 { - return negate(or_op(terminal1, terminal2)); + return negate(or_op(a, b)); }; ////////////////////////////////////////////////////////////////////////////// /// \brief Logical 'xor' operator, i.e. the truth table: [0,1,1,0]. ////////////////////////////////////////////////////////////////////////////// - const bool_op xor_op = [](const internal::ptr_uint64 &terminal1, const internal::ptr_uint64 &terminal2) -> internal::uid_uint64 + const bool_op xor_op = [](const internal::ptr_uint64 &a, const internal::ptr_uint64 &b) -> internal::uid_uint64 { - return essential(terminal1 ^ terminal2); + return essential(a ^ b); }; ////////////////////////////////////////////////////////////////////////////// /// \brief Logical 'xor' operator, i.e. the truth table: [1,0,0,1]. ////////////////////////////////////////////////////////////////////////////// - const bool_op xnor_op = [](const internal::ptr_uint64 &terminal1, const internal::ptr_uint64 &terminal2) -> internal::uid_uint64 + const bool_op xnor_op = [](const internal::ptr_uint64 &a, const internal::ptr_uint64 &b) -> internal::uid_uint64 { - return negate(xor_op(terminal1, terminal2)); + return negate(xor_op(a, b)); }; ////////////////////////////////////////////////////////////////////////////// /// \brief Logical 'implication' operator, i.e. the truth table: [1,0,1,1]. ////////////////////////////////////////////////////////////////////////////// - const bool_op imp_op = [](const internal::ptr_uint64 &terminal1, const internal::ptr_uint64 &terminal2) -> internal::uid_uint64 + const bool_op imp_op = [](const internal::ptr_uint64 &a, const internal::ptr_uint64 &b) -> internal::uid_uint64 { - return internal::ptr_uint64(essential(terminal1) <= essential(terminal2)); + return internal::ptr_uint64(essential(a) <= essential(b)); }; ////////////////////////////////////////////////////////////////////////////// /// \brief Logical 'implication' operator, i.e. the truth table: [1,1,0,1]. ////////////////////////////////////////////////////////////////////////////// - const bool_op invimp_op = [](const internal::ptr_uint64 &terminal1, const internal::ptr_uint64 &terminal2) -> internal::ptr_uint64 + const bool_op invimp_op = [](const internal::ptr_uint64 &a, const internal::ptr_uint64 &b) -> internal::ptr_uint64 { - return internal::ptr_uint64(essential(terminal2) <= essential(terminal1)); + return internal::ptr_uint64(essential(b) <= essential(a)); }; ////////////////////////////////////////////////////////////////////////////// @@ -92,98 +92,18 @@ namespace adiar ////////////////////////////////////////////////////////////////////////////// /// \brief Logical 'set difference' operator, i.e. the truth table [0,1,0,0]. ////////////////////////////////////////////////////////////////////////////// - const bool_op diff_op = [](const internal::ptr_uint64 &terminal1, const internal::ptr_uint64 &terminal2) -> internal::ptr_uint64 + const bool_op diff_op = [](const internal::ptr_uint64 &a, const internal::ptr_uint64 &b) -> internal::ptr_uint64 { - return and_op(terminal1, negate(terminal2)); + return and_op(a, negate(b)); }; ////////////////////////////////////////////////////////////////////////////// /// \brief Logical 'less' operator, i.e. the truth table [0,0,1,0]. ////////////////////////////////////////////////////////////////////////////// - const bool_op less_op = [](const internal::ptr_uint64 &terminal1, const internal::ptr_uint64 &terminal2) -> internal::ptr_uint64 + const bool_op less_op = [](const internal::ptr_uint64 &a, const internal::ptr_uint64 &b) -> internal::ptr_uint64 { - return and_op(negate(terminal1), terminal2); + return and_op(negate(a), b); }; - - ////////////////////////////////////////////////////////////////////////////// - /// \brief Whether the terminal shortcuts the operator from the right, - /// i.e. op(T,terminal) = op(F,terminal). - ////////////////////////////////////////////////////////////////////////////// - inline bool can_right_shortcut(const bool_op &op, const internal::ptr_uint64 &terminal) - { - return op(internal::ptr_uint64(false), terminal) == op(internal::ptr_uint64(true), terminal); - } - - ////////////////////////////////////////////////////////////////////////////// - /// \brief Whether the terminal shortcuts the operator from the left, - /// i.e. op(terminal, T) = op(terminal, F). - ////////////////////////////////////////////////////////////////////////////// - inline bool can_left_shortcut(const bool_op &op, const internal::ptr_uint64 &terminal) - { - return op(terminal, internal::ptr_uint64(false)) == op(terminal, internal::ptr_uint64(true)); - } - - ////////////////////////////////////////////////////////////////////////////// - /// \brief Whether the terminal is irrelevant for the operator from the right, - /// i.e. op(X, terminal) = X. - ////////////////////////////////////////////////////////////////////////////// - inline bool is_right_irrelevant(const bool_op &op, const internal::ptr_uint64 &terminal) - { - return op(internal::ptr_uint64(false), terminal) == internal::ptr_uint64(false) - && op(internal::ptr_uint64(true), terminal) == internal::ptr_uint64(true); - } - - ////////////////////////////////////////////////////////////////////////////// - /// \brief Whether the terminal is irrelevant for the operator from the left, - /// i.e. op(terminal, X) = X. - ////////////////////////////////////////////////////////////////////////////// - inline bool is_left_irrelevant(const bool_op &op, const internal::ptr_uint64 &terminal) - { - return op(terminal, internal::ptr_uint64(false)) == internal::ptr_uint64(false) - && op(terminal, internal::ptr_uint64(true)) == internal::ptr_uint64(true); - } - - ////////////////////////////////////////////////////////////////////////////// - /// \brief Whether the terminal for this operator negates the value of the other - /// from the right, i.e. op(X, terminal) = ~X. - ////////////////////////////////////////////////////////////////////////////// - inline bool is_right_negating(const bool_op &op, const internal::ptr_uint64 &terminal) - { - return op(terminal, internal::ptr_uint64(false)) == internal::ptr_uint64(true) - && op(terminal, internal::ptr_uint64(true)) == internal::ptr_uint64(false); - } - - ////////////////////////////////////////////////////////////////////////////// - /// \brief Whether the terminal for this operator negates the value of the other - /// from the left, i.e. op(terminal, X) = ~X - ////////////////////////////////////////////////////////////////////////////// - inline bool is_left_negating(const bool_op &op, const internal::ptr_uint64 &terminal) - { - return op(terminal, internal::ptr_uint64(false)) == internal::ptr_uint64(true) - && op(terminal, internal::ptr_uint64(true)) == internal::ptr_uint64(false); - } - - ////////////////////////////////////////////////////////////////////////////// - /// \brief Whether an operator is commutative, op(X, Y) = op(Y, X). - ////////////////////////////////////////////////////////////////////////////// - inline bool is_commutative(const bool_op &op) - { - internal::ptr_uint64 terminal_T = internal::ptr_uint64(true); - internal::ptr_uint64 terminal_F = internal::ptr_uint64(false); - - return op(terminal_T, terminal_F) == op(terminal_F, terminal_T); - } - - ////////////////////////////////////////////////////////////////////////////// - /// \brief Return the operator in flipped version, i.e. op'(X, Y) = op(Y, X). - ////////////////////////////////////////////////////////////////////////////// - inline bool_op flip(const bool_op &op) - { - if (is_commutative(op)) return op; - - return [&op](const internal::ptr_uint64 &a, const internal::ptr_uint64 &b) - {return op(b, a);}; - } } #endif // ADIAR_BOOL_OP_H diff --git a/src/adiar/builder.h b/src/adiar/builder.h index 93e878619..83bddcff7 100644 --- a/src/adiar/builder.h +++ b/src/adiar/builder.h @@ -4,6 +4,7 @@ #include #include #include +#include #include #include #include @@ -60,7 +61,7 @@ namespace adiar /// \brief The unique identifier of a prior node. /////////////////////////////////////////////////////////////////////////////// // TODO: rename to 'ptr ptr' when using complement edges - /*const*/ internal::node::uid_t uid; + /*const*/ internal::node::uid_type uid; /////////////////////////////////////////////////////////////////////////////// /// \brief Unique shared reference for the parent builder object. @@ -78,7 +79,7 @@ namespace adiar builder_ptr(const builder_ptr&) = default; private: - builder_ptr(const internal::node::uid_t &p, + builder_ptr(const internal::node::uid_type &p, const shared_ptr &sp) : uid(p), builder_ref(sp) { } @@ -89,15 +90,14 @@ namespace adiar /// /// \see bdd_builder /////////////////////////////////////////////////////////////////////////////// - typedef builder_ptr bdd_ptr; + using bdd_ptr = builder_ptr; /////////////////////////////////////////////////////////////////////////////// /// \brief Pointer for a ZDD node created by a ZDD builder. /// /// \see zdd_builder /////////////////////////////////////////////////////////////////////////////// - typedef builder_ptr zdd_ptr; - + using zdd_ptr = builder_ptr; /////////////////////////////////////////////////////////////////////////////// /// \brief A builder for decision diagrams @@ -117,12 +117,12 @@ namespace adiar ///////////////////////////////////////////////////////////////////////////// /// \brief Type of nodes created within the file. ///////////////////////////////////////////////////////////////////////////// - typedef typename dd_policy::node_t node_t; + using node_type = typename dd_policy::node_type; ///////////////////////////////////////////////////////////////////////////// /// \brief File containing all prior pushed nodes. ///////////////////////////////////////////////////////////////////////////// - shared_ptr> nf; + shared_ptr> nf; ///////////////////////////////////////////////////////////////////////////// /// \brief Node writer to push new nodes into 'nf'. @@ -142,12 +142,12 @@ namespace adiar ///////////////////////////////////////////////////////////////////////////// /// \brief Label of the current level. ///////////////////////////////////////////////////////////////////////////// - typename dd_policy::label_t current_label; + typename dd_policy::label_type current_label; ///////////////////////////////////////////////////////////////////////////// /// \brief Next available level identifier for the current level. ///////////////////////////////////////////////////////////////////////////// - typename dd_policy::id_t current_id; + typename dd_policy::id_type current_id; ///////////////////////////////////////////////////////////////////////////// /// \brief Number of yet unreferenced nodes. @@ -198,7 +198,7 @@ namespace adiar /// /// \throws invalid_argument If pointers stem from another builder. ///////////////////////////////////////////////////////////////////////////// - builder_ptr add_node(typename dd_policy::label_t label, + builder_ptr add_node(typename dd_policy::label_type label, const builder_ptr &low, const builder_ptr &high) { @@ -208,7 +208,7 @@ namespace adiar if(low.builder_ref != builder_ref || high.builder_ref != builder_ref) { throw invalid_argument("Cannot use pointers from a different builder"); } - if(label > dd_policy::MAX_LABEL) { + if(label > dd_policy::max_label) { throw invalid_argument("Nodes must have a valid label"); } if(label > current_label) { @@ -224,14 +224,14 @@ namespace adiar // Update label and ID if necessary if(label < current_label) { current_label = label; - current_id = dd_policy::MAX_ID; + current_id = dd_policy::max_id; } // Create potential node - const node_t n(label, current_id, low.uid, high.uid); + const node_type n(label, current_id, low.uid, high.uid); // Check whether this node is 'redundant' - const typename node_t::uid_t res_uid = dd_policy::reduction_rule(n); + const typename node_type::uid_type res_uid = dd_policy::reduction_rule(n); if (res_uid.is_terminal()) { created_terminal = true; @@ -279,13 +279,13 @@ namespace adiar /// \throws invalid_argument If `label` and `high` are illegal (see \ref /// add_node). ///////////////////////////////////////////////////////////////////////////// - builder_ptr add_node(const typename dd_policy::label_t label, + builder_ptr add_node(const typename dd_policy::label_type label, const bool low, const builder_ptr &high) { attach_if_needed(); - builder_ptr low_ptr = make_ptr(typename node_t::ptr_t(low)); + builder_ptr low_ptr = make_ptr(typename node_type::pointer_type(low)); return add_node(label, low_ptr, high); } @@ -306,13 +306,13 @@ namespace adiar /// \throws invalid_argument If `label` and `low` are illegal (see \ref /// add_node). ///////////////////////////////////////////////////////////////////////////// - builder_ptr add_node(const typename dd_policy::label_t label, + builder_ptr add_node(const typename dd_policy::label_type label, const builder_ptr &low, const bool high) { attach_if_needed(); - builder_ptr high_ptr = make_ptr(typename node_t::ptr_t(high)); + builder_ptr high_ptr = make_ptr(typename node_type::pointer_type(high)); return add_node(label, low, high_ptr); } @@ -332,14 +332,14 @@ namespace adiar /// \throws invalid_argument If `label` violates the bottom-up ordering (see /// \ref add_node). ///////////////////////////////////////////////////////////////////////////// - builder_ptr add_node(const typename dd_policy::label_t label, + builder_ptr add_node(const typename dd_policy::label_type label, const bool low, const bool high) { attach_if_needed(); - builder_ptr low_ptr = make_ptr(typename node_t::ptr_t(low)); - builder_ptr high_ptr = make_ptr(typename node_t::ptr_t(high)); + builder_ptr low_ptr = make_ptr(typename node_type::pointer_type(low)); + builder_ptr high_ptr = make_ptr(typename node_type::pointer_type(high)); return add_node(label, low_ptr, high_ptr); } @@ -359,7 +359,7 @@ namespace adiar created_terminal = true; terminal_val = terminal_value; - return make_ptr(typename node_t::ptr_t(terminal_value)); + return make_ptr(typename node_type::pointer_type(terminal_value)); } ///////////////////////////////////////////////////////////////////////////// @@ -384,7 +384,7 @@ namespace adiar if(!nw.has_pushed()) { if(created_terminal) { - nw.push(node_t(terminal_val)); + nw.push(node_type(terminal_val)); } else { throw domain_error("There must be at least one node or terminal in the decision diagram"); } @@ -421,12 +421,12 @@ namespace adiar "`nw`'s attachment should be consistent with existence of `nf`"); // Initialise file - nf = internal::make_shared_levelized_file(); + nf = internal::make_shared_levelized_file(); nw.attach(nf); // Initialise state variables - current_label = dd_policy::MAX_LABEL; - current_id = dd_policy::MAX_ID; + current_label = dd_policy::max_label; + current_id = dd_policy::max_id; created_terminal = false; terminal_val = false; unref_nodes = 0; @@ -448,7 +448,7 @@ namespace adiar ///////////////////////////////////////////////////////////////////////////// /// \brief Create a builder_ptr with 'this' builder as its parent. ///////////////////////////////////////////////////////////////////////////// - builder_ptr make_ptr(const typename node_t::ptr_t &p) noexcept + builder_ptr make_ptr(const typename node_type::pointer_type &p) noexcept { return builder_ptr(p, builder_ref); } @@ -459,14 +459,14 @@ namespace adiar /// /// \sa builder /////////////////////////////////////////////////////////////////////////////// - typedef builder bdd_builder; + using bdd_builder = builder; /////////////////////////////////////////////////////////////////////////////// /// \brief Builder for ZDDs /// /// \sa builder /////////////////////////////////////////////////////////////////////////////// - typedef builder zdd_builder; + using zdd_builder = builder; /// \} ///////////////////////////////////////////////////////////////////////////// diff --git a/src/adiar/data.h b/src/adiar/data.h deleted file mode 100644 index 63e23eb8d..000000000 --- a/src/adiar/data.h +++ /dev/null @@ -1,13 +0,0 @@ -#ifndef ADIAR_DATA_H -#define ADIAR_DATA_H - -#include -#include -#include -#include -#include -#include -#include -#include - -#endif // ADIAR_DATA_H diff --git a/src/adiar/domain.cpp b/src/adiar/domain.cpp index 6d6580ad4..2a494bc99 100644 --- a/src/adiar/domain.cpp +++ b/src/adiar/domain.cpp @@ -9,43 +9,43 @@ namespace adiar // Use an explicit 'shared_ptr' rather than a 'shared_file' to allow using the // NULL value. - shared_ptr> domain_ptr; + shared_ptr> domain_ptr; - void adiar_set_domain(const domain_var_t varcount) { - shared_file dom; + void domain_set(const domain_var varcount) { + shared_file dom; { // Garbage collect writer to free write-lock - internal::file_writer lw(dom); - for (domain_var_t v = 0; v < varcount; v++) { lw << v; } + internal::file_writer lw(dom); + for (domain_var v = 0; v < varcount; v++) { lw << v; } } - adiar_set_domain(dom); + domain_set(dom); } - void adiar_set_domain(const generator &gen) { - shared_file dom; + void domain_set(const generator &gen) { + shared_file dom; { // Garbage collect writer to free write-lock - internal::file_writer lw(dom); + internal::file_writer lw(dom); - domain_var_t v; - while ((v = gen()) <= MAX_DOMAIN_VAR) { lw << v; } + domain_var v; + while ((v = gen()) <= domain_max) { lw << v; } } - adiar_set_domain(dom); + domain_set(dom); } - void adiar_set_domain(const shared_file &dom) { + void domain_set(const shared_file &dom) { domain_ptr = dom; } - void adiar_unset_domain() { + void domain_unset() { domain_ptr.reset(); } - bool adiar_has_domain() { + bool domain_isset() { return domain_ptr ? true : false; } - shared_file adiar_get_domain() { - if(!adiar_has_domain()) { + shared_file domain_get() { + if(!domain_isset()) { throw domain_error("Domain must be set before it can be used"); } diff --git a/src/adiar/domain.h b/src/adiar/domain.h index d64975962..a4830f890 100644 --- a/src/adiar/domain.h +++ b/src/adiar/domain.h @@ -12,10 +12,10 @@ //////////////////////////////////////////////////////////////////////////////// #include -#include +#include // <-- TODO: Replace with #include -// TODO: Make 'domain_var_t' independent of node type. Then remove this include. +// TODO: Make 'domain_var' independent of node type. Then remove this include. #include namespace adiar @@ -28,27 +28,27 @@ namespace adiar ////////////////////////////////////////////////////////////////////////////// /// \brief The variable type of a domain variable. ////////////////////////////////////////////////////////////////////////////// - using domain_var_t = internal::node::label_t; + using domain_var = internal::node::label_type; ////////////////////////////////////////////////////////////////////////////// /// \brief The maximum supported domain variable. ////////////////////////////////////////////////////////////////////////////// - constexpr domain_var_t MAX_DOMAIN_VAR = internal::node::MAX_LABEL; + constexpr domain_var domain_max = internal::node::max_label; ////////////////////////////////////////////////////////////////////////////// /// \brief Set the domain globally for all of Adiar to be [*0, varcount*). ////////////////////////////////////////////////////////////////////////////// - void adiar_set_domain(const domain_var_t varcount); + void domain_set(const domain_var varcount); ////////////////////////////////////////////////////////////////////////////// /// \brief Set the domain globally for all of Adiar to be the variables /// produced by the given generator function. /// /// \param dom Generator that produces variables to be quantified in - /// *ascending* order. When none are left to-be quantified, it must - /// return a value greater than `MAX_DOMAIN_VAR`. + /// *ascending* order. When none are left, it must return a value + /// greater than `domain_max`. ////////////////////////////////////////////////////////////////////////////// - void adiar_set_domain(const generator &dom); + void domain_set(const generator &dom); ////////////////////////////////////////////////////////////////////////////// /// \brief Set the domain globally for all of Adiar to be the variables @@ -60,38 +60,49 @@ namespace adiar /// \param end Iterator that marks the end for `begin`. ////////////////////////////////////////////////////////////////////////////// template - void adiar_set_domain(IT begin, IT end) - { - return adiar_set_domain(make_generator(begin, end)); - } + void domain_set(IT begin, IT end) + { return domain_set(make_generator(begin, end)); } ////////////////////////////////////////////////////////////////////////////// /// \brief Set the domain globally for all of Adiar. /// + /// \details This may be usable, if one needs to change the domain, but + /// wants to set it back again to the prior value without recreating + /// the entire file. + /// /// \param dom A \ref shared_file containing all labels of the problem domain /// in ascending order. + /// + /// \see domain_get() ////////////////////////////////////////////////////////////////////////////// - void adiar_set_domain(const shared_file &dom); + void domain_set(const shared_file &dom); ////////////////////////////////////////////////////////////////////////////// /// \brief Removes any globally shared domain variables (if any). /// - /// \sa adiar_set_domain + /// \sa domain_set ////////////////////////////////////////////////////////////////////////////// - void adiar_unset_domain(); + void domain_unset(); ////////////////////////////////////////////////////////////////////////////// /// \brief Whether Adiar has a global domain. ////////////////////////////////////////////////////////////////////////////// - bool adiar_has_domain(); + bool domain_isset(); ////////////////////////////////////////////////////////////////////////////// - /// \brief Returns the global domain if `adiar_has_domain() == true`. + /// \brief Returns the global domain. + /// + /// \details This may be usable, if one needs to change the domain, but + /// wants to set it back again to the prior value without recreating + /// the entire file. + /// + /// \pre `domain_isset() == true` + /// + /// \throws domain_error If no domain is set, i.e. `domain_isset() == false`. /// - /// \throws domain_error If no domain is yet set, i.e. - /// `adiar_has_domain() == false`. + /// \see domain_set(const shared_file &dom) ////////////////////////////////////////////////////////////////////////////// - shared_file adiar_get_domain(); + shared_file domain_get(); /// \} ////////////////////////////////////////////////////////////////////////////// diff --git a/src/adiar/functional.h b/src/adiar/functional.h index 8a7413a94..817480b54 100644 --- a/src/adiar/functional.h +++ b/src/adiar/functional.h @@ -2,12 +2,19 @@ #define ADIAR_FUNCTIONAL_H #include -#include + +#include + +//////////////////////////////////////////////////////////////////////////////// +/// \defgroup module__functional Function Objects +/// +/// \brief The bridge between you and Adiar. +//////////////////////////////////////////////////////////////////////////////// namespace adiar { ////////////////////////////////////////////////////////////////////////////// - /// \addtogroup module__adiar + /// \addtogroup module__functional /// /// \{ @@ -64,7 +71,7 @@ namespace adiar { return [&begin, &end](const typename iterator_t::value_type x) { if (begin == end) { - throw std::out_of_range("Iterator range unable to contain all generated values"); + throw out_of_range("Iterator range unable to contain all generated values"); } *(begin++) = x; }; @@ -103,12 +110,12 @@ namespace adiar /// \brief Wrap an `adiar::internal::file_stream` into a generator function. //////////////////////////////////////////////////////////////////////////// template - inline generator + inline generator make_generator(stream_t &s) { return [&s]() { if (!s.can_pull()) { - return static_cast(-1); + return static_cast(-1); } return s.pull(); }; diff --git a/src/adiar/internal/algorithms/build.h b/src/adiar/internal/algorithms/build.h index 838848c3e..41dc71a69 100644 --- a/src/adiar/internal/algorithms/build.h +++ b/src/adiar/internal/algorithms/build.h @@ -2,6 +2,7 @@ #define ADIAR_INTERNAL_ALGORITHMS_BUILD_H #include +#include #include #include #include @@ -13,14 +14,14 @@ namespace adiar::internal { template inline - shared_levelized_file + shared_levelized_file build_terminal(bool value) { - using node_t = typename dd_policy::node_t; - shared_levelized_file nf; + using node_type = typename dd_policy::node_type; + shared_levelized_file nf; { node_writer nw(nf); - nw.unsafe_push(node_t(value)); + nw.unsafe_push(node_type(value)); nw.unsafe_set_number_of_terminals(!value, value); nw.unsafe_set_canonical(true); } @@ -30,20 +31,20 @@ namespace adiar::internal template inline - shared_levelized_file - build_ithvar(typename dd_policy::label_t label) + shared_levelized_file + build_ithvar(typename dd_policy::label_type label) { - using node_t = typename dd_policy::node_t; - using ptr_t = typename node_t::ptr_t; + using node_type = typename dd_policy::node_type; + using pointer_type = typename node_type::pointer_type; - if (node_t::MAX_LABEL < label) { + if (node_type::max_label < label) { throw invalid_argument("Cannot represent that large a label"); } - shared_levelized_file nf; + shared_levelized_file nf; { node_writer nw(nf); - nw.unsafe_push(node(label, ptr_t::MAX_ID, ptr_t(false), ptr_t(true))); + nw.unsafe_push(node(label, pointer_type::max_id, pointer_type(false), pointer_type(true))); nw.unsafe_push(level_info(label,1u)); nw.unsafe_set_canonical(true); } @@ -58,16 +59,16 @@ namespace adiar::internal static constexpr bool init_terminal = INIT_TERMINAL; constexpr bool - skip(const typename dd_policy::label_t &) const + skip(const typename dd_policy::label_type &) const { return false; } - inline typename dd_policy::node_t - make_node(const typename dd_policy::label_t &l, - const typename dd_policy::ptr_t &r) const + inline typename dd_policy::node_type + make_node(const typename dd_policy::label_type &l, + const typename dd_policy::pointer_type &r) const { - return typename dd_policy::node_t(l, dd_policy::MAX_ID, + return typename dd_policy::node_type(l, dd_policy::max_id, r, - typename dd_policy::ptr_t(HIGH_VAL)); + typename dd_policy::pointer_type(HIGH_VAL)); } }; @@ -78,15 +79,15 @@ namespace adiar::internal static constexpr bool init_terminal = INIT_TERMINAL; constexpr bool - skip(const typename dd_policy::label_t &) const + skip(const typename dd_policy::label_type &) const { return false; } - inline typename dd_policy::node_t - make_node(const typename dd_policy::label_t &l, - const typename dd_policy::ptr_t &r) const + inline typename dd_policy::node_type + make_node(const typename dd_policy::label_type &l, + const typename dd_policy::pointer_type &r) const { - return typename dd_policy::node_t(l, dd_policy::MAX_ID, - typename dd_policy::ptr_t(LOW_VAL), + return typename dd_policy::node_type(l, dd_policy::max_id, + typename dd_policy::pointer_type(LOW_VAL), r); } }; @@ -98,29 +99,29 @@ namespace adiar::internal static constexpr bool init_terminal = INIT_TERMINAL; constexpr bool - skip(const typename dd_policy::label_t &) const + skip(const typename dd_policy::label_type &) const { return false; } - inline typename dd_policy::node_t - make_node(const typename dd_policy::label_t &l, - const typename dd_policy::ptr_t &r) const + inline typename dd_policy::node_type + make_node(const typename dd_policy::label_type &l, + const typename dd_policy::pointer_type &r) const { - return typename dd_policy::node_t(l, dd_policy::MAX_ID, r, r); + return typename dd_policy::node_type(l, dd_policy::max_id, r, r); } }; template inline typename chain_policy::reduced_t build_chain(const chain_policy &policy, - const generator &vars) + const generator &vars) { - typename chain_policy::label_t next_label = vars(); + typename chain_policy::label_type next_label = vars(); - if (chain_policy::MAX_LABEL < next_label) { + if (chain_policy::max_label < next_label) { return build_terminal(chain_policy::init_terminal); } - shared_levelized_file nf; + shared_levelized_file nf; node_writer nw(nf); size_t max_internal_cut = 1; @@ -129,9 +130,9 @@ namespace adiar::internal bool terminal_at_bottom[2] = {false, false}; size_t terminals[2] = {0u, 0u}; - node::ptr_t root = node::ptr_t(chain_policy::init_terminal); + node::pointer_type root = node::pointer_type(chain_policy::init_terminal); - while(next_label <= chain_policy::MAX_LABEL) { + while(next_label <= chain_policy::max_label) { // Fail if generator is increasing. if (!root.is_terminal() && root.label() < next_label) { throw invalid_argument("Labels not given in decreasing order"); @@ -153,7 +154,7 @@ namespace adiar::internal const node n = policy.make_node(next_label, root); adiar_assert(n.label() == next_label, "Policy ought to make a node for this level node"); - adiar_assert(n.id() == node::MAX_ID, "Policy ought to make a canonical node"); + adiar_assert(n.id() == node::max_id, "Policy ought to make a canonical node"); max_internal_cut = std::max(max_internal_cut, n.low().is_node() + n.high().is_node()); @@ -195,27 +196,27 @@ namespace adiar::internal nw.unsafe_set_canonical(true); // 1-level cuts - nf->max_1level_cut[cut_type::INTERNAL] = max_internal_cut; + nf->max_1level_cut[cut::Internal] = max_internal_cut; - nf->max_1level_cut[cut_type::INTERNAL_FALSE] = + nf->max_1level_cut[cut::Internal_False] = std::max({ - nf->max_1level_cut[cut_type::INTERNAL], + nf->max_1level_cut[cut::Internal], terminals_internal[false] + terminals[false] - terminal_at_bottom[false], terminals[false] }); - nf->max_1level_cut[cut_type::INTERNAL_TRUE] = + nf->max_1level_cut[cut::Internal_True] = std::max({ - nf->max_1level_cut[cut_type::INTERNAL], + nf->max_1level_cut[cut::Internal], terminals_internal[true] + terminals[true] - terminal_at_bottom[true], terminals[true] }); - nf->max_1level_cut[cut_type::ALL] = + nf->max_1level_cut[cut::All] = std::max({ - nf->max_1level_cut[cut_type::INTERNAL], - nf->max_1level_cut[cut_type::INTERNAL_FALSE], - nf->max_1level_cut[cut_type::INTERNAL_TRUE], + nf->max_1level_cut[cut::Internal], + nf->max_1level_cut[cut::Internal_False], + nf->max_1level_cut[cut::Internal_True], terminals[false] + terminals[true] }); diff --git a/src/adiar/internal/algorithms/convert.h b/src/adiar/internal/algorithms/convert.h index faaf316ce..743902c5f 100644 --- a/src/adiar/internal/algorithms/convert.h +++ b/src/adiar/internal/algorithms/convert.h @@ -23,16 +23,17 @@ namespace adiar::internal static_assert(std::is_base_of<__dd, typename to_policy::unreduced_t>::value); public: - typedef typename from_policy::reduced_t reduced_t; - typedef typename from_policy::ptr_t ptr_t; - typedef typename from_policy::node_t node_t; + using reduced_t = typename from_policy::reduced_t; + using pointer_type = typename from_policy::pointer_type; + using node_type = typename from_policy::node_type; - typedef typename to_policy::unreduced_t unreduced_t; - typedef typename to_policy::label_t label_t; - typedef typename to_policy::id_t id_t; + using unreduced_t = typename to_policy::unreduced_t; + using label_type = typename to_policy::label_type; + using id_type = typename to_policy::id_type; - static constexpr typename to_policy::label_t MAX_LABEL = to_policy::MAX_LABEL; - static constexpr typename to_policy::id_t MAX_ID = to_policy::MAX_ID; + static constexpr label_type max_label = to_policy::max_label; + + static constexpr id_type max_id = to_policy::max_id; public: static constexpr bool may_skip = true; @@ -52,25 +53,25 @@ namespace adiar::internal static typename to_policy::reduced_t on_terminal_input(const bool terminal_value, const typename from_policy::reduced_t& /*dd*/, - const shared_file &dom) + const shared_file &dom) { adiar_assert(dom->size() > 0, "Emptiness check is before terminal check"); - node::uid_t prior_node = node::uid_t(terminal_value); + node::uid_type prior_node = node::uid_type(terminal_value); - shared_levelized_file nf; + shared_levelized_file nf; bool has_output = true; node_writer nw(nf); - file_stream ls(dom); + file_stream ls(dom); while(ls.can_pull()) { - const typename to_policy::label_t next_label = ls.pull(); + const typename to_policy::label_type next_label = ls.pull(); const tuple children = from_policy::reduction_rule_inv(prior_node); - const node next_node = node(next_label, to_policy::MAX_ID, children[0], children[1]); - const typename to_policy::ptr_t reduction_result = to_policy::reduction_rule(next_node); + const node next_node = node(next_label, to_policy::max_id, children[0], children[1]); + const typename to_policy::pointer_type reduction_result = to_policy::reduction_rule(next_node); if (reduction_result == next_node.uid()) { // Output prior_node = next_node.uid(); @@ -100,14 +101,14 @@ namespace adiar::internal static intercut_rec hit_existing(const node &n) { - const node::ptr_t to_reduction = to_policy::reduction_rule(n); + const node::pointer_type to_reduction = to_policy::reduction_rule(n); if (to_reduction != n.uid()) { return intercut_rec_skipto { to_reduction }; } return intercut_rec_output { n.low(), n.high() }; } - static intercut_rec_output hit_cut(const node::ptr_t target) + static intercut_rec_output hit_cut(const node::pointer_type target) { const tuple children = from_policy::reduction_rule_inv(target); diff --git a/src/adiar/internal/algorithms/count.cpp b/src/adiar/internal/algorithms/count.cpp index 9c6f2d1fd..e3eed672a 100644 --- a/src/adiar/internal/algorithms/count.cpp +++ b/src/adiar/internal/algorithms/count.cpp @@ -2,5 +2,5 @@ namespace adiar::internal { - stats_t::count_t stats_count; + statistics::count_t stats_count; } diff --git a/src/adiar/internal/algorithms/count.h b/src/adiar/internal/algorithms/count.h index aa425d373..3cc12121c 100644 --- a/src/adiar/internal/algorithms/count.h +++ b/src/adiar/internal/algorithms/count.h @@ -4,6 +4,7 @@ #include #include +#include #include #include #include @@ -12,16 +13,16 @@ namespace adiar::internal { ////////////////////////////////////////////////////////////////////////////// /// Struct to hold statistics - extern stats_t::count_t stats_count; + extern statistics::count_t stats_count; ////////////////////////////////////////////////////////////////////////////// // Data structures struct path_sum { // TODO: replace with request class - node::uid_t target; + node::uid_type target; uint64_t sum; - node::label_t level() const + node::label_type level() const { return target.label(); } }; @@ -39,10 +40,10 @@ namespace adiar::internal } }; - template + template using count_priority_queue_t = - levelized_node_priority_queue, - LOOK_AHEAD, + levelized_node_priority_queue, + look_ahead, mem_mode>; ////////////////////////////////////////////////////////////////////////////// @@ -51,11 +52,11 @@ namespace adiar::internal class path_count_policy : public dd_policy { public: - typedef path_sum queue_t; + using queue_t = path_sum; template inline static uint64_t forward_request(count_pq_t &count_pq, - const ptr_uint64::label_t /* varcount */, + const ptr_uint64::label_type /* varcount */, const ptr_uint64 child_to_resolve, const queue_t &request) { @@ -81,7 +82,7 @@ namespace adiar::internal ////////////////////////////////////////////////////////////////////////////// template uint64_t __count(const typename count_policy::reduced_t &dd, - const typename count_policy::label_t varcount, + const typename count_policy::label_type varcount, const size_t pq_max_memory, const size_t pq_max_size) { @@ -127,9 +128,9 @@ namespace adiar::internal template uint64_t count(const typename count_policy::reduced_t &dd, - const typename count_policy::label_t varcount) + const typename count_policy::label_type varcount) { - adiar_assert(!is_terminal(dd), + adiar_assert(!dd_isterminal(dd), "Count algorithm does not work on terminal-only edge case"); // Compute amount of memory available for auxiliary data structures after @@ -142,12 +143,12 @@ namespace adiar::internal const size_t aux_available_memory = memory_available() - node_stream<>::memory_usage(); const size_t pq_memory_fits = - count_priority_queue_t::memory_fits(aux_available_memory); + count_priority_queue_t::memory_fits(aux_available_memory); - const bool internal_only = memory_mode == memory_mode_t::INTERNAL; - const bool external_only = memory_mode == memory_mode_t::EXTERNAL; + const bool internal_only = memory_mode == memory_mode_t::Internal; + const bool external_only = memory_mode == memory_mode_t::External; - const size_t pq_bound = dd.max_2level_cut(cut_type::INTERNAL); + const size_t pq_bound = dd.max_2level_cut(cut::Internal); const size_t max_pq_size = internal_only ? std::min(pq_memory_fits, pq_bound) : pq_bound; @@ -157,7 +158,7 @@ namespace adiar::internal #endif return __count> + memory_mode_t::Internal>> (dd, varcount, aux_available_memory, max_pq_size); } else if(!external_only && max_pq_size <= pq_memory_fits) { #ifdef ADIAR_STATS @@ -165,7 +166,7 @@ namespace adiar::internal #endif return __count> + memory_mode_t::Internal>> (dd, varcount, aux_available_memory, max_pq_size); } else { #ifdef ADIAR_STATS @@ -173,7 +174,7 @@ namespace adiar::internal #endif return __count> + memory_mode_t::External>> (dd, varcount, aux_available_memory, max_pq_size); } } diff --git a/src/adiar/internal/algorithms/intercut.cpp b/src/adiar/internal/algorithms/intercut.cpp index eccabd439..f2c527beb 100644 --- a/src/adiar/internal/algorithms/intercut.cpp +++ b/src/adiar/internal/algorithms/intercut.cpp @@ -2,5 +2,5 @@ namespace adiar::internal { - stats_t::intercut_t stats_intercut; + statistics::intercut_t stats_intercut; } diff --git a/src/adiar/internal/algorithms/intercut.h b/src/adiar/internal/algorithms/intercut.h index 9dc00726e..9b153baad 100644 --- a/src/adiar/internal/algorithms/intercut.h +++ b/src/adiar/internal/algorithms/intercut.h @@ -4,6 +4,7 @@ #include #include #include +#include #include #include #include @@ -19,7 +20,7 @@ namespace adiar::internal { ////////////////////////////////////////////////////////////////////////////// /// Struct to hold statistics - extern stats_t::intercut_t stats_intercut; + extern statistics::intercut_t stats_intercut; ////////////////////////////////////////////////////////////////////////////// // Priority queue @@ -27,7 +28,7 @@ namespace adiar::internal class intercut_req : public arc { // TODO: replace with request class private: - ptr_uint64::label_t _level = ptr_uint64::MAX_LABEL + 1u; + ptr_uint64::label_type _level = ptr_uint64::max_label + 1u; public: intercut_req() = default; @@ -35,11 +36,11 @@ namespace adiar::internal ~intercut_req() = default; public: - intercut_req(ptr_uint64 source, ptr_uint64 target, ptr_uint64::label_t lvl) : arc(source, target), _level(lvl) + intercut_req(ptr_uint64 source, ptr_uint64 target, ptr_uint64::label_type lvl) : arc(source, target), _level(lvl) { } public: - ptr_uint64::label_t level() const + ptr_uint64::label_type level() const { return _level; } }; @@ -56,10 +57,10 @@ namespace adiar::internal } }; - template + template using intercut_priority_queue_t = levelized_label_priority_queue; @@ -77,17 +78,17 @@ namespace adiar::internal ptr_uint64 tgt; }; - typedef std::variant intercut_rec; + using intercut_rec = std::variant; ////////////////////////////////////////////////////////////////////////////// // Helper functions template - bool cut_terminal(const typename intercut_policy::label_t curr_level, - const typename intercut_policy::label_t cut_level, + bool cut_terminal(const typename intercut_policy::label_type curr_level, + const typename intercut_policy::label_type cut_level, const bool terminal_value) { return curr_level < cut_level - && cut_level <= intercut_policy::MAX_LABEL + && cut_level <= intercut_policy::max_label && (!terminal_value || intercut_policy::cut_true_terminal) && ( terminal_value || intercut_policy::cut_false_terminal); } @@ -101,14 +102,14 @@ namespace adiar::internal template static inline void forward(arc_writer &aw, pq_t &pq, - const typename intercut_policy::ptr_t source, - const typename intercut_policy::ptr_t target, - const typename intercut_policy::label_t curr_level, - const typename intercut_policy::label_t next_cut) + const typename intercut_policy::pointer_type source, + const typename intercut_policy::pointer_type target, + const typename intercut_policy::label_type curr_level, + const typename intercut_policy::label_type next_cut) { - const typename intercut_policy::label_t target_level = target.is_node() + const typename intercut_policy::label_type target_level = target.is_node() ? target.label() - : intercut_policy::MAX_LABEL+1; + : intercut_policy::max_label+1; if (target.is_terminal() && !cut_terminal(curr_level, next_cut, target.value())) { aw.push_terminal(arc(source, target)); @@ -128,8 +129,8 @@ namespace adiar::internal pq_t &/*pq*/, const ptr_uint64 source, const ptr_uint64 target, - const ptr_uint64::label_t /*curr_level*/, - const ptr_uint64::label_t /*next_cut*/) + const ptr_uint64::label_type /*curr_level*/, + const ptr_uint64::label_type /*next_cut*/) { aw.push_internal(arc(source, target)); } @@ -138,10 +139,10 @@ namespace adiar::internal template inline void intercut_in__pq(arc_writer &aw, pq_t &pq, - const typename intercut_policy::label_t out_label, - const typename intercut_policy::ptr_t pq_target, - const typename intercut_policy::ptr_t out_target, - const typename intercut_policy::label_t l) + const typename intercut_policy::label_type out_label, + const typename intercut_policy::pointer_type pq_target, + const typename intercut_policy::pointer_type out_target, + const typename intercut_policy::label_type l) { adiar_assert(out_label <= out_target.label(), "should forward/output a node on this level or ahead."); @@ -158,24 +159,24 @@ namespace adiar::internal template typename intercut_policy::unreduced_t __intercut (const typename intercut_policy::reduced_t &dd, - const generator &xs, + const generator &xs, const size_t pq_memory, const size_t max_pq_size) { node_stream<> in_nodes(dd); node n = in_nodes.pull(); - // TODO: Only copy `xs` into a `shared_file`, in the degenerate + // TODO: Only copy `xs` into a `shared_file`, in the degenerate // case, that we have to reverse it. // // In the general case, we have to use it both in the priority queue // `intercut_pq` below, and for a lookahead of the algorithm. The main issue // is how to design the priority queue such that it can retrieve, merge with // `dd_levels`, and expose `xs`. - shared_file hit_levels; + shared_file hit_levels; { - file_writer lw(hit_levels); - for (auto x = xs(); x <= intercut_policy::MAX_LABEL; x = xs()) { + file_writer lw(hit_levels); + for (auto x = xs(); x <= intercut_policy::max_label; x = xs()) { lw << x; } @@ -188,16 +189,16 @@ namespace adiar::internal return intercut_policy::on_terminal_input(n.value(), dd, hit_levels); } - file_stream ls(hit_levels); - typename intercut_policy::label_t l = ls.pull(); + file_stream ls(hit_levels); + typename intercut_policy::label_type l = ls.pull(); shared_levelized_file out_arcs; arc_writer aw(out_arcs); - shared_file dd_levels; + shared_file dd_levels; { - file_writer lw(dd_levels); - dd_varprofile(dd, [&lw](const typename intercut_policy::label_t x) { + file_writer lw(dd_levels); + dd_varprofile(dd, [&lw](const typename intercut_policy::label_type x) { lw << x; }); } @@ -205,9 +206,9 @@ namespace adiar::internal pq_t intercut_pq({dd_levels, hit_levels}, pq_memory, max_pq_size, stats_intercut.lpq); // Add request for root in the queue - typename intercut_policy::label_t out_label = std::min(l, n.label()); - intercut_pq.push(intercut_req(ptr_uint64::NIL(), n.uid(), out_label)); - typename intercut_policy::id_t out_id = 0; + typename intercut_policy::label_type out_label = std::min(l, n.label()); + intercut_pq.push(intercut_req(ptr_uint64::nil(), n.uid(), out_label)); + typename intercut_policy::id_type out_id = 0; size_t max_1level_cut = 0; @@ -230,7 +231,7 @@ namespace adiar::internal } if(!ls.can_pull() && l <= out_label) { - l = intercut_policy::MAX_LABEL + 1; + l = intercut_policy::max_label + 1; } // Resolve requests that end at the cut for this level @@ -261,7 +262,7 @@ namespace adiar::internal (aw, intercut_pq, out_label, n.uid(), rs.tgt, l); } else { const intercut_rec_output ro = std::get(r); - const node::uid_t out_uid(out_label, out_id++); + const node::uid_type out_uid(out_label, out_id++); intercut_out__pq::forward (aw, intercut_pq, out_uid.with(false), ro.low, out_label, l); @@ -281,7 +282,7 @@ namespace adiar::internal const intercut_req request = intercut_pq.top(); const intercut_rec_output ro = intercut_policy::hit_cut(request.target()); - const node::uid_t out_uid(out_label, out_id++); + const node::uid_type out_uid(out_label, out_id++); intercut_out__pq::forward (aw, intercut_pq, out_uid.with(false), ro.low, out_label, l); @@ -306,7 +307,7 @@ namespace adiar::internal template size_t __intercut_2level_upper_bound(const typename intercut_policy::reduced_t &dd) { - const cut_type ct = cut_type_with(intercut_policy::cut_false_terminal, + const cut ct = cut(intercut_policy::cut_false_terminal, intercut_policy::cut_true_terminal); const safe_size_t max_1level_cut = dd.max_1level_cut(ct); @@ -315,7 +316,7 @@ namespace adiar::internal template typename intercut_policy::unreduced_t intercut(const typename intercut_policy::reduced_t &dd, - const generator &xs) + const generator &xs) { // Compute amount of memory available for auxiliary data structures after // having opened all streams. @@ -332,10 +333,10 @@ namespace adiar::internal const size_t pq_memory = aux_available_memory; const size_t pq_memory_fits = - intercut_priority_queue_t::memory_fits(pq_memory); + intercut_priority_queue_t::memory_fits(pq_memory); - const bool internal_only = memory_mode == memory_mode_t::INTERNAL; - const bool external_only = memory_mode == memory_mode_t::EXTERNAL; + const bool internal_only = memory_mode == memory_mode_t::Internal; + const bool external_only = memory_mode == memory_mode_t::External; const size_t pq_bound = __intercut_2level_upper_bound(dd); @@ -346,21 +347,21 @@ namespace adiar::internal stats_intercut.lpq.unbucketed += 1u; #endif return __intercut> + intercut_priority_queue_t<0, memory_mode_t::Internal>> (dd, xs, pq_memory, max_pq_size); } else if(!external_only && max_pq_size <= pq_memory_fits) { #ifdef ADIAR_STATS stats_intercut.lpq.internal += 1u; #endif return __intercut> + intercut_priority_queue_t> (dd, xs, pq_memory, max_pq_size); } else { #ifdef ADIAR_STATS stats_intercut.lpq.external += 1u; #endif return __intercut> + intercut_priority_queue_t> (dd, xs, pq_memory, max_pq_size); } } diff --git a/src/adiar/internal/algorithms/nested_sweeping.cpp b/src/adiar/internal/algorithms/nested_sweeping.cpp index 55c7cfff1..4566ee031 100644 --- a/src/adiar/internal/algorithms/nested_sweeping.cpp +++ b/src/adiar/internal/algorithms/nested_sweeping.cpp @@ -4,6 +4,6 @@ namespace adiar::internal { namespace nested_sweeping { - stats_t::nested_sweeping_t stats; + statistics::nested_sweeping_t stats; } } diff --git a/src/adiar/internal/algorithms/nested_sweeping.h b/src/adiar/internal/algorithms/nested_sweeping.h index 34278b2ea..c04fe44cd 100644 --- a/src/adiar/internal/algorithms/nested_sweeping.h +++ b/src/adiar/internal/algorithms/nested_sweeping.h @@ -24,7 +24,7 @@ namespace adiar::internal { //////////////////////////////////////////////////////////////////////////// /// Struct to hold statistics - extern stats_t::nested_sweeping_t stats; + extern statistics::nested_sweeping_t stats; //////////////////////////////////////////////////////////////////////////// /// \brief Choice of Reduce algorithm to use. @@ -32,25 +32,25 @@ namespace adiar::internal enum reduce_strategy { /** Always use the canonical reduce algorithm. */ - ALWAYS_CANONICAL, + Always_Canonical, /** Use canonical reduce at the very end for the final output. */ - FINAL_CANONICAL, + Final_Canonical, /** Always use the faster non-canonical reduce. */ - NEVER_CANONICAL, - /** In-between `ALWAYS_CANONICAL` and `FINAL_CANONICAL`; whether the + Never_Canonical, + /** In-between `Always_Canonical` and `Final_Canonical`; whether the canonical reduce is used depends on heuristics. */ - AUTO + Auto }; - template + template inline void - __reduce_decrement_cut(cuts_t &c, const ptr_t& p) + __reduce_decrement_cut(cuts_t &c, const pointer_type& p) { if (p.is_terminal()) { - c[cut_type::ALL]--; - c[cut_type_with(!p.value(), p.value())]--; + c[cut::All]--; + c[cut(!p.value(), p.value())]--; } else { - for(size_t ct = 0u; ct < CUT_TYPES; ct++) { + for(size_t ct = 0u; ct < cut::size; ct++) { c[ct]--; } } @@ -70,7 +70,7 @@ namespace adiar::internal typename arc_stream_t> void __reduce_level__fast(arc_stream_t &arcs, - const typename dd_policy::label_t label, + const typename dd_policy::label_type label, pq_t &pq, node_writer &out_writer) { @@ -86,11 +86,11 @@ namespace adiar::internal bool terminal_val = false /* <-- dummy value */; // Pull out all nodes from pq and terminal_arcs for this level - typename dd_policy::id_t out_id = dd_policy::MAX_ID; + typename dd_policy::id_type out_id = dd_policy::max_id; while (pq.can_pull() || (arcs.can_pull_terminal() && arcs.peek_terminal().source().label() == label)) { // TODO (MDD / QMDD): - // Use __reduce_get_next node_t::OUTDEGREE times to create a node_t::children_t. + // Use __reduce_get_next node_type::outdegree times to create a node_type::children_type. const arc e_high = __reduce_get_next(pq, arcs); const arc e_low = __reduce_get_next(pq, arcs); @@ -101,20 +101,20 @@ namespace adiar::internal // Disable the following if-statement for faster performance // Apply Reduction rule 1 - const node::ptr_t reduction_rule_ret = dd_policy::reduction_rule(n); + const node::pointer_type reduction_rule_ret = dd_policy::reduction_rule(n); if (reduction_rule_ret != n.uid()) { #ifdef ADIAR_STATS stats_reduce.removed_by_rule_1 += 1u; #endif // Forward child // Tell the parents this arc is tainted by Reduction Rule 1. - const node::ptr_t t = flag(reduction_rule_ret); + const node::pointer_type t = flag(reduction_rule_ret); adiar_assert(t.is_terminal() || t.out_idx() == false, "Created target is without an index"); if (t.is_terminal()) { terminal_val = t.value(); } while (arcs.can_pull_internal() && arcs.peek_internal().target() == n.uid()) { // The out_idx is included in arc.source() pulled from the internal arcs. - const node::ptr_t s = arcs.pull_internal().source(); + const node::pointer_type s = arcs.pull_internal().source(); pq.push(arc(s,t)); } @@ -128,12 +128,12 @@ namespace adiar::internal out_writer.unsafe_push(next_node); // Forward new node to parents - const node::ptr_t t = next_node.uid(); + const node::pointer_type t = next_node.uid(); adiar_assert(t.is_terminal() || t.out_idx() == false, "Created target is without an index"); while (arcs.can_pull_internal() && arcs.peek_internal().target() == n.uid()) { // The out_idx is included in arc.source() pulled from the internal arcs. - const node::ptr_t s = arcs.pull_internal().source(); + const node::pointer_type s = arcs.pull_internal().source(); pq.push(arc(s,t)); } } @@ -144,8 +144,8 @@ namespace adiar::internal // Add number of nodes to level information, if any nodes were pushed to // the output. Furthermore, mark as non-canonical if at least two nodes // were output (their order might very much have been wrong). - if (out_id != dd_policy::MAX_ID) { - const size_t width = dd_policy::MAX_ID - out_id; + if (out_id != dd_policy::max_id) { + const size_t width = dd_policy::max_id - out_id; out_writer.unsafe_push(level_info(label, width)); if (width > 1u) { @@ -176,20 +176,18 @@ namespace adiar::internal class roots_sorter { public: - static constexpr size_t DATA_STRUCTURES = 1u; - //////////////////////////////////////////////////////////////////////// /// \brief Type of the elements. //////////////////////////////////////////////////////////////////////// - using elem_t = element_t; + using value_type = element_t; - static_assert(elem_t::inputs == 1 && elem_t::sorted_target, + static_assert(value_type::inputs == 1 && value_type::sorted_target, "Request should be on a single input, and hence sorted"); //////////////////////////////////////////////////////////////////////// /// \brief Type of the element comparator. //////////////////////////////////////////////////////////////////////// - using elem_comp_t = element_comp_t; + using value_comp_type = element_comp_t; //////////////////////////////////////////////////////////////////////// /// \brief Memory mode of sorter. @@ -199,11 +197,13 @@ namespace adiar::internal //////////////////////////////////////////////////////////////////////// /// \brief Type of the sorter. //////////////////////////////////////////////////////////////////////// - using sorter_t = sorter; + using sorter_t = sorter; //////////////////////////////////////////////////////////////////////// - static constexpr typename elem_t::label_t NO_LEVEL = - static_cast(-1); + static constexpr typename value_type::label_type no_level = + static_cast(-1); + + static constexpr size_t data_structures = sorter_t::data_structures; private: //////////////////////////////////////////////////////////////////////// @@ -214,7 +214,7 @@ namespace adiar::internal //////////////////////////////////////////////////////////////////////// /// \brief Maximum source seen //////////////////////////////////////////////////////////////////////// - typename elem_t::ptr_t _max_source = elem_t::ptr_t::NIL(); + typename value_type::pointer_type _max_source = value_type::pointer_type::nil(); //////////////////////////////////////////////////////////////////////// // NOTE: There is not '_terminals[2]' like in the priority queue, since @@ -255,17 +255,17 @@ namespace adiar::internal //////////////////////////////////////////////////////////////////////// /// \brief Push request (marked as from outer sweep). //////////////////////////////////////////////////////////////////////// - void push(const elem_t& e) + void push(const value_type& v) { - adiar_assert(e.target.first().is_node(), + adiar_assert(v.target.first().is_node(), "Requests should have at least one internal node"); _max_source = _max_source.is_nil() - ? e.data.source - : std::max(_max_source, e.data.source); + ? v.data.source + : std::max(_max_source, v.data.source); // TODO: support requests with more than just the source - _sorter_ptr->push({ e.target, {}, {flag(e.data.source)} }); + _sorter_ptr->push({ v.target, {}, {flag(v.data.source)} }); } //////////////////////////////////////////////////////////////////////// @@ -279,14 +279,14 @@ namespace adiar::internal // TODO: support requests with more than just the source // TODO: Is there a better way to explicitly set the remainders of - // target to NIL? + // target to nil? - if constexpr (elem_t::cardinality == 1u) { - push(elem_t({a.target()}, {}, {flag(a.source())})); - } else if constexpr (elem_t::cardinality == 2u) { - push(elem_t({a.target(), elem_t::ptr_t::NIL()}, {}, {a.source()})); + if constexpr (value_type::cardinality == 1u) { + push(value_type({a.target()}, {}, {flag(a.source())})); + } else if constexpr (value_type::cardinality == 2u) { + push(value_type({a.target(), value_type::pointer_type::nil()}, {}, {a.source()})); } else { - static_assert(elem_t::cardinality <= 2u, + static_assert(value_type::cardinality <= 2u, "Missing implementation for larger than binary combinators"); } } @@ -300,11 +300,11 @@ namespace adiar::internal { return _sorter_ptr->can_pull(); } //////////////////////////////////////////////////////////////////////// - elem_t top() /*const*/ + value_type top() /*const*/ { return _sorter_ptr->top(); } //////////////////////////////////////////////////////////////////////// - elem_t pull() + value_type pull() { // TODO: decrement terminal count (is this number ever relevant before // it already is 'reset()'?) @@ -315,7 +315,7 @@ namespace adiar::internal void reset() { sorter_t::reset_unique(_sorter_ptr, _memory_bytes, _no_arcs); - _max_source = elem_t::ptr_t::NIL(); + _max_source = value_type::pointer_type::nil(); } //////////////////////////////////////////////////////////////////////// @@ -340,15 +340,15 @@ namespace adiar::internal //////////////////////////////////////////////////////////////////////// /// \brief Level of the deepest source //////////////////////////////////////////////////////////////////////// - typename elem_t::label_t deepest_source() - { return _max_source.is_nil() ? NO_LEVEL : _max_source.label(); } + typename value_type::label_type deepest_source() + { return _max_source.is_nil() ? no_level : _max_source.label(); } }; ////////////////////////////////////////////////////////////////////////// /// \brief Default priority queue for the Outer Up Sweep. ////////////////////////////////////////////////////////////////////////// - template - using up__pq_t = reduce_priority_queue; + template + using up__pq_t = reduce_priority_queue; ////////////////////////////////////////////////////////////////////////// /// \brief Decorator for the Reduce priority queue that either forwards @@ -366,12 +366,12 @@ namespace adiar::internal //////////////////////////////////////////////////////////////////////////// /// \brief Type of the elements. //////////////////////////////////////////////////////////////////////////// - using elem_t = typename outer_pq_t::elem_t; + using value_type = typename outer_pq_t::value_type; //////////////////////////////////////////////////////////////////////////// /// \brief Type of the element comparator. //////////////////////////////////////////////////////////////////////////// - using elem_comp_t = typename outer_pq_t::elem_comp_t; + using value_comp_type = typename outer_pq_t::value_comp_type; //////////////////////////////////////////////////////////////////////////// /// \brief Memory mode (same as decorated priority queue). @@ -394,20 +394,20 @@ namespace adiar::internal //////////////////////////////////////////////////////////////////////// /// \brief Type of a level. //////////////////////////////////////////////////////////////////////// - using level_t = typename elem_t::ptr_t::label_t; + using level_type = typename value_type::pointer_type::label_type; //////////////////////////////////////////////////////////////////////// /// \brief The level of the next inner sweep; //////////////////////////////////////////////////////////////////////// // TODO: turn into signed value to allow using decorator above last // legal value of '_next_inner' (abusing negative numbers). - const level_t _next_inner; + const level_type _next_inner; public: //////////////////////////////////////////////////////////////////////////// /// \brief Value to reflect 'out of levels'. //////////////////////////////////////////////////////////////////////////// - static constexpr level_t NO_LABEL = outer_pq_t::NO_LABEL; + static constexpr level_type no_label = outer_pq_t::no_label; public: //////////////////////////////////////////////////////////////////////// @@ -415,7 +415,7 @@ namespace adiar::internal //////////////////////////////////////////////////////////////////////// up__pq_decorator(outer_pq_t &outer_pq, outer_roots_t &outer_roots, - const level_t next_inner) + const level_type next_inner) : _outer_pq(outer_pq) , _outer_roots(outer_roots) , _next_inner(next_inner) @@ -493,11 +493,11 @@ namespace adiar::internal /// /// \param e The request with some `target` and `data.source` /// - /// \pre The request's source must be above `_next_inner` or `NIL`. + /// \pre The request's source must be above `_next_inner` or `nil`. /// /// \see request, request_with_data //////////////////////////////////////////////////////////////////////// - void push(const typename outer_roots_t::elem_t &e) + void push(const typename outer_roots_t::value_type &e) { adiar_assert(e.data.source.is_nil() || e.data.source.label() < _next_inner); if (e.target.first().is_terminal()) { @@ -511,7 +511,7 @@ namespace adiar::internal /// \brief Set up the next nonempty level in the priority queue and the /// sorter (down to the given `stop_level`). //////////////////////////////////////////////////////////////////////// - void setup_next_level(level_t stop_level = NO_LABEL) + void setup_next_level(level_type stop_level = no_label) { _outer_pq.setup_next_level(stop_level); adiar_assert(_next_inner <= _outer_pq.current_level(), @@ -533,7 +533,7 @@ namespace adiar::internal class inner_iterator { public: - using level_t = typename nesting_policy::ptr_t::label_t; + using level_type = typename nesting_policy::pointer_type::label_type; public: //////////////////////////////////////////////////////////////////////// @@ -546,28 +546,28 @@ namespace adiar::internal nesting_policy &_policy_impl; public: - inner_iterator(const typename nesting_policy::shared_arcs_t &dag, + inner_iterator(const typename nesting_policy::shared_arc_file_type &dag, nesting_policy &policy_impl) : _lis(dag) , _policy_impl(policy_impl) { } public: - static constexpr level_t NONE = static_cast(-1); + static constexpr level_type end = static_cast(-1); //////////////////////////////////////////////////////////////////////// /// \brief Obtain the next level to do an inner sweep to pull. /// - /// \returns The next inner level that should be recursed on (or `NONE` + /// \returns The next inner level that should be recursed on (or `end` /// if none are left) //////////////////////////////////////////////////////////////////////// - level_t next_inner() + level_type next_inner() { while (_lis.can_pull()) { - const level_t l = _lis.pull().level(); + const level_type l = _lis.pull().level(); if (_policy_impl.has_sweep(l)) { return l; } } - return NONE; + return end; } }; } // namespace outer @@ -594,14 +594,14 @@ namespace adiar::internal //////////////////////////////////////////////////////////////////////////// /// \brief Type of the elements. //////////////////////////////////////////////////////////////////////////// - using elem_t = typename inner_pq_t::elem_t; + using value_type = typename inner_pq_t::value_type; - // TODO: static_assert(inner_pq_t::elem_t == outer_roots_t::elem_t); + // TODO: static_assert(inner_pq_t::value_type == outer_roots_t::value_type); //////////////////////////////////////////////////////////////////////////// /// \brief Type of the element comparator. //////////////////////////////////////////////////////////////////////////// - using elem_comp_t = typename inner_pq_t::elem_comp_t; + using value_comp_type = typename inner_pq_t::value_comp_type; //////////////////////////////////////////////////////////////////////////// /// \brief Memory mode (same as decorated priority queue). @@ -611,7 +611,7 @@ namespace adiar::internal //////////////////////////////////////////////////////////////////////// /// \brief Type of the elements in the priority queue / sorter. //////////////////////////////////////////////////////////////////////// - using level_t = typename elem_t::ptr_t::label_t; + using level_type = typename value_type::pointer_type::label_type; private: //////////////////////////////////////////////////////////////////////// @@ -623,7 +623,7 @@ namespace adiar::internal //////////////////////////////////////////////////////////////////////////// /// \brief Instantiation of the comparator between elements. //////////////////////////////////////////////////////////////////////////// - elem_comp_t _e_comparator = elem_comp_t(); + value_comp_type _v_comparator = value_comp_type(); //////////////////////////////////////////////////////////////////////// /// \brief Reference to the sorter in the outer sweep that contains the @@ -635,7 +635,7 @@ namespace adiar::internal //////////////////////////////////////////////////////////////////////////// /// \brief Value to reflect 'out of levels'. //////////////////////////////////////////////////////////////////////////// - static constexpr level_t NO_LABEL = inner_pq_t::NO_LABEL; + static constexpr level_type no_label = inner_pq_t::no_label; public: //////////////////////////////////////////////////////////////////////// @@ -656,7 +656,7 @@ namespace adiar::internal //////////////////////////////////////////////////////////////////////// /// \brief The label of the current level. //////////////////////////////////////////////////////////////////////// - level_t current_level() const + level_type current_level() const { return _inner_pq.current_level(); } //////////////////////////////////////////////////////////////////////// @@ -668,7 +668,7 @@ namespace adiar::internal //////////////////////////////////////////////////////////////////////// /// \brief The label of the next (possibly empty) level. //////////////////////////////////////////////////////////////////////// - level_t next_level() /*const*/ + level_type next_level() /*const*/ { return _inner_pq.next_level(); } //////////////////////////////////////////////////////////////////////// @@ -680,14 +680,14 @@ namespace adiar::internal //////////////////////////////////////////////////////////////////////// /// \brief Push request to inner priority queue. //////////////////////////////////////////////////////////////////////// - void push(const elem_t& e) + void push(const value_type& e) { _inner_pq.push(e); } //////////////////////////////////////////////////////////////////////// /// \brief Set up the next nonempty level in the priority queue and the /// sorter (down to the given `stop_level`). //////////////////////////////////////////////////////////////////////// - void setup_next_level(level_t stop_level = NO_LABEL) + void setup_next_level(level_type stop_level = no_label) { if (_outer_roots.can_pull()) { stop_level = std::min(stop_level, _outer_roots.top().level()); @@ -719,7 +719,7 @@ namespace adiar::internal /// /// \pre `can_pull() == true` //////////////////////////////////////////////////////////////////////// - elem_t top() + value_type top() { return __pq_first() ? _inner_pq.top() @@ -731,7 +731,7 @@ namespace adiar::internal /// /// \pre `can_pull() == true` //////////////////////////////////////////////////////////////////////// - elem_t peek() + value_type peek() { return top(); } //////////////////////////////////////////////////////////////////////// @@ -739,7 +739,7 @@ namespace adiar::internal /// /// \pre `can_pull() == true` //////////////////////////////////////////////////////////////////////// - elem_t pull() + value_type pull() { return __pq_first() ? _inner_pq.pull() @@ -776,28 +776,28 @@ namespace adiar::internal if (_inner_pq.empty_level()) { return false; } if (!_outer_roots.can_pull()) { return true; } - const level_t _outer_roots_level = _outer_roots.top().level(); + const level_type _outer_roots_level = _outer_roots.top().level(); if (_outer_roots_level != current_level()) { return true; } - return _e_comparator(_inner_pq.top(), _outer_roots.top()); + return _v_comparator(_inner_pq.top(), _outer_roots.top()); } - elem_t __essential(const elem_t &r) + value_type __essential(const value_type &r) { // TODO: generalize into a `map(r.target, essential)` in // . Ensure everything can be // inlined at compile-time. - static_assert(elem_t::cardinality <= 2, + static_assert(value_type::cardinality <= 2, "No need to support higher cardinality (yet)"); - typename elem_t::target_t r_tgt; - if constexpr (elem_t::cardinality == 1) { - r_tgt = typename elem_t::target_t(essential(r.target[0])); - } else {// if constexpr (elem_t::cardinality == 2) { - r_tgt = typename elem_t::target_t(essential(r.target[0]), + typename value_type::target_t r_tgt; + if constexpr (value_type::cardinality == 1) { + r_tgt = typename value_type::target_t(essential(r.target[0])); + } else {// if constexpr (value_type::cardinality == 2) { + r_tgt = typename value_type::target_t(essential(r.target[0]), essential(r.target[1])); } - return elem_t(r_tgt, {}, r.data); + return value_type(r_tgt, {}, r.data); } }; @@ -811,7 +811,7 @@ namespace adiar::internal template typename nesting_policy::unreduced_t down(nesting_policy &policy_impl, - const typename nesting_policy::shared_nodes_t &outer_file, + const typename nesting_policy::shared_node_file_type &outer_file, outer_roots_t &outer_roots, const size_t inner_memory) { @@ -842,7 +842,7 @@ namespace adiar::internal template inline typename nesting_policy::unreduced_t down__sweep_switch(nesting_policy &policy_impl, - const typename nesting_policy::shared_nodes_t &outer_file, + const typename nesting_policy::shared_node_file_type &outer_file, outer_roots_t &outer_roots, const size_t inner_memory) { @@ -872,25 +872,25 @@ namespace adiar::internal const size_t inner_remaining_memory = inner_memory - inner_stream_memory - inner_pq_memory; const size_t inner_pq_fits = - nesting_policy::template pq_t::memory_fits(inner_pq_memory); + nesting_policy::template pq_t::memory_fits(inner_pq_memory); const size_t inner_pq_bound = policy_impl.pq_bound(outer_file, outer_roots.size()); - const bool external_only = memory_mode == memory_mode_t::EXTERNAL; + const bool external_only = memory_mode == memory_mode_t::External; - const size_t inner_pq_max_size = memory_mode == memory_mode_t::INTERNAL + const size_t inner_pq_max_size = memory_mode == memory_mode_t::Internal ? std::min(inner_pq_fits, inner_pq_bound) : inner_pq_bound; // TODO (bdd_compose): ask 'nesting_policy' implementation for the initalizer list - if(!external_only && inner_pq_max_size <= no_lookahead_bound(outer_roots_t::elem_t::cardinality)) { + if(!external_only && inner_pq_max_size <= no_lookahead_bound(outer_roots_t::value_type::cardinality)) { #ifdef ADIAR_STATS stats.inner.down.lpq.unbucketed += 1u; #endif adiar_assert(inner_pq_max_size <= inner_pq_fits, "'no_lookahead' implies it should (in practice) satisfy the '<='"); - using inner_pq_t = typename nesting_policy::template pq_t<0, memory_mode_t::INTERNAL>; + using inner_pq_t = typename nesting_policy::template pq_t<0, memory_mode_t::Internal>; inner_pq_t inner_pq({typename nesting_policy::reduced_t(outer_file)}, inner_pq_memory, inner_pq_max_size, stats.inner.down.lpq); @@ -903,7 +903,7 @@ namespace adiar::internal #ifdef ADIAR_STATS stats.inner.down.lpq.internal += 1u; #endif - using inner_pq_t = typename nesting_policy::template pq_t; + using inner_pq_t = typename nesting_policy::template pq_t; inner_pq_t inner_pq({typename nesting_policy::reduced_t(outer_file)}, inner_pq_memory, inner_pq_max_size, stats.inner.down.lpq); @@ -916,7 +916,7 @@ namespace adiar::internal #ifdef ADIAR_STATS stats.inner.down.lpq.external += 1u; #endif - using inner_pq_t = typename nesting_policy::template pq_t; + using inner_pq_t = typename nesting_policy::template pq_t; inner_pq_t inner_pq({typename nesting_policy::reduced_t(outer_file)}, inner_pq_memory, inner_pq_max_size, stats.inner.down.lpq); @@ -931,8 +931,8 @@ namespace adiar::internal ////////////////////////////////////////////////////////////////////////// /// \brief Default priority queue for the Inner Up Sweep. ////////////////////////////////////////////////////////////////////////// - template - using up__pq_t = outer::up__pq_t; + template + using up__pq_t = outer::up__pq_t; ////////////////////////////////////////////////////////////////////////// /// \brief Decorator for a (levelized) priority queue that either forwards @@ -951,12 +951,12 @@ namespace adiar::internal //////////////////////////////////////////////////////////////////////////// /// \brief Type of the elements. //////////////////////////////////////////////////////////////////////////// - using elem_t = typename inner_pq_t::elem_t; + using value_type = typename inner_pq_t::value_type; //////////////////////////////////////////////////////////////////////////// /// \brief Type of the element comparator. //////////////////////////////////////////////////////////////////////////// - using elem_comp_t = typename inner_pq_t::elem_comp_t; + using value_comp_type = typename inner_pq_t::value_comp_type; //////////////////////////////////////////////////////////////////////////// /// \brief Memory mode (same as decorated priority queue). @@ -966,7 +966,7 @@ namespace adiar::internal //////////////////////////////////////////////////////////////////////// /// \brief Type of the elements in the priority queue / sorter. //////////////////////////////////////////////////////////////////////// - using level_t = typename elem_t::ptr_t::label_t; + using level_type = typename value_type::pointer_type::label_type; private: //////////////////////////////////////////////////////////////////////// @@ -978,7 +978,7 @@ namespace adiar::internal //////////////////////////////////////////////////////////////////////////// /// \brief Instantiation of the comparator between elements. //////////////////////////////////////////////////////////////////////////// - elem_comp_t _e_comparator = elem_comp_t(); + value_comp_type _v_comparator = value_comp_type(); //////////////////////////////////////////////////////////////////////// /// \brief Reference to the outer sweep's (levelized) priority queue. @@ -989,7 +989,7 @@ namespace adiar::internal //////////////////////////////////////////////////////////////////////////// /// \brief Value to reflect 'out of levels'. //////////////////////////////////////////////////////////////////////////// - static constexpr level_t NO_LABEL = inner_pq_t::NO_LABEL; + static constexpr level_type no_label = inner_pq_t::no_label; public: //////////////////////////////////////////////////////////////////////// @@ -1010,7 +1010,7 @@ namespace adiar::internal //////////////////////////////////////////////////////////////////////// /// \brief The label of the current level. //////////////////////////////////////////////////////////////////////// - level_t current_level() const + level_type current_level() const { return _inner_pq.current_level(); } //////////////////////////////////////////////////////////////////////// @@ -1022,7 +1022,7 @@ namespace adiar::internal //////////////////////////////////////////////////////////////////////// /// \brief The label of the next (possibly empty) level. //////////////////////////////////////////////////////////////////////// - level_t next_level() /*const*/ + level_type next_level() /*const*/ { return _inner_pq.next_level(); } //////////////////////////////////////////////////////////////////////// @@ -1034,12 +1034,12 @@ namespace adiar::internal //////////////////////////////////////////////////////////////////////// /// \brief Push request to inner priority queue. //////////////////////////////////////////////////////////////////////// - void push(const elem_t& e) + void push(const value_type& v) { - if (e.source().is_flagged()) { - _outer_pq.push(arc(unflag(e.source()), e.target())); + if (v.source().is_flagged()) { + _outer_pq.push(arc(unflag(v.source()), v.target())); } else { - _inner_pq.push(e); + _inner_pq.push(v); } } @@ -1047,7 +1047,7 @@ namespace adiar::internal /// \brief Set up the next nonempty level in the priority queue and the /// sorter (down to the given `stop_level`). //////////////////////////////////////////////////////////////////////// - void setup_next_level(level_t stop_level = NO_LABEL) + void setup_next_level(level_type stop_level = no_label) { _inner_pq.setup_next_level(stop_level); } //////////////////////////////////////////////////////////////////////// @@ -1071,7 +1071,7 @@ namespace adiar::internal /// /// \pre `can_pull() == true` //////////////////////////////////////////////////////////////////////// - elem_t top() + value_type top() { return _inner_pq.top(); } //////////////////////////////////////////////////////////////////////// @@ -1079,7 +1079,7 @@ namespace adiar::internal /// /// \pre `can_pull() == true` //////////////////////////////////////////////////////////////////////// - elem_t peek() + value_type peek() { return _inner_pq.peek(); } //////////////////////////////////////////////////////////////////////// @@ -1087,7 +1087,7 @@ namespace adiar::internal /// /// \pre `can_pull() == true` //////////////////////////////////////////////////////////////////////// - elem_t pull() + value_type pull() { return _inner_pq.pull(); } //////////////////////////////////////////////////////////////////////// @@ -1211,7 +1211,7 @@ namespace adiar::internal up(const arc_stream<> &outer_arcs, outer_pq_t &outer_pq, node_writer &outer_writer, - const typename nesting_policy::shared_arcs_t &inner_arcs_file, + const typename nesting_policy::shared_arc_file_type &inner_arcs_file, const size_t inner_pq_memory, const size_t inner_pq_max_size, const size_t inner_sorters_memory, @@ -1238,13 +1238,13 @@ namespace adiar::internal "If there is a level, then there should also be something for it."); const level_info inner_level_info = inner_levels.pull(); - const typename nesting_policy::label_t level = inner_level_info.level(); + const typename nesting_policy::label_type level = inner_level_info.level(); adiar_assert(!decorated_pq.has_current_level() || level == decorated_pq.current_level(), "level and priority queue should be in sync"); - if (nesting_policy::reduce_strategy == nested_sweeping::NEVER_CANONICAL || - (nesting_policy::reduce_strategy == nested_sweeping::FINAL_CANONICAL && !is_last_inner)) { + if (nesting_policy::reduce_strategy == nested_sweeping::Never_Canonical || + (nesting_policy::reduce_strategy == nested_sweeping::Final_Canonical && !is_last_inner)) { #ifdef ADIAR_STATS // TODO #endif @@ -1284,7 +1284,7 @@ namespace adiar::internal up(const arc_stream<> &outer_arcs, outer_pq_t &outer_pq, node_writer &outer_writer, - const typename nesting_policy::shared_arcs_t &inner_arcs_file, + const typename nesting_policy::shared_arc_file_type &inner_arcs_file, const size_t inner_memory, const bool is_last_inner) { @@ -1303,20 +1303,20 @@ namespace adiar::internal inner_aux_available_memory - inner_pq_memory - tpie::file_stream::memory_usage(); const tpie::memory_size_type inner_pq_memory_fits = - up__pq_t::memory_fits(inner_pq_memory); + up__pq_t::memory_fits(inner_pq_memory); const size_t inner_pq_bound = inner_arcs_file->max_1level_cut; - const size_t inner_pq_max_size = memory_mode == memory_mode_t::INTERNAL + const size_t inner_pq_max_size = memory_mode == memory_mode_t::Internal ? std::min(inner_pq_memory_fits, inner_pq_bound) : inner_pq_bound; - const bool external_only = memory_mode == memory_mode_t::EXTERNAL; + const bool external_only = memory_mode == memory_mode_t::External; if (!external_only && inner_pq_max_size <= no_lookahead_bound(1)) { #ifdef ADIAR_STATS stats.inner.up.lpq.unbucketed += 1u; #endif - using inner_pq_t = up__pq_t<0, memory_mode_t::INTERNAL>; + using inner_pq_t = up__pq_t<0, memory_mode_t::Internal>; up(outer_arcs, outer_pq, outer_writer, inner_arcs_file, inner_pq_memory, inner_pq_max_size, inner_sorters_memory, @@ -1326,7 +1326,7 @@ namespace adiar::internal #ifdef ADIAR_STATS stats.inner.up.lpq.internal += 1u; #endif - using inner_pq_t = up__pq_t; + using inner_pq_t = up__pq_t; up(outer_arcs, outer_pq, outer_writer, inner_arcs_file, inner_pq_memory, inner_pq_max_size, inner_sorters_memory, @@ -1335,7 +1335,7 @@ namespace adiar::internal #ifdef ADIAR_STATS stats.inner.up.lpq.external += 1u; #endif - using inner_pq_t = up__pq_t; + using inner_pq_t = up__pq_t; up(outer_arcs, outer_pq, outer_writer, inner_arcs_file, inner_pq_memory, inner_pq_max_size, inner_sorters_memory, @@ -1354,29 +1354,29 @@ namespace adiar::internal size_t outer_look_ahead, memory_mode_t outer_mem_mode> typename nesting_policy::reduced_t - __nested_sweep(const typename nesting_policy::shared_arcs_t &dag, + __nested_sweep(const typename nesting_policy::shared_arc_file_type &dag, nesting_policy &policy_impl, const size_t outer_pq_memory, const size_t outer_roots_memory, const size_t outer_pq_roots_max, const size_t inner_memory) { - using level_t = typename nesting_policy::label_t; + using level_type = typename nesting_policy::label_type; using reduced_t = typename nesting_policy::reduced_t; using unreduced_t = typename nesting_policy::unreduced_t; using request_t = typename nesting_policy::request_t; using request_pred_t = typename nesting_policy::request_pred_t; - using shared_arcs_t = typename nesting_policy::shared_arcs_t; - using shared_nodes_t = typename nesting_policy::shared_nodes_t; + using shared_arc_file_type = typename nesting_policy::shared_arc_file_type; + using shared_node_file_type = typename nesting_policy::shared_node_file_type; using inner_iter_t = nested_sweeping::outer::inner_iterator; inner_iter_t inner_iter(dag, policy_impl); - level_t next_inner = inner_iter.next_inner(); + level_type next_inner = inner_iter.next_inner(); // If there are no levels to do an inner sweep, then bail out with the // classic Reduce sweep. - if (next_inner == inner_iter_t::NONE) { + if (next_inner == inner_iter_t::end) { #ifdef ADIAR_STATS // TODO #endif @@ -1387,7 +1387,7 @@ namespace adiar::internal arc_stream<> outer_arcs(dag); // Set up (intermediate) output - shared_nodes_t outer_file = __reduce_init_output(); + shared_node_file_type outer_file = __reduce_init_output(); node_writer outer_writer(outer_file); @@ -1449,14 +1449,14 @@ namespace adiar::internal adiar_assert(!outer_pq.has_current_level() || outer_level.level() == outer_pq.current_level(), "level and priority queue should be in sync"); - adiar_assert(next_inner == inner_iter_t::NONE || next_inner <= outer_level.level(), + adiar_assert(next_inner == inner_iter_t::end || next_inner <= outer_level.level(), "next_inner level should (if it exists) be above current level (inclusive)."); // ----------------------------------------------------------------------- // CASE Unnested Level with no nested sweep above: // Reduce this level (without decorators). - if (next_inner == inner_iter_t::NONE) { - if constexpr (nesting_policy::reduce_strategy == nested_sweeping::NEVER_CANONICAL) { + if (next_inner == inner_iter_t::end) { + if constexpr (nesting_policy::reduce_strategy == nested_sweeping::Never_Canonical) { #ifdef ADIAR_STATS // TODO #endif @@ -1487,9 +1487,9 @@ namespace adiar::internal if (next_inner < outer_level.level()) { outer_pq_decorator_t outer_pq_decorator(outer_pq, outer_roots, next_inner); - if (/*constexpr*/ nesting_policy::reduce_strategy == nested_sweeping::NEVER_CANONICAL || - /*constexpr*/ nesting_policy::reduce_strategy == nested_sweeping::FINAL_CANONICAL || - (nesting_policy::reduce_strategy == nested_sweeping::AUTO && auto_fast_reduce)) { + if (/*constexpr*/ nesting_policy::reduce_strategy == nested_sweeping::Never_Canonical || + /*constexpr*/ nesting_policy::reduce_strategy == nested_sweeping::Final_Canonical || + (nesting_policy::reduce_strategy == nested_sweeping::Auto && auto_fast_reduce)) { #ifdef ADIAR_STATS // TODO #endif @@ -1512,9 +1512,9 @@ namespace adiar::internal outer_sorters_memory, unreduced_width); } - // AUTO Strategy: Use the fast reduce from the next level (until next + // Strategy: Use the fast reduce from the next level (until next // inner sweep) if this level did not change considerably in size. - if constexpr (nesting_policy::reduce_strategy == nested_sweeping::AUTO) { + if constexpr (nesting_policy::reduce_strategy == nested_sweeping::Auto) { const double threshold = 0.05; const double prior = static_cast(unreduced_width); @@ -1533,7 +1533,7 @@ namespace adiar::internal adiar_assert(outer_level.level() == next_inner, "'next_inner' level is not skipped"); - // Reset fast reduce for AUTO strategy. + // Reset fast reduce for strategy. auto_fast_reduce = false; // ----------------------------------------------------------------------- @@ -1557,7 +1557,7 @@ namespace adiar::internal const node n = node_of(e_low, e_high); // Apply Reduction rule 1? - const node::ptr_t reduction_rule_ret = nesting_policy::reduction_rule(n); + const node::pointer_type reduction_rule_ret = nesting_policy::reduction_rule(n); if (reduction_rule_ret != n.uid()) { // If so, preserve child in inner sweep if (!outer_levels.can_pull()) { @@ -1566,7 +1566,7 @@ namespace adiar::internal if (reduction_rule_ret.is_terminal()) { return reduced_t(reduction_rule_ret.value()); } - outer_pq_decorator.push(arc(node::ptr_t::NIL(), flag(reduction_rule_ret))); + outer_pq_decorator.push(arc(node::pointer_type::nil(), flag(reduction_rule_ret))); } else { do { outer_pq_decorator.push(arc(outer_arcs.pull_internal().source(), flag(reduction_rule_ret))); @@ -1578,7 +1578,7 @@ namespace adiar::internal adiar_assert(!outer_arcs.can_pull_internal(), "Should not have any parents at top-most level"); const request_t r = - policy_impl.request_from_node(n, node::ptr_t::NIL()); + policy_impl.request_from_node(n, node::pointer_type::nil()); adiar_assert(r.targets() > 0, "Requests are always to something"); non_gc_request |= r.targets() > 1; @@ -1606,7 +1606,7 @@ namespace adiar::internal // Obtain the next level to sweep nestedly on. next_inner = inner_iter.next_inner(); - const bool is_last_inner = next_inner == inner_iter_t::NONE; + const bool is_last_inner = next_inner == inner_iter_t::end; const bool run_inner = // We have some requests to sweep on @@ -1633,13 +1633,13 @@ namespace adiar::internal const unreduced_t inner_unreduced = nested_sweeping::inner::down(policy_impl, outer_file, outer_roots, inner_memory); - if (inner_unreduced.template has()) { + if (inner_unreduced.template has()) { adiar_assert(!outer_levels.can_pull(), "Should only collapse to a node file case when at the very top-level."); - adiar_assert(inner_unreduced.template get()->is_terminal(), + adiar_assert(inner_unreduced.template get()->is_terminal(), "Should have collapsed to a terminal."); - return inner_unreduced.template get(); + return inner_unreduced.template get(); } // --------------------------------------------------------------------- @@ -1647,8 +1647,8 @@ namespace adiar::internal adiar_assert(!inner_unreduced.template has(), "Inner Sweep returned something"); - const shared_arcs_t inner_arcs = - inner_unreduced.template get(); + const shared_arc_file_type inner_arcs = + inner_unreduced.template get(); outer_file = __reduce_init_output(); outer_writer.attach(outer_file); @@ -1672,7 +1672,7 @@ namespace adiar::internal #ifdef ADIAR_STATS // TODO #endif - adiar_assert(next_inner <= nesting_policy::ptr_t::MAX_LABEL, + adiar_assert(next_inner <= nesting_policy::pointer_type::max_label, "Has another later sweep to do possible garbage collection"); adiar_assert(outer_roots_memory <= inner_memory, @@ -1716,22 +1716,22 @@ namespace adiar::internal "All forwarded arcs for 'label' should be processed"); const size_t terminal_stop_level = - outer_arcs.can_pull_terminal() ? outer_arcs.peek_terminal().source().label() : outer_pq_t::NO_LABEL; + outer_arcs.can_pull_terminal() ? outer_arcs.peek_terminal().source().label() : outer_pq_t::no_label; const size_t outer_roots_stop_level = - !outer_roots.empty() ? outer_roots.deepest_source() : outer_pq_t::NO_LABEL; + !outer_roots.empty() ? outer_roots.deepest_source() : outer_pq_t::no_label; - adiar_assert(terminal_stop_level != outer_pq_t::NO_LABEL - || outer_roots_stop_level != outer_pq_t::NO_LABEL + adiar_assert(terminal_stop_level != outer_pq_t::no_label + || outer_roots_stop_level != outer_pq_t::no_label || !outer_pq.empty(), "There must be some (known) level ready to be forwarded to."); - const size_t stop_level = terminal_stop_level == outer_pq_t::NO_LABEL ? outer_roots_stop_level - : outer_roots_stop_level == outer_pq_t::NO_LABEL ? terminal_stop_level + const size_t stop_level = terminal_stop_level == outer_pq_t::no_label ? outer_roots_stop_level + : outer_roots_stop_level == outer_pq_t::no_label ? terminal_stop_level : std::max(terminal_stop_level, outer_roots_stop_level) ; - adiar_assert(stop_level != outer_pq_t::NO_LABEL || !outer_pq.empty(), + adiar_assert(stop_level != outer_pq_t::no_label || !outer_pq.empty(), "There must be some (known) level ready to be forwarded to."); outer_pq.setup_next_level(stop_level); @@ -1775,20 +1775,20 @@ namespace adiar::internal using reduced_t = typename nesting_policy::reduced_t; using request_t = typename nesting_policy::request_t; using request_pred_t = typename nesting_policy::request_pred_t; - using shared_arcs_t = typename nesting_policy::shared_arcs_t; - using shared_nodes_t = typename nesting_policy::shared_nodes_t; + using shared_arc_file_type = typename nesting_policy::shared_arc_file_type; + using shared_node_file_type = typename nesting_policy::shared_node_file_type; adiar_assert(!input.empty(), "Input for Nested Sweeping should always be non-empty"); // Is it a terminal? - if (input.template has() && input.template get()->is_terminal()) { - return reduced_t(input.template get(), input.negate); + if (input.template has() && input.template get()->is_terminal()) { + return reduced_t(input.template get(), input.negate); } // Otherwise obtain the semi-transposed DAG (construct it if necessary) - const shared_arcs_t dag = input.template has() - ? input.template get() - : transpose(reduced_t(input.template get(), input.negate)); + const shared_arc_file_type dag = input.template has() + ? input.template get() + : transpose(reduced_t(input.template get(), input.negate)); // Compute amount of memory available for auxiliary data structures after // having opened all streams. @@ -1813,14 +1813,14 @@ namespace adiar::internal // Output streams - node_writer::memory_usage(); - using outer_default_lpq_t = nested_sweeping::outer::up__pq_t; + using outer_default_lpq_t = nested_sweeping::outer::up__pq_t; - constexpr size_t data_structures_in_pq = outer_default_lpq_t::DATA_STRUCTURES; + constexpr size_t data_structures_in_pq = outer_default_lpq_t::data_structures; using internal_roots_sorter_t = - nested_sweeping::outer::roots_sorter; + nested_sweeping::outer::roots_sorter; - constexpr size_t data_structures_in_roots = internal_roots_sorter_t::DATA_STRUCTURES; + constexpr size_t data_structures_in_roots = internal_roots_sorter_t::data_structures; const size_t outer_pq_memory = (aux_outer_memory / (data_structures_in_pq + data_structures_in_roots)) * data_structures_in_pq; @@ -1834,28 +1834,28 @@ namespace adiar::internal const size_t pq_roots_bound = dag->max_1level_cut; - const size_t outer_pq_roots_max = memory_mode == memory_mode_t::INTERNAL + const size_t outer_pq_roots_max = memory_mode == memory_mode_t::Internal ? std::min({outer_pq_memory_fits, outer_roots_memory_fits, pq_roots_bound}) : pq_roots_bound; - const bool external_only = memory_mode == memory_mode_t::EXTERNAL; + const bool external_only = memory_mode == memory_mode_t::External; if (!external_only && outer_pq_roots_max <= no_lookahead_bound(1)) { #ifdef ADIAR_STATS stats_reduce.lpq.unbucketed += 1u; #endif - return __nested_sweep + return __nested_sweep (dag, policy_impl, outer_pq_memory, outer_roots_memory, outer_pq_roots_max, inner_memory); } else if(!external_only && outer_pq_roots_max <= outer_pq_memory_fits && outer_pq_roots_max <= outer_roots_memory_fits) { #ifdef ADIAR_STATS stats_reduce.lpq.internal += 1u; #endif - return __nested_sweep + return __nested_sweep (dag, policy_impl, outer_pq_memory, outer_roots_memory, outer_pq_roots_max, inner_memory); } else { #ifdef ADIAR_STATS stats_reduce.lpq.external += 1u; #endif - return __nested_sweep + return __nested_sweep (dag, policy_impl, outer_pq_memory, outer_roots_memory, outer_pq_roots_max, inner_memory); } } diff --git a/src/adiar/internal/algorithms/pred.cpp b/src/adiar/internal/algorithms/pred.cpp index a093b2d6c..12ff034a9 100644 --- a/src/adiar/internal/algorithms/pred.cpp +++ b/src/adiar/internal/algorithms/pred.cpp @@ -1,12 +1,14 @@ #include "pred.h" -#include +#include #include #include +#include + namespace adiar::internal { - stats_t::equality_t stats_equality; + statistics::equality_t stats_equality; ////////////////////////////////////////////////////////////////////////////// // Slow O(sort(N)) I/Os comparison by traversing the product construction and @@ -29,15 +31,15 @@ namespace adiar::internal static size_t pq1_upper_bound(const shared_levelized_file &in_1, const shared_levelized_file &in_2) { - return std::max(in_1->max_2level_cut[cut_type::INTERNAL], - in_2->max_2level_cut[cut_type::INTERNAL]); + return std::max(in_1->max_2level_cut[cut::Internal], + in_2->max_2level_cut[cut::Internal]); } static size_t pq2_upper_bound(const shared_levelized_file &in_1, const shared_levelized_file &in_2) { - return std::max(in_1->max_1level_cut[cut_type::INTERNAL], - in_2->max_1level_cut[cut_type::INTERNAL]); + return std::max(in_1->max_1level_cut[cut::Internal], + in_2->max_1level_cut[cut::Internal]); } static constexpr size_t memory_usage() @@ -51,7 +53,7 @@ namespace adiar::internal : in_meta_1(f0) { } - void next_level(ptr_uint64::label_t /* level */) + void next_level(ptr_uint64::label_type /* level */) { // Ignore input, since only used with the isomorphism_policy below. curr_level_size = in_meta_1.pull().width(); curr_level_processed = 0; @@ -84,15 +86,15 @@ namespace adiar::internal // Since we guarantee to be on the same level, then we merely provide a noop // (similar to the bdd_policy) for the cofactor. static inline void compute_cofactor([[maybe_unused]] const bool on_curr_level, - dd::ptr_t &/*low*/, - dd::ptr_t &/*high*/) + dd::pointer_type &/*low*/, + dd::pointer_type &/*high*/) { adiar_assert(on_curr_level, "No request have mixed levels"); } // Since we guarantee to be on the same level, then we merely provide a noop // (similar to the bdd_policy) for the cofactor. - static inline dd::node_t::children_t + static inline dd::node_type::children_type compute_cofactor([[maybe_unused]] const bool on_curr_level, - const dd::node_t::children_t &children) + const dd::node_type::children_type &children) { adiar_assert(on_curr_level, "No request have mixed levels"); return children; @@ -114,7 +116,7 @@ namespace adiar::internal , public prod2_same_level_merger { public: - typedef input_bound_levels level_check_t; + using level_check_t = input_bound_levels; public: static constexpr size_t lookahead_bound() @@ -123,7 +125,7 @@ namespace adiar::internal } public: - static bool resolve_terminals(const dd::node_t &v1, const dd::node_t &v2, bool &ret_value) + static bool resolve_terminals(const dd::node_type &v1, const dd::node_type &v2, bool &ret_value) { ret_value = v1.is_terminal() && v2.is_terminal() && v1.value() == v2.value(); #ifdef ADIAR_STATS @@ -133,7 +135,7 @@ namespace adiar::internal } public: - static bool resolve_singletons(const dd::node_t &v1, const dd::node_t &v2) + static bool resolve_singletons(const dd::node_type &v1, const dd::node_type &v2) { #ifdef ADIAR_STATS stats_equality.slow_check.exit_on_root += 1u; @@ -144,7 +146,7 @@ namespace adiar::internal public: template - static bool resolve_request(pq_1_t &pq, const tuple &rp) + static bool resolve_request(pq_1_t &pq, const tuple &rp) { // Are they both a terminal (and the same terminal)? if (rp[0].is_terminal() || rp[1].is_terminal()) { @@ -181,7 +183,7 @@ namespace adiar::internal /// requires, that the shared_levelized_file is 'canonical' in the /// following sense: /// - /// - For each level, the ids are decreasing from MAX_ID in increments of one. + /// - For each level, the ids are decreasing from max_id in increments of one. /// - There are no duplicate nodes. /// - Nodes within each level are sorted by the children (e.g. ordered first on /// 'high', secondly on 'low'). diff --git a/src/adiar/internal/algorithms/pred.h b/src/adiar/internal/algorithms/pred.h index 65c349ea7..f5da560b9 100644 --- a/src/adiar/internal/algorithms/pred.h +++ b/src/adiar/internal/algorithms/pred.h @@ -15,7 +15,7 @@ namespace adiar::internal { ////////////////////////////////////////////////////////////////////////////// /// Struct to hold statistics for equality checking - extern stats_t::equality_t stats_equality; + extern statistics::equality_t stats_equality; ////////////////////////////////////////////////////////////////////////////// /// \brief Compute whether two shared levelized node files (with associated @@ -56,15 +56,15 @@ namespace adiar::internal template using pred_request = request<2, nodes_carried>; - template + template using comparison_priority_queue_1_t = levelized_node_priority_queue, request_first_lt>, - LOOK_AHEAD, + look_ahead, mem_mode, 2u, 0u>; - typedef request<2, 1> pred_request_2; + using pred_request_2 = request<2, 1>; template using comparison_priority_queue_2_t = @@ -120,7 +120,7 @@ namespace adiar::internal if (comparison_pq_1.can_pull() && (comparison_pq_2.empty() || comparison_pq_1.top().target.first() < comparison_pq_2.top().target.second())) { req = { comparison_pq_1.top().target, - { {{ node::ptr_t::NIL(), node::ptr_t::NIL() }} } }; + { {{ node::pointer_type::nil(), node::pointer_type::nil() }} } }; comparison_pq_1.pop(); } else { req = comparison_pq_2.top(); @@ -128,7 +128,7 @@ namespace adiar::internal } // Seek request partially in stream - const typename comp_policy::ptr_t t_seek = + const typename comp_policy::pointer_type t_seek = req.empty_carry() ? req.target.first() : req.target.second(); while (v0.uid() < t_seek && in_nodes_0.can_pull()) { @@ -148,7 +148,7 @@ namespace adiar::internal && req.target[0].is_node() && req.target[1].is_node() && req.target[0].label() == req.target[1].label() && (v0.uid() != req.target[0] || v1.uid() != req.target[1])) { - const typename comp_policy::children_t children = + const typename comp_policy::children_type children = (req.target[0] == v0.uid() ? v0 : v1).children(); comparison_pq_2.push({ req.target, { children } }); @@ -161,14 +161,14 @@ namespace adiar::internal } // Obtain children or root for both nodes (depending on level) - const tuple children = + const tuple children = comp_policy::merge(req, t_seek, v0, v1); // Create pairing of product children and obtain new recursion targets - const tuple rec_pair_0 = + const tuple rec_pair_0 = { children[0][false], children[1][false] }; - const tuple rec_pair_1 = + const tuple rec_pair_1 = { children[0][true], children[1][true] }; // Forward pairing and return early if possible @@ -223,10 +223,10 @@ namespace adiar::internal - comp_policy::level_check_t::memory_usage(); constexpr size_t data_structures_in_pq_1 = - comparison_priority_queue_1_t::DATA_STRUCTURES; + comparison_priority_queue_1_t::data_structures; constexpr size_t data_structures_in_pq_2 = - comparison_priority_queue_2_t::DATA_STRUCTURES; + comparison_priority_queue_2_t::data_structures; const size_t pq_1_internal_memory = (aux_available_memory / (data_structures_in_pq_1 + data_structures_in_pq_2)) * data_structures_in_pq_1; @@ -234,13 +234,13 @@ namespace adiar::internal const size_t pq_2_internal_memory = aux_available_memory - pq_1_internal_memory; const size_t pq_1_memory_fits = - comparison_priority_queue_1_t::memory_fits(pq_1_internal_memory); + comparison_priority_queue_1_t::memory_fits(pq_1_internal_memory); const size_t pq_2_memory_fits = - comparison_priority_queue_2_t::memory_fits(pq_2_internal_memory); + comparison_priority_queue_2_t::memory_fits(pq_2_internal_memory); - const bool internal_only = memory_mode == memory_mode_t::INTERNAL; - const bool external_only = memory_mode == memory_mode_t::EXTERNAL; + const bool internal_only = memory_mode == memory_mode_t::Internal; + const bool external_only = memory_mode == memory_mode_t::External; const size_t pq_1_bound = comp_policy::level_check_t::pq1_upper_bound(f0, f1); @@ -256,8 +256,8 @@ namespace adiar::internal stats_equality.lpq.unbucketed += 1u; #endif return __comparison_check, - comparison_priority_queue_2_t> + comparison_priority_queue_1_t<0, memory_mode_t::Internal>, + comparison_priority_queue_2_t> (f0, f1, negate0, negate1, pq_1_internal_memory, pq_2_internal_memory, max_pq_1_size); } else if(!external_only && max_pq_1_size <= pq_1_memory_fits && max_pq_2_size <= pq_2_memory_fits) { @@ -265,8 +265,8 @@ namespace adiar::internal stats_equality.lpq.internal += 1u; #endif return __comparison_check, - comparison_priority_queue_2_t> + comparison_priority_queue_1_t, + comparison_priority_queue_2_t> (f0, f1, negate0, negate1, pq_1_internal_memory, pq_2_internal_memory, max_pq_1_size); } else { #ifdef ADIAR_STATS @@ -276,8 +276,8 @@ namespace adiar::internal const size_t pq_2_memory = pq_1_memory; return __comparison_check, - comparison_priority_queue_2_t> + comparison_priority_queue_1_t, + comparison_priority_queue_2_t> (f0, f1, negate0, negate1, pq_1_memory, pq_2_memory, max_pq_1_size); } } diff --git a/src/adiar/internal/algorithms/prod2.cpp b/src/adiar/internal/algorithms/prod2.cpp index 5e3082cec..b032ee32a 100644 --- a/src/adiar/internal/algorithms/prod2.cpp +++ b/src/adiar/internal/algorithms/prod2.cpp @@ -2,5 +2,5 @@ namespace adiar::internal { - stats_t::prod2_t stats_prod2; + statistics::prod2_t stats_prod2; } diff --git a/src/adiar/internal/algorithms/prod2.h b/src/adiar/internal/algorithms/prod2.h index 87ccdf5d3..78f1bd988 100644 --- a/src/adiar/internal/algorithms/prod2.h +++ b/src/adiar/internal/algorithms/prod2.h @@ -4,12 +4,15 @@ #include #include -#include #include #include + +#include +#include #include #include #include +#include #include #include #include @@ -25,7 +28,7 @@ namespace adiar::internal { ////////////////////////////////////////////////////////////////////////////// /// Struct to hold statistics - extern stats_t::prod2_t stats_prod2; + extern statistics::prod2_t stats_prod2; ////////////////////////////////////////////////////////////////////////////// // Data structures @@ -33,19 +36,19 @@ namespace adiar::internal using prod2_request = request_data<2, with_parent, nodes_carried>; // TODO: move this definition down to __prod2_ra, as it is only used here? - template + template using prod_priority_queue_t = levelized_node_priority_queue, request_data_lt<1, prod2_request<0>>, - LOOK_AHEAD, + look_ahead, mem_mode, 2, 0>; // TODO: move this definition down to __prod2_pq, as it is only used here? - template + template using prod_priority_queue_1_t = levelized_node_priority_queue, request_data_first_lt>, - LOOK_AHEAD, + look_ahead, mem_mode, 2, 0>; @@ -54,15 +57,15 @@ namespace adiar::internal using prod_priority_queue_2_t = priority_queue, request_data_second_lt>>; - // TODO: turn into 'tuple>' + // TODO: turn into 'tuple>' struct prod2_rec_output { - tuple low; - tuple high; + tuple low; + tuple high; }; - typedef tuple prod2_rec_skipto; + using prod2_rec_skipto = tuple; - typedef std::variant prod2_rec; + using prod2_rec = std::variant; ////////////////////////////////////////////////////////////////////////////// // Helper functions @@ -130,8 +133,8 @@ namespace adiar::internal { template static inline void go(pq_t& /*prod_pq_1*/, arc_writer &aw, - const node::uid_t &out_uid, - const node::ptr_t &source) + const node::uid_type &out_uid, + const node::pointer_type &source) { if (!source.is_nil()) { aw.push_internal({ source, out_uid }); @@ -163,7 +166,7 @@ namespace adiar::internal template inline shared_levelized_file - __prod2_terminal(const tuple &rp, const bool_op &op) + __prod2_terminal(const tuple &rp, const bool_op &op) { // TODO: Abuse that op(tgt[0], tgt[1]) already is a pointer. return build_terminal(op(rp[0], rp[1]).value()); @@ -175,16 +178,16 @@ namespace adiar::internal { public: template - static tuple + static tuple merge(const request_t &r, const ptr_uint64 &t_seek, const node &v0, const node &v1) { - const typename dd_policy::children_t pair_0 = + const typename dd_policy::children_type pair_0 = r.target[0] < t_seek ? r.node_carry[0] : v0.children(); - const typename dd_policy::children_t pair_1 = + const typename dd_policy::children_type pair_1 = r.target[1] < t_seek ? r.node_carry[0] : v1.children(); return { pair_0, pair_1 }; @@ -196,11 +199,11 @@ namespace adiar::internal { public: template - static tuple + static tuple merge(const request_t &r, - const typename dd_policy::ptr_t &t_seek, - const typename dd_policy::node_t &v0, - const typename dd_policy::node_t &v1) + const typename dd_policy::pointer_type &t_seek, + const typename dd_policy::node_type &v0, + const typename dd_policy::node_type &v1) { if (r.target[0].is_terminal() || r.target[1].is_terminal() || @@ -210,13 +213,13 @@ namespace adiar::internal "Cannot have mismatching levels and be equal"); // t.target[0].label() < r.target[1].label() || r.target[1].is_terminal() ? - const typename dd_policy::children_t pair_0 = + const typename dd_policy::children_type pair_0 = r.target[0] < r.target[1] ? v0.children() : dd_policy::reduction_rule_inv(r.target[0]); // r.target[1].label() < r.target[0].label() || r.target[0].is_terminal() ? - const typename dd_policy::children_t pair_1 = + const typename dd_policy::children_type pair_1 = r.target[1] < r.target[0] ? v1.children() : dd_policy::reduction_rule_inv(r.target[1]); @@ -250,7 +253,7 @@ namespace adiar::internal // Set up cross-level priority queue pq_1_t prod_pq({in_0, in_1}, pq_memory, max_pq_size, stats_prod2.lpq); - prod_pq.push({ { in_nodes_0.root(), v1.uid() }, {}, { ptr_uint64::NIL() } }); + prod_pq.push({ { in_nodes_0.root(), v1.uid() }, {}, { ptr_uint64::nil() } }); size_t max_1level_cut = 0; @@ -259,8 +262,8 @@ namespace adiar::internal // Setup layer prod_pq.setup_next_level(); - typename prod_policy::label_t out_label = prod_pq.current_level(); - typename prod_policy::id_t out_id = 0; + typename prod_policy::label_type out_label = prod_pq.current_level(); + typename prod_policy::id_type out_id = 0; in_nodes_0.setup_next_level(out_label); @@ -277,21 +280,21 @@ namespace adiar::internal "Must have found correct node in `in_1`"); } - const typename prod_policy::children_t children_0 = + const typename prod_policy::children_type children_0 = req.target[0].on_level(out_label) ? in_nodes_0.at(req.target[0]).children() : prod_policy::reduction_rule_inv(req.target[0]); - const typename prod_policy::children_t children_1 = + const typename prod_policy::children_type children_1 = req.target[1].on_level(out_label) ? v1.children() : prod_policy::reduction_rule_inv(req.target[1]); // Create pairing of product children - const tuple rec_pair_0 = + const tuple rec_pair_0 = { children_0[false], children_1[false] }; - const tuple rec_pair_1 = + const tuple rec_pair_1 = { children_0[true], children_1[true] }; // Obtain new recursion targets @@ -302,8 +305,8 @@ namespace adiar::internal if (prod_policy::no_skip || std::holds_alternative(rec_res)) { const prod2_rec_output r = std::get(rec_res); - adiar_assert(out_id < prod_policy::MAX_ID, "Has run out of ids"); - const node::uid_t out_uid(out_label, out_id++); + adiar_assert(out_id < prod_policy::max_id, "Has run out of ids"); + const node::uid_type out_uid(out_label, out_id++); __prod2_recurse_out(prod_pq, aw, op, out_uid.with(false), r.low); __prod2_recurse_out(prod_pq, aw, op, out_uid.with(true), r.high); @@ -335,7 +338,7 @@ namespace adiar::internal max_1level_cut = std::max(max_1level_cut, prod_pq.size()); } - // Ensure the edge case, where the in-going edge from NIL to the root pair + // Ensure the edge case, where the in-going edge from nil to the root pair // does not dominate the max_1level_cut max_1level_cut = std::min(aw.size() - out_arcs->number_of_terminals[false] - out_arcs->number_of_terminals[true], @@ -367,14 +370,14 @@ namespace adiar::internal // Set up cross-level priority queue pq_1_t prod_pq_1({in_0, in_1}, pq_1_memory, max_pq_1_size, stats_prod2.lpq); - prod_pq_1.push({ { v0.uid(), v1.uid() }, {}, { ptr_uint64::NIL() } }); + prod_pq_1.push({ { v0.uid(), v1.uid() }, {}, { ptr_uint64::nil() } }); // Set up per-level priority queue pq_2_t prod_pq_2(pq_2_memory, max_pq_2_size); // Process requests in topological order of both BDDs - typename prod_policy::label_t out_label = first(v0.uid(), v1.uid()).label(); - typename prod_policy::id_t out_id = 0; + typename prod_policy::label_type out_label = first(v0.uid(), v1.uid()).label(); + typename prod_policy::id_type out_id = 0; size_t max_1level_cut = 0; @@ -398,7 +401,7 @@ namespace adiar::internal if (prod_pq_1.can_pull() && (prod_pq_2.empty() || prod_pq_1.top().target.first() < prod_pq_2.top().target.second())) { req = { prod_pq_1.top().target, - {{ { node::ptr_t::NIL(), node::ptr_t::NIL() } }}, + {{ { node::pointer_type::nil(), node::pointer_type::nil() } }}, { prod_pq_1.top().data } }; } else { req = prod_pq_2.top(); @@ -410,7 +413,7 @@ namespace adiar::internal "Request should never level-wise be behind current position"); // Seek request partially in stream - const typename prod_policy::ptr_t t_seek = + const typename prod_policy::pointer_type t_seek = req.empty_carry() ? req.target.first() : req.target.second(); while (v0.uid() < t_seek && in_nodes_0.can_pull()) { @@ -425,7 +428,7 @@ namespace adiar::internal && req.target[0].is_node() && req.target[1].is_node() && req.target[0].label() == req.target[1].label() && (v0.uid() != req.target[0] || v1.uid() != req.target[1])) { - const typename prod_policy::children_t children = + const typename prod_policy::children_type children = (req.target[0] == v0.uid() ? v0 : v1).children(); while (prod_pq_1.can_pull() && prod_pq_1.top().target == req.target) { @@ -438,14 +441,14 @@ namespace adiar::internal } // Recreate children of nodes for req.target - const tuple children = + const tuple children = prod_policy::merge(req, t_seek, v0, v1); // Create pairing of product children - const tuple rec_pair_0 = + const tuple rec_pair_0 = { children[0][false], children[1][false] }; - const tuple rec_pair_1 = + const tuple rec_pair_1 = { children[0][true], children[1][true] }; // Obtain new recursion targets @@ -456,8 +459,8 @@ namespace adiar::internal if (prod_policy::no_skip || std::holds_alternative(rec_res)) { const prod2_rec_output r = std::get(rec_res); - adiar_assert(out_id < prod_policy::MAX_ID, "Has run out of ids"); - const node::uid_t out_uid(out_label, out_id++); + adiar_assert(out_id < prod_policy::max_id, "Has run out of ids"); + const node::uid_type out_uid(out_label, out_id++); __prod2_recurse_out(prod_pq_1, aw, op, out_uid.with(false), r.low); __prod2_recurse_out(prod_pq_1, aw, op, out_uid.with(true), r.high); @@ -486,7 +489,7 @@ namespace adiar::internal aw.push(level_info(out_label, out_id)); } - // Ensure the edge case, where the in-going edge from NIL to the root pair + // Ensure the edge case, where the in-going edge from nil to the root pair // does not dominate the max_1level_cut max_1level_cut = std::min(aw.size() - out_arcs->number_of_terminals[false] - out_arcs->number_of_terminals[true], @@ -507,15 +510,15 @@ namespace adiar::internal const bool_op &op) { // Cuts for left-hand side - const safe_size_t left_cut_internal = cut::get(in_0, cut_type::INTERNAL); + const safe_size_t left_cut_internal = cut::get(in_0, cut::type::Internal); - const cut_type left_ct = prod_policy::left_cut(op); + const typename cut::type left_ct = prod_policy::left_cut(op); const safe_size_t left_cut_terminals = cut::get(in_0, left_ct) - left_cut_internal; // Cuts for right-hand side - const safe_size_t right_cut_internal = cut::get(in_1, cut_type::INTERNAL); + const safe_size_t right_cut_internal = cut::get(in_1, cut::type::Internal); - const cut_type right_ct = prod_policy::right_cut(op); + const typename cut::type right_ct = prod_policy::right_cut(op); const safe_size_t right_cut_terminals = cut::get(in_1, right_ct) - right_cut_internal; // Compute cut, where we make sure not to pair terminals with terminals. @@ -535,20 +538,20 @@ namespace adiar::internal const bool_op &op) { // Left-hand side - const safe_size_t left_2level_cut = in_0.max_2level_cut(cut_type::INTERNAL); - const safe_size_t left_1level_cut = in_0.max_1level_cut(cut_type::INTERNAL); + const safe_size_t left_2level_cut = in_0.max_2level_cut(cut::Internal); + const safe_size_t left_1level_cut = in_0.max_1level_cut(cut::Internal); - const cut_type left_ct = prod_policy::left_cut(op); - const safe_size_t left_terminal_vals = number_of_terminals(left_ct); + const cut left_ct = prod_policy::left_cut(op); + const safe_size_t left_terminal_vals = left_ct.number_of_terminals(); const safe_size_t left_terminal_arcs = in_0.max_1level_cut(left_ct) - left_1level_cut; // Right-hand side - const safe_size_t right_2level_cut = in_1.max_2level_cut(cut_type::INTERNAL); - const safe_size_t right_1level_cut = in_1.max_1level_cut(cut_type::INTERNAL); + const safe_size_t right_2level_cut = in_1.max_2level_cut(cut::Internal); + const safe_size_t right_1level_cut = in_1.max_1level_cut(cut::Internal); - const cut_type right_ct = prod_policy::right_cut(op); - const safe_size_t right_terminal_vals = number_of_terminals(right_ct); + const cut right_ct = prod_policy::right_cut(op); + const safe_size_t right_terminal_vals = right_ct.number_of_terminals(); const safe_size_t right_terminal_arcs = in_1.max_1level_cut(right_ct) - right_1level_cut; @@ -569,12 +572,12 @@ namespace adiar::internal const typename prod_policy::reduced_t &in_1, const bool_op &op) { - const cut_type left_ct = prod_policy::left_cut(op); - const safe_size_t left_terminal_vals = number_of_terminals(left_ct); + const cut left_ct = prod_policy::left_cut(op); + const safe_size_t left_terminal_vals = left_ct.number_of_terminals(); const safe_size_t left_size = in_0->size(); - const cut_type right_ct = prod_policy::right_cut(op); - const safe_size_t right_terminal_vals = number_of_terminals(right_ct); + const cut right_ct = prod_policy::right_cut(op); + const safe_size_t right_terminal_vals = right_ct.number_of_terminals(); const safe_size_t right_size = in_1->size(); return to_size((left_size + left_terminal_vals) * (right_size + right_terminal_vals) + 1u + 2u); @@ -642,7 +645,7 @@ namespace adiar::internal // ------------------------------------------------------------------------- // Case: At least one terminal. - if (is_terminal(in_0) || is_terminal(in_1)) { + if (dd_isterminal(in_0) || dd_isterminal(in_1)) { typename prod_policy::unreduced_t maybe_resolved = prod_policy::resolve_terminal_root(in_0, in_1, op); @@ -670,15 +673,15 @@ namespace adiar::internal __prod2_2level_upper_bound(in_0, in_1, op), __prod2_ilevel_upper_bound(in_0, in_1, op)}); - const bool internal_only = memory_mode == memory_mode_t::INTERNAL; - const bool external_only = memory_mode == memory_mode_t::EXTERNAL; + const bool internal_only = memory_mode == memory_mode_t::Internal; + const bool external_only = memory_mode == memory_mode_t::External; // TODO: define this otherwise // 2 mega byte - constexpr size_t ra_thresshold = 2 * 1024 * 1024 / sizeof(typename prod_policy::node_t); + constexpr size_t ra_thresshold = 2 * 1024 * 1024 / sizeof(typename prod_policy::node_type); - if (access_mode == access_mode_t::RA - || (access_mode == access_mode_t::AUTO + if (access_mode == access_mode_t::Random_Access + || (access_mode == access_mode_t::Auto // The smallest of the canonical inputs, must be under the thresshold && ( (in_0->canonical && in_1->canonical && std::min(in_0->width, in_1->width) <= ra_thresshold) || (in_0->canonical && in_0->width <= ra_thresshold) @@ -715,7 +718,7 @@ namespace adiar::internal - arc_writer::memory_usage(); const size_t pq_memory_fits = - prod_priority_queue_t::memory_fits(pq_available_memory); + prod_priority_queue_t::memory_fits(pq_available_memory); const size_t max_pq_size = internal_only ? std::min(pq_memory_fits, pq_1_bound) : pq_1_bound; @@ -724,21 +727,21 @@ namespace adiar::internal stats_prod2.lpq.unbucketed += 1u; #endif return __prod2_ra> + prod_priority_queue_t<0, memory_mode_t::Internal>> (ra_in_0, ra_in_1, ra_op, pq_available_memory, max_pq_size); } else if (!external_only && max_pq_size <= pq_memory_fits) { #ifdef ADIAR_STATS stats_prod2.lpq.internal += 1u; #endif return __prod2_ra> + prod_priority_queue_t> (ra_in_0, ra_in_1, ra_op, pq_available_memory, max_pq_size); } else { #ifdef ADIAR_STATS stats_prod2.lpq.external += 1u; #endif return __prod2_ra> + prod_priority_queue_t> (ra_in_0, ra_in_1, ra_op, pq_available_memory, max_pq_size); } } @@ -762,10 +765,10 @@ namespace adiar::internal - arc_writer::memory_usage(); constexpr size_t data_structures_in_pq_1 = - prod_priority_queue_1_t::DATA_STRUCTURES; + prod_priority_queue_1_t::data_structures; constexpr size_t data_structures_in_pq_2 = - prod_priority_queue_2_t::DATA_STRUCTURES; + prod_priority_queue_2_t::data_structures; const size_t pq_1_internal_memory = (aux_available_memory / (data_structures_in_pq_1 + data_structures_in_pq_2)) * data_structures_in_pq_1; @@ -773,10 +776,10 @@ namespace adiar::internal const size_t pq_2_internal_memory = aux_available_memory - pq_1_internal_memory; const size_t pq_1_memory_fits = - prod_priority_queue_1_t::memory_fits(pq_1_internal_memory); + prod_priority_queue_1_t::memory_fits(pq_1_internal_memory); const size_t pq_2_memory_fits = - prod_priority_queue_2_t::memory_fits(pq_2_internal_memory); + prod_priority_queue_2_t::memory_fits(pq_2_internal_memory); const size_t max_pq_1_size = internal_only ? std::min(pq_1_memory_fits, pq_1_bound) : pq_1_bound; @@ -789,8 +792,8 @@ namespace adiar::internal stats_prod2.lpq.unbucketed += 1u; #endif return __prod2_pq, - prod_priority_queue_2_t> + prod_priority_queue_1_t<0, memory_mode_t::Internal>, + prod_priority_queue_2_t> (in_0, in_1, op, pq_1_internal_memory, max_pq_1_size, pq_2_internal_memory, max_pq_2_size); } else if(!external_only && max_pq_1_size <= pq_1_memory_fits && max_pq_2_size <= pq_2_memory_fits) { @@ -798,8 +801,8 @@ namespace adiar::internal stats_prod2.lpq.internal += 1u; #endif return __prod2_pq, - prod_priority_queue_2_t> + prod_priority_queue_1_t, + prod_priority_queue_2_t> (in_0, in_1, op, pq_1_internal_memory, max_pq_1_size, pq_2_internal_memory, max_pq_2_size); } else { #ifdef ADIAR_STATS @@ -809,8 +812,8 @@ namespace adiar::internal const size_t pq_2_memory = pq_1_memory; return __prod2_pq, - prod_priority_queue_2_t> + prod_priority_queue_1_t, + prod_priority_queue_2_t> (in_0, in_1, op, pq_1_memory, max_pq_1_size, pq_2_memory, max_pq_2_size); } } diff --git a/src/adiar/internal/algorithms/quantify.cpp b/src/adiar/internal/algorithms/quantify.cpp index 0e3161031..ff31fc0b9 100644 --- a/src/adiar/internal/algorithms/quantify.cpp +++ b/src/adiar/internal/algorithms/quantify.cpp @@ -2,5 +2,5 @@ namespace adiar::internal { - stats_t::quantify_t stats_quantify; + statistics::quantify_t stats_quantify; } diff --git a/src/adiar/internal/algorithms/quantify.h b/src/adiar/internal/algorithms/quantify.h index 425fe891b..b293bfbb6 100644 --- a/src/adiar/internal/algorithms/quantify.h +++ b/src/adiar/internal/algorithms/quantify.h @@ -4,10 +4,11 @@ #include #include -#include #include #include + #include +#include #include #include #include @@ -29,7 +30,7 @@ namespace adiar::internal { ////////////////////////////////////////////////////////////////////////////// /// Struct to hold statistics - extern stats_t::quantify_t stats_quantify; + extern statistics::quantify_t stats_quantify; ////////////////////////////////////////////////////////////////////////////// // Data structures @@ -39,20 +40,20 @@ namespace adiar::internal ////////////////////////////////////////////////////////////////////////////// // Priority queue functions - template + template using quantify_priority_queue_1_node_t = levelized_node_priority_queue, request_data_first_lt>, - LOOK_AHEAD, + look_ahead, mem_mode, 1, 0>; - template + template using quantify_priority_queue_1_arc_t = levelized_node_arc_priority_queue, request_data_first_lt>, - LOOK_AHEAD, + look_ahead, mem_mode, 1, 0>; @@ -66,11 +67,11 @@ namespace adiar::internal template inline void __quantify_forward_request(pq_1_t &quantify_pq_1, arc_writer &aw, - const typename quantify_policy::ptr_t source, + const typename quantify_policy::pointer_type source, const quantify_request<0>::target_t &target) { adiar_assert(!target.first().is_nil(), - "ptr_t::NIL() should only ever end up being placed in target[1]"); + "pointer_type::nil() should only ever end up being placed in target[1]"); if (target.first().is_terminal()) { adiar_assert(target.second().is_nil(), @@ -102,9 +103,9 @@ namespace adiar::internal } template - inline tuple + inline tuple __quantify_resolve_request(const bool_op &op, - std::array ts) + std::array ts) { { // Sort array with pointers // TODO (optimisation): Abuse array is tiny with single-swap (2) / insertion-sort (3+) @@ -117,8 +118,8 @@ namespace adiar::internal for (size_t i = ts_max_idx+1; i < ts.size(); ++i) { adiar_assert(ts_max_idx < i, "i is always ahead of 'ts_max_idx'"); - // Stop early at maximum value of 'NIL' - if (ts[i] == quantify_policy::ptr_t::NIL()) { break; } + // Stop early at maximum value of 'nil' + if (ts[i] == quantify_policy::pointer_type::nil()) { break; } // Move new unique element at next spot for 'ts_max_idx' if (ts[ts_max_idx] != ts[i] && @@ -127,7 +128,7 @@ namespace adiar::internal } } for (size_t i = ts_max_idx+1; i < ts.size(); ++i) { - ts[i] = quantify_policy::ptr_t::NIL(); + ts[i] = quantify_policy::pointer_type::nil(); } // Is the final element a collapsing terminal? @@ -144,7 +145,7 @@ namespace adiar::internal adiar_assert(!ts[1].is_nil(), "Cannot be nil at i <= ts_max_elem"); ts[0] = max_shortcuts ? ts[ts_max_idx] : op(ts[0], ts[1]); for (size_t i = 1u; i <= ts_max_idx; ++i) { - ts[i] = quantify_policy::ptr_t::NIL(); + ts[i] = quantify_policy::pointer_type::nil(); } } @@ -169,7 +170,7 @@ namespace adiar::internal // Use '.seek(...)' with 'in_nodes' instead such that it only needs to be // opened once in the caller of this function. node_stream_t in_nodes(in); - typename quantify_policy::node_t v = in_nodes.pull(); + typename quantify_policy::node_type v = in_nodes.pull(); // Set up output shared_levelized_file out_arcs; @@ -182,8 +183,8 @@ namespace adiar::internal // Set up level quantify_pq_1.setup_next_level(); - const typename quantify_policy::label_t out_label = quantify_pq_1.current_level(); - typename quantify_policy::id_t out_id = 0; + const typename quantify_policy::label_type out_label = quantify_pq_1.current_level(); + typename quantify_policy::id_type out_id = 0; // TODO: move quantification test out here instead @@ -196,7 +197,7 @@ namespace adiar::internal if (quantify_pq_1.can_pull() && (quantify_pq_2.empty() || quantify_pq_1.top().target.first() < quantify_pq_2.top().target.second())) { req = { quantify_pq_1.top().target, - {{ { node::ptr_t::NIL(), node::ptr_t::NIL() } }}, + {{ { node::pointer_type::nil(), node::pointer_type::nil() } }}, quantify_pq_1.top().data }; quantify_pq_1.pop(); } else { @@ -248,28 +249,28 @@ namespace adiar::internal // Recreate children of the two targeted nodes (or possibly the // suppressed node for target.second()). - const node::children_t children0 = + const node::children_type children0 = req.empty_carry() ? v.children() : req.node_carry[0]; - const node::children_t children1 = + const node::children_type children1 = req.target.second().on_level(out_label) ? v.children() : quantify_policy::reduction_rule_inv(req.target.second()); - adiar_assert(out_id < quantify_policy::MAX_ID, "Has run out of ids"); + adiar_assert(out_id < quantify_policy::max_id, "Has run out of ids"); // --------------------------------------------------------------------- // CASE: Partial Quantification of Tuple (f,g). if constexpr (quantify_policy::partial_quantification) { if (should_quantify) { - const tuple rec_all = + const tuple rec_all = __quantify_resolve_request(op, {children0[false], children0[true], children1[false], children1[true]}); - if (rec_all[2] == quantify_policy::ptr_t::NIL()) { + if (rec_all[2] == quantify_policy::pointer_type::nil()) { // Collapsed to a terminal? if (req.data.source.is_nil() && rec_all[0].is_terminal()) { - adiar_assert(rec_all[1] == quantify_policy::ptr_t::NIL(), + adiar_assert(rec_all[1] == quantify_policy::pointer_type::nil(), "Operator should already be applied"); return typename quantify_policy::reduced_t(rec_all[0].value()); @@ -288,7 +289,7 @@ namespace adiar::internal policy_impl.remaining_nodes++; // Output an intermediate node at this level to be quantified later. - const node::uid_t out_uid(out_label, out_id++); + const node::uid_type out_uid(out_label, out_id++); quantify_request<0>::target_t rec0(rec_all[0], rec_all[1]); @@ -318,7 +319,7 @@ namespace adiar::internal // TODO (optimisation): // Skip node creation due to Reduction Rule 1 - const node::uid_t out_uid(out_label, out_id++); + const node::uid_type out_uid(out_label, out_id++); quantify_request<0>::target_t rec0 = __quantify_resolve_request(op, {children0[false], children1[false]}); @@ -346,7 +347,7 @@ namespace adiar::internal out_arcs->max_1level_cut = std::max(out_arcs->max_1level_cut, quantify_pq_1.size()); } - // Ensure the edge case, where the in-going edge from NIL to the root pair + // Ensure the edge case, where the in-going edge from nil to the root pair // does not dominate the max_1level_cut out_arcs->max_1level_cut = std::min(aw.size() - out_arcs->number_of_terminals[false] - out_arcs->number_of_terminals[true], @@ -364,8 +365,8 @@ namespace adiar::internal size_t __quantify_ilevel_upper_bound(const in_t &in, const bool_op &op) { - const cut_type ct_internal = cut_type::INTERNAL; - const cut_type ct_terminals = quantify_policy::cut_with_terminals(op); + const typename cut::type ct_internal = cut::type::Internal; + const typename cut::type ct_terminals = quantify_policy::cut_with_terminals(op); const safe_size_t max_cut_internal = cut::get(in, ct_internal); const safe_size_t max_cut_terminals = cut::get(in, ct_terminals); @@ -393,14 +394,14 @@ namespace adiar::internal const size_t pq_2_memory, const size_t max_pq_2_size) { // Check for trivial terminal-only return on shortcutting the root - typename quantify_policy::node_t root; + typename quantify_policy::node_type root; { // Detach and garbage collect node_stream<> node_stream_t in_nodes(in); root = in_nodes.pull(); if (policy_impl.should_quantify(root.label()) && (root.low().is_terminal() || root.high().is_terminal())) { - typename quantify_policy::ptr_t result = quantify_policy::resolve_root(root, op); + typename quantify_policy::pointer_type result = quantify_policy::resolve_root(root, op); if (result != root.uid() && result.is_terminal()) { return typename quantify_policy::reduced_t(result.value()); @@ -412,7 +413,7 @@ namespace adiar::internal // Set up cross-level priority queue pq_1_t quantify_pq_1({in}, pq_1_memory, max_pq_1_size, stats_quantify.lpq); - quantify_pq_1.push({ { root.uid(), ptr_uint64::NIL() }, {}, {ptr_uint64::NIL()} }); + quantify_pq_1.push({ { root.uid(), ptr_uint64::nil() }, {}, {ptr_uint64::nil()} }); // Set up per-level priority queue pq_2_t quantify_pq_2(pq_2_memory, max_pq_2_size); @@ -445,25 +446,25 @@ namespace adiar::internal - arc_writer::memory_usage(); constexpr size_t data_structures_in_pq_1 = - pq_1_template::DATA_STRUCTURES; + pq_1_template::data_structures; constexpr size_t data_structures_in_pq_2 = - quantify_priority_queue_2_t::DATA_STRUCTURES; + quantify_priority_queue_2_t::data_structures; const size_t pq_1_internal_memory = (aux_available_memory / (data_structures_in_pq_1 + data_structures_in_pq_2)) * data_structures_in_pq_1; const size_t pq_1_memory_fits = - pq_1_template::memory_fits(pq_1_internal_memory); + pq_1_template::memory_fits(pq_1_internal_memory); const size_t pq_2_internal_memory = aux_available_memory - pq_1_internal_memory; const size_t pq_2_memory_fits = - quantify_priority_queue_2_t::memory_fits(pq_2_internal_memory); + quantify_priority_queue_2_t::memory_fits(pq_2_internal_memory); - const bool internal_only = memory_mode == memory_mode_t::INTERNAL; - const bool external_only = memory_mode == memory_mode_t::EXTERNAL; + const bool internal_only = memory_mode == memory_mode_t::Internal; + const bool external_only = memory_mode == memory_mode_t::External; const size_t pq_1_bound = std::min({__quantify_ilevel_upper_bound(in,op), __quantify_ilevel_upper_bound(in)}); @@ -479,8 +480,8 @@ namespace adiar::internal stats_quantify.lpq.unbucketed += 1u; #endif return __quantify, - quantify_priority_queue_2_t> + pq_1_template<0, memory_mode_t::Internal>, + quantify_priority_queue_2_t> (in, policy_impl, op, pq_1_internal_memory, max_pq_1_size, pq_2_internal_memory, max_pq_2_size); } else if(!external_only && max_pq_1_size <= pq_1_memory_fits && max_pq_2_size <= pq_2_memory_fits) { @@ -488,8 +489,8 @@ namespace adiar::internal stats_quantify.lpq.internal += 1u; #endif return __quantify, - quantify_priority_queue_2_t> + pq_1_template, + quantify_priority_queue_2_t> (in, policy_impl, op, pq_1_internal_memory, max_pq_1_size, pq_2_internal_memory, max_pq_2_size); } else { #ifdef ADIAR_STATS @@ -499,8 +500,8 @@ namespace adiar::internal const size_t pq_2_memory = pq_1_memory; return __quantify, - quantify_priority_queue_2_t> + pq_1_template, + quantify_priority_queue_2_t> (in, policy_impl, op, pq_1_memory, max_pq_1_size, pq_2_memory, max_pq_2_size); } } @@ -530,17 +531,17 @@ namespace adiar::internal class single_quantify_policy : public quantify_policy { private: - const typename quantify_policy::label_t _level; + const typename quantify_policy::label_type _level; public: //////////////////////////////////////////////////////////////////////////// - single_quantify_policy(typename quantify_policy::label_t level) + single_quantify_policy(typename quantify_policy::label_type level) : _level(level) { } //////////////////////////////////////////////////////////////////////////// inline bool - should_quantify(typename quantify_policy::label_t level) const + should_quantify(typename quantify_policy::label_type level) const { return _level == level; } //////////////////////////////////////////////////////////////////////////// @@ -550,12 +551,12 @@ namespace adiar::internal template typename quantify_policy::unreduced_t quantify(const typename quantify_policy::reduced_t &in, - const typename quantify_policy::label_t label, + const typename quantify_policy::label_type label, const bool_op &op) { // Trivial cases, where there is no need to do any computation - if (is_terminal(in) || !has_level(in, label)) { + if (dd_isterminal(in) || !has_level(in, label)) { return in; } @@ -576,8 +577,8 @@ namespace adiar::internal using request_t = quantify_request<0>; using request_pred_t = request_data_first_lt; - template - using pq_t = quantify_priority_queue_1_node_t; + template + using pq_t = quantify_priority_queue_1_node_t; public: //////////////////////////////////////////////////////////////////////////// @@ -588,16 +589,16 @@ namespace adiar::internal static size_t pq_memory(const size_t inner_memory) { constexpr size_t data_structures_in_pq_1 = - quantify_priority_queue_1_node_t::DATA_STRUCTURES; + quantify_priority_queue_1_node_t::data_structures; constexpr size_t data_structures_in_pq_2 = - quantify_priority_queue_2_t::DATA_STRUCTURES; + quantify_priority_queue_2_t::data_structures; return (inner_memory / (data_structures_in_pq_1 + data_structures_in_pq_2)) * data_structures_in_pq_1; } //////////////////////////////////////////////////////////////////////////// - size_t pq_bound(const typename quantify_policy::shared_nodes_t &outer_file, + size_t pq_bound(const typename quantify_policy::shared_node_file_type &outer_file, const size_t /*outer_roots*/) const { const typename quantify_policy::reduced_t outer_wrapper(outer_file); @@ -617,13 +618,13 @@ namespace adiar::internal /// always-false predicate that is immediate to the compiler. ////////////////////////////////////////////////////////////////////////////// constexpr bool - should_quantify(typename quantify_policy::label_t /*level*/) const + should_quantify(typename quantify_policy::label_type /*level*/) const { return false; } //////////////////////////////////////////////////////////////////////////// static constexpr bool partial_quantification = false; - // bool has_sweep(typename quantify_policy::label_t) const; + // bool has_sweep(typename quantify_policy::label_type) const; //////////////////////////////////////////////////////////////////////////// /// \brief Run Sweep with given priority queue. @@ -635,24 +636,24 @@ namespace adiar::internal const size_t inner_remaining_memory) const { const size_t pq_2_memory_fits = - quantify_priority_queue_2_t::memory_fits(inner_remaining_memory); + quantify_priority_queue_2_t::memory_fits(inner_remaining_memory); const size_t pq_2_bound = __quantify_ilevel_upper_bound (typename quantify_policy::reduced_t(outer_file), _op); - const size_t max_pq_2_size = memory_mode == memory_mode_t::INTERNAL + const size_t max_pq_2_size = memory_mode == memory_mode_t::Internal ? std::min(pq_2_memory_fits, pq_2_bound) : pq_2_bound; - if(memory_mode != memory_mode_t::EXTERNAL && max_pq_2_size <= pq_2_memory_fits) { - using inner_pq_2_t = quantify_priority_queue_2_t; + if(memory_mode != memory_mode_t::External && max_pq_2_size <= pq_2_memory_fits) { + using inner_pq_2_t = quantify_priority_queue_2_t; inner_pq_2_t inner_pq_2(inner_remaining_memory, max_pq_2_size); return __quantify, inner_pq_1_t, inner_pq_2_t> (outer_file, *this, _op, inner_pq_1, inner_pq_2); } else { - using inner_pq_2_t = quantify_priority_queue_2_t; + using inner_pq_2_t = quantify_priority_queue_2_t; inner_pq_2_t inner_pq_2(inner_remaining_memory, max_pq_2_size); return __quantify, inner_pq_1_t, inner_pq_2_t> @@ -677,16 +678,16 @@ namespace adiar::internal /// \brief Create request ////////////////////////////////////////////////////////////////////////////// inline request_t - request_from_node(const typename quantify_policy::node_t &n, - const typename quantify_policy::ptr_t &parent) const + request_from_node(const typename quantify_policy::node_type &n, + const typename quantify_policy::pointer_type &parent) const { // Shortcutting or Irrelevant terminal? - const typename quantify_policy::ptr_t result = + const typename quantify_policy::pointer_type result = quantify_policy::resolve_root(n, _op); typename request_t::target_t tgt = result != n.uid() // If able to shortcut, preserve result. - ? request_t::target_t{ result, quantify_policy::ptr_t::NIL() } + ? request_t::target_t{ result, quantify_policy::pointer_type::nil() } // Otherwise, create product of children : request_t::target_t{ first(n.low(), n.high()), second(n.low(), n.high()) }; @@ -695,7 +696,7 @@ namespace adiar::internal //////////////////////////////////////////////////////////////////////////// static constexpr internal::nested_sweeping::reduce_strategy reduce_strategy = - internal::nested_sweeping::AUTO; + internal::nested_sweeping::Auto; }; ////////////////////////////////////////////////////////////////////////////// @@ -708,7 +709,7 @@ namespace adiar::internal //////////////////////////////////////////////////////////////////////////// /// \brief Predicate for whether a level should be swept on (or not). //////////////////////////////////////////////////////////////////////////// - using pred_t = predicate; + using pred_t = predicate; private: //////////////////////////////////////////////////////////////////////////// @@ -730,7 +731,7 @@ namespace adiar::internal //////////////////////////////////////////////////////////////////////////// inline bool - should_quantify(typename quantify_policy::label_t level) const + should_quantify(typename quantify_policy::label_type level) const { return _pred(level) == quantify_policy::quantify_onset; } //////////////////////////////////////////////////////////////////////////// @@ -751,7 +752,7 @@ namespace adiar::internal //////////////////////////////////////////////////////////////////////////// /// \brief Predicate for whether a level should be swept on (or not). //////////////////////////////////////////////////////////////////////////// - using pred_t = predicate; + using pred_t = predicate; private: //////////////////////////////////////////////////////////////////////////// @@ -769,7 +770,7 @@ namespace adiar::internal //////////////////////////////////////////////////////////////////////////// /// \brief Whether the generator wants to sweep on the given level. //////////////////////////////////////////////////////////////////////////// - bool has_sweep(node::ptr_t::label_t l) + bool has_sweep(node::pointer_type::label_type l) { return _pred(l) == quantify_policy::quantify_onset; } @@ -780,23 +781,23 @@ namespace adiar::internal // - initial 'quantify__get_deepest' should not terminate early but // determine whether any variable may "survive". template - inline typename quantify_policy::label_t + inline typename quantify_policy::label_type quantify__get_deepest(const typename quantify_policy::reduced_t &dd, - const predicate &pred) + const predicate &pred) { level_info_stream lis(dd); while (lis.can_pull()) { - const typename quantify_policy::label_t l = lis.pull().label(); + const typename quantify_policy::label_type l = lis.pull().label(); if (pred(l) == quantify_policy::quantify_onset) { return l; } } - return quantify_policy::MAX_LABEL+1; + return quantify_policy::max_label+1; } template - inline typename quantify_policy::label_t + inline typename quantify_policy::label_type quantify__count_above_widest(const typename quantify_policy::reduced_t &dd, - const predicate &pred) + const predicate &pred) { level_info_stream lis(dd); @@ -813,15 +814,15 @@ namespace adiar::internal template typename quantify_policy::unreduced_t quantify(typename quantify_policy::reduced_t dd, - const predicate &pred, + const predicate &pred, const bool_op &op) { using unreduced_t = typename quantify_policy::unreduced_t; // TODO: check for missing std::move(...) - typename quantify_policy::label_t label = quantify__get_deepest(dd, pred); + typename quantify_policy::label_type label = quantify__get_deepest(dd, pred); - if (quantify_policy::MAX_LABEL < label) { + if (quantify_policy::max_label < label) { #ifdef ADIAR_STATS // TODO #endif @@ -829,7 +830,7 @@ namespace adiar::internal } switch (quantify_mode) { - case quantify_mode_t::PARTIAL: + case quantify_mode_t::Partial: { // --------------------------------------------------------------------- // Case: Repeated partial quantification #ifdef ADIAR_STATS @@ -848,22 +849,22 @@ namespace adiar::internal return res; } - case quantify_mode_t::SINGLETON: + case quantify_mode_t::Singleton: { // --------------------------------------------------------------------- // Case: Repeated single variable quantification #ifdef ADIAR_STATS // TODO #endif - while (label <= quantify_policy::MAX_LABEL) { + while (label <= quantify_policy::max_label) { dd = quantify(dd, label, op); - if (is_terminal(dd)) { return std::move(dd); } + if (dd_isterminal(dd)) { return std::move(dd); } label = quantify__get_deepest(dd, pred); } return dd; } - case quantify_mode_t::NESTED: + case quantify_mode_t::Nested: { // --------------------------------------------------------------------- // Case: Nested Sweeping #ifdef ADIAR_STATS @@ -873,13 +874,13 @@ namespace adiar::internal return nested_sweep<>(quantify(std::move(dd), label, op), inner_impl); } - case quantify_mode_t::AUTO: + case quantify_mode_t::Auto: { // --------------------------------------------------------------------- // Case: Partial/Singleton Quantification + Nested Sweeping const size_t dd_size = dd.size(); const size_t nodes_per_block = - get_block_size() / sizeof(typename quantify_policy::node_t); + get_block_size() / sizeof(typename quantify_policy::node_type); // Do Partial Quantification as long as... // 1. ... it stays smaller than 150% of the input size. @@ -975,7 +976,7 @@ namespace adiar::internal /// \brief Generator of the levels to sweep on (or not to sweep on) in /// descending order. //////////////////////////////////////////////////////////////////////////// - using generator_t = generator; + using generator_t = generator; private: //////////////////////////////////////////////////////////////////////////// @@ -987,7 +988,7 @@ namespace adiar::internal //////////////////////////////////////////////////////////////////////////// /// \brief Buffer for to hold onto the generated next level. //////////////////////////////////////////////////////////////////////////// - typename quantify_policy::label_t _next_level; + typename quantify_policy::label_type _next_level; public: //////////////////////////////////////////////////////////////////////////// @@ -1001,7 +1002,7 @@ namespace adiar::internal //////////////////////////////////////////////////////////////////////////// /// \brief Whether the generator wants to sweep on the given level. //////////////////////////////////////////////////////////////////////////// - bool has_sweep(const node::ptr_t::label_t l) + bool has_sweep(const node::pointer_type::label_type l) { return l == next_level(l) ? quantify_policy::quantify_onset @@ -1011,10 +1012,10 @@ namespace adiar::internal private: bool has_next_level() const - { return _next_level <= quantify_policy::MAX_LABEL; } + { return _next_level <= quantify_policy::max_label; } - const node::ptr_t::label_t& - next_level(const node::ptr_t::label_t l) + const node::pointer_type::label_type& + next_level(const node::pointer_type::label_type l) { while (has_next_level() && l < _next_level) { _next_level = _lvls(); @@ -1028,20 +1029,20 @@ namespace adiar::internal // - initial 'quantify__get_deepest' should not terminate early but // determine whether any variable may "survive". template - inline typename quantify_policy::label_t + inline typename quantify_policy::label_type quantify__get_deepest(const typename quantify_policy::reduced_t &dd, - const typename quantify_policy::label_t bot_level, - const typename quantify_policy::label_t top_level) + const typename quantify_policy::label_type bot_level, + const typename quantify_policy::label_type top_level) { level_info_stream lis(dd); while (lis.can_pull()) { - const typename quantify_policy::label_t l = lis.pull().label(); - if ((top_level < l || quantify_policy::MAX_LABEL < top_level) && l < bot_level) { + const typename quantify_policy::label_type l = lis.pull().label(); + if ((top_level < l || quantify_policy::max_label < top_level) && l < bot_level) { return l; } } - return quantify_policy::MAX_LABEL+1; + return quantify_policy::max_label+1; } template @@ -1055,20 +1056,20 @@ namespace adiar::internal // NOTE: read-once access with 'gen' makes partial quantification not // possible. switch (quantify_mode) { - case quantify_mode_t::PARTIAL: - case quantify_mode_t::SINGLETON: + case quantify_mode_t::Partial: + case quantify_mode_t::Singleton: { // ------------------------------------------------------------------- // Case: Repeated single variable quantification // TODO: correctly handle quantify_policy::quantify_onset - typename quantify_policy::label_t on_level = lvls(); + typename quantify_policy::label_type on_level = lvls(); if (quantify_policy::quantify_onset) { - if (quantify_policy::MAX_LABEL < on_level) { return dd; } + if (quantify_policy::max_label < on_level) { return dd; } - typename quantify_policy::label_t next_on_level = lvls(); - while (next_on_level <= quantify_policy::MAX_LABEL) { + typename quantify_policy::label_type next_on_level = lvls(); + while (next_on_level <= quantify_policy::max_label) { dd = quantify(dd, on_level, op); - if (is_terminal(dd)) { return dd; } + if (dd_isterminal(dd)) { return dd; } on_level = next_on_level; next_on_level = lvls(); @@ -1076,34 +1077,34 @@ namespace adiar::internal return quantify(dd, on_level, op); } else { // !quantify_policy::quantify_onset // TODO: only designed for 'OR' at this point in time - if (quantify_policy::MAX_LABEL < on_level) { + if (quantify_policy::max_label < on_level) { return typename quantify_policy::reduced_t(dd->number_of_terminals[true] > 0); } // Quantify everything below 'label' for (;;) { - const typename quantify_policy::label_t off_level = - quantify__get_deepest(dd, quantify_policy::MAX_LABEL, on_level); + const typename quantify_policy::label_type off_level = + quantify__get_deepest(dd, quantify_policy::max_label, on_level); - if (quantify_policy::MAX_LABEL < off_level) { break; } + if (quantify_policy::max_label < off_level) { break; } dd = quantify(dd, off_level, op); - if (is_terminal(dd)) { return dd; } + if (dd_isterminal(dd)) { return dd; } } // Quantify everything strictly in between 'bot_level' and 'top_level' - typename quantify_policy::label_t bot_level = on_level; - typename quantify_policy::label_t top_level = lvls(); + typename quantify_policy::label_type bot_level = on_level; + typename quantify_policy::label_type top_level = lvls(); - while (bot_level <= quantify_policy::MAX_LABEL) { + while (bot_level <= quantify_policy::max_label) { for (;;) { - const typename quantify_policy::label_t off_level = + const typename quantify_policy::label_type off_level = quantify__get_deepest(dd, bot_level, top_level); - if (quantify_policy::MAX_LABEL < off_level) { break; } + if (quantify_policy::max_label < off_level) { break; } dd = quantify(dd, off_level, op); - if (is_terminal(dd)) { return dd; } + if (dd_isterminal(dd)) { return dd; } } bot_level = top_level; @@ -1113,8 +1114,8 @@ namespace adiar::internal } } - case quantify_mode_t::AUTO: - case quantify_mode_t::NESTED: + case quantify_mode_t::Auto: + case quantify_mode_t::Nested: { // --------------------------------------------------------------------- // Case: Nested Sweeping // @@ -1123,12 +1124,12 @@ namespace adiar::internal // bottom-most level to transpose the DAG. if constexpr (quantify_policy::quantify_onset) { // Obtain the bottom-most onset level that exists in the diagram. - typename quantify_policy::label_t transposition_level = lvls(); - if (quantify_policy::MAX_LABEL < transposition_level) { return dd; } + typename quantify_policy::label_type transposition_level = lvls(); + if (quantify_policy::max_label < transposition_level) { return dd; } { level_info_stream in_meta(dd); - typename quantify_policy::label_t dd_level = in_meta.pull().level(); + typename quantify_policy::label_type dd_level = in_meta.pull().level(); for (;;) { // Go forward in the diagram's levels, until we are at or above @@ -1152,7 +1153,7 @@ namespace adiar::internal transposition_level = lvls(); // Did we run out of 'onset' levels? - if (quantify_policy::MAX_LABEL < transposition_level) { + if (quantify_policy::max_label < transposition_level) { return dd; } } diff --git a/src/adiar/internal/algorithms/reduce.cpp b/src/adiar/internal/algorithms/reduce.cpp index a3a0af384..6eca1b35c 100644 --- a/src/adiar/internal/algorithms/reduce.cpp +++ b/src/adiar/internal/algorithms/reduce.cpp @@ -2,5 +2,5 @@ namespace adiar::internal { - stats_t::reduce_t stats_reduce; + statistics::reduce_t stats_reduce; } diff --git a/src/adiar/internal/algorithms/reduce.h b/src/adiar/internal/algorithms/reduce.h index f25c8bdc0..884736e14 100644 --- a/src/adiar/internal/algorithms/reduce.h +++ b/src/adiar/internal/algorithms/reduce.h @@ -20,14 +20,14 @@ namespace adiar::internal { ////////////////////////////////////////////////////////////////////////////// /// Struct to hold statistics - extern stats_t::reduce_t stats_reduce; + extern statistics::reduce_t stats_reduce; ////////////////////////////////////////////////////////////////////////////// // Data structures struct mapping { - node::uid_t old_uid; - node::uid_t new_uid; + node::uid_type old_uid; + node::uid_type new_uid; }; ////////////////////////////////////////////////////////////////////////////// @@ -50,7 +50,7 @@ namespace adiar::internal //////////////////////////////////////////////////////////////////////////// /// \brief The level at which this nodes source belongs to. //////////////////////////////////////////////////////////////////////////// - arc::label_t level() const + arc::label_type level() const { return source().label(); } }; @@ -68,14 +68,14 @@ namespace adiar::internal /// \brief Decorator on the levelized priority queue to also keep track of /// the number of arcs to each terminal. //////////////////////////////////////////////////////////////////////////// - template + template class reduce_priority_queue : public levelized_arc_priority_queue { private: using inner_lpq = levelized_arc_priority_queue; //////////////////////////////////////////////////////////////////////////// @@ -178,16 +178,16 @@ namespace adiar::internal /// \brief Create the output file with correct initial meta data already set. ////////////////////////////////////////////////////////////////////////////// template - shared_levelized_file + shared_levelized_file __reduce_init_output() { - shared_levelized_file out_file; + shared_levelized_file out_file; out_file->canonical = true; - out_file->max_1level_cut[cut_type::INTERNAL] = 0u; - out_file->max_1level_cut[cut_type::INTERNAL_FALSE] = 0u; - out_file->max_1level_cut[cut_type::INTERNAL_TRUE] = 0u; - out_file->max_1level_cut[cut_type::ALL] = 0u; + out_file->max_1level_cut[cut::Internal] = 0u; + out_file->max_1level_cut[cut::Internal_False] = 0u; + out_file->max_1level_cut[cut::Internal_True] = 0u; + out_file->max_1level_cut[cut::All] = 0u; return out_file; } @@ -211,22 +211,22 @@ namespace adiar::internal /// \brief Update a cut size with some number of arcs. ////////////////////////////////////////////////////////////////////////////// inline void __reduce_cut_add(cuts_t &cut, - const cut_size_t internal_arcs, - const cut_size_t false_arcs, - const cut_size_t true_arcs) + const cut::size_type internal_arcs, + const cut::size_type false_arcs, + const cut::size_type true_arcs) { - cut[cut_type::INTERNAL] += internal_arcs; - cut[cut_type::INTERNAL_FALSE] += internal_arcs + false_arcs; - cut[cut_type::INTERNAL_TRUE] += internal_arcs + true_arcs; - cut[cut_type::ALL] += internal_arcs + false_arcs + true_arcs; + cut[cut::Internal] += internal_arcs; + cut[cut::Internal_False] += internal_arcs + false_arcs; + cut[cut::Internal_True] += internal_arcs + true_arcs; + cut[cut::All] += internal_arcs + false_arcs + true_arcs; } inline void __reduce_cut_add(cuts_t &cut, const ptr_uint64 target) { - cut[cut_type::INTERNAL] += target.is_node(); - cut[cut_type::INTERNAL_FALSE] += target.is_node() + target.is_false(); - cut[cut_type::INTERNAL_TRUE] += target.is_node() + target.is_true(); - cut[cut_type::ALL] += 1u; + cut[cut::Internal] += target.is_node(); + cut[cut::Internal_False] += target.is_node() + target.is_false(); + cut[cut::Internal_True] += target.is_node() + target.is_true(); + cut[cut::All] += 1u; } ////////////////////////////////////////////////////////////////////////////// @@ -259,7 +259,7 @@ namespace adiar::internal typename arc_stream_t> size_t __reduce_level(arc_stream_t &arcs, - const typename dd_policy::label_t label, + const typename dd_policy::label_type label, pq_t &reduce_pq, node_writer &out_writer, const size_t sorters_memory, @@ -280,8 +280,8 @@ namespace adiar::internal || reduce_pq.can_pull()) { // TODO (MDD): // TODO (QMDD): - // Use __reduce_get_next node_t::OUTDEGREE times to create a - // node_t::children_t. + // Use __reduce_get_next node_type::outdegree times to create a + // node_type::children_type. const arc e_high = __reduce_get_next(reduce_pq, arcs); const arc e_low = __reduce_get_next(reduce_pq, arcs); @@ -289,7 +289,7 @@ namespace adiar::internal adiar_assert(n.label() == label, "Label is for desired level"); // Apply Reduction rule 1 - const node::ptr_t reduction_rule_ret = dd_policy::reduction_rule(n); + const node::pointer_type reduction_rule_ret = dd_policy::reduction_rule(n); if (reduction_rule_ret != n.uid()) { // Open red1_mapping first (and create file on disk) when at least one // element is written to it. @@ -315,8 +315,8 @@ namespace adiar::internal // Sort and apply Reduction rule 2 child_grouping.sort(); - typename dd_policy::id_t out_id = dd_policy::MAX_ID; - node out_node = node(node::uid_t(), ptr_uint64::NIL(), ptr_uint64::NIL()); + typename dd_policy::id_type out_id = dd_policy::max_id; + node out_node = node(node::uid_type(), ptr_uint64::nil(), ptr_uint64::nil()); while (child_grouping.can_pull()) { const node next_node = child_grouping.pull(); @@ -340,7 +340,7 @@ namespace adiar::internal } // Add number of nodes to level information, if any nodes were pushed to the output. - const size_t reduced_width = dd_policy::MAX_ID - out_id; + const size_t reduced_width = dd_policy::max_id - out_id; if (reduced_width > 0) { out_writer.unsafe_push(level_info(label, reduced_width)); } @@ -349,14 +349,14 @@ namespace adiar::internal red2_mapping.sort(); // Merging of red1_mapping and red2_mapping - mapping next_red1 = { node::uid_t(), node::uid_t() }; // <-- dummy value + mapping next_red1 = { node::uid_type(), node::uid_type() }; // <-- dummy value bool has_next_red1 = red1_mapping.is_open() && red1_mapping.size() > 0; if (has_next_red1) { red1_mapping.seek(0); next_red1 = red1_mapping.read(); } - mapping next_red2 = { node::uid_t(), node::uid_t() }; // <-- dummy value + mapping next_red2 = { node::uid_type(), node::uid_type() }; // <-- dummy value bool has_next_red2 = red2_mapping.can_pull(); if (has_next_red2) { next_red2 = red2_mapping.pull(); @@ -480,7 +480,7 @@ namespace adiar::internal /// \brief Reduce an entire decision diagram bottom-up. ////////////////////////////////////////////////////////////////////////////// template - shared_levelized_file + shared_levelized_file __reduce(const shared_levelized_file &in_file, const size_t lpq_memory, const size_t sorters_memory) @@ -494,7 +494,7 @@ namespace adiar::internal level_info_stream<> levels(in_file); // Set up output - shared_levelized_file out_file = + shared_levelized_file out_file = __reduce_init_output(); node_writer out_writer(out_file); @@ -518,25 +518,25 @@ namespace adiar::internal out_writer.unsafe_set_number_of_terminals(!terminal_val, terminal_val); __reduce_cut_add(out_file->max_1level_cut, 0u, !terminal_val, terminal_val); } else { - const typename dd_policy::label_t label = e_low.source().label(); + const typename dd_policy::label_type label = e_low.source().label(); - out_writer.unsafe_push(node(label, dd_policy::MAX_ID, e_low.target(), e_high.target())); + out_writer.unsafe_push(node(label, dd_policy::max_id, e_low.target(), e_high.target())); out_writer.unsafe_push(level_info(label,1u)); - out_file->max_1level_cut[cut_type::INTERNAL] = 1u; + out_file->max_1level_cut[cut::Internal] = 1u; - out_file->max_1level_cut[cut_type::INTERNAL_FALSE] = + out_file->max_1level_cut[cut::Internal_False] = std::max(!e_low.target().value() + !e_high.target().value(), 1); - out_file->max_1level_cut[cut_type::INTERNAL_TRUE] = + out_file->max_1level_cut[cut::Internal_True] = std::max(e_low.target().value() + e_high.target().value(), 1); - out_file->max_1level_cut[cut_type::ALL] = 2u; + out_file->max_1level_cut[cut::All] = 2u; } // Copy over 1-level cut to 2-level cut. - for(size_t ct = 0u; ct < CUT_TYPES; ct++) { + for(size_t ct = 0u; ct < cut::size; ct++) { out_file->max_2level_cut[ct] = out_file->max_1level_cut[ct]; } @@ -553,7 +553,7 @@ namespace adiar::internal adiar_assert(arcs.can_pull_terminal() || !reduce_pq.empty(), "If there is a level, then there should also be something for it."); const level_info current_level_info = levels.pull(); - const typename dd_policy::label_t level = current_level_info.level(); + const typename dd_policy::label_type level = current_level_info.level(); adiar_assert(!reduce_pq.has_current_level() || level == reduce_pq.current_level(), "level and priority queue should be in sync"); @@ -586,13 +586,13 @@ namespace adiar::internal adiar_assert(!input.empty(), "Input for Reduce should always be non-empty"); // Is it already reduced? - if (input.template has()) { - return typename dd_policy::reduced_t(input.template get(), + if (input.template has()) { + return typename dd_policy::reduced_t(input.template get(), input.negate); } // Get unreduced input - const typename dd_policy::shared_arcs_t in_file = input.template get(); + const typename dd_policy::shared_arc_file_type in_file = input.template get(); // Compute amount of memory available for auxiliary data structures after // having opened all streams. @@ -611,10 +611,10 @@ namespace adiar::internal const size_t sorters_memory = aux_available_memory - pq_memory - tpie::file_stream::memory_usage(); const tpie::memory_size_type pq_memory_fits = - reduce_priority_queue::memory_fits(pq_memory); + reduce_priority_queue::memory_fits(pq_memory); - const bool internal_only = memory_mode == memory_mode_t::INTERNAL; - const bool external_only = memory_mode == memory_mode_t::EXTERNAL; + const bool internal_only = memory_mode == memory_mode_t::Internal; + const bool external_only = memory_mode == memory_mode_t::External; const size_t pq_bound = in_file->max_1level_cut; @@ -624,19 +624,19 @@ namespace adiar::internal #ifdef ADIAR_STATS stats_reduce.lpq.unbucketed += 1u; #endif - return __reduce> + return __reduce> (in_file, pq_memory, sorters_memory); } else if(!external_only && max_pq_size <= pq_memory_fits) { #ifdef ADIAR_STATS stats_reduce.lpq.internal += 1u; #endif - return __reduce> + return __reduce> (in_file, pq_memory, sorters_memory); } else { #ifdef ADIAR_STATS stats_reduce.lpq.external += 1u; #endif - return __reduce> + return __reduce> (in_file, pq_memory, sorters_memory); } } diff --git a/src/adiar/internal/algorithms/substitution.cpp b/src/adiar/internal/algorithms/substitution.cpp index 55a677bc4..201806d81 100644 --- a/src/adiar/internal/algorithms/substitution.cpp +++ b/src/adiar/internal/algorithms/substitution.cpp @@ -2,5 +2,5 @@ namespace adiar::internal { - stats_t::substitute_t stats_substitute; + statistics::substitute_t stats_substitute; } diff --git a/src/adiar/internal/algorithms/substitution.h b/src/adiar/internal/algorithms/substitution.h index 63f9b5da3..8d1f33053 100644 --- a/src/adiar/internal/algorithms/substitution.h +++ b/src/adiar/internal/algorithms/substitution.h @@ -22,7 +22,7 @@ namespace adiar::internal { ////////////////////////////////////////////////////////////////////////////// /// Struct to hold statistics - extern stats_t::substitute_t stats_substitute; + extern statistics::substitute_t stats_substitute; ////////////////////////////////////////////////////////////////////////////// // Priority queue functions @@ -40,20 +40,20 @@ namespace adiar::internal //////////////////////////////////////////////////////////////////////////// /// \brief The level at which this nodes target belongs to. //////////////////////////////////////////////////////////////////////////// - arc::label_t level() const + arc::label_type level() const { return target().label(); } }; - template + template using substitute_priority_queue_t = levelized_node_priority_queue; struct substitute_rec_output { node out; }; struct substitute_rec_skipto { ptr_uint64 child; }; - typedef std::variant substitute_rec; + using substitute_rec = std::variant; ////////////////////////////////////////////////////////////////////////////// // Helper functions @@ -101,7 +101,7 @@ namespace adiar::internal pq_t substitute_pq({dd}, pq_memory, pq_max_size, stats_substitute.lpq); - typename substitute_policy::label_t level = n.label(); + typename substitute_policy::label_type level = n.label(); size_t level_size = 0; bool output_changes = false; @@ -130,7 +130,7 @@ namespace adiar::internal return substitute_policy::terminal(rec_child.value(), amgr); } - substitute_pq.push(arc(ptr_uint64::NIL(), rec_child)); + substitute_pq.push(arc(ptr_uint64::nil(), rec_child)); } } @@ -213,7 +213,7 @@ namespace adiar::internal template size_t __substitute_2level_upper_bound(const typename substitute_policy::reduced_t &dd) { - const safe_size_t max_2level_cut = dd.max_2level_cut(cut_type::INTERNAL); + const safe_size_t max_2level_cut = dd.max_2level_cut(cut::Internal); return to_size(max_2level_cut + 2u); } @@ -231,10 +231,10 @@ namespace adiar::internal - node_stream<>::memory_usage() - arc_writer::memory_usage(); const tpie::memory_size_type pq_memory_fits = - substitute_priority_queue_t::memory_fits(aux_available_memory); + substitute_priority_queue_t::memory_fits(aux_available_memory); - const bool internal_only = memory_mode == memory_mode_t::INTERNAL; - const bool external_only = memory_mode == memory_mode_t::EXTERNAL; + const bool internal_only = memory_mode == memory_mode_t::Internal; + const bool external_only = memory_mode == memory_mode_t::External; const size_t pq_bound = __substitute_2level_upper_bound(dd); @@ -245,21 +245,21 @@ namespace adiar::internal stats_substitute.lpq.unbucketed += 1u; #endif return __substitute> + substitute_priority_queue_t<0, memory_mode_t::Internal>> (dd, amgr, aux_available_memory, max_pq_size); } else if(!external_only && max_pq_size <= pq_memory_fits) { #ifdef ADIAR_STATS stats_substitute.lpq.internal += 1u; #endif return __substitute> + substitute_priority_queue_t> (dd, amgr, aux_available_memory, max_pq_size); } else { #ifdef ADIAR_STATS stats_substitute.lpq.external += 1u; #endif return __substitute> + substitute_priority_queue_t> (dd, amgr, aux_available_memory, max_pq_size); } } diff --git a/src/adiar/internal/algorithms/traverse.h b/src/adiar/internal/algorithms/traverse.h index e9a730a14..da7bb1b30 100644 --- a/src/adiar/internal/algorithms/traverse.h +++ b/src/adiar/internal/algorithms/traverse.h @@ -1,6 +1,7 @@ #ifndef ADIAR_INTERNAL_ALGORITHMS_TRAVERSE_H #define ADIAR_INTERNAL_ALGORITHMS_TRAVERSE_H +#include #include #include #include @@ -14,8 +15,8 @@ namespace adiar::internal { node_stream<> in_nodes(dd); - typename dd_t::node_t n = in_nodes.pull(); - typename dd_t::ptr_t tgt = n.uid(); + typename dd_t::node_type n = in_nodes.pull(); + typename dd_t::pointer_type tgt = n.uid(); while (!tgt.is_terminal() && !tgt.is_nil()) { while (n.uid() < tgt) { n = in_nodes.pull(); } @@ -26,7 +27,7 @@ namespace adiar::internal tgt = visitor.visit(n); adiar_assert((tgt == n.low()) || (tgt == n.high()) || (tgt.is_nil()), - "Visitor pointer should be within the diagram or NIL"); + "Visitor pointer should be within the diagram or nil"); } if (!tgt.is_nil()) { visitor.visit(tgt.value()); diff --git a/src/adiar/internal/bool_op.h b/src/adiar/internal/bool_op.h new file mode 100644 index 000000000..ee273b7fb --- /dev/null +++ b/src/adiar/internal/bool_op.h @@ -0,0 +1,95 @@ +#ifndef ADIAR_INTERNAL_BOOL_OP_H +#define ADIAR_INTERNAL_BOOL_OP_H + +#include + +namespace adiar::internal +{ + ////////////////////////////////////////////////////////////////////////////// + /// \brief Whether the terminal shortcuts the operator from the right, + /// i.e. `op(T,t) == op(F,t)`. + ////////////////////////////////////////////////////////////////////////////// + inline bool can_right_shortcut(const bool_op &op, const internal::ptr_uint64 &terminal) + { + adiar_assert(terminal.is_terminal()); + return op(internal::ptr_uint64(false), terminal) == op(internal::ptr_uint64(true), terminal); + } + + ////////////////////////////////////////////////////////////////////////////// + /// \brief Whether the terminal shortcuts the operator from the left, + /// i.e. `op(t, T) == op(t, F)`. + ////////////////////////////////////////////////////////////////////////////// + inline bool can_left_shortcut(const bool_op &op, const internal::ptr_uint64 &terminal) + { + adiar_assert(terminal.is_terminal()); + return op(terminal, internal::ptr_uint64(false)) == op(terminal, internal::ptr_uint64(true)); + } + + ////////////////////////////////////////////////////////////////////////////// + /// \brief Whether the terminal is irrelevant for the operator from the right, + /// i.e. `op(X, t) == X`. + ////////////////////////////////////////////////////////////////////////////// + inline bool is_right_irrelevant(const bool_op &op, const internal::ptr_uint64 &terminal) + { + adiar_assert(terminal.is_terminal()); + return op(internal::ptr_uint64(false), terminal) == internal::ptr_uint64(false) + && op(internal::ptr_uint64(true), terminal) == internal::ptr_uint64(true); + } + + ////////////////////////////////////////////////////////////////////////////// + /// \brief Whether the terminal is irrelevant for the operator from the left, + /// i.e. `op(t, X) == X`. + ////////////////////////////////////////////////////////////////////////////// + inline bool is_left_irrelevant(const bool_op &op, const internal::ptr_uint64 &terminal) + { + adiar_assert(terminal.is_terminal()); + return op(terminal, internal::ptr_uint64(false)) == internal::ptr_uint64(false) + && op(terminal, internal::ptr_uint64(true)) == internal::ptr_uint64(true); + } + + ////////////////////////////////////////////////////////////////////////////// + /// \brief Whether the terminal for this operator negates the value of the other + /// from the right, i.e. `op(X, t) == ~X`. + ////////////////////////////////////////////////////////////////////////////// + inline bool is_right_negating(const bool_op &op, const internal::ptr_uint64 &terminal) + { + adiar_assert(terminal.is_terminal()); + return op(terminal, internal::ptr_uint64(false)) == internal::ptr_uint64(true) + && op(terminal, internal::ptr_uint64(true)) == internal::ptr_uint64(false); + } + + ////////////////////////////////////////////////////////////////////////////// + /// \brief Whether the terminal for this operator negates the value of the other + /// from the left, i.e. `op(t, X) == ~X` + ////////////////////////////////////////////////////////////////////////////// + inline bool is_left_negating(const bool_op &op, const internal::ptr_uint64 &terminal) + { + adiar_assert(terminal.is_terminal()); + return op(terminal, internal::ptr_uint64(false)) == internal::ptr_uint64(true) + && op(terminal, internal::ptr_uint64(true)) == internal::ptr_uint64(false); + } + + ////////////////////////////////////////////////////////////////////////////// + /// \brief Whether an operator is commutative, `op(X, Y) == op(Y, X)`. + ////////////////////////////////////////////////////////////////////////////// + inline bool is_commutative(const bool_op &op) + { + internal::ptr_uint64 terminal_T = internal::ptr_uint64(true); + internal::ptr_uint64 terminal_F = internal::ptr_uint64(false); + + return op(terminal_T, terminal_F) == op(terminal_F, terminal_T); + } + + ////////////////////////////////////////////////////////////////////////////// + /// \brief Return the flipped operator, i.e. `op'(X, Y) == op(Y, X)`. + ////////////////////////////////////////////////////////////////////////////// + inline bool_op flip(const bool_op &op) + { + if (is_commutative(op)) return op; + + return [&op](const internal::ptr_uint64 &a, const internal::ptr_uint64 &b) + {return op(b, a);}; + } +} + +#endif // ADIAR_INTERNAL_BOOL_OP_H diff --git a/src/adiar/internal/cnl.h b/src/adiar/internal/cnl.h index bf4d619d1..61d3f73c5 100644 --- a/src/adiar/internal/cnl.h +++ b/src/adiar/internal/cnl.h @@ -12,7 +12,7 @@ namespace adiar ////////////////////////////////////////////////////////////////////////////// /// \brief An (overflow safe) size_t (64 bit unsigned number). ////////////////////////////////////////////////////////////////////////////// - typedef cnl::overflow_integer safe_size_t; + using safe_size_t = cnl::overflow_integer; ////////////////////////////////////////////////////////////////////////////// /// \brief Unpacks the value from a 'safe_size_t'. @@ -25,12 +25,12 @@ namespace adiar ////////////////////////////////////////////////////////////////////////////// /// \brief Wide intger, i.e. support of infinite size. ////////////////////////////////////////////////////////////////////////////// - typedef cnl::wide_integer<128, uint32_t> uintwide_t; + using uintwide_t = cnl::wide_integer<128, uint32_t>; ////////////////////////////////////////////////////////////////////////////// /// \brief Fraction using wide intger. ////////////////////////////////////////////////////////////////////////////// - typedef cnl::fraction uintwide_frac_t; + using uintwide_frac_t = cnl::fraction; ////////////////////////////////////////////////////////////////////////////// /// \brief Compute nominator / denominator as a double. diff --git a/src/adiar/internal/cut.h b/src/adiar/internal/cut.h index d8c0230ac..5a7af56b1 100644 --- a/src/adiar/internal/cut.h +++ b/src/adiar/internal/cut.h @@ -5,103 +5,138 @@ #include #include +#include + namespace adiar::internal { - //////////////////////////////////////////////////////////////////////////// - /// \brief Type for a cut size - //////////////////////////////////////////////////////////////////////////// - using cut_size_t = size_t; - - //////////////////////////////////////////////////////////////////////////// - /// \brief Maximum value for a cut. - //////////////////////////////////////////////////////////////////////////// - constexpr cut_size_t MAX_CUT = std::numeric_limits::max(); - - //////////////////////////////////////////////////////////////////////////// - /// \brief Available types of cuts. This should be used with the - /// `max_ilevel_cut` variables in \ref shared_levelized_file - /// in and \ref shared_levelized_file. - //////////////////////////////////////////////////////////////////////////// - enum cut_type { - /** Internal arcs only */ - INTERNAL = 0, // 0x00 - /** Internal arcs and false arcs only */ - INTERNAL_FALSE = 1, // 0x01 - /** Internal arcs and true arcs only */ - INTERNAL_TRUE = 2, // 0x10 - /** All types of arcs: internal, false, and true */ - ALL = 3 // 0x11 - }; + ////////////////////////////////////////////////////////////////////////////// + /// \brief Available types of cuts. Each instance of a class holds onto a + /// certain type of cut which in turn can be used to index into the + /// `max_ilevel_cut` variables in \ref shared_levelized_file and + /// in \ref shared_levelized_file. + /// + /// \details The implementation of this 'enum with logic' is based on jtlim's + /// comment on Stackoverflow: https://stackoverflow.com/a/53284026 + ////////////////////////////////////////////////////////////////////////////// + class cut + { + public: + //////////////////////////////////////////////////////////////////////////// + /// \brief Type for a cut size. + //////////////////////////////////////////////////////////////////////////// + using size_type = size_t; - //////////////////////////////////////////////////////////////////////////// - /// \brief Number of different types of cuts. - //////////////////////////////////////////////////////////////////////////// - constexpr size_t CUT_TYPES = 4u; + //////////////////////////////////////////////////////////////////////////// + /// \brief Type for a cut size. + //////////////////////////////////////////////////////////////////////////// + using terminal_type = bool; - //////////////////////////////////////////////////////////////////////////// - /// \brief Type for list of (all) possible cuts. - //////////////////////////////////////////////////////////////////////////// - using cuts_t = std::array; + //////////////////////////////////////////////////////////////////////////// + /// \brief Maximum value for a cut. + //////////////////////////////////////////////////////////////////////////// + static constexpr size_type max = std::numeric_limits::max(); - //////////////////////////////////////////////////////////////////////////// - /// \brief Get the desired \ref cut_type based on whether to respectively - /// include the false and true terminals. - /// - /// \param incl_false Whether to include arcs to the false terminal. - /// \param incl_true Whether to include arcs to the true terminal. - //////////////////////////////////////////////////////////////////////////// - inline cut_type cut_type_with(const bool incl_false, const bool incl_true) - { - return static_cast((incl_true << 1) + incl_false); - } + //////////////////////////////////////////////////////////////////////////// + /// \brief Enum values for `cut`. + //////////////////////////////////////////////////////////////////////////// + enum type { + /** Internal arcs only */ + Internal = 0, // 0x00 + /** Internal arcs and false arcs only */ + Internal_False = 1, // 0x01 + /** Internal arcs and true arcs only */ + Internal_True = 2, // 0x10 + /** All types of arcs: internal, false, and true */ + All = 3 // 0x11 + }; - //////////////////////////////////////////////////////////////////////////// - /// \brief Whether a type of cut includes arcs to the desired terminal. - //////////////////////////////////////////////////////////////////////////// - inline bool includes_terminal(const cut_type cut, const bool terminal_val) - { - return terminal_val - ? cut >= cut_type::INTERNAL_TRUE - : cut == cut_type::INTERNAL_FALSE || cut == cut_type::ALL; - } + //////////////////////////////////////////////////////////////////////////// + /// \brief Number of different types of cuts. + //////////////////////////////////////////////////////////////////////////// + static constexpr size_t size = 4u; - inline bool includes_terminal(const size_t cut, const bool terminal_val) - { - return includes_terminal(static_cast(cut), terminal_val); - } + private: + type _ct; - //////////////////////////////////////////////////////////////////////////// - /// \brief The number of terminals included in a cut type. - //////////////////////////////////////////////////////////////////////////// - inline size_t number_of_terminals(const cut_type cut) - { - return includes_terminal(cut, false) + includes_terminal(cut, true); - } + public: + //////////////////////////////////////////////////////////////////////////// + /// \brief Number of different types of cuts. + //////////////////////////////////////////////////////////////////////////// + cut() = delete; - inline size_t number_of_terminals(const size_t cut) - { - return number_of_terminals(static_cast(cut)); - } + //////////////////////////////////////////////////////////////////////////// + /// \brief Conversion from the `t` enum value (possibly at compile-time). + //////////////////////////////////////////////////////////////////////////// + constexpr cut(type ct) + : _ct(ct) + { } - //////////////////////////////////////////////////////////////////////////// + //////////////////////////////////////////////////////////////////////////// + /// \brief Conversion from a `size_t` enum value (possibly at compile-time). + //////////////////////////////////////////////////////////////////////////// + constexpr cut(size_t ct) + : _ct(static_cast(ct)) + { } + + //////////////////////////////////////////////////////////////////////////// + /// \brief Convert the boolean values of whether to include the `false` and + /// the `true` terminal into a `cut_type`. + //////////////////////////////////////////////////////////////////////////// + constexpr cut(bool incl_false, bool incl_true) + : _ct(static_cast((incl_true << 1) + incl_false)) + { } + + //////////////////////////////////////////////////////////////////////////// + /// \brief Implicit conversion to enum to allow for switch and comparisons. + //////////////////////////////////////////////////////////////////////////// + constexpr operator type() const + { return _ct; } + + // Prevent usage: if(cut) + explicit operator bool() const = delete; + + public: + //////////////////////////////////////////////////////////////////////////// + /// \brief Whether this cut includes the given terminal. + //////////////////////////////////////////////////////////////////////////// + bool includes(const terminal_type &t) const + { return t ? _ct >= Internal_True : (_ct == Internal_False || _ct == All); } + + //////////////////////////////////////////////////////////////////////////// + /// \brief The number of terminals included in this cut. + //////////////////////////////////////////////////////////////////////////// + size_t number_of_terminals() const + { return this->includes(false) + this->includes(true); } + }; + + ////////////////////////////////////////////////////////////////////////////// + /// \brief Type for list of (all) possible cuts. + ////////////////////////////////////////////////////////////////////////////// + using cuts_t = std::array; + + ////////////////////////////////////////////////////////////////////////////// /// \brief Interface hiding how the 1-level cut is obtained - //////////////////////////////////////////////////////////////////////////// + ////////////////////////////////////////////////////////////////////////////// struct get_1level_cut { + using type = cut; + template - static inline cut_size_t get(const dd_t &dd, const cut_type ct) + static inline cut::size_type get(const dd_t &dd, const type ct) { return dd.max_1level_cut(ct); } }; - //////////////////////////////////////////////////////////////////////////// + ////////////////////////////////////////////////////////////////////////////// /// \brief Interface hiding how the 2-level cut is obtained - //////////////////////////////////////////////////////////////////////////// + ////////////////////////////////////////////////////////////////////////////// struct get_2level_cut { + using type = cut; + template - static inline cut_size_t get(const dd_t &dd, const cut_type ct) + static inline cut::size_type get(const dd_t &dd, const type ct) { return dd.max_2level_cut(ct); } diff --git a/src/adiar/internal/data_structures/level_merger.h b/src/adiar/internal/data_structures/level_merger.h index 4ebe96f55..93432538b 100644 --- a/src/adiar/internal/data_structures/level_merger.h +++ b/src/adiar/internal/data_structures/level_merger.h @@ -1,6 +1,7 @@ #ifndef ADIAR_INTERNAL_DATA_STRUCTURES_LEVEL_MERGER_H #define ADIAR_INTERNAL_DATA_STRUCTURES_LEVEL_MERGER_H +#include #include #include #include @@ -11,33 +12,8 @@ namespace adiar::internal { - ////////////////////////////////////////////////////////////////////////////// - /// \brief Defines at compile time the type of the file stream to use for - /// reading the levels from some file(s). - ////////////////////////////////////////////////////////////////////////////// - template - struct level_stream_t - { - template - using stream_t = level_info_stream; - }; - - template<> - struct level_stream_t> - { - template - using stream_t = file_stream; - }; - - template<> - struct level_stream_t> - { - template - using stream_t = file_stream; - }; - // TODO (code clarity): - // Add to 'file_t' an enum with 'ASCENDING'/'DESCENDING' to then derive the + // Add to 'file_t' an enum with 'Ascending'/'Descending' to then derive the // comparator in conjunction with 'reverse'. ////////////////////////////////////////////////////////////////////////////// @@ -47,53 +23,65 @@ namespace adiar::internal /// /// \tparam comp_t Comparator with which to merge the levels. /// - /// \tparam FILES Number of files to read from. + /// \tparam file_count Number of files to read from. ////////////////////////////////////////////////////////////////////////////// - template + template class level_merger { - static_assert(0 < FILES, "At least one file should be merged"); + static_assert(0 < file_count, "At least one file should be merged"); using stream_t = typename level_stream_t::template stream_t; public: static size_t memory_usage() { - return FILES * stream_t::memory_usage(); + return file_count * stream_t::memory_usage(); } - typedef ptr_uint64::label_t level_t; + using level_type = ptr_uint64::label_type; private: comp_t _comparator = comp_t(); - unique_ptr _level_streams[FILES]; + unique_ptr _level_streams[file_count]; public: - void hook(const file_t (&fs) [FILES]) + //////////////////////////////////////////////////////////////////////////// + /// \brief Attach onto the given list of files. + //////////////////////////////////////////////////////////////////////////// + void hook(const file_t (&fs) [file_count]) { - for (size_t idx = 0u; idx < FILES; idx++) { + for (size_t idx = 0u; idx < file_count; idx++) { _level_streams[idx] = adiar::make_unique(fs[idx]); } } - void hook(const dd (&dds) [FILES]) + //////////////////////////////////////////////////////////////////////////// + /// \brief Attach onto the given list of decision diagrams. + //////////////////////////////////////////////////////////////////////////// + void hook(const dd (&dds) [file_count]) { - for (size_t idx = 0u; idx < FILES; idx++) { + for (size_t idx = 0u; idx < file_count; idx++) { _level_streams[idx] = adiar::make_unique(dds[idx].file); } } - void hook(const __dd (&dds) [FILES]) + //////////////////////////////////////////////////////////////////////////// + /// \brief Attach onto the given list of (unreduced) decision diagrams. + //////////////////////////////////////////////////////////////////////////// + void hook(const __dd (&dds) [file_count]) { - for (size_t idx = 0u; idx < FILES; idx++) { + for (size_t idx = 0u; idx < file_count; idx++) { _level_streams[idx] = adiar::make_unique(dds[idx]); } } + //////////////////////////////////////////////////////////////////////////// + /// \brief Whether there are more levels to fetch. + //////////////////////////////////////////////////////////////////////////// bool can_pull() { - for (size_t idx = 0u; idx < FILES; idx++) { + for (size_t idx = 0u; idx < file_count; idx++) { if (_level_streams[idx]->can_pull()) { return true; } @@ -101,32 +89,42 @@ namespace adiar::internal return false; } - level_t peek() + //////////////////////////////////////////////////////////////////////////// + /// \brief Obtain the next level. + /// + /// \pre `can_pull() == true` + //////////////////////////////////////////////////////////////////////////// + level_type peek() { adiar_assert(can_pull(), "Cannot peek past end of all streams"); bool has_min_level = false; - level_t min_level = 0u; - for (size_t idx = 0u; idx < FILES; idx++) { + level_type min_level = 0u; + for (size_t idx = 0u; idx < file_count; idx++) { if (_level_streams[idx]->can_pull() - && (!has_min_level || _comparator(__level_of<>(_level_streams[idx]->peek()), min_level))) { + && (!has_min_level || _comparator(level_of(_level_streams[idx]->peek()), min_level))) { has_min_level = true; - min_level = __level_of<>(_level_streams[idx]->peek()); + min_level = level_of(_level_streams[idx]->peek()); } } return min_level; } - level_t pull() + //////////////////////////////////////////////////////////////////////////// + /// \brief Obtain the next level and go to the next. + /// + /// \pre `can_pull() == true` + //////////////////////////////////////////////////////////////////////////// + level_type pull() { adiar_assert(can_pull(), "Cannot pull past end of all streams"); - level_t min_level = peek(); + level_type min_level = peek(); // pull from all with min_level for (const unique_ptr &level_info_stream : _level_streams) { - if (level_info_stream->can_pull() && __level_of<>(level_info_stream->peek()) == min_level) { + if (level_info_stream->can_pull() && level_of(level_info_stream->peek()) == min_level) { level_info_stream->pull(); } } diff --git a/src/adiar/internal/data_structures/levelized_priority_queue.cpp b/src/adiar/internal/data_structures/levelized_priority_queue.cpp index 72394dba3..bd02e595d 100644 --- a/src/adiar/internal/data_structures/levelized_priority_queue.cpp +++ b/src/adiar/internal/data_structures/levelized_priority_queue.cpp @@ -2,5 +2,5 @@ namespace adiar::internal { - stats_t::levelized_priority_queue_t stats_levelized_priority_queue; + statistics::levelized_priority_queue_t stats_levelized_priority_queue; } diff --git a/src/adiar/internal/data_structures/levelized_priority_queue.h b/src/adiar/internal/data_structures/levelized_priority_queue.h index e86ddf1bc..0675789fd 100644 --- a/src/adiar/internal/data_structures/levelized_priority_queue.h +++ b/src/adiar/internal/data_structures/levelized_priority_queue.h @@ -4,6 +4,7 @@ #include #include +#include #include #include #include @@ -27,8 +28,8 @@ namespace adiar::internal /// \brief Strictly less ' < ' between two levels. //////////////////////////////////////////////////////////////////////////// template - inline bool level_cmp_lt(const ptr_uint64::label_t l1, - const ptr_uint64::label_t l2, + inline bool level_cmp_lt(const ptr_uint64::label_type l1, + const ptr_uint64::label_type l2, const level_comp_t &level_comp) { return level_comp(l1, l2); @@ -38,8 +39,8 @@ namespace adiar::internal /// \brief Less or equal ' <= ' between two levels. //////////////////////////////////////////////////////////////////////////// template - inline bool level_cmp_le(const ptr_uint64::label_t l1, - const ptr_uint64::label_t l2, + inline bool level_cmp_le(const ptr_uint64::label_type l1, + const ptr_uint64::label_type l2, const level_comp_t &level_comp) { return level_comp(l1, l2) || l1 == l2; @@ -57,7 +58,7 @@ namespace adiar::internal ////////////////////////////////////////////////////////////////////////////// /// \brief Struct holding statistics on the levelized priority queue ////////////////////////////////////////////////////////////////////////////// - extern stats_t::levelized_priority_queue_t stats_levelized_priority_queue; + extern statistics::levelized_priority_queue_t stats_levelized_priority_queue; ////////////////////////////////////////////////////////////////////////////// /// \brief Levelized Priority Queue with a finite circular array of sorters @@ -74,34 +75,34 @@ namespace adiar::internal /// \remark Elements may \e only be pushed to a \e later level than the /// currently read level. /// - /// \tparam elem_t Type of items to be placed in the priority queue + /// \tparam value_t Type of items to be placed in the priority queue /// - /// \tparam elem_comp_t Sorting comparator to use in the inner queue buckets + /// \tparam value_comp_t Sorting comparator to use in the inner queue buckets /// and for merging /// - /// \tparam file_t Type of the files to obtain the relevant levels from + /// \tparam look_ahead The number of levels (ahead of the current) + /// explicitly handle with a sorting algorithm + /// + /// \tparam level_file_t Type of the files to obtain the relevant levels from /// - /// \tparam FILES Number of files to obtain the levels from + /// \tparam level_files Number of files to obtain the levels from /// /// \tparam level_comp_t Comparator to be used for merging multiple levels /// from the files together (std::less = top-down, while /// std::greater = bottom-up) /// - /// \tparam INIT_LEVEL The index for the first level one can push to. In + /// \tparam init_level The index for the first level one can push to. In /// other words, the number of levels to 'skip'. - /// - /// \tparam LOOK_AHEAD The number of levels (ahead of the current) - /// explicitly handle with a sorting algorithm ////////////////////////////////////////////////////////////////////////////// - template , - ptr_uint64::label_t LOOK_AHEAD = ADIAR_LPQ_LOOKAHEAD, - memory_mode_t memory_mode = memory_mode_t::EXTERNAL, - typename file_t = shared_file_ptr>, - size_t FILES = 1u, - typename level_comp_t = std::less, + template , + size_t look_ahead = ADIAR_LPQ_LOOKAHEAD, + memory_mode_t memory_mode = memory_mode_t::External, + typename level_file_t = shared_file_ptr>, + size_t level_files = 1u, + typename level_comp_t = std::less<>, bool level_reverse = false, - ptr_uint64::label_t INIT_LEVEL = 1u + size_t init_level = 1u > class levelized_priority_queue { @@ -109,12 +110,12 @@ namespace adiar::internal //////////////////////////////////////////////////////////////////////////// /// \brief Type of the elements. //////////////////////////////////////////////////////////////////////////// - using elem_t = element_t; + using value_type = value_t; //////////////////////////////////////////////////////////////////////////// /// \brief Type of the element comparator. //////////////////////////////////////////////////////////////////////////// - using elem_comp_t = element_comp_t; + using value_comp_type = value_comp_t; //////////////////////////////////////////////////////////////////////////// /// \brief Number of buckets. @@ -122,62 +123,62 @@ namespace adiar::internal static constexpr memory_mode_t mem_mode = memory_mode; //////////////////////////////////////////////////////////////////////////// - // using level_t = TODO?; + // using level_type = TODO?; public: //////////////////////////////////////////////////////////////////////////// /// \brief Type of the sorter for each bucket. //////////////////////////////////////////////////////////////////////////// - using sorter_t = sorter; + using sorter_t = sorter; //////////////////////////////////////////////////////////////////////////// /// \brief Type of the overflow priority queue. //////////////////////////////////////////////////////////////////////////// - using priority_queue_t = priority_queue; + using priority_queue_t = priority_queue; //////////////////////////////////////////////////////////////////////////// /// \brief Type of the level merger. //////////////////////////////////////////////////////////////////////////// - using level_merger_t = level_merger; + using level_merger_t = level_merger; public: //////////////////////////////////////////////////////////////////////////// /// \brief Number of buckets. //////////////////////////////////////////////////////////////////////////// - static constexpr size_t BUCKETS = LOOK_AHEAD + 1; + static constexpr size_t buckets = look_ahead + 1; //////////////////////////////////////////////////////////////////////////// /// \brief Index for no bucket. //////////////////////////////////////////////////////////////////////////// - static constexpr ptr_uint64::label_t OUT_OF_BUCKETS_IDX = - static_cast(-1); + static constexpr ptr_uint64::label_type out_of_buckets_idx = + static_cast(-1); //////////////////////////////////////////////////////////////////////////// /// \brief Total number of data structures in Levelized Priority Queue. //////////////////////////////////////////////////////////////////////////// - static constexpr size_t DATA_STRUCTURES = - BUCKETS * sorter_t::DATA_STRUCTURES + priority_queue_t::DATA_STRUCTURES; + static constexpr size_t data_structures = + buckets * sorter_t::data_structures + priority_queue_t::data_structures; //////////////////////////////////////////////////////////////////////////// /// \brief Value to reflect 'out of levels'. //////////////////////////////////////////////////////////////////////////// - static constexpr ptr_uint64::label_t NO_LABEL = ptr_uint64::MAX_LABEL+1; + static constexpr ptr_uint64::label_type no_label = ptr_uint64::max_label+1; private: - static_assert(0 < LOOK_AHEAD, - "LOOK_AHEAD must at least be of one level"); + static_assert(0 < look_ahead, + "look_ahead must at least be of one level"); - static_assert(0 < ptr_uint64::MAX_LABEL, - "A larger LOOK_AHEAD than MAX_LABEL is wasteful"); + static_assert(0 < ptr_uint64::max_label, + "A larger look_ahead than max_label is wasteful"); - static_assert(BUCKETS < OUT_OF_BUCKETS_IDX, - "LOOK_AHEAD must not be so large to also include '-1'"); + static_assert(buckets < out_of_buckets_idx, + "look_ahead must not be so large to also include '-1'"); - static_assert(OUT_OF_BUCKETS_IDX + 1 == 0, + static_assert(out_of_buckets_idx + 1 == 0, "Overflow to '0' is necessary for internal logic to work"); - static_assert(ptr_uint64::MAX_LABEL+1 > ptr_uint64::MAX_LABEL, - "'ptr_uint64::label_t' should leave a window of at least one above 'MAX_LABEL'"); + static_assert(ptr_uint64::max_label+1 > ptr_uint64::max_label, + "'ptr_uint64::label_type' should leave a window of at least one above 'max_label'"); private: static tpie::memory_size_type const_memory_usage() @@ -188,8 +189,8 @@ namespace adiar::internal public: static tpie::memory_size_type memory_usage(tpie::memory_size_type no_elements) { - return priority_queue::memory_usage(no_elements) - + BUCKETS * sorter::memory_usage(no_elements) + return priority_queue::memory_usage(no_elements) + + buckets * sorter::memory_usage(no_elements) + const_memory_usage(); } @@ -203,12 +204,12 @@ namespace adiar::internal // HACK: just provide the minimum of what either of the data structures // can hold when given an equal share of the memory. - const size_t memory_per_data_structure = (memory_bytes - const_memory_bytes) / DATA_STRUCTURES; + const size_t memory_per_data_structure = (memory_bytes - const_memory_bytes) / data_structures; - const size_t sorter_fits = sorter + const size_t sorter_fits = sorter ::memory_fits(memory_per_data_structure); - const size_t priority_queue_fits = priority_queue + const size_t priority_queue_fits = priority_queue ::memory_fits(memory_per_data_structure); const size_t res = std::min(sorter_fits, priority_queue_fits); @@ -233,13 +234,13 @@ namespace adiar::internal /// the current level is completely frozen. Hence, the top element /// cannot change on a push. //////////////////////////////////////////////////////////////////////////// - elem_t _top_elem; + value_type _top_elem; bool _has_top_elem = false; //////////////////////////////////////////////////////////////////////////// /// \brief Instantiation of the comparator between levels. //////////////////////////////////////////////////////////////////////////// - ptr_uint64::label_t _current_level = NO_LABEL; + ptr_uint64::label_type _current_level = no_label; //////////////////////////////////////////////////////////////////////////// /// \brief Instantiation of the comparator between levels. @@ -249,7 +250,7 @@ namespace adiar::internal //////////////////////////////////////////////////////////////////////////// /// \brief Instantiation of the comparator between elements. //////////////////////////////////////////////////////////////////////////// - elem_comp_t _e_comparator = elem_comp_t(); + value_comp_type _v_comparator = value_comp_type(); //////////////////////////////////////////////////////////////////////////// /// \brief Maximum size of levelized priority queue. @@ -285,22 +286,22 @@ namespace adiar::internal //////////////////////////////////////////////////////////////////////////// /// \brief Level of each bucket. //////////////////////////////////////////////////////////////////////////// - ptr_uint64::label_t _buckets_level [BUCKETS]; + ptr_uint64::label_type _buckets_level [buckets]; //////////////////////////////////////////////////////////////////////////// /// \brief Sorter for each bucket. //////////////////////////////////////////////////////////////////////////// - unique_ptr _buckets_sorter [BUCKETS]; + unique_ptr _buckets_sorter [buckets]; //////////////////////////////////////////////////////////////////////////// /// \brief Index of the currently read-from bucket (if any). //////////////////////////////////////////////////////////////////////////// - ptr_uint64::label_t _front_bucket_idx = OUT_OF_BUCKETS_IDX; + ptr_uint64::label_type _front_bucket_idx = out_of_buckets_idx; //////////////////////////////////////////////////////////////////////////// /// \brief Index of the last available bucket (if any). //////////////////////////////////////////////////////////////////////////// - ptr_uint64::label_t _back_bucket_idx = OUT_OF_BUCKETS_IDX; + ptr_uint64::label_type _back_bucket_idx = out_of_buckets_idx; //////////////////////////////////////////////////////////////////////////// /// \brief Next element to take out of the bucket (if any) @@ -311,7 +312,7 @@ namespace adiar::internal /// peek the next value. We can decrease code complexity by moving /// this into the sorter's logic. //////////////////////////////////////////////////////////////////////////// - elem_t _next_from_bucket; + value_type _next_from_bucket; bool _has_next_from_bucket = false; //////////////////////////////////////////////////////////////////////////// @@ -329,7 +330,7 @@ namespace adiar::internal //////////////////////////////////////////////////////////////////////////// /// \brief Reference to struct to store non-global stats into. //////////////////////////////////////////////////////////////////////////// - stats_t::levelized_priority_queue_t &_stats; + statistics::levelized_priority_queue_t &_stats; #endif private: @@ -346,13 +347,13 @@ namespace adiar::internal // GCC bug 85282: One cannot do a member class specialization of each of // the two following cases. So, we will have to resort to a constexpr // if-statement instead. - if constexpr (mem_mode == memory_mode_t::INTERNAL) { + if constexpr (mem_mode == memory_mode_t::Internal) { // --------------------------------------------------------------------- - // INTERNAL MEMORY MODE: + // Internal MEMORY MODE: // Divide memory in equal parts - return memory_given / DATA_STRUCTURES; - } else if constexpr (mem_mode == memory_mode_t::EXTERNAL) { + return memory_given / data_structures; + } else if constexpr (mem_mode == memory_mode_t::External) { // --------------------------------------------------------------------- // EXTERNAL MEMORY MODE: // Use 1/(4Buckets + 1)th of the memory and at least 8 MiB. @@ -360,19 +361,19 @@ namespace adiar::internal // LCOV_EXCL_START // TODO: Unit test external memory variants? const tpie::memory_size_type eight_MiB = 8 * 1024; - const tpie::memory_size_type weighted_share = memory_given / (4 * BUCKETS + 1); + const tpie::memory_size_type weighted_share = memory_given / (4 * buckets + 1); return std::max(eight_MiB, weighted_share); // LCOV_EXCL_STOP } else { // --------------------------------------------------------------------- - static_assert(mem_mode == memory_mode_t::INTERNAL && mem_mode == memory_mode_t::EXTERNAL, - "Memory mode must be 'INTERNAL' or 'EXTERNAL' at compile-time"); + static_assert(mem_mode == memory_mode_t::Internal && mem_mode == memory_mode_t::External, + "Memory mode must be 'Internal' or 'EXTERNAL' at compile-time"); } } levelized_priority_queue(tpie::memory_size_type memory_given, size_t max_size, - [[maybe_unused]] stats_t::levelized_priority_queue_t &stats) + [[maybe_unused]] statistics::levelized_priority_queue_t &stats) : _max_size(max_size) , _memory_given(memory_given) , _memory_for_buckets(memory_given - _memory_occupied_by_merger - mem_overflow_queue(memory_given)) @@ -395,10 +396,10 @@ namespace adiar::internal /// /// \param memory_given Total amount of memory to use //////////////////////////////////////////////////////////////////////////// - levelized_priority_queue(const file_t (& files) [FILES], + levelized_priority_queue(const level_file_t (& files) [level_files], tpie::memory_size_type memory_given, size_t max_size, - stats_t::levelized_priority_queue_t &stats) + statistics::levelized_priority_queue_t &stats) : levelized_priority_queue(memory_given, max_size, stats) { _level_merger.hook(files); @@ -412,10 +413,10 @@ namespace adiar::internal /// /// \param memory_given Total amount of memory to use //////////////////////////////////////////////////////////////////////////// - levelized_priority_queue(const dd (& dds) [FILES], + levelized_priority_queue(const dd (& dds) [level_files], tpie::memory_size_type memory_given, size_t max_size, - stats_t::levelized_priority_queue_t &stats) + statistics::levelized_priority_queue_t &stats) : levelized_priority_queue(memory_given, max_size, stats) { _level_merger.hook(dds); @@ -429,10 +430,10 @@ namespace adiar::internal /// /// \param memory_given Total amount of memory to use //////////////////////////////////////////////////////////////////////////// - levelized_priority_queue(const __dd (& dds) [FILES], + levelized_priority_queue(const __dd (& dds) [level_files], tpie::memory_size_type memory_given, size_t max_size, - stats_t::levelized_priority_queue_t &stats) + statistics::levelized_priority_queue_t &stats) : levelized_priority_queue(memory_given, max_size, stats) { _level_merger.hook(dds); @@ -450,22 +451,22 @@ namespace adiar::internal void init_buckets() { // Initially skip the number of levels - for (ptr_uint64::label_t idx = 0; _level_merger.can_pull() && idx < INIT_LEVEL; idx++) { + for (ptr_uint64::label_type idx = 0; _level_merger.can_pull() && idx < init_level; idx++) { _level_merger.pull(); } // Set up buckets until no levels are left or all buckets have been // instantiated. Notice, that _back_bucket_idx was initialised to -1. - while (_back_bucket_idx + 1 < BUCKETS && _level_merger.can_pull()) { - const ptr_uint64::label_t level = _level_merger.pull(); + while (_back_bucket_idx + 1 < buckets && _level_merger.can_pull()) { + const ptr_uint64::label_type level = _level_merger.pull(); - adiar_assert(_front_bucket_idx == OUT_OF_BUCKETS_IDX, + adiar_assert(_front_bucket_idx == out_of_buckets_idx, "Front bucket not moved"); _back_bucket_idx++; _buckets_level[_back_bucket_idx] = level; - _buckets_sorter[_back_bucket_idx] = sorter_t::make_unique(_memory_for_buckets, _max_size, BUCKETS); + _buckets_sorter[_back_bucket_idx] = sorter_t::make_unique(_memory_for_buckets, _max_size, buckets); } } @@ -493,7 +494,7 @@ namespace adiar::internal //////////////////////////////////////////////////////////////////////////// bool has_current_level() const { - return _current_level != NO_LABEL; + return _current_level != no_label; } //////////////////////////////////////////////////////////////////////////// @@ -501,7 +502,7 @@ namespace adiar::internal /// /// \pre `has_current_level() == true` //////////////////////////////////////////////////////////////////////////// - ptr_uint64::label_t current_level() const + ptr_uint64::label_type current_level() const { adiar_assert(has_current_level(), "Needs to have a 'current' level to read the level from"); @@ -522,7 +523,7 @@ namespace adiar::internal /// /// \pre `has_next_level() == true` //////////////////////////////////////////////////////////////////////////// - ptr_uint64::label_t next_level() const + ptr_uint64::label_type next_level() const { return next_bucket_level(); } @@ -538,12 +539,12 @@ namespace adiar::internal //////////////////////////////////////////////////////////////////////////// /// \brief Push an element into the priority queue. //////////////////////////////////////////////////////////////////////////// - void push(const elem_t &e) + void push(const value_type &e) { adiar_assert(can_push(), "Should only push when there is a yet unvisited level."); - const ptr_uint64::label_t level = e.level(); + const ptr_uint64::label_type level = e.level(); adiar_assert(level_cmp_le(next_bucket_level(), level, _level_comparator), "Can only push element to next bucket or later."); @@ -558,9 +559,9 @@ namespace adiar::internal _actual_max_size = std::max(_actual_max_size, _size); #endif - ptr_uint64::label_t bucket_offset = 1u; + ptr_uint64::label_type bucket_offset = 1u; do { - const ptr_uint64::label_t bucket_idx = (_front_bucket_idx + bucket_offset++) % BUCKETS; + const ptr_uint64::label_type bucket_idx = (_front_bucket_idx + bucket_offset++) % buckets; if (_buckets_level[bucket_idx] == level) { _buckets_sorter[bucket_idx] -> push(e); @@ -587,26 +588,26 @@ namespace adiar::internal /// stop level is given then the next level is based on /// the next existing element in the priority queue. //////////////////////////////////////////////////////////////////////////// - void setup_next_level(ptr_uint64::label_t stop_level = NO_LABEL) + void setup_next_level(ptr_uint64::label_type stop_level = no_label) { - adiar_assert(stop_level <= ptr_uint64::MAX_LABEL || stop_level == NO_LABEL, + adiar_assert(stop_level <= ptr_uint64::max_label || stop_level == no_label, "The stop level should be a legal value (or not given)"); adiar_assert(!has_current_level() || empty_level(), "Level is empty before moving on to the next"); - adiar_assert(stop_level != NO_LABEL || !empty(), + adiar_assert(stop_level != no_label || !empty(), "Either a stop level is given or we have some non-empty level to forward to"); - const ptr_uint64::label_t overflow_level = !_overflow_queue.empty() + const ptr_uint64::label_type overflow_level = !_overflow_queue.empty() ? _overflow_queue.top().level() : stop_level; - stop_level = stop_level == NO_LABEL || level_cmp_lt(overflow_level, stop_level, _level_comparator) + stop_level = stop_level == no_label || level_cmp_lt(overflow_level, stop_level, _level_comparator) ? overflow_level : stop_level; - const bool has_stop_level = stop_level != NO_LABEL; + const bool has_stop_level = stop_level != no_label; adiar_assert(has_next_level(), "There should be a next level to go to"); @@ -676,7 +677,7 @@ namespace adiar::internal /// /// \pre `can_pull() == true` //////////////////////////////////////////////////////////////////////////// - elem_t top() + value_type top() { adiar_assert(can_pull(), "Can only obtain top element on non-empty level"); @@ -695,7 +696,7 @@ namespace adiar::internal /// /// \sa levelized_priority_queue::top //////////////////////////////////////////////////////////////////////////// - elem_t peek() + value_type peek() { return top(); } @@ -705,7 +706,7 @@ namespace adiar::internal /// /// \pre `can_pull() == true` //////////////////////////////////////////////////////////////////////////// - elem_t pull() + value_type pull() { adiar_assert(!empty_level(), "Can only pull on non-empty level"); @@ -719,8 +720,8 @@ namespace adiar::internal // Merge bucket with overflow queue if (_overflow_queue.empty() || (_has_next_from_bucket - && _e_comparator(_next_from_bucket, _overflow_queue.top()))) { - const elem_t ret = _next_from_bucket; + && _v_comparator(_next_from_bucket, _overflow_queue.top()))) { + const value_type ret = _next_from_bucket; if (_buckets_sorter[_front_bucket_idx] -> can_pull()) { _next_from_bucket = _buckets_sorter[_front_bucket_idx] -> pull(); } else { @@ -728,7 +729,7 @@ namespace adiar::internal } return ret; } else { - const elem_t ret = _overflow_queue.top(); + const value_type ret = _overflow_queue.top(); _overflow_queue.pop(); return ret; } @@ -779,13 +780,13 @@ namespace adiar::internal //////////////////////////////////////////////////////////////////////////// size_t active_buckets() const { - if (_front_bucket_idx == OUT_OF_BUCKETS_IDX) { + if (_front_bucket_idx == out_of_buckets_idx) { return _back_bucket_idx + 1; } return _front_bucket_idx <= _back_bucket_idx ? (_back_bucket_idx - _front_bucket_idx) + 1 - : (BUCKETS - _front_bucket_idx) + _back_bucket_idx + 1; + : (buckets - _front_bucket_idx) + _back_bucket_idx + 1; } //////////////////////////////////////////////////////////////////////////// @@ -799,13 +800,13 @@ namespace adiar::internal //////////////////////////////////////////////////////////////////////////// /// \brief Label of the next bucket. //////////////////////////////////////////////////////////////////////////// - ptr_uint64::label_t next_bucket_level() const + ptr_uint64::label_type next_bucket_level() const { adiar_assert(has_next_bucket(), "Cannot obtain level of non-existing next bucket"); - const ptr_uint64::label_t next_idx = (_front_bucket_idx + 1) % BUCKETS; - const ptr_uint64::label_t next_level = _buckets_level[next_idx]; + const ptr_uint64::label_type next_idx = (_front_bucket_idx + 1) % buckets; + const ptr_uint64::label_type next_level = _buckets_level[next_idx]; return next_level; } @@ -815,13 +816,13 @@ namespace adiar::internal //////////////////////////////////////////////////////////////////////////// bool has_front_bucket() const { - return _front_bucket_idx != OUT_OF_BUCKETS_IDX; + return _front_bucket_idx != out_of_buckets_idx; } //////////////////////////////////////////////////////////////////////////// /// \brief Level of the front bucket. //////////////////////////////////////////////////////////////////////////// - ptr_uint64::label_t front_bucket_level() const + ptr_uint64::label_type front_bucket_level() const { return _buckets_level[_front_bucket_idx]; } @@ -829,7 +830,7 @@ namespace adiar::internal //////////////////////////////////////////////////////////////////////////// /// \brief Level of the back bucket. //////////////////////////////////////////////////////////////////////////// - ptr_uint64::label_t back_bucket_level() const + ptr_uint64::label_type back_bucket_level() const { return _buckets_level[_back_bucket_idx]; } @@ -846,7 +847,7 @@ namespace adiar::internal /// /// \sa levelized_priority_queue::setup_next_level //////////////////////////////////////////////////////////////////////////// - inline void forward_to_nonempty_bucket(const ptr_uint64::label_t stop_level, const bool has_stop_level) + inline void forward_to_nonempty_bucket(const ptr_uint64::label_type stop_level, const bool has_stop_level) { do { adiar_assert(has_next_bucket(), @@ -863,15 +864,15 @@ namespace adiar::internal // Replace the current read-only bucket, if there is one if (_level_merger.can_pull() && has_front_bucket()) { - const ptr_uint64::label_t next_level = _level_merger.pull(); + const ptr_uint64::label_type next_level = _level_merger.pull(); _buckets_level[_front_bucket_idx] = next_level; sorter_t::reset_unique(_buckets_sorter[_front_bucket_idx], - _memory_for_buckets, _max_size, BUCKETS); + _memory_for_buckets, _max_size, buckets); _back_bucket_idx = _front_bucket_idx; } - _front_bucket_idx = (_front_bucket_idx + 1) % BUCKETS; + _front_bucket_idx = (_front_bucket_idx + 1) % buckets; adiar_assert(!has_next_bucket() || !has_front_bucket() || level_cmp_lt(front_bucket_level(), back_bucket_level(), _level_comparator), @@ -911,9 +912,9 @@ namespace adiar::internal /// /// \sa levelized_priority_queue::setup_next_level //////////////////////////////////////////////////////////////////////////// - inline void relabel_buckets(const ptr_uint64::label_t stop_level) + inline void relabel_buckets(const ptr_uint64::label_type stop_level) { - adiar_assert(stop_level != NO_LABEL, + adiar_assert(stop_level != no_label, "Relabelling of buckets require a valid 'stop_level'"); // Backup of start and end of circular array @@ -921,12 +922,12 @@ namespace adiar::internal const size_t old_back_bucket_idx = _back_bucket_idx; // Create a list of the new levels - ptr_uint64::label_t new_levels[BUCKETS]; - _back_bucket_idx = OUT_OF_BUCKETS_IDX; + ptr_uint64::label_type new_levels[buckets]; + _back_bucket_idx = out_of_buckets_idx; // Copy over still relevant levels from current buckets do { - _front_bucket_idx = (_front_bucket_idx + 1) % BUCKETS; + _front_bucket_idx = (_front_bucket_idx + 1) % buckets; adiar_assert(has_front_bucket(), "After increment the front bucket will 'exist'"); @@ -937,22 +938,22 @@ namespace adiar::internal } } while (_front_bucket_idx != old_back_bucket_idx); - _front_bucket_idx = OUT_OF_BUCKETS_IDX; + _front_bucket_idx = out_of_buckets_idx; // Add as many levels from the level_merger as we can fit in while (_level_merger.can_pull() && level_cmp_le(_level_merger.peek(), stop_level, _level_comparator)) { _current_level = _level_merger.pull(); } - while (_back_bucket_idx + 1 < BUCKETS && _level_merger.can_pull()) { + while (_back_bucket_idx + 1 < buckets && _level_merger.can_pull()) { new_levels[++_back_bucket_idx] = _level_merger.pull(); } - adiar_assert(_back_bucket_idx == OUT_OF_BUCKETS_IDX || _back_bucket_idx < BUCKETS, + adiar_assert(_back_bucket_idx == out_of_buckets_idx || _back_bucket_idx < buckets, "_back_bucket_idx is a valid index"); // Relabel all buckets - if (_back_bucket_idx != OUT_OF_BUCKETS_IDX) { + if (_back_bucket_idx != out_of_buckets_idx) { for (size_t idx = 0; idx <= _back_bucket_idx; idx++) { _buckets_level[idx] = new_levels[idx]; } @@ -960,7 +961,7 @@ namespace adiar::internal // Reset the prior read-only bucket, if relevant if (old_front_bucket_idx <= _back_bucket_idx) { sorter_t::reset_unique(_buckets_sorter[old_front_bucket_idx], - _memory_for_buckets, _max_size, BUCKETS); + _memory_for_buckets, _max_size, buckets); } // We can clean up all the dead buckets with a '.reset()' on the @@ -973,31 +974,31 @@ namespace adiar::internal /// \brief Specialization of the levelized priority queue with a look_ahead /// of '0', i.e. **without** any buckets. //////////////////////////////////////////////////////////////////////////// - template - class levelized_priority_queue + level_file_t, level_files, level_comp_t, level_reverse, + init_level> { public: //////////////////////////////////////////////////////////////////////////// /// \brief Type of the elements. //////////////////////////////////////////////////////////////////////////// - using elem_t = element_t; + using value_type = value_t; //////////////////////////////////////////////////////////////////////////// /// \brief Type of the element comparator. //////////////////////////////////////////////////////////////////////////// - using elem_comp_t = element_comp_t; + using value_comp_type = value_comp_t; //////////////////////////////////////////////////////////////////////////// /// \brief Number of buckets. @@ -1008,40 +1009,40 @@ namespace adiar::internal //////////////////////////////////////////////////////////////////////////// /// \brief Type of the (overflow) priority queue. //////////////////////////////////////////////////////////////////////////// - using priority_queue_t = priority_queue; + using priority_queue_t = priority_queue; public: //////////////////////////////////////////////////////////////////////////// /// \brief Number of buckets. //////////////////////////////////////////////////////////////////////////// - static constexpr size_t BUCKETS = 0; + static constexpr size_t buckets = 0; //////////////////////////////////////////////////////////////////////////// /// \brief Total number of data structures in Levelized Priority Queue. //////////////////////////////////////////////////////////////////////////// - static constexpr size_t DATA_STRUCTURES = priority_queue_t::DATA_STRUCTURES; + static constexpr size_t data_structures = priority_queue_t::data_structures; //////////////////////////////////////////////////////////////////////////// /// \brief Value to reflect 'out of levels'. //////////////////////////////////////////////////////////////////////////// - static constexpr ptr_uint64::label_t NO_LABEL = ptr_uint64::MAX_LABEL+1; + static constexpr ptr_uint64::label_type no_label = ptr_uint64::max_label+1; public: static tpie::memory_size_type memory_usage(tpie::memory_size_type no_elements) { - return priority_queue::memory_usage(no_elements); + return priority_queue::memory_usage(no_elements); } static tpie::memory_size_type memory_fits(tpie::memory_size_type memory_bytes) { - return priority_queue::memory_fits(memory_bytes); + return priority_queue::memory_fits(memory_bytes); } private: //////////////////////////////////////////////////////////////////////////// /// \brief Instantiation of the comparator between levels. //////////////////////////////////////////////////////////////////////////// - ptr_uint64::label_t _current_level = NO_LABEL; + ptr_uint64::label_type _current_level = no_label; //////////////////////////////////////////////////////////////////////////// /// \brief Instantiation of the comparator between levels. @@ -1051,7 +1052,7 @@ namespace adiar::internal //////////////////////////////////////////////////////////////////////////// /// \brief Instantiation of the comparator between elements. //////////////////////////////////////////////////////////////////////////// - elem_comp_t _e_comparator = elem_comp_t(); + value_comp_type _v_comparator = value_comp_type(); //////////////////////////////////////////////////////////////////////////// /// \brief Maximum size of levelized priority queue. @@ -1078,12 +1079,12 @@ namespace adiar::internal //////////////////////////////////////////////////////////////////////////// /// \brief Reference to struct to store non-global stats into. //////////////////////////////////////////////////////////////////////////// - stats_t::levelized_priority_queue_t &_stats; + statistics::levelized_priority_queue_t &_stats; #endif private: levelized_priority_queue(tpie::memory_size_type memory_given, size_t max_size, - [[maybe_unused]] stats_t::levelized_priority_queue_t &stats) + [[maybe_unused]] statistics::levelized_priority_queue_t &stats) : _max_size(max_size), _memory_given(memory_given), _priority_queue(memory_given, max_size) @@ -1100,10 +1101,10 @@ namespace adiar::internal /// /// \param memory_given Total amount of memory to use //////////////////////////////////////////////////////////////////////////// - levelized_priority_queue(const file_t (& /*files*/) [FILES], + levelized_priority_queue(const level_file_t (& /*files*/) [level_files], tpie::memory_size_type memory_given, size_t max_size, - stats_t::levelized_priority_queue_t &stats) + statistics::levelized_priority_queue_t &stats) : levelized_priority_queue(memory_given, max_size, stats) { } @@ -1114,10 +1115,10 @@ namespace adiar::internal /// /// \param memory_given Total amount of memory to use //////////////////////////////////////////////////////////////////////////// - levelized_priority_queue(const dd (& /*dds*/) [FILES], + levelized_priority_queue(const dd (& /*dds*/) [level_files], tpie::memory_size_type memory_given, size_t max_size, - stats_t::levelized_priority_queue_t &stats) + statistics::levelized_priority_queue_t &stats) : levelized_priority_queue(memory_given, max_size, stats) { } @@ -1128,10 +1129,10 @@ namespace adiar::internal /// /// \param memory_given Total amount of memory to use //////////////////////////////////////////////////////////////////////////// - levelized_priority_queue(const __dd (& /*dds*/) [FILES], + levelized_priority_queue(const __dd (& /*dds*/) [level_files], tpie::memory_size_type memory_given, size_t max_size, - stats_t::levelized_priority_queue_t &stats) + statistics::levelized_priority_queue_t &stats) : levelized_priority_queue(memory_given, max_size, stats) { } @@ -1159,7 +1160,7 @@ namespace adiar::internal //////////////////////////////////////////////////////////////////////////// bool has_current_level() const { - return _current_level != NO_LABEL; + return _current_level != no_label; } //////////////////////////////////////////////////////////////////////////// @@ -1167,7 +1168,7 @@ namespace adiar::internal /// /// \pre `has_current_level() == true` //////////////////////////////////////////////////////////////////////////// - ptr_uint64::label_t current_level() const + ptr_uint64::label_type current_level() const { adiar_assert(has_current_level(), "Needs to have a 'current' level to read the level from"); @@ -1183,7 +1184,7 @@ namespace adiar::internal if(_priority_queue.empty()) { return false; } - ptr_uint64::label_t next_label_from_queue = _priority_queue.top().level(); + ptr_uint64::label_type next_label_from_queue = _priority_queue.top().level(); return (has_current_level() && level_cmp_lt(_current_level, next_label_from_queue, _level_comparator)) @@ -1195,7 +1196,7 @@ namespace adiar::internal /// /// \pre `has_next_level() == true` //////////////////////////////////////////////////////////////////////////// - ptr_uint64::label_t next_level() /*const*/ + ptr_uint64::label_type next_level() /*const*/ { return _priority_queue.top().level(); } @@ -1211,14 +1212,14 @@ namespace adiar::internal //////////////////////////////////////////////////////////////////////////// /// \brief Push an element into the priority queue. //////////////////////////////////////////////////////////////////////////// - void push(const elem_t &e) + void push(const value_type &v) { #ifdef ADIAR_STATS _actual_max_size = std::max(_actual_max_size, _priority_queue.size()); stats_levelized_priority_queue.push_overflow += 1u; _stats.push_overflow += 1u; #endif - _priority_queue.push(e); + _priority_queue.push(v); } //////////////////////////////////////////////////////////////////////////// @@ -1229,15 +1230,15 @@ namespace adiar::internal /// stop level is given then the next level is based on /// the next existing element in the priority queue. //////////////////////////////////////////////////////////////////////////// - void setup_next_level(ptr_uint64::label_t stop_level = NO_LABEL) + void setup_next_level(ptr_uint64::label_type stop_level = no_label) { - adiar_assert(stop_level <= ptr_uint64::MAX_LABEL || stop_level == NO_LABEL, + adiar_assert(stop_level <= ptr_uint64::max_label || stop_level == no_label, "The stop level should be a legal value (or not given)"); adiar_assert(!has_current_level() || empty_level(), "Level is empty before moving on to the next"); - const bool has_stop_level = stop_level != NO_LABEL; + const bool has_stop_level = stop_level != no_label; adiar_assert(has_stop_level || !empty(), "Either a stop level is given or we have some non-empty level to forward to"); @@ -1253,7 +1254,7 @@ namespace adiar::internal // The stop level is before the next level of the queue adiar_assert(has_next_level(), "There should be a next level to go to"); - ptr_uint64::label_t next_level_from_queue = next_level(); + ptr_uint64::label_type next_level_from_queue = next_level(); if(has_stop_level && level_cmp_le(stop_level, next_level_from_queue, _level_comparator)) { _current_level = stop_level; return; @@ -1291,7 +1292,7 @@ namespace adiar::internal /// /// \pre `can_pull() == true` //////////////////////////////////////////////////////////////////////////// - elem_t top() + value_type top() { adiar_assert(can_pull(), "Can only obtain top element on non-empty level"); return _priority_queue.top(); @@ -1304,7 +1305,7 @@ namespace adiar::internal /// /// \sa levelized_priority_queue::top //////////////////////////////////////////////////////////////////////////// - elem_t peek() + value_type peek() { return top(); } @@ -1314,11 +1315,11 @@ namespace adiar::internal /// /// \pre `can_pull() == true` //////////////////////////////////////////////////////////////////////////// - elem_t pull() + value_type pull() { adiar_assert(!empty_level(), "Can only pull on non-empty level"); - const elem_t ret = _priority_queue.top(); + const value_type ret = _priority_queue.top(); _priority_queue.pop(); return ret; } @@ -1361,68 +1362,68 @@ namespace adiar::internal ////////////////////////////////////////////////////////////////////////////// /// \brief Levelized Priority Queue to be used with `levelized_file`. ////////////////////////////////////////////////////////////////////////////// - template , - node::label_t LOOK_AHEAD = ADIAR_LPQ_LOOKAHEAD, - memory_mode_t mem_mode = memory_mode_t::EXTERNAL, - size_t FILES = 1u, - node::label_t INIT_LEVEL = 1u> + template , + size_t look_ahead = ADIAR_LPQ_LOOKAHEAD, + memory_mode_t mem_mode = memory_mode_t::External, + size_t level_files = 1u, + size_t init_level = 1u> using levelized_node_priority_queue = - levelized_priority_queue, FILES, std::less, false, - INIT_LEVEL>; + shared_levelized_file, level_files, std::less, false, + init_level>; ////////////////////////////////////////////////////////////////////////////// /// \brief Levelized Priority Queue to be used with `levelized_file` and /// an `arc_stream`. ////////////////////////////////////////////////////////////////////////////// - template , - arc::label_t LOOK_AHEAD = ADIAR_LPQ_LOOKAHEAD, - memory_mode_t mem_mode = memory_mode_t::EXTERNAL, - size_t FILES = 1u, - arc::label_t INIT_LEVEL = 1u> + template , + size_t look_ahead = ADIAR_LPQ_LOOKAHEAD, + memory_mode_t mem_mode = memory_mode_t::External, + size_t level_files = 1u, + size_t init_level = 1u> using levelized_arc_priority_queue = - levelized_priority_queue, FILES, std::greater, false, - INIT_LEVEL>; + shared_levelized_file, level_files, std::greater, false, + init_level>; ////////////////////////////////////////////////////////////////////////////// /// \brief Levelized Priority Queue to be used with `levelized_file` and /// a `node_arc_stream`. ////////////////////////////////////////////////////////////////////////////// - template , - arc::label_t LOOK_AHEAD = ADIAR_LPQ_LOOKAHEAD, - memory_mode_t mem_mode = memory_mode_t::EXTERNAL, - size_t FILES = 1u, - arc::label_t INIT_LEVEL = 1u> + template , + size_t look_ahead = ADIAR_LPQ_LOOKAHEAD, + memory_mode_t mem_mode = memory_mode_t::External, + size_t level_files = 1u, + size_t init_level = 1u> using levelized_node_arc_priority_queue = - levelized_priority_queue, FILES, std::less, true, - INIT_LEVEL>; + shared_levelized_file, level_files, std::less, true, + init_level>; ////////////////////////////////////////////////////////////////////////////// - /// \brief Levelized Priority Queue to be used with `shared_file`. + /// \brief Levelized Priority Queue to be used with `shared_file`. ////////////////////////////////////////////////////////////////////////////// - template , - ptr_uint64::label_t LOOK_AHEAD = ADIAR_LPQ_LOOKAHEAD, - memory_mode_t mem_mode = memory_mode_t::EXTERNAL, - size_t FILES = 1u, - ptr_uint64::label_t INIT_LEVEL = 1u> + template , + size_t look_ahead = ADIAR_LPQ_LOOKAHEAD, + memory_mode_t mem_mode = memory_mode_t::External, + size_t level_files = 1u, + size_t init_level = 1u> using levelized_label_priority_queue = - levelized_priority_queue, FILES, std::less, false, - INIT_LEVEL>; + shared_file, level_files, std::less, false, + init_level>; } #endif // ADIAR_INTERNAL_DATA_STRUCTURES_LEVELIZED_PRIORITY_QUEUE_H diff --git a/src/adiar/internal/data_structures/priority_queue.h b/src/adiar/internal/data_structures/priority_queue.h index 8abc1f1b1..b2649ff25 100644 --- a/src/adiar/internal/data_structures/priority_queue.h +++ b/src/adiar/internal/data_structures/priority_queue.h @@ -12,17 +12,17 @@ namespace adiar::internal { - template > + template > class priority_queue; ////////////////////////////////////////////////////////////////////////////// /// \brief Wrapper for TPIE's internal binary heap. ////////////////////////////////////////////////////////////////////////////// - template - class priority_queue + template + class priority_queue { private: - using pq_t = tpie::internal_priority_queue; + using pq_t = tpie::internal_priority_queue; pq_t pq; public: @@ -40,7 +40,9 @@ namespace adiar::internal return ret; } - static constexpr size_t DATA_STRUCTURES = 1u; + static constexpr size_t data_structures = 1u; + + using value_type = value_t; public: priority_queue([[maybe_unused]] size_t memory_bytes, size_t max_size) @@ -50,14 +52,14 @@ namespace adiar::internal "Must be instantiated with enough memory."); } - elem_t top() const + value_type top() const { return pq.top(); } void pop() { pq.pop(); } - void push(const elem_t &e) - { pq.push(e); } + void push(const value_type &v) + { pq.push(v); } size_t size() const { return pq.size(); } @@ -70,8 +72,8 @@ namespace adiar::internal /// \brief Type alias for sorter for partial type application of the /// 'internal' memory type. ////////////////////////////////////////////////////////////////////////////// - template > - using internal_priority_queue = priority_queue; + template > + using internal_priority_queue = priority_queue; // LCOV_EXCL_START // TODO: Unit test external memory variants? @@ -79,27 +81,31 @@ namespace adiar::internal ////////////////////////////////////////////////////////////////////////////// /// \brief Wrapper for TPIE's internal binary heap. ////////////////////////////////////////////////////////////////////////////// - template - class priority_queue + template + class priority_queue { public: - static constexpr size_t DATA_STRUCTURES = 1u; + static constexpr size_t data_structures = 1u; + + using value_type = value_t; private: - tpie::priority_queue pq; + using pq_t = tpie::priority_queue; + pq_t pq; public: - priority_queue(size_t memory_bytes, size_t /*max_size*/) : pq(memory_bytes) + priority_queue(size_t memory_bytes, size_t /*max_size*/) + : pq(memory_bytes) {} - elem_t top() + value_type top() { return pq.top(); } void pop() { pq.pop(); } - void push(const elem_t &e) - { pq.push(e); } + void push(const value_type &v) + { pq.push(v); } size_t size() const { return pq.size(); } @@ -112,8 +118,8 @@ namespace adiar::internal /// \brief Type alias for sorter for partial type application of the /// 'external' memory type. ////////////////////////////////////////////////////////////////////////////// - template > - using external_priority_queue = priority_queue; + template > + using external_priority_queue = priority_queue; // LCOV_EXCL_STOP } diff --git a/src/adiar/internal/data_structures/sorter.h b/src/adiar/internal/data_structures/sorter.h index 4ec4d3641..3fb970060 100644 --- a/src/adiar/internal/data_structures/sorter.h +++ b/src/adiar/internal/data_structures/sorter.h @@ -15,19 +15,22 @@ namespace adiar::internal { - template > + template > class sorter; ////////////////////////////////////////////////////////////////////////////// /// \brief Wrapper for TPIE's internal vector with standard quick-sort. ////////////////////////////////////////////////////////////////////////////// - template - class sorter + template + class sorter { + public: + using value_type = value_t; + private: - using array_t = tpie::array; + using array_t = tpie::array; array_t _array; - pred_t _pred; + comp_t _pred; size_t _size; size_t _front_idx; @@ -48,24 +51,24 @@ namespace adiar::internal return ret; } - static constexpr size_t DATA_STRUCTURES = 1u; + static constexpr size_t data_structures = 1u; - static unique_ptr> + static unique_ptr> make_unique(size_t memory_bytes, size_t no_elements, size_t no_sorters = 1, - pred_t pred = pred_t()) + comp_t comp = comp_t()) { - return adiar::make_unique> - (memory_bytes, no_elements, no_sorters, pred); + return adiar::make_unique> + (memory_bytes, no_elements, no_sorters, comp); } static void - reset_unique(unique_ptr> &u_ptr, + reset_unique(unique_ptr> &u_ptr, size_t /*memory_bytes*/, size_t /*no_elements*/, size_t /*no_sorters*/ = 1, - pred_t /*pred*/ = pred_t()) + comp_t /*comp*/ = comp_t()) { u_ptr->reset(); } @@ -74,8 +77,8 @@ namespace adiar::internal sorter([[maybe_unused]] size_t memory_bytes, size_t no_elements, [[maybe_unused]] size_t no_sorters = 1, - pred_t pred = pred_t()) - : _array(no_elements), _pred(pred), _size(0), _front_idx(0) + comp_t comp = comp_t()) + : _array(no_elements), _pred(comp), _size(0), _front_idx(0) { adiar_assert(no_elements <= memory_fits(memory_bytes / no_sorters), "Must be instantiated with enough memory."); @@ -87,10 +90,10 @@ namespace adiar::internal return _front_idx == 0u && _array.size() > _size; } - void push(const elem_t& t) + void push(const value_type& v) { adiar_assert(can_push()); - _array[_size++] = t; + _array[_size++] = v; } void sort() @@ -105,13 +108,13 @@ namespace adiar::internal return _size != _front_idx; } - elem_t top() const + value_type top() const { adiar_assert(can_pull()); return _array[_front_idx]; } - elem_t pull() + value_type pull() { adiar_assert(can_pull()); return _array[_front_idx++]; @@ -138,8 +141,8 @@ namespace adiar::internal /// \brief Type alias for sorter for partial type application of the /// 'internal' memory type. ////////////////////////////////////////////////////////////////////////////// - template > - using internal_sorter = sorter; + template > + using internal_sorter = sorter; // LCOV_EXCL_START // TODO: Unit test external memory variants? @@ -151,45 +154,48 @@ namespace adiar::internal /// computations involved in deriving how much memory should be used and how /// it should be. ////////////////////////////////////////////////////////////////////////////// - template - class sorter + template + class sorter { + public: + using value_type = value_t; + private: - tpie::merge_sorter _sorter; + tpie::merge_sorter _sorter; - bool _has_peeked = false; - elem_t _peeked; + bool _has_peeked = false; + value_type _peeked; size_t _pulls = 0u; public: - static constexpr size_t DATA_STRUCTURES = 1u; + static constexpr size_t data_structures = 1u; - static unique_ptr> + static unique_ptr> make_unique(size_t memory_bytes, size_t no_elements, size_t no_sorters = 1, - pred_t pred = pred_t()) + comp_t comp = comp_t()) { - return adiar::make_unique> - (memory_bytes, no_elements, no_sorters, pred); + return adiar::make_unique> + (memory_bytes, no_elements, no_sorters, comp); } - static void reset_unique(unique_ptr> &u_ptr, + static void reset_unique(unique_ptr> &u_ptr, size_t memory_bytes, size_t no_elements, size_t no_sorters = 1, - pred_t pred = pred_t()) + comp_t comp = comp_t()) { - u_ptr = make_unique(memory_bytes, no_elements, no_sorters, pred); + u_ptr = make_unique(memory_bytes, no_elements, no_sorters, comp); } public: sorter(size_t memory_bytes, size_t no_elements, size_t number_of_sorters, - pred_t pred = pred_t()) - : _sorter(pred) + comp_t comp = comp_t()) + : _sorter(comp) { // ======================================================================= // Case 0: No sorters - why are we then instantiating one? @@ -199,7 +205,7 @@ namespace adiar::internal // necessary to sort these elements in internal memory. We don't need to // allocate more than a constant of this for the external memory case. const tpie::memory_size_type no_elements_memory = - 2 * sorter::memory_usage(no_elements); + 2 * sorter::memory_usage(no_elements); // ======================================================================= // Case 1: A single sorter. @@ -243,7 +249,7 @@ namespace adiar::internal // Phase 1 : Push Mergesort base cases // // Quickfix: Issue https://github.com/thomasmoelhave/tpie/issues/250 - constexpr tpie::memory_size_type minimum_phase1 = sizeof(elem_t) * 128 * 1024 + 5 * 1024 * 1024; + constexpr tpie::memory_size_type minimum_phase1 = sizeof(value_type) * 128 * 1024 + 5 * 1024 * 1024; // Take up at most 1/(Sorter-1)'th of 1/16th of the total memory. The last // sorter is either in the same phase or another phase. @@ -297,9 +303,9 @@ namespace adiar::internal bool can_push(); // TODO: Update TPIE merge sorter to access the current phase Enum. - void push(const elem_t& e) + void push(const value_type& v) { - _sorter.push(e); + _sorter.push(v); } void sort() @@ -315,7 +321,7 @@ namespace adiar::internal return _has_peeked || _sorter.can_pull(); } - elem_t top() + value_type top() { adiar_assert(can_pull()); if (!_has_peeked) { @@ -325,7 +331,7 @@ namespace adiar::internal return _peeked; } - elem_t pull() + value_type pull() { adiar_assert(can_pull()); _pulls++; @@ -353,8 +359,8 @@ namespace adiar::internal /// \brief Type alias for sorter for partial type application of the /// 'external' memory type. ////////////////////////////////////////////////////////////////////////////// - template > - using external_sorter = sorter; + template > + using external_sorter = sorter; // LCOV_EXCL_STOP } diff --git a/src/adiar/internal/data_types/arc.h b/src/adiar/internal/data_types/arc.h index b1ab6e85a..67118acbd 100644 --- a/src/adiar/internal/data_types/arc.h +++ b/src/adiar/internal/data_types/arc.h @@ -1,6 +1,7 @@ #ifndef ADIAR_INTERNAL_DATA_TYPES_ARC_H #define ADIAR_INTERNAL_DATA_TYPES_ARC_H +#include #include #include @@ -24,7 +25,7 @@ namespace adiar::internal /// \remark If `source` is flagged, then this is a high arc rather than a low /// arc. /// - /// \remark `source` may be NIL + /// \remark `source` may be nil ////////////////////////////////////////////////////////////////////////////// class arc { @@ -32,31 +33,31 @@ namespace adiar::internal //////////////////////////////////////////////////////////////////////////// /// \brief Type of the pointer of this arc's source and target. //////////////////////////////////////////////////////////////////////////// - using ptr_t = ptr_uint64; + using pointer_type = ptr_uint64; //////////////////////////////////////////////////////////////////////////// /// \brief Type of the a node's unique identifier. //////////////////////////////////////////////////////////////////////////// - using uid_t = __uid; + using uid_type = __uid; //////////////////////////////////////////////////////////////////////////// /// \brief Type of variable label. //////////////////////////////////////////////////////////////////////////// - using label_t = ptr_t::label_t; + using label_type = pointer_type::label_type; //////////////////////////////////////////////////////////////////////////// /// \brief Type of terminal values. //////////////////////////////////////////////////////////////////////////// - using value_t = ptr_t::value_t; + using terminal_type = pointer_type::terminal_type; private: - ptr_t _source; + pointer_type _source; // TODO (Attributed Edges): // Add logic related to flag on 'target'. // At that point, 'target()' should always return the unflagged value? - ptr_t _target; + pointer_type _target; public: // Provide 'default' constructors to ensure it being a 'POD' inside of TPIE. @@ -73,7 +74,7 @@ namespace adiar::internal /// \pre The flags on both `source` and `target` are already set correctly /// and the out-index on `source` is too. //////////////////////////////////////////////////////////////////////////// - arc(const ptr_t &source, const ptr_t &target) + arc(const pointer_type &source, const pointer_type &target) : _source(source), _target(target) { adiar_assert(!target.is_node() || target.out_idx() == 0u); @@ -84,9 +85,9 @@ namespace adiar::internal /// /// \pre The flags on `target` is already set correctly. //////////////////////////////////////////////////////////////////////////// - arc(const uid_t &source, - const ptr_t::out_idx_t &out_idx, - const ptr_t &target) + arc(const uid_type &source, + const pointer_type::out_idx_type &out_idx, + const pointer_type &target) : _source(source.with(out_idx)) , _target(target) { @@ -99,19 +100,19 @@ namespace adiar::internal /// \brief Obtain 'source' value (including flag and out-index). //////////////////////////////////////////////////////////////////////////// // TODO Always return the essential pointer? - ptr_t source() const + pointer_type source() const { return _source; } //////////////////////////////////////////////////////////////////////////// /// \brief Obtain 'target' value (including flag). //////////////////////////////////////////////////////////////////////////// // TODO Always return the essential pointer? - ptr_t target() const + pointer_type target() const { return _target; } /* ================================= FLAGS ============================== */ public: - ptr_t::out_idx_t out_idx() const + pointer_type::out_idx_type out_idx() const { return _source.out_idx(); } /* ============================== COMPARATORS =========================== */ diff --git a/src/adiar/internal/data_types/convert.h b/src/adiar/internal/data_types/convert.h index f13bf9404..d595458b8 100644 --- a/src/adiar/internal/data_types/convert.h +++ b/src/adiar/internal/data_types/convert.h @@ -1,6 +1,7 @@ #ifndef ADIAR_INTERNAL_DATA_TYPES_CONVERT_H #define ADIAR_INTERNAL_DATA_TYPES_CONVERT_H +#include #include #include diff --git a/src/adiar/internal/data_types/level_info.h b/src/adiar/internal/data_types/level_info.h index 89d66ff6a..ea61c2ee1 100644 --- a/src/adiar/internal/data_types/level_info.h +++ b/src/adiar/internal/data_types/level_info.h @@ -11,13 +11,13 @@ namespace adiar::internal class level_info { // TODO (Larger variable identifiers): - // template + // template public: - using level_t = ptr_uint64::label_t; + using level_type = ptr_uint64::label_type; /* ================================ VARIABLES =========================== */ private: - level_t _label; + level_type _label; size_t _width; /* ============================== CONSTRUCTORS ========================== */ @@ -31,7 +31,7 @@ namespace adiar::internal /// \brief Create a level_info for a variable and a certain width when using /// the identity variable ordering. //////////////////////////////////////////////////////////////////////////// - level_info(level_t label, size_t width) + level_info(level_type label, size_t width) : _label(label), _width(width) { } @@ -40,19 +40,19 @@ namespace adiar::internal //////////////////////////////////////////////////////////////////////////// /// \brief Obtain the label for a level. //////////////////////////////////////////////////////////////////////////// - level_t label() const + level_type label() const { return _label; } //////////////////////////////////////////////////////////////////////////// /// \brief Obtain the level. //////////////////////////////////////////////////////////////////////////// - level_t level() const + level_type level() const { return _label; } //////////////////////////////////////////////////////////////////////////// /// \brief Obtain the width (i.e. number of nodes) of this level. //////////////////////////////////////////////////////////////////////////// - level_t width() const + level_type width() const { return _width; } /* =============================== OPERATORS ============================ */ diff --git a/src/adiar/internal/data_types/node.h b/src/adiar/internal/data_types/node.h index 19e1dfbe0..ec3cb6d14 100644 --- a/src/adiar/internal/data_types/node.h +++ b/src/adiar/internal/data_types/node.h @@ -1,6 +1,7 @@ #ifndef ADIAR_INTERNAL_DATA_TYPES_NODE_H #define ADIAR_INTERNAL_DATA_TYPES_NODE_H +#include #include #include #include @@ -13,8 +14,8 @@ namespace adiar::internal /// \remark A node contains a unique identifier for said node in `uid` /// together with pointers to its children in `low` and `high`. /// - /// \remark If a node is a terminal, then `low` and `high` are NIL. Otherwise, - /// they are always \em not NIL. + /// \remark If a node is a terminal, then `low` and `high` are nil. Otherwise, + /// they are always \em not nil. ////////////////////////////////////////////////////////////////////////////// class node { @@ -31,57 +32,57 @@ namespace adiar::internal //////////////////////////////////////////////////////////////////////////// /// \brief Number of children of this node type. //////////////////////////////////////////////////////////////////////////// - static constexpr size_t OUTDEGREE = 2u; + static constexpr size_t outdegree = 2u; // TODO (ADD (64-bit)): - // template with 'uid_t' reexpose it (and its related 'ptr') with typedefs. + // template with 'uid_type' reexpose it (and its related 'ptr') with typedefs. //////////////////////////////////////////////////////////////////////////// /// \brief Type of the pointer of this node's children. //////////////////////////////////////////////////////////////////////////// - typedef ptr_uint64 ptr_t; + using pointer_type = ptr_uint64; //////////////////////////////////////////////////////////////////////////// /// \brief Type of this node's unique identifier. //////////////////////////////////////////////////////////////////////////// - typedef __uid uid_t; + using uid_type = __uid; //////////////////////////////////////////////////////////////////////////// /// \brief Type of terminal values. //////////////////////////////////////////////////////////////////////////// - typedef ptr_t::value_t value_t; + using terminal_type = pointer_type::terminal_type; //////////////////////////////////////////////////////////////////////////// /// \brief Type of this node's variable label. //////////////////////////////////////////////////////////////////////////// - typedef ptr_t::label_t label_t; + using label_type = pointer_type::label_type; ////////////////////////////////////////////////////////////////////////////// /// \brief The maximal possible value for a unique identifier's label. ////////////////////////////////////////////////////////////////////////////// - static constexpr label_t MAX_LABEL = ptr_t::MAX_LABEL; + static constexpr label_type max_label = pointer_type::max_label; //////////////////////////////////////////////////////////////////////////// /// \brief Type of this node's level identifier. //////////////////////////////////////////////////////////////////////////// - typedef ptr_t::id_t id_t; + using id_type = pointer_type::id_type; ////////////////////////////////////////////////////////////////////////////// /// \brief The maximal possible value for this nodes level identifier. ////////////////////////////////////////////////////////////////////////////// - static constexpr id_t MAX_ID = ptr_t::MAX_ID; + static constexpr id_type max_id = pointer_type::max_id; //////////////////////////////////////////////////////////////////////////// /// \brief Type of the children tuple. //////////////////////////////////////////////////////////////////////////// - typedef tuple children_t; + using children_type = tuple; private: // TODO (Attributed Edges): // Add logic related to flag on children. - uid_t _uid; - children_t _children; + uid_type _uid; + children_type _children; public: // Provide 'default' constructors to ensure it being a 'POD' inside of TPIE. @@ -93,7 +94,7 @@ namespace adiar::internal //////////////////////////////////////////////////////////////////////////// /// \brief The unique identifier of this node //////////////////////////////////////////////////////////////////////////// - inline uid_t uid() const + inline uid_type uid() const { return _uid; } /* ============================== TERMINAL NODE ========================= */ @@ -101,10 +102,10 @@ namespace adiar::internal // Provide 'non-default' constructors to make it easy to use outside of TPIE. //////////////////////////////////////////////////////////////////////////// - /// \brief Construct *terminal* node `(value, NIL, NIL)`. + /// \brief Construct *terminal* node `(value, nil, nil)`. //////////////////////////////////////////////////////////////////////////// - node(const value_t value) - : _uid(ptr_t(value)), _children(ptr_uint64::NIL()) + node(const terminal_type value) + : _uid(pointer_type(value)), _children(ptr_uint64::nil()) { } //////////////////////////////////////////////////////////////////////////// @@ -118,7 +119,7 @@ namespace adiar::internal /// /// \pre `is_terminal()` evaluates to `true`. //////////////////////////////////////////////////////////////////////////// - inline value_t value() const + inline terminal_type value() const { adiar_assert(is_terminal()); return _uid.value(); @@ -146,26 +147,26 @@ namespace adiar::internal // TODO (QMDD): // Add generic version of the two constructors below that takes a - // 'children_t' as argument. + // 'children_type' as argument. //////////////////////////////////////////////////////////////////////////// /// \brief Construct node `(uid, low, high)`. //////////////////////////////////////////////////////////////////////////// - node(const uid_t &u, const ptr_t &l, const ptr_t &h) + node(const uid_type &u, const pointer_type &l, const pointer_type &h) : _uid(u), _children{l, h} { } //////////////////////////////////////////////////////////////////////////// /// \brief Construct *internal* node `((label, id), low, high)`. //////////////////////////////////////////////////////////////////////////// - node(const label_t label, const id_t id, const ptr_t &l, const ptr_t &h) + node(const label_type label, const id_type id, const pointer_type &l, const pointer_type &h) : _uid(label, id), _children{l, h} { - adiar_assert(!l.is_nil(), "Cannot create a node with NIL child"); + adiar_assert(!l.is_nil(), "Cannot create a node with nil child"); adiar_assert(l.is_terminal() || label < l.label(), "Node is not prior to given low child"); - adiar_assert(!h.is_nil(), "Cannot create a node with NIL child"); + adiar_assert(!h.is_nil(), "Cannot create a node with nil child"); adiar_assert(h.is_terminal() || label < h.label(), "Node is not prior to given high child"); } @@ -173,28 +174,28 @@ namespace adiar::internal //////////////////////////////////////////////////////////////////////////// /// \brief Construct *internal* node `((label, id), low, high)`. //////////////////////////////////////////////////////////////////////////// - node(const label_t label, const id_t id, const node &l, const ptr_t &h) + node(const label_type label, const id_type id, const node &l, const pointer_type &h) : node(label, id, l.uid(), h) { - adiar_assert(OUTDEGREE == 2, "Constructor is for binary node only."); + adiar_assert(outdegree == 2, "Constructor is for binary node only."); } //////////////////////////////////////////////////////////////////////////// /// \brief Construct *internal* node `((label, id), low, high)`. //////////////////////////////////////////////////////////////////////////// - node(const label_t label, const id_t id, const ptr_t &l, const node &h) + node(const label_type label, const id_type id, const pointer_type &l, const node &h) : node(label, id, l, h.uid()) { - adiar_assert(OUTDEGREE == 2, "Constructor is for binary node only."); + adiar_assert(outdegree == 2, "Constructor is for binary node only."); } //////////////////////////////////////////////////////////////////////////// /// \brief Construct *internal* node `((label, id), low, high)`. //////////////////////////////////////////////////////////////////////////// - node(const label_t label, const id_t id, const node &l, const node &h) + node(const label_type label, const id_type id, const node &l, const node &h) : node(label, id, l.uid(), h.uid()) { - adiar_assert(OUTDEGREE == 2, "Constructor is for binary node only."); + adiar_assert(outdegree == 2, "Constructor is for binary node only."); } //////////////////////////////////////////////////////////////////////////// @@ -203,7 +204,7 @@ namespace adiar::internal /// \pre `is_terminal()` evaluates to `false`. //////////////////////////////////////////////////////////////////////////// // TODO: Rename to `level()` when introducing variable ordering - inline label_t label() const + inline label_type label() const { adiar_assert(!is_terminal()); return uid().label(); @@ -214,7 +215,7 @@ namespace adiar::internal /// /// \pre `is_terminal()` evaluates to `false`. //////////////////////////////////////////////////////////////////////////// - inline id_t id() const + inline id_type id() const { adiar_assert(!is_terminal()); return uid().id(); @@ -223,7 +224,7 @@ namespace adiar::internal //////////////////////////////////////////////////////////////////////////// /// \brief Whether a node is on a given level, i.e. has the given label. //////////////////////////////////////////////////////////////////////////// - inline bool on_level(const label_t level) const + inline bool on_level(const label_type level) const { return uid().on_level(level); } /* ================================= CHILDREN =========================== */ @@ -231,15 +232,15 @@ namespace adiar::internal //////////////////////////////////////////////////////////////////////////// /// \brief The node's children sorted based on the semantics of this node. //////////////////////////////////////////////////////////////////////////// - inline const children_t& children() const + inline const children_type& children() const { return _children; } //////////////////////////////////////////////////////////////////////////// /// \brief The node's i'th child (sorted based on the semantics). //////////////////////////////////////////////////////////////////////////// - inline ptr_t child(const size_t i) const + inline pointer_type child(const size_t i) const { - adiar_assert(i < OUTDEGREE, "'i' must be a valid children index."); + adiar_assert(i < outdegree, "'i' must be a valid children index."); return _children[i]; } @@ -251,9 +252,9 @@ namespace adiar::internal /// /// \see child //////////////////////////////////////////////////////////////////////////// - inline ptr_t low() const + inline pointer_type low() const { - adiar_assert(OUTDEGREE == 2, + adiar_assert(outdegree == 2, "Semantics of 'low' is only defined for binary nodes."); return child(false); @@ -267,9 +268,9 @@ namespace adiar::internal /// /// \see child //////////////////////////////////////////////////////////////////////////// - inline ptr_t high() const + inline pointer_type high() const { - adiar_assert(OUTDEGREE == 2, + adiar_assert(outdegree == 2, "Semantics of 'high' is only defined for binary node."); return child(true); @@ -312,14 +313,14 @@ namespace adiar::internal node operator~ () const { if (this->is_terminal()) { - return node(~this->_uid, ptr_t::NIL(), ptr_t::NIL()); + return node(~this->_uid, pointer_type::nil(), pointer_type::nil()); } - const ptr_t low = this->_children[0].is_terminal() + const pointer_type low = this->_children[0].is_terminal() ? ~this->_children[0] : this->_children[0]; - const ptr_t high = this->_children[1].is_terminal() + const pointer_type high = this->_children[1].is_terminal() ? ~this->_children[1] : this->_children[1]; @@ -336,49 +337,49 @@ namespace adiar::internal ////////////////////////////////////////////////////////////////////////////// /// \brief Ordering of node in comparison to a unique identifier. ////////////////////////////////////////////////////////////////////////////// - inline bool operator< (const node &n, const node::uid_t &u) + inline bool operator< (const node &n, const node::uid_type &u) { return n.uid() < u; } ////////////////////////////////////////////////////////////////////////////// /// \brief Ordering of node in comparison to a unique identifier. ////////////////////////////////////////////////////////////////////////////// - inline bool operator< (const node::uid_t &u, const node &n) + inline bool operator< (const node::uid_type &u, const node &n) { return u < n.uid(); } ////////////////////////////////////////////////////////////////////////////// /// \brief Ordering of node in comparison to a unique identifier. ////////////////////////////////////////////////////////////////////////////// - inline bool operator<= (const node &n, const node::uid_t &u) + inline bool operator<= (const node &n, const node::uid_type &u) { return n.uid() <= u; } ////////////////////////////////////////////////////////////////////////////// /// \brief Ordering of node in comparison to a unique identifier. ////////////////////////////////////////////////////////////////////////////// - inline bool operator<= (const node::uid_t &u, const node &n) + inline bool operator<= (const node::uid_type &u, const node &n) { return u <= n.uid(); } ////////////////////////////////////////////////////////////////////////////// /// \brief Ordering of node in comparison to a unique identifier. ////////////////////////////////////////////////////////////////////////////// - inline bool operator> (const node &n, const node::uid_t &u) + inline bool operator> (const node &n, const node::uid_type &u) { return n.uid() > u; } ////////////////////////////////////////////////////////////////////////////// /// \brief Ordering of node in comparison to a unique identifier. ////////////////////////////////////////////////////////////////////////////// - inline bool operator> (const node::uid_t &u, const node &n) + inline bool operator> (const node::uid_type &u, const node &n) { return u > n.uid(); } ////////////////////////////////////////////////////////////////////////////// /// \brief Ordering of node in comparison to a unique identifier. ////////////////////////////////////////////////////////////////////////////// - inline bool operator>= (const node &n, const node::uid_t &u) + inline bool operator>= (const node &n, const node::uid_type &u) { return n.uid() >= u; } ////////////////////////////////////////////////////////////////////////////// /// \brief Ordering of node in comparison to a unique identifier. ////////////////////////////////////////////////////////////////////////////// - inline bool operator>= (const node::uid_t &u, const node &n) + inline bool operator>= (const node::uid_type &u, const node &n) { return u >= n.uid(); } } diff --git a/src/adiar/internal/data_types/ptr.h b/src/adiar/internal/data_types/ptr.h index 370ae720a..3282aac76 100644 --- a/src/adiar/internal/data_types/ptr.h +++ b/src/adiar/internal/data_types/ptr.h @@ -17,7 +17,7 @@ namespace adiar::internal } // TODO (ADD (32-bit)): - // Template 'ptr_uint64' with 'value_t' of how to interpret the bits of a + // Template 'ptr_uint64' with 'terminal_t' of how to interpret the bits of a // terminal. To this end, one wants to use 'std::bit_cast' in the internal // logic. Use 'static_assert' to ensure the desired type indeed fits into // 62 bits of memory. @@ -25,32 +25,32 @@ namespace adiar::internal // TODO (ADD (64-bit)): // TODO (10+ TiB Decision Diagrams): // Create a new 'ptr_templ' class that does not compress all information - // into a single 64-bit unsigned integer. The 'label_t' and 'id_t' should be - // provided as template parameters and the 'MAX_ID' and 'MAX_LABEL' should + // into a single 64-bit unsigned integer. The 'label_type' and 'id_type' should be + // provided as template parameters and the 'max_id' and 'max_label' should // be derived based on 'std::numeric_limits::max()'. // - // For ADDs it should furthermore be templated with 'value_t'. + // For ADDs it should furthermore be templated with 'terminal_t'. // TODO (LDD): - // Extend 'ptr_t' to a 'weighted_ptr' with a templated `weight_t`. + // Extend 'pointer_type' to a 'weighted_ptr' with a templated `weight_t`. // TODO (QMDD): // Same as for LDD but with the weight specifically being complex values. - // Furthermore, template the `OUTDEGREE` to use an extra bit for the out + // Furthermore, template the `outdegree` to use an extra bit for the out // index. ////////////////////////////////////////////////////////////////////////////// /// \brief A (possibly flagged) unique identifier of a terminal, an internal - /// node, or nothing (`NIL`). + /// node, or nothing (`nil`). /// /// \remark The layout of a pointer is such, that unique identifiers precede - /// terminals which in turn precede NIL. The ordering on unique + /// terminals which in turn precede nil. The ordering on unique /// identifiers and terminals are lifted to pointers. /// /// \remark A pointer may be flagged. For an arc's source this marks the arc /// being a 'high' rather than a 'low' arc. /// - /// \sa uid_t + /// \see uid_type ////////////////////////////////////////////////////////////////////////////// class ptr_uint64 { @@ -68,7 +68,7 @@ namespace adiar::internal /// of the middle areas differ (see below). /// /// - `_` : The layout of these 62 bits change based on whether it - /// describes a terminal, an internal node, or NIL. + /// describes a terminal, an internal node, or nil. /// /// - `F` : A boolean flag. This is currently only used in arcs to identify /// high and low arcs (see below). @@ -85,12 +85,12 @@ namespace adiar::internal //////////////////////////////////////////////////////////////////////////// /// \brief Total number of bits. //////////////////////////////////////////////////////////////////////////// - static constexpr uint8_t TOTAL_BITS = sizeof(uint64_t)*8u; + static constexpr uint8_t total_bits = sizeof(uint64_t)*8u; // -------------------------------------------------- // befriend other functions that need access to 'raw' - template - friend void output_dot(const T& nodes, std::ostream &out); + template + friend void __print_dot(const dd_t&, std::ostream &); public: // Provide 'default' constructors to ensure it being a 'POD' inside of TPIE. @@ -102,7 +102,7 @@ namespace adiar::internal constexpr ptr_uint64(const uint64_t raw) : _raw(raw) { } - template + template friend class __uid; /* ============================= ATTRIBUTES ============================= */ @@ -114,17 +114,17 @@ namespace adiar::internal //////////////////////////////////////////////////////////////////////////// /// \brief Number of flags //////////////////////////////////////////////////////////////////////////// - static constexpr uint8_t FLAG_BITS = 1u; + static constexpr uint8_t flag_bits = 1u; //////////////////////////////////////////////////////////////////////////// /// \brief Generic bit-flag. //////////////////////////////////////////////////////////////////////////// - static constexpr uint64_t FLAG_MASK = 0x0000000000000001ull; + static constexpr uint64_t flag_mask = 0x0000000000000001ull; //////////////////////////////////////////////////////////////////////////// /// \brief Generic bit-flag. //////////////////////////////////////////////////////////////////////////// - static constexpr uint64_t FLAG_BIT = FLAG_MASK; + static constexpr uint64_t flag_bit = flag_mask; public: //////////////////////////////////////////////////////////////////////////// @@ -132,13 +132,13 @@ namespace adiar::internal //////////////////////////////////////////////////////////////////////////// inline bool is_flagged() const { - return _raw & ptr_uint64::FLAG_MASK; + return _raw & ptr_uint64::flag_mask; } - /* ================================= NIL ================================ */ + /* ================================= nil ================================ */ protected: - static constexpr uint64_t NIL_VAL = - std::numeric_limits::max() ^ FLAG_MASK; + static constexpr uint64_t nil_val = + std::numeric_limits::max() ^ flag_mask; public: //////////////////////////////////////////////////////////////////////////// @@ -149,18 +149,18 @@ namespace adiar::internal /// instead we provide a special value that works with this /// specific setup. /// - /// \remark A NIL value always comes after all other types of pointers. + /// \remark A nil value always comes after all other types of pointers. //////////////////////////////////////////////////////////////////////////// - static inline constexpr ptr_uint64 NIL() - { return ptr_uint64{ NIL_VAL }; } + static inline constexpr ptr_uint64 nil() + { return ptr_uint64{ nil_val }; } //////////////////////////////////////////////////////////////////////////// - /// \brief Whether a pointer is NIL. + /// \brief Whether a pointer is nil. //////////////////////////////////////////////////////////////////////////// inline bool is_nil() const { - // Check for flagged and unflagged NIL - return _raw >= NIL_VAL; + // Check for flagged and unflagged nil + return _raw >= nil_val; } /* ================================ NODES =============================== */ @@ -168,7 +168,7 @@ namespace adiar::internal //////////////////////////////////////////////////////////////////////////// /// \brief Type of the out-degree. //////////////////////////////////////////////////////////////////////////// - using out_idx_t = uint64_t; + using out_idx_type = uint64_t; public: //////////////////////////////////////////////////////////////////////////// @@ -180,43 +180,43 @@ namespace adiar::internal //////////////////////////////////////////////////////////////////////////// // TODO (QMDD): // Make into a template parameter - static constexpr size_t OUTDEGREE = 2u; + static constexpr size_t outdegree = 2u; public: //////////////////////////////////////////////////////////////////////////// /// \brief The maximal possible value for the out index. //////////////////////////////////////////////////////////////////////////// - static constexpr out_idx_t MAX_OUT_IDX = OUTDEGREE - 1; + static constexpr out_idx_type max_out_idx = outdegree - 1; public: //////////////////////////////////////////////////////////////////////////// /// \brief Number of bits used to store the out0index. //////////////////////////////////////////////////////////////////////////// - static constexpr uint8_t OUT_IDX_BITS = log2(MAX_OUT_IDX); + static constexpr uint8_t out_idx_bits = log2(max_out_idx); public: //////////////////////////////////////////////////////////////////////////// /// \brief Type able to hold the label of a variable. //////////////////////////////////////////////////////////////////////////// - typedef uint32_t label_t; + using label_type = uint32_t; private: //////////////////////////////////////////////////////////////////////////// /// \brief The number of bits for a label. //////////////////////////////////////////////////////////////////////////// - static constexpr uint8_t LABEL_BITS = 24u; + static constexpr uint8_t label_bits = 24u; public: //////////////////////////////////////////////////////////////////////////// /// \brief The maximal possible value for a unique identifier's label. //////////////////////////////////////////////////////////////////////////// - static constexpr label_t MAX_LABEL = (1ull << LABEL_BITS) - 1; + static constexpr label_type max_label = (1ull << label_bits) - 1; public: //////////////////////////////////////////////////////////////////////////// /// \brief Type of a level identifier. //////////////////////////////////////////////////////////////////////////// - using id_t = uint64_t; + using id_type = uint64_t; private: //////////////////////////////////////////////////////////////////////////// @@ -224,20 +224,23 @@ namespace adiar::internal /// /// \details Take up the remaining bits for the ID. This dictates the /// maximum width possible for a single level: a level cannot - /// exceed \$2^{ID_BITS} \cdot 3 \cdot 8\$ bytes. + /// exceed \$2^{id_bits} \cdot 3 \cdot 8\$ bytes. //////////////////////////////////////////////////////////////////////////// - static constexpr uint8_t ID_BITS = - TOTAL_BITS - 1u - LABEL_BITS - OUT_IDX_BITS - FLAG_BITS; + static constexpr uint8_t id_bits = + total_bits - 1u - label_bits - out_idx_bits - flag_bits; public: //////////////////////////////////////////////////////////////////////////// /// \brief The maximal possible value for a level identifier. //////////////////////////////////////////////////////////////////////////// - static constexpr id_t MAX_ID = (1ull << ID_BITS) - 1; + static constexpr id_type max_id = (1ull << id_bits) - 1; private: - friend ptr_uint64 essential(const ptr_uint64 &p); - friend ptr_uint64 with_out_idx(const ptr_uint64 &p, const out_idx_t out_idx); + friend ptr_uint64 + essential(const ptr_uint64 &p); + + friend ptr_uint64 + with_out_idx(const ptr_uint64 &p, const out_idx_type out_idx); //////////////////////////////////////////////////////////////////////////// /// When the is_node flag is true, then it is a pointer to a node, @@ -261,27 +264,32 @@ namespace adiar::internal /// their level-identifier, and finally by their . //////////////////////////////////////////////////////////////////////////// protected: - static uint64_t encode_label(const label_t label) + static uint64_t + encode_label(const label_type label) { - adiar_assert(label <= MAX_LABEL, "Cannot represent given label"); - return (uint64_t) label << (ID_BITS + OUT_IDX_BITS + FLAG_BITS); + adiar_assert(label <= max_label, "Cannot represent given label"); + return (uint64_t) label << (id_bits + out_idx_bits + flag_bits); } - static uint64_t encode_id(const id_t id) + static uint64_t + encode_id(const id_type id) { - adiar_assert(id <= MAX_ID, "Cannot represent given id"); - return (uint64_t) id << (OUT_IDX_BITS + FLAG_BITS); + adiar_assert(id <= max_id, "Cannot represent given id"); + return (uint64_t) id << (out_idx_bits + flag_bits); } - static uint64_t encode_out_idx(const out_idx_t out_idx) - { return (uint64_t) out_idx << (FLAG_BITS); } + static uint64_t + encode_out_idx(const out_idx_type out_idx) + { + return (uint64_t) out_idx << (flag_bits); + } public: //////////////////////////////////////////////////////////////////////////// /// \brief Constructor for a pointer to an internal node (label, id) with /// weight 0. //////////////////////////////////////////////////////////////////////////// - ptr_uint64(const label_t label, const id_t id) + ptr_uint64(const label_type label, const id_type id) : _raw(encode_label(label) | encode_id(id)) { } @@ -289,7 +297,7 @@ namespace adiar::internal /// \brief Constructor for a pointer to an internal node (label, id) with /// given weight. //////////////////////////////////////////////////////////////////////////// - ptr_uint64(const label_t label, const id_t id, const out_idx_t out_idx) + ptr_uint64(const label_type label, const id_type id, const out_idx_type out_idx) : _raw(encode_label(label) | encode_id(id) | encode_out_idx(out_idx)) { } @@ -297,9 +305,10 @@ namespace adiar::internal //////////////////////////////////////////////////////////////////////////// /// \brief Whether a pointer is for an internal node (label, id). //////////////////////////////////////////////////////////////////////////// - inline bool is_node() const + inline bool + is_node() const { - return _raw <= ~ptr_uint64::TERMINAL_BIT; + return _raw <= ~ptr_uint64::terminal_bit; } //////////////////////////////////////////////////////////////////////////// @@ -307,9 +316,10 @@ namespace adiar::internal /// /// \pre `is_node()` evaluates to `true.` //////////////////////////////////////////////////////////////////////////// - inline label_t label() const + inline label_type + label() const { - return _raw >> (ID_BITS + OUT_IDX_BITS + FLAG_BITS); + return _raw >> (id_bits + out_idx_bits + flag_bits); } //////////////////////////////////////////////////////////////////////////// @@ -317,9 +327,10 @@ namespace adiar::internal /// /// \pre `is_node()` evaluates to `true.` //////////////////////////////////////////////////////////////////////////// - inline id_t id() const + inline id_type + id() const { - return (_raw >> (OUT_IDX_BITS + FLAG_BITS)) & MAX_ID; + return (_raw >> (out_idx_bits + flag_bits)) & max_id; } //////////////////////////////////////////////////////////////////////////// @@ -329,9 +340,10 @@ namespace adiar::internal /// /// \sa arc //////////////////////////////////////////////////////////////////////////// - inline out_idx_t out_idx() const + inline out_idx_type + out_idx() const { - return (_raw >> FLAG_BITS) & MAX_OUT_IDX; + return (_raw >> flag_bits) & max_out_idx; } /* ============================== TERMINALS ============================= */ @@ -339,7 +351,7 @@ namespace adiar::internal //////////////////////////////////////////////////////////////////////////// /// \brief Type of terminal values. //////////////////////////////////////////////////////////////////////////// - typedef bool value_t; + using terminal_type = bool; public: friend inline ptr_uint64 negate(ptr_uint64 p); @@ -360,27 +372,28 @@ namespace adiar::internal //////////////////////////////////////////////////////////////////////////// /// \brief Terminal bit-flag. //////////////////////////////////////////////////////////////////////////// - static constexpr uint64_t TERMINAL_BIT = 0x8000000000000000ull; + static constexpr uint64_t terminal_bit = 0x8000000000000000ull; //////////////////////////////////////////////////////////////////////////// /// \brief Terminal bit-flag mask. //////////////////////////////////////////////////////////////////////////// - static constexpr uint64_t VALUE_MASK = 0x0000000000000002ull; + static constexpr uint64_t value_mask = 0x0000000000000002ull; public: //////////////////////////////////////////////////////////////////////////// /// \brief Constructor for a pointer to a terminal node (v). //////////////////////////////////////////////////////////////////////////// - ptr_uint64(const value_t v) : _raw(TERMINAL_BIT | (v << FLAG_BITS)) + ptr_uint64(const terminal_type v) : _raw(terminal_bit | (v << flag_bits)) { } public: //////////////////////////////////////////////////////////////////////////// /// \brief Whether this pointer points to a terminal node. //////////////////////////////////////////////////////////////////////////// - inline bool is_terminal() const + inline bool + is_terminal() const { - return !is_nil() && _raw >= ptr_uint64::TERMINAL_BIT; + return !is_nil() && _raw >= ptr_uint64::terminal_bit; } //////////////////////////////////////////////////////////////////////////// @@ -388,7 +401,8 @@ namespace adiar::internal /// /// \pre `is_terminal()` evaluates to `true`. //////////////////////////////////////////////////////////////////////////// - inline value_t value() const + inline terminal_type + value() const { adiar_assert(is_terminal()); @@ -396,13 +410,14 @@ namespace adiar::internal // Negate resulting value based on 'is_flagged()'? It might actually be // better to completely ditch the flag for terminals; this will // simplify quite a lot of the logic. - return (_raw & ~TERMINAL_BIT) >> FLAG_BITS; + return (_raw & ~terminal_bit) >> flag_bits; } //////////////////////////////////////////////////////////////////////////// /// \brief Whether this pointer points to the `false` terminal. //////////////////////////////////////////////////////////////////////////// - inline bool is_false() const + inline bool + is_false() const { return is_terminal() && !value(); } @@ -410,7 +425,8 @@ namespace adiar::internal //////////////////////////////////////////////////////////////////////////// /// \brief Whether this pointer points to the `true` terminal. //////////////////////////////////////////////////////////////////////////// - inline bool is_true() const + inline bool + is_true() const { return is_terminal() && value(); } @@ -418,7 +434,8 @@ namespace adiar::internal //////////////////////////////////////////////////////////////////////////// /// \brief Whether a pointer is for a node on a given level. //////////////////////////////////////////////////////////////////////////// - inline bool on_level(const label_t level) const + inline bool + on_level(const label_type level) const { return is_terminal() ? false : label() == level; } @@ -455,7 +472,7 @@ namespace adiar::internal ptr_uint64 operator~ () const { adiar_assert(this->is_terminal()); - return ptr_uint64(VALUE_MASK ^ _raw); + return ptr_uint64(value_mask ^ _raw); } ////////////////////////////////////////////////////////////////////////////// @@ -469,7 +486,7 @@ namespace adiar::internal adiar_assert(this->is_terminal()); adiar_assert(o.is_terminal()); - return ptr_uint64(TERMINAL_BIT | (this->_raw ^ o._raw)); + return ptr_uint64(terminal_bit | (this->_raw ^ o._raw)); } ////////////////////////////////////////////////////////////////////////////// @@ -508,7 +525,7 @@ namespace adiar::internal ////////////////////////////////////////////////////////////////////////////// inline ptr_uint64 flag(const ptr_uint64 &p) { - return p._raw | ptr_uint64::FLAG_BIT; + return p._raw | ptr_uint64::flag_bit; } ////////////////////////////////////////////////////////////////////////////// @@ -516,7 +533,7 @@ namespace adiar::internal ////////////////////////////////////////////////////////////////////////////// inline ptr_uint64 unflag(const ptr_uint64 &p) { - return p._raw & (~ptr_uint64::FLAG_MASK); + return p._raw & (~ptr_uint64::flag_mask); } ////////////////////////////////////////////////////////////////////////////// @@ -530,12 +547,12 @@ namespace adiar::internal const uint64_t _raw = p._raw; constexpr uint64_t main_mask = - ~((1ull << ptr_uint64::FLAG_BITS) - 1u); + ~((1ull << ptr_uint64::flag_bits) - 1u); constexpr uint64_t node_mask = - ~(((1ull << ptr_uint64::OUT_IDX_BITS) - 1u) << ptr_uint64::FLAG_BITS) & main_mask; + ~(((1ull << ptr_uint64::out_idx_bits) - 1u) << ptr_uint64::flag_bits) & main_mask; - return _raw > ptr_uint64::TERMINAL_BIT + return _raw > ptr_uint64::terminal_bit ? (_raw & main_mask) : (_raw & node_mask); } @@ -546,12 +563,12 @@ namespace adiar::internal /// \pre `p.is_node() == true` ////////////////////////////////////////////////////////////////////////////// inline ptr_uint64 with_out_idx(const ptr_uint64 &p, - const ptr_uint64::out_idx_t out_idx) + const ptr_uint64::out_idx_type out_idx) { adiar_assert(p.is_node()); constexpr uint64_t out_idx_mask = - ~(((1ull << ptr_uint64::OUT_IDX_BITS) - 1u) << ptr_uint64::FLAG_BITS); + ~(((1ull << ptr_uint64::out_idx_bits) - 1u) << ptr_uint64::flag_bits); return (p._raw & out_idx_mask) | ptr_uint64::encode_out_idx(out_idx); } diff --git a/src/adiar/internal/data_types/request.h b/src/adiar/internal/data_types/request.h index 1f9549d71..583360392 100644 --- a/src/adiar/internal/data_types/request.h +++ b/src/adiar/internal/data_types/request.h @@ -4,6 +4,7 @@ #include #include +#include #include #include @@ -62,15 +63,15 @@ namespace adiar::internal //////////////////////////////////////////////////////////////////////////// static constexpr bool sorted_target = cardinality == 1u || inputs == 1u; - typedef node::label_t label_t; - typedef node::ptr_t ptr_t; + using label_type = node::label_type; + using pointer_type = node::pointer_type; /* ========================== RECURSION TARGET ========================== */ public: //////////////////////////////////////////////////////////////////////////// /// \brief Type of the target tuple. //////////////////////////////////////////////////////////////////////////// - typedef tuple target_t; + using target_t = tuple; //////////////////////////////////////////////////////////////////////////// /// \brief Target node(s) of recursion request. @@ -80,7 +81,7 @@ namespace adiar::internal //////////////////////////////////////////////////////////////////////////// /// \brief The level at which this request should be resolved. //////////////////////////////////////////////////////////////////////////// - ptr_t::label_t level() const + pointer_type::label_type level() const { return target.first().label(); } /* ============================= NODE CARRY ============================= */ @@ -93,13 +94,13 @@ namespace adiar::internal //////////////////////////////////////////////////////////////////////////// /// \brief Type of the set of children carried to the last in `target`. //////////////////////////////////////////////////////////////////////////// - typedef node::children_t children_t; + using children_type = node::children_type; //////////////////////////////////////////////////////////////////////////// /// \brief The value to be inserted in empy slots in the `node_carry`. //////////////////////////////////////////////////////////////////////////// - static inline constexpr children_t NO_CHILDREN() - { return children_t(ptr_t::NIL()); } + static inline constexpr children_type NO_CHILDREN() + { return children_type(pointer_type::nil()); } //////////////////////////////////////////////////////////////////////////// /// \brief The number of nodes actually carried by this request. @@ -119,16 +120,16 @@ namespace adiar::internal uint8_t targets() const { if constexpr (sorted_target) { - // Since NIL is the greatest value, we can look for the first nil entry + // Since nil is the greatest value, we can look for the first nil entry // (if any). for (uint8_t i = 0u; i < cardinality; i++) { - if (target[i] == ptr_t::NIL()) { return i; } + if (target[i] == pointer_type::nil()) { return i; } } return cardinality; } else { // !sorted_target uint8_t sum = 0u; for (uint8_t i = 0u; i < cardinality; i++) { - if (target[i] != ptr_t::NIL()) { sum++; } + if (target[i] != pointer_type::nil()) { sum++; } } return sum; } @@ -154,7 +155,7 @@ namespace adiar::internal /// node carry. //////////////////////////////////////////////////////////////////////////// request(const target_t &t, - const std::array&/*nc*/) + const std::array&/*nc*/) : request(t) { } }; @@ -181,13 +182,13 @@ namespace adiar::internal //////////////////////////////////////////////////////////////////////////// /// \brief Set of nodes of prior visited nodes in `target`. /// - /// \details This is not implemented as a `std::array` because for `node_carry_size` being 0 we still spend 8 /// bytes on empty space. /// /// \sa NO_CHILDREN //////////////////////////////////////////////////////////////////////////// - std::array node_carry; + std::array node_carry; //////////////////////////////////////////////////////////////////////////// /// \brief The number of nodes actually carried within `node_carry`. @@ -198,9 +199,9 @@ namespace adiar::internal { uint8_t sum = 0u; for (uint8_t n_idx = 0u; n_idx < node_carry_size; n_idx++) { - if (node_carry[n_idx][0] == base::ptr_t::NIL()) { + if (node_carry[n_idx][0] == base::pointer_type::nil()) { adiar_assert(node_carry[n_idx] == base::NO_CHILDREN(), - "Either no entry is NIL or all of them are"); + "Either no entry is nil or all of them are"); break; } sum++; @@ -217,7 +218,7 @@ namespace adiar::internal bool empty_carry() const { if constexpr (node_carry_size == 0u) return true; - return node_carry[0][0] == base::ptr_t::NIL(); + return node_carry[0][0] == base::pointer_type::nil(); } /* ============================ CONSTRUCTORS ============================ */ @@ -230,7 +231,7 @@ namespace adiar::internal public: // Provide 'non-default' constructors to make it easy to use outside of TPIE. request(const typename base::target_t &t, - const std::array &nc) + const std::array &nc) : base(t), node_carry(nc) { } }; @@ -244,8 +245,8 @@ namespace adiar::internal { inline bool operator()(const request_t &a, const request_t &b) { - const typename request_t::label_t label_a = a.target.first().label(); - const typename request_t::label_t label_b = b.target.first().label(); + const typename request_t::label_type label_a = a.target.first().label(); + const typename request_t::label_type label_b = b.target.first().label(); if constexpr (request_t::cardinality == 2) { constexpr size_t o_idx = 1u - idx; @@ -295,7 +296,7 @@ namespace adiar::internal /// \sa request ////////////////////////////////////////////////////////////////////////////// template class request_data : public request @@ -308,12 +309,12 @@ namespace adiar::internal //////////////////////////////////////////////////////////////////////////// /// \brief Type of the extra data carried with this recursion request. //////////////////////////////////////////////////////////////////////////// - typedef data_type data_t; + using data_type = data_t; //////////////////////////////////////////////////////////////////////////// /// \brief Extra data related to this recursion request tuple. //////////////////////////////////////////////////////////////////////////// - data_t data; + data_type data; /* ============================ CONSTRUCTORS ============================ */ public: @@ -325,8 +326,8 @@ namespace adiar::internal public: // Provide 'non-default' constructors to make it easy to use outside of TPIE. request_data(const typename request_t::target_t &t, - const std::array &nc, - const data_t &d) + const std::array &nc, + const data_type &d) : request_t(t, nc), data(d) { } }; @@ -338,7 +339,7 @@ namespace adiar::internal { inline bool operator()(const request_t &a, const request_t &b) { - if (request_t::data_t::sort_on_tiebreak && a.target == b.target) { + if (request_t::data_type::sort_on_tiebreak && a.target == b.target) { return a.data < b.data; } return request_lt()(a, b); @@ -350,7 +351,7 @@ namespace adiar::internal { inline bool operator()(const request_t &a, const request_t &b) { - if (request_t::data_t::sort_on_tiebreak && a.target == b.target) { + if (request_t::data_type::sort_on_tiebreak && a.target == b.target) { return a.data < b.data; } return request_first_lt()(a, b); @@ -362,7 +363,7 @@ namespace adiar::internal { inline bool operator()(const request_t &a, const request_t &b) { - if (request_t::data_t::sort_on_tiebreak && a.target == b.target) { + if (request_t::data_type::sort_on_tiebreak && a.target == b.target) { return a.data < b.data; } return request_second_lt()(a, b); @@ -374,7 +375,7 @@ namespace adiar::internal { inline bool operator()(const request_t &a, const request_t &b) { - if (request_t::data_t::sort_on_tiebreak && a.target == b.target) { + if (request_t::data_type::sort_on_tiebreak && a.target == b.target) { return a.data < b.data; } return request_third_lt()(a, b); @@ -394,7 +395,7 @@ namespace adiar::internal #endif //////////////////////////////////////////////////////////////////////////// - node::ptr_t source; + node::pointer_type source; //////////////////////////////////////////////////////////////////////////// inline bool operator< (const with_parent &o) const diff --git a/src/adiar/internal/data_types/tuple.h b/src/adiar/internal/data_types/tuple.h index 983597ac1..1ddf9332a 100644 --- a/src/adiar/internal/data_types/tuple.h +++ b/src/adiar/internal/data_types/tuple.h @@ -3,6 +3,7 @@ #include +#include #include namespace adiar::internal @@ -17,50 +18,59 @@ namespace adiar::internal ////////////////////////////////////////////////////////////////////////////// // Ordered access to two elements. - template - inline const elem_t& first(const elem_t &t1, const elem_t &t2) + template + inline const value_type& + first(const value_type &t1, const value_type &t2) { return std::min(t1, t2); } - template - inline const elem_t& second(const elem_t &t1, const elem_t &t2) + template + inline const value_type& + second(const value_type &t1, const value_type &t2) { return std::max(t1, t2); } ////////////////////////////////////////////////////////////////////////////// // Ordered access to three elements. - template - inline const elem_t& first(const elem_t &t1, const elem_t &t2, const elem_t &t3) + template + inline const value_type& + first(const value_type &t1, const value_type &t2, const value_type &t3) { return std::min(t1, std::min(t2, t3)); } - template - inline const elem_t& second(const elem_t &t1, const elem_t &t2, const elem_t &t3) + template + inline const value_type& + second(const value_type &t1, const value_type &t2, const value_type &t3) { return std::max(std::min(t1, t2), std::min(std::max(t1,t2),t3)); } - template - inline const elem_t& third(const elem_t &t1, const elem_t &t2, const elem_t &t3) + template + inline const value_type& + third(const value_type &t1, const value_type &t2, const value_type &t3) { return std::max(t1, std::max(t2, t3)); } ////////////////////////////////////////////////////////////////////////////// // Ordered access to four elements. - template - inline const elem_t& first(const elem_t &t1, const elem_t &t2, const elem_t &t3, const elem_t &t4) + template + inline const value_type& + first(const value_type &t1, const value_type &t2, const value_type &t3, const value_type &t4) { return std::min(std::min(t1, t2), std::min(t3, t4)); } - template - inline const elem_t& second(const elem_t &t1, const elem_t &t2, const elem_t &t3, const elem_t &t4) + template + inline const value_type& + second(const value_type &t1, const value_type &t2, const value_type &t3, const value_type &t4) { return std::min(std::min(std::max(t1,t2), std::max(t3,t4)), std::max(std::min(t1,t2), std::min(t3,t4))); } - template - inline const elem_t& third(const elem_t &t1, const elem_t &t2, const elem_t &t3, const elem_t &t4) + template + inline const value_type& + third(const value_type &t1, const value_type &t2, const value_type &t3, const value_type &t4) { return std::max(std::min(std::max(t1,t2), std::max(t3,t4)), std::max(std::min(t1,t2), std::min(t3,t4))); } - template - inline const elem_t& fourth(const elem_t &t1, const elem_t &t2, const elem_t &t3, const elem_t &t4) + template + inline const value_type& + fourth(const value_type &t1, const value_type &t2, const value_type &t3, const value_type &t4) { return std::max(std::max(t1, t2), std::max(t3, t4)); } ////////////////////////////////////////////////////////////////////////////// @@ -70,7 +80,7 @@ namespace adiar::internal ////////////////////////////////////////////////////////////////////////////// /// \brief Tuple holding elements and providing an ordered access. /// - /// \tparam elem_type The type of elements within the tuple. This part + /// \tparam value_t The type of elements within the tuple. This part /// should have a partial ordering '<'. /// /// \tparam cardinality The number of elements in the tuple @@ -79,7 +89,7 @@ namespace adiar::internal /// \tparam is_sorted Whether elements are given in sorted order /// (default: `false`). ////////////////////////////////////////////////////////////////////////////// - template + template class tuple { /* ============================== CONSTANTS ============================= */ @@ -87,7 +97,7 @@ namespace adiar::internal //////////////////////////////////////////////////////////////////////////// /// \brief Type of the elements in the tuple. //////////////////////////////////////////////////////////////////////////// - using elem_t = elem_type; + using value_type = value_t; //////////////////////////////////////////////////////////////////////////// /// \brief Number of elements stored in the tuple. @@ -104,23 +114,23 @@ namespace adiar::internal /* ============================== ELEMENTS ============================== */ private: - std::array _elems; + std::array _values; /* ============================ DIRECT ACCESS =========================== */ public: //////////////////////////////////////////////////////////////////////////// /// \brief Direct access to tuple elements in the order they were given. //////////////////////////////////////////////////////////////////////////// - inline const elem_t& at(const size_t idx) const + inline const value_type& at(const size_t idx) const { adiar_assert(idx < cardinality, "Tuple index must be within its cardinality."); - return _elems[idx]; + return _values[idx]; } //////////////////////////////////////////////////////////////////////////// /// \brief Direct access to tuple elements in the order they were given. //////////////////////////////////////////////////////////////////////////// - inline const elem_t& operator [] (const size_t idx) const + inline const value_type& operator [] (const size_t idx) const { return this->at(idx); } @@ -128,9 +138,9 @@ namespace adiar::internal //////////////////////////////////////////////////////////////////////////// /// \brief direct (read-only) access to the underlying array. //////////////////////////////////////////////////////////////////////////// - inline const std::array& data() const + inline const std::array& data() const { - return this->_elems; + return this->_values; } /* =========================== ORDERED ACCESS =========================== */ @@ -138,7 +148,7 @@ namespace adiar::internal //////////////////////////////////////////////////////////////////////////// /// \brief Access to the first element wrt. the elements ordering. //////////////////////////////////////////////////////////////////////////// - inline const elem_t& first() const + inline const value_type& first() const { static_assert(1 <= cardinality, "Must at least be a 1-ary tuple to retrieve the first element."); @@ -146,18 +156,18 @@ namespace adiar::internal if constexpr (is_sorted) { return this->at(0); } else if constexpr (cardinality == 2) { - return adiar::internal::first(_elems[0], _elems[1]); + return adiar::internal::first(_values[0], _values[1]); } else if constexpr (cardinality == 3) { - return adiar::internal::first(_elems[0], _elems[1], _elems[2]); + return adiar::internal::first(_values[0], _values[1], _values[2]); } else if constexpr (cardinality == 4) { - return adiar::internal::first(_elems[0], _elems[1], _elems[2], _elems[3]); + return adiar::internal::first(_values[0], _values[1], _values[2], _values[3]); } } //////////////////////////////////////////////////////////////////////////// /// \brief Access to the second element wrt. the elements ordering. //////////////////////////////////////////////////////////////////////////// - inline const elem_t& second() const + inline const value_type& second() const { static_assert(2 <= cardinality, "Must at least be a 2-ary tuple to retrieve the second element."); @@ -165,18 +175,18 @@ namespace adiar::internal if constexpr (is_sorted) { return this->at(1); } else if constexpr (cardinality == 2) { - return adiar::internal::second(_elems[0], _elems[1]); + return adiar::internal::second(_values[0], _values[1]); } else if constexpr (cardinality == 3) { - return adiar::internal::second(_elems[0], _elems[1], _elems[2]); + return adiar::internal::second(_values[0], _values[1], _values[2]); } else if constexpr (cardinality == 4) { - return adiar::internal::second(_elems[0], _elems[1], _elems[2], _elems[3]); + return adiar::internal::second(_values[0], _values[1], _values[2], _values[3]); } } //////////////////////////////////////////////////////////////////////////// /// \brief Access to the second element wrt. the elements ordering. //////////////////////////////////////////////////////////////////////////// - inline const elem_t& third() const + inline const value_type& third() const { static_assert(3 <= cardinality, "Must at least be a 3-ary tuple to retrieve the third element."); @@ -184,16 +194,16 @@ namespace adiar::internal if constexpr (is_sorted) { return this->at(2); } else if constexpr (cardinality == 3) { - return adiar::internal::third(_elems[0], _elems[1], _elems[2]); + return adiar::internal::third(_values[0], _values[1], _values[2]); } else if constexpr (cardinality == 4) { - return adiar::internal::third(_elems[0], _elems[1], _elems[2], _elems[3]); + return adiar::internal::third(_values[0], _values[1], _values[2], _values[3]); } } //////////////////////////////////////////////////////////////////////////// /// \brief Access to the second element wrt. the elements ordering. //////////////////////////////////////////////////////////////////////////// - inline const elem_t& fourth() const + inline const value_type& fourth() const { static_assert(3 <= cardinality, "Must at least be a 4-ary tuple to retrieve the fourth element."); @@ -201,7 +211,7 @@ namespace adiar::internal if constexpr (is_sorted) { return this->at(3); } else if constexpr (cardinality == 4) { - return adiar::internal::fourth(_elems[0], _elems[1], _elems[2], _elems[3]); + return adiar::internal::fourth(_values[0], _values[1], _values[2], _values[3]); } } @@ -218,20 +228,20 @@ namespace adiar::internal //////////////////////////////////////////////////////////////////////////// /// \brief Initialize a tuple with all elements being the given one. //////////////////////////////////////////////////////////////////////////// - tuple(const elem_t &elem) - : _elems{elem} + tuple(const value_type &elem) + : _values{elem} { // TODO: replace with a (templated) default value (?) - if constexpr (2 <= CARDINALITY) _elems[1] = elem; - if constexpr (3 <= CARDINALITY) _elems[2] = elem; - if constexpr (4 <= CARDINALITY) _elems[3] = elem; + if constexpr (2 <= cardinality) _values[1] = elem; + if constexpr (3 <= cardinality) _values[2] = elem; + if constexpr (4 <= cardinality) _values[3] = elem; } //////////////////////////////////////////////////////////////////////////// /// \brief Create a 2-ary tuple with the two given elements. //////////////////////////////////////////////////////////////////////////// - tuple(const elem_t &elem1, const elem_t &elem2) - : _elems{elem1,elem2} + tuple(const value_type &elem1, const value_type &elem2) + : _values{elem1,elem2} { static_assert(cardinality == 2, "Constructor is only designed for 2-ary tuples."); @@ -244,8 +254,8 @@ namespace adiar::internal //////////////////////////////////////////////////////////////////////////// /// \brief Create a 3-ary tuple with the three given elements. //////////////////////////////////////////////////////////////////////////// - tuple(const elem_t &elem1, const elem_t &elem2, const elem_t &elem3) - : _elems{elem1,elem2,elem3} + tuple(const value_type &elem1, const value_type &elem2, const value_type &elem3) + : _values{elem1,elem2,elem3} { static_assert(cardinality == 3, "Constructor is only designed for 3-ary tuples."); @@ -259,11 +269,11 @@ namespace adiar::internal //////////////////////////////////////////////////////////////////////////// /// \brief Create a 4-ary tuple with the four given elements. //////////////////////////////////////////////////////////////////////////// - tuple(const elem_t &elem1, - const elem_t &elem2, - const elem_t &elem3, - const elem_t &elem4) - : _elems{elem1,elem2,elem3,elem4} + tuple(const value_type &elem1, + const value_type &elem2, + const value_type &elem3, + const value_type &elem4) + : _values{elem1,elem2,elem3,elem4} { static_assert(cardinality == 4, "Constructor is only designed for 4-ary tuples."); @@ -278,8 +288,8 @@ namespace adiar::internal //////////////////////////////////////////////////////////////////////////// /// \brief Create a tuple from a `std::array` of the same cardinality. //////////////////////////////////////////////////////////////////////////// - tuple(const std::array &elems) - : _elems(elems) + tuple(const std::array &elems) + : _values(elems) { if constexpr (is_sorted) { for (size_t i = 0; i < (cardinality-1); ++i) { @@ -297,8 +307,8 @@ namespace adiar::internal { // TODO: manual loop unrolling? for (size_t i = 0; i < cardinality; i++) { - if (this->_elems[i] < o._elems[i]) { return true; }; - if (this->_elems[i] > o._elems[i]) { return false; }; + if (this->_values[i] < o._values[i]) { return true; }; + if (this->_values[i] > o._values[i]) { return false; }; } return false; } @@ -316,7 +326,7 @@ namespace adiar::internal { // TODO: manual loop unrolling? for (size_t i = 0; i < cardinality; i++) { - if (this->_elems[i] != o._elems[i]) { return false; }; + if (this->_values[i] != o._values[i]) { return false; }; } return true; } diff --git a/src/adiar/internal/data_types/uid.h b/src/adiar/internal/data_types/uid.h index 37b3bc6e2..7f95a76da 100644 --- a/src/adiar/internal/data_types/uid.h +++ b/src/adiar/internal/data_types/uid.h @@ -12,32 +12,32 @@ namespace adiar::internal /// \brief A unique identifier a decision diagram node. /// /// \details This essentially is a *ptr* guaranteed to point to a node, i.e. - /// it is \em never NIL, and without any associated information, + /// it is \em never nil, and without any associated information, /// e.g. \em without a flag. ////////////////////////////////////////////////////////////////////////////// template class __uid : public ptr_type { public: - typedef ptr_type ptr_t; + using pointer_type = ptr_type; public: // Provide 'default' constructors to ensure it being a 'POD' inside of TPIE. __uid() = default; - __uid(const __uid &p) = default; + __uid(const __uid &p) = default; ~__uid() = default; private: - static ptr_t clean_ptr(const ptr_t &p) + static pointer_type clean_ptr(const pointer_type &p) { - return p.is_node() ? ptr_t(p.label(), p.id()) : unflag(p); + return p.is_node() ? pointer_type(p.label(), p.id()) : unflag(p); } public: //////////////////////////////////////////////////////////////////////////// /// \brief Constructor for a uid of an internal node (label, id). //////////////////////////////////////////////////////////////////////////// - __uid(const ptr_t &p) : ptr_t(essential(p)) + __uid(const pointer_type &p) : pointer_type(essential(p)) { adiar_assert(!p.is_nil(), "UID must be created from non-nil value"); } @@ -47,33 +47,35 @@ namespace adiar::internal bool is_flagged() = delete; - /* ================================= NIL ================================ */ - // Remove anything related to NIL + /* ================================= nil ================================ */ + // Remove anything related to nil - static inline constexpr ptr_t NIL() = delete; + static inline constexpr pointer_type nil() = delete; bool is_nil() = delete; /* ================================ NODES =============================== */ // Remove anything related to out-index - typename ptr_t::out_idx_t out_idx() = delete; + typename pointer_type::out_idx_type out_idx() = delete; //////////////////////////////////////////////////////////////////////////// /// \brief Obtain the `ptr` for this node uid with the given `out_idx`. //////////////////////////////////////////////////////////////////////////// - inline ptr_t with(const typename ptr_t::out_idx_t out_idx) const + inline pointer_type + with(const typename pointer_type::out_idx_type out_idx) const { - adiar_assert(ptr_t::is_node()); - return ptr_t(ptr_t::label(), ptr_t::id(), out_idx); + adiar_assert(pointer_type::is_node()); + return pointer_type(pointer_type::label(), pointer_type::id(), out_idx); } public: //////////////////////////////////////////////////////////////////////////// /// \brief Constructor for a pointer to an internal node (label, id). //////////////////////////////////////////////////////////////////////////// - __uid(const typename ptr_t::label_t label, const typename ptr_t::id_t id) - : ptr_t(label, id) + __uid(const typename pointer_type::label_type label, + const typename pointer_type::id_type id) + : pointer_type(label, id) { } /* ============================== TERMINALS ============================= */ @@ -81,8 +83,8 @@ namespace adiar::internal //////////////////////////////////////////////////////////////////////////// /// \brief Constructor for a uid of a terminal node (v). //////////////////////////////////////////////////////////////////////////// - __uid(typename ptr_t::value_t v) - : ptr_t(v) + __uid(typename pointer_type::terminal_type v) + : pointer_type(v) { } public: @@ -90,7 +92,7 @@ namespace adiar::internal /// \brief Whether this uid identifies a terminal node. //////////////////////////////////////////////////////////////////////////// inline bool is_terminal() const - { return ptr_t::is_terminal(); } + { return pointer_type::is_terminal(); } }; ////////////////////////////////////////////////////////////////////////////// @@ -98,11 +100,11 @@ namespace adiar::internal template<> inline ptr_uint64 - __uid::with(const ptr_uint64::out_idx_t out_idx) const + __uid::with(const ptr_uint64::out_idx_type out_idx) const { // Based on the bit-layout, we can do this much faster than the one above. - constexpr uint64_t out_idx_mask = ~(MAX_OUT_IDX << ptr_t::FLAG_BITS); - return ptr_uint64((_raw & out_idx_mask) | ptr_t::encode_out_idx(out_idx)); + constexpr uint64_t out_idx_mask = ~(max_out_idx << pointer_type::flag_bits); + return ptr_uint64((_raw & out_idx_mask) | pointer_type::encode_out_idx(out_idx)); } template<> @@ -111,7 +113,7 @@ namespace adiar::internal { // Since uid never is nil, then this is a slightly a faster logic than the // one in 'ptr' itself. - return _raw >= ptr_t::TERMINAL_BIT; + return _raw >= pointer_type::terminal_bit; } using uid_uint64 = __uid; diff --git a/src/adiar/internal/dd.h b/src/adiar/internal/dd.h index 1feb3cbc9..6ba620f47 100644 --- a/src/adiar/internal/dd.h +++ b/src/adiar/internal/dd.h @@ -1,15 +1,14 @@ #ifndef ADIAR_INTERNAL_DD_H #define ADIAR_INTERNAL_DD_H +#include + #include #include #include -#include #include #include -#include - namespace adiar::internal { // TODO (MDD): @@ -24,7 +23,7 @@ namespace adiar::internal /// A std::variant is used to distinguish the type of file. This uses /// std::monostate to hold a 'nothing' value, i.e. when there is no file. ////////////////////////////////////////////////////////////////////////////// - typedef std::monostate no_file; + using no_file = std::monostate; ////////////////////////////////////////////////////////////////////////////// /// \warning You should never explicitly be dealing with this class or have it @@ -48,27 +47,27 @@ namespace adiar::internal //////////////////////////////////////////////////////////////////////////// /// \brief Type of nodes of this diagram. //////////////////////////////////////////////////////////////////////////// - using node_t = node; + using node_type = node; //////////////////////////////////////////////////////////////////////////// /// \brief Type of the file object node-based representation of a diagram. //////////////////////////////////////////////////////////////////////////// - using shared_nodes_t = shared_levelized_file; + using shared_node_file_type = shared_levelized_file; //////////////////////////////////////////////////////////////////////////// /// \brief Type of nodes of this diagram. //////////////////////////////////////////////////////////////////////////// - using arc_t = arc; + using arc_type = arc; //////////////////////////////////////////////////////////////////////////// /// \brief Type of the file object arc-based representation of a diagram. //////////////////////////////////////////////////////////////////////////// - using shared_arcs_t = shared_levelized_file; + using shared_arc_file_type = shared_levelized_file; //////////////////////////////////////////////////////////////////////////// // Union of levelized node or arc files to reflect the possible return types // of a function and a 'no_file' for 'error'. - std::variant + std::variant _union; //////////////////////////////////////////////////////////////////////////// @@ -80,17 +79,19 @@ namespace adiar::internal __dd() { } - __dd(const shared_nodes_t &f) : _union(f) + __dd(const shared_node_file_type &f) + : _union(f) { } - __dd(const shared_arcs_t &f) : _union(f) + __dd(const shared_arc_file_type &f) + : _union(f) { } __dd(const dd &dd); //////////////////////////////////////////////////////////////////////////// // Accessors - // TODO: change from 'file_t' to 'elem_t'. + // TODO: change from 'file_t' to 'file::value_type'. template bool has() const { @@ -116,11 +117,12 @@ namespace adiar::internal //////////////////////////////////////////////////////////////////////////// size_t size() const { - if (has()) { - return get()->size() / 2u; + if (has()) { + // TODO (QMDD): Divide by node::outdegree instead of 2u + return get()->size() / 2u; } - if (has()) { - return get()->size(); + if (has()) { + return get()->size(); } return 0u; } @@ -131,16 +133,16 @@ namespace adiar::internal /// /// \param ct The type of the cut to obtain //////////////////////////////////////////////////////////////////////////// - cut_size_t max_1level_cut(const cut_type ct) const + cut::size_type max_1level_cut(const cut ct) const { - if (has()) { - const shared_arcs_t &af = get(); + if (has()) { + const shared_arc_file_type &af = get(); return af->max_1level_cut - + (includes_terminal(ct, false) ? af->number_of_terminals[false] : 0u) - + (includes_terminal(ct, true) ? af->number_of_terminals[true] : 0u); + + (ct.includes(false) ? af->number_of_terminals[false] : 0u) + + (ct.includes(true) ? af->number_of_terminals[true] : 0u); } - if (has()) { - return get()->max_1level_cut[ct]; + if (has()) { + return get()->max_1level_cut[ct]; } return 0u; } @@ -151,19 +153,19 @@ namespace adiar::internal /// /// \param ct The type of the cut to obtain //////////////////////////////////////////////////////////////////////////// - cut_size_t max_2level_cut(const cut_type ct) const + cut::size_type max_2level_cut(const cut ct) const { - if (has()) { - const shared_arcs_t &af = get(); + if (has()) { + const shared_arc_file_type &af = get(); return std::min(// 3/2 times the 1-level cut (3 * af->max_1level_cut) / 2 - + (includes_terminal(ct, false) ? af->number_of_terminals[false] : 0u) - + (includes_terminal(ct, true) ? af->number_of_terminals[true] : 0u), + + (ct.includes(false) ? af->number_of_terminals[false] : 0u) + + (ct.includes(true) ? af->number_of_terminals[true] : 0u), // At most the number of nodes + 1 (af->size() / 2u) + 1); } - if (has()) { - return get()->max_2level_cut[ct]; + if (has()) { + return get()->max_2level_cut[ct]; } return 0u; } @@ -173,11 +175,11 @@ namespace adiar::internal //////////////////////////////////////////////////////////////////////////// size_t number_of_terminals(const bool value) const { - if (has()) { - return get()->number_of_terminals[negate ^ value]; + if (has()) { + return get()->number_of_terminals[negate ^ value]; } - if (has()) { - return get()->number_of_terminals[negate ^ value]; + if (has()) { + return get()->number_of_terminals[negate ^ value]; } return 0u; } @@ -187,12 +189,12 @@ namespace adiar::internal //////////////////////////////////////////////////////////////////////////// size_t number_of_terminals() const { - if (has()) { - const shared_arcs_t &af = get(); + if (has()) { + const shared_arc_file_type &af = get(); return af->number_of_terminals[false] + af->number_of_terminals[true]; } - if (has()) { - const shared_nodes_t &nf = get(); + if (has()) { + const shared_node_file_type &nf = get(); return nf->number_of_terminals[false] + nf->number_of_terminals[true]; } return 0u; @@ -214,42 +216,47 @@ namespace adiar::internal //////////////////////////////////////////////////////////////////////////// /// \brief Type of nodes of this diagram. //////////////////////////////////////////////////////////////////////////// - using node_t = node; + using node_type = node; //////////////////////////////////////////////////////////////////////////// /// \brief Type of pointers of this diagram. //////////////////////////////////////////////////////////////////////////// - using ptr_t = node_t::ptr_t; + using pointer_type = node_type::pointer_type; //////////////////////////////////////////////////////////////////////////// /// \brief Type of this node's variable label. //////////////////////////////////////////////////////////////////////////// - using label_t = node_t::label_t; + using label_type = node_type::label_type; ////////////////////////////////////////////////////////////////////////////// /// \brief The maximal possible value for a unique identifier's label. ////////////////////////////////////////////////////////////////////////////// - static constexpr label_t MAX_LABEL = node_t::MAX_LABEL; + static constexpr label_type max_label = node_type::max_label; //////////////////////////////////////////////////////////////////////////// /// \brief Type of this node's level identifier. //////////////////////////////////////////////////////////////////////////// - using id_t = node_t::id_t; + using id_type = node_type::id_type; ////////////////////////////////////////////////////////////////////////////// /// \brief The maximal possible value for this nodes level identifier. ////////////////////////////////////////////////////////////////////////////// - static constexpr id_t MAX_ID = node_t::MAX_ID; + static constexpr id_type max_id = node_type::max_id; + + //////////////////////////////////////////////////////////////////////////// + /// \brief Type of a terminal value. + //////////////////////////////////////////////////////////////////////////// + using terminal_type = typename node_type::terminal_type; //////////////////////////////////////////////////////////////////////////// /// \brief File type for the file object representing the diagram. //////////////////////////////////////////////////////////////////////////// - using nodes_t = levelized_file; + using node_file_type = levelized_file; //////////////////////////////////////////////////////////////////////////// /// \brief File type for the shared file object representing the diagram. //////////////////////////////////////////////////////////////////////////// - using shared_nodes_t = shared_file_ptr; + using shared_node_file_type = shared_file_ptr; //////////////////////////////////////////////////////////////////////////// // Internal state @@ -257,7 +264,7 @@ namespace adiar::internal //////////////////////////////////////////////////////////////////////////// /// \brief The file describing the actual DAG of the decision diagram. //////////////////////////////////////////////////////////////////////////// - shared_nodes_t file; + shared_node_file_type file; //////////////////////////////////////////////////////////////////////////// /// \brief Release the claim on the underlying file, thereby decreasing its @@ -278,14 +285,37 @@ namespace adiar::internal //////////////////////////////////////////////////////////////////////////// // Constructors public: - dd(const shared_nodes_t &f, bool negate = false) + //////////////////////////////////////////////////////////////////////////// + /// \brief Constructor to wrap the node-based result of an algorithm. + //////////////////////////////////////////////////////////////////////////// + dd(const shared_node_file_type &f, bool negate = false) : file(f), negate(negate) { } + //////////////////////////////////////////////////////////////////////////// + /// \brief Copy construction, incrementing the reference count on the file + /// underneath. + //////////////////////////////////////////////////////////////////////////// dd(const dd &dd) : file(dd.file), negate(dd.negate) { } + //////////////////////////////////////////////////////////////////////////// + /// \brief Move construction, taking over ownership of the files underneath. + //////////////////////////////////////////////////////////////////////////// + dd(dd &&dd) + : file(std::move(dd.file)), negate(std::move(dd.negate)) + { } + + //////////////////////////////////////////////////////////////////////////// + // NOTE: + // + // To implement the specific DD, add the following move-conversion that + // runs the Reduce algorithm. + // + // dd(__dd &&dd) + //////////////////////////////////////////////////////////////////////////// + public: //////////////////////////////////////////////////////////////////////////// /// \brief Read-only access to the negation flag. @@ -298,7 +328,7 @@ namespace adiar::internal //////////////////////////////////////////////////////////////////////////// /// \brief Read-only access to the raw files and meta information. //////////////////////////////////////////////////////////////////////////// - const shared_nodes_t file_ptr() const + const shared_node_file_type file_ptr() const { return file; } @@ -308,18 +338,19 @@ namespace adiar::internal /// information, i.e. this is similar to writing /// `.file_ptr()->`. //////////////////////////////////////////////////////////////////////////// - const nodes_t* operator->() const + const node_file_type* operator->() const { return file_ptr().get(); } + /// \cond //////////////////////////////////////////////////////////////////////////// /// \brief Obtain the 1-level cut of the desired type, i.e. of the sub-graph /// including the desired type of arcs. /// /// \param ct The type of the cut to obtain //////////////////////////////////////////////////////////////////////////// - cut_size_t max_1level_cut(const cut_type ct) const + cut::size_type max_1level_cut(const cut ct) const { return file->max_1level_cut[negate_cut_type(ct)]; } @@ -330,10 +361,11 @@ namespace adiar::internal /// /// \param ct The type of the cut to obtain //////////////////////////////////////////////////////////////////////////// - cut_size_t max_2level_cut(const cut_type ct) const + cut::size_type max_2level_cut(const cut ct) const { return file->max_2level_cut[negate_cut_type(ct)]; } + /// \endcond //////////////////////////////////////////////////////////////////////////// /// \brief The number of elements in the node file. @@ -360,15 +392,15 @@ namespace adiar::internal } private: - cut_type negate_cut_type(const cut_type ct) const + cut negate_cut_type(const cut ct) const { if (!negate) { return ct; } switch (ct) { - case cut_type::INTERNAL_FALSE: - return cut_type::INTERNAL_TRUE; - case cut_type::INTERNAL_TRUE: - return cut_type::INTERNAL_FALSE; + case cut::Internal_False: + return cut::Internal_True; + case cut::Internal_True: + return cut::Internal_False; default: return ct; } @@ -376,7 +408,7 @@ namespace adiar::internal //////////////////////////////////////////////////////////////////////////// // Friends - // |- classes + // |- streaming classes friend class __dd; template @@ -388,18 +420,27 @@ namespace adiar::internal template friend class level_merger; + // |- algorithm functions and classes friend bool is_isomorphic(const dd&, const dd&); template friend bool comparison_check(const dd &in_1, const dd &in_2); - friend bool is_terminal(const dd &dd); - friend bool value_of(const dd &dd); - friend label_t min_var(const dd &dd); - friend label_t max_var(const dd &dd); - template friend class convert_dd_policy; + + // |- public API + template + friend bool dd_isterminal(const dd_t &dd); + + template + friend bool dd_valueof(const dd_t &dd); + + template + friend label_type dd_minvar(const dd_t &dd); + + template + friend label_type dd_maxvar(const dd_t &dd); }; inline __dd::__dd(const dd &dd) @@ -426,72 +467,74 @@ namespace adiar::internal // TODO: rename to '__dd_t'? using unreduced_t = __dd_type; - //////////////////////////////////////////////////////////////////////////// - // Constants - public: //////////////////////////////////////////////////////////////////////////// /// \brief Type of nodes of this diagram. //////////////////////////////////////////////////////////////////////////// - using node_t = typename dd_type::node_t; + using node_type = typename dd_type::node_type; //////////////////////////////////////////////////////////////////////////// /// \brief Type of pointers of this diagram. //////////////////////////////////////////////////////////////////////////// - using ptr_t = typename dd_type::ptr_t; + using pointer_type = typename dd_type::pointer_type; //////////////////////////////////////////////////////////////////////////// /// \brief Type of pointers of this diagram. //////////////////////////////////////////////////////////////////////////// - using children_t = typename node_t::children_t; + using children_type = typename node_type::children_type; //////////////////////////////////////////////////////////////////////////// /// \brief Type of this node's variable label. //////////////////////////////////////////////////////////////////////////// - using label_t = typename dd_type::label_t; + using label_type = typename dd_type::label_type; ////////////////////////////////////////////////////////////////////////////// /// \brief The maximal possible value for a unique identifier's label. ////////////////////////////////////////////////////////////////////////////// - static constexpr label_t MAX_LABEL = dd_type::MAX_LABEL; + static constexpr label_type max_label = dd_type::max_label; //////////////////////////////////////////////////////////////////////////// /// \brief Type of this node's level identifier. //////////////////////////////////////////////////////////////////////////// - using id_t = typename dd_type::id_t; + using id_type = typename dd_type::id_type; ////////////////////////////////////////////////////////////////////////////// /// \brief The maximal possible value for this nodes level identifier. ////////////////////////////////////////////////////////////////////////////// - static constexpr id_t MAX_ID = dd_type::MAX_ID; + static constexpr id_type max_id = dd_type::max_id; + + //////////////////////////////////////////////////////////////////////////// + /// \brief Type of a terminal value. + //////////////////////////////////////////////////////////////////////////// + using terminal_type = typename dd_type::terminal_type; //////////////////////////////////////////////////////////////////////////// /// \brief Type of shared nodes for this diagram type. //////////////////////////////////////////////////////////////////////////// - using shared_nodes_t = typename __dd_type::shared_nodes_t; + using shared_node_file_type = typename __dd_type::shared_node_file_type; //////////////////////////////////////////////////////////////////////////// /// \brief Type of shared arcs for this diagram type. //////////////////////////////////////////////////////////////////////////// - using shared_arcs_t = typename __dd_type::shared_arcs_t; + using shared_arc_file_type = typename __dd_type::shared_arc_file_type; //////////////////////////////////////////////////////////////////////////// /// Function declaration public: - static inline ptr_t - reduction_rule(const node_t &n); + static inline pointer_type + reduction_rule(const node_type &n); - static inline children_t - reduction_rule_inv(const ptr_t &child); + static inline children_type + reduction_rule_inv(const pointer_type &child); // TODO: stop using these in favour of 'reduction_rule_inv' above static inline void compute_cofactor(const bool on_curr_level, - ptr_t &low, - ptr_t &high); + pointer_type &low, + pointer_type &high); - static inline children_t + static inline children_type compute_cofactor(const bool on_curr_level, - const children_t &children); + const children_type &children); }; /// \endcond } diff --git a/src/adiar/internal/dd_func.h b/src/adiar/internal/dd_func.h index df6ff7b7c..938c6cf20 100644 --- a/src/adiar/internal/dd_func.h +++ b/src/adiar/internal/dd_func.h @@ -1,89 +1,130 @@ #ifndef ADIAR_INTERNAL_DD_FUNC_H #define ADIAR_INTERNAL_DD_FUNC_H -#include +#include + #include -#include -#include namespace adiar::internal { - //////////////////////////////////////////////////////////////////////////// - /// \brief Obtain the level_info stream projected onto the labels. - //////////////////////////////////////////////////////////////////////////// - template - void dd_varprofile(const dd_t &dd, const consumer &cb) - { - level_info_stream<> info_stream(dd); - while(info_stream.can_pull()) { cb(info_stream.pull().label()); } - } - - // TODO: move into 'dd' class? + ////////////////////////////////////////////////////////////////////////////// + // Collection of simple functions common to all types of decision diagrams. ////////////////////////////////////////////////////////////////////////////// - /// Check whether a given decision diagram is canonical, i.e. has the - /// following stronger guarantees than the total ordering of nodes. + /// \brief Check whether a given decision diagram is canonical. + /// + /// \details In Adiar, the word *canonical* refers to the following two + /// stronger guarantees on the total ordering of nodes. /// /// 1. Nodes within a level are effectively sorted based on their children: /// high first, then low. /// - /// 2. Identifiers are from \ref MAX_ID and down (when read bottom-up) + /// 2. Identifiers are from \ref max_id and down (when read bottom-up) /// /// If this is true, then equality checking can be done in a single cheap /// linear scan rather than with an *O(N log N)* time-forwarding algorithm. ////////////////////////////////////////////////////////////////////////////// - inline bool is_canonical(const dd &dd) + template + bool dd_iscanonical(const dd_t &dd) { + // TODO: Move into 'dd' class... return dd->canonical; } ////////////////////////////////////////////////////////////////////////////// /// \brief Whether a given decision diagram represents a terminal. ////////////////////////////////////////////////////////////////////////////// - inline bool is_terminal(const dd &dd) + template + bool dd_isterminal(const dd_t &dd) { + // TODO: Move into 'dd' class... return dd->is_terminal(); } ////////////////////////////////////////////////////////////////////////////// /// \brief Obtain the terminal's value (if 'is_terminal' is true). ////////////////////////////////////////////////////////////////////////////// - inline bool value_of(const dd &dd) + template + bool dd_valueof(const dd_t &dd) { + // TODO: Move into 'dd' class... return dd.negate ^ dd->value(); } ////////////////////////////////////////////////////////////////////////////// /// \brief Whether a given decision diagram represents the false terminal. ////////////////////////////////////////////////////////////////////////////// - inline bool is_false(const dd &dd) + template + bool dd_isfalse(const dd_t &dd) { - return is_terminal(dd) && !value_of(dd); + // TODO: Move into 'dd' class... + return dd_isterminal(dd) && !dd_valueof(dd); } ////////////////////////////////////////////////////////////////////////////// /// \brief Whether a given decision diagram represents the true terminal. ////////////////////////////////////////////////////////////////////////////// - inline bool is_true(const dd &dd) + template + bool dd_istrue(const dd_t &dd) { - return is_terminal(dd) && value_of(dd); + // TODO: Move into 'dd' class... + return dd_isterminal(dd) && dd_valueof(dd); } ////////////////////////////////////////////////////////////////////////////// /// \brief Get the minimal occurring label in the decision diagram ////////////////////////////////////////////////////////////////////////////// - inline dd::label_t min_var(const dd &dd) + template + dd::label_type dd_minvar(const dd_t &dd) { + // TODO: Exception if terminal. + + // TODO: Move into 'dd' class... return dd->first_level(); } + // TODO: dd_topvar(dd&) := dd_minvar(dd&) + ////////////////////////////////////////////////////////////////////////////// /// \brief Get the maximal occurring label in the decision diagram ////////////////////////////////////////////////////////////////////////////// - inline dd::label_t max_var(const dd &dd) + template + dd::label_type dd_maxvar(const dd_t &dd) { + // TODO: Exception if terminal. + + // TODO: Move into 'dd' class... return dd->last_level(); } + + //////////////////////////////////////////////////////////////////////////// + /// \brief Number of nodes in a decision diagram. + //////////////////////////////////////////////////////////////////////////// + template + size_t dd_nodecount(const dd_t &dd) + { + return dd_isterminal(dd) ? 0u : dd->size(); + } + + //////////////////////////////////////////////////////////////////////////// + /// \brief Number of variables, i.e. levels, present in a decision diagram. + //////////////////////////////////////////////////////////////////////////// + template + typename dd_t::label_type dd_varcount(const dd_t &dd) + { + return dd->levels(); + } + + //////////////////////////////////////////////////////////////////////////// + /// \brief The variable labels (in order of their level) that are present in a + /// decision diagram. + //////////////////////////////////////////////////////////////////////////// + template + void dd_varprofile(const dd_t &dd, const consumer &cb) + { + level_info_stream<> info_stream(dd); + while(info_stream.can_pull()) { cb(info_stream.pull().label()); } + } } #endif // ADIAR_INTERNAL_DD_FUNC_H diff --git a/src/adiar/internal/dot.h b/src/adiar/internal/dot.h index 02a663fff..32626ee8f 100644 --- a/src/adiar/internal/dot.h +++ b/src/adiar/internal/dot.h @@ -12,14 +12,17 @@ namespace adiar::internal { - template - void output_dot(const file_t& nodes, std::ostream &out) + ////////////////////////////////////////////////////////////////////////////// + /// \brief Output a container of nodes to a given output stream. + ////////////////////////////////////////////////////////////////////////////// + template + inline void __print_dot(const nodes_t& nodes, std::ostream &out) { - out << "digraph BDD {" << std::endl; + out << "digraph DD {" << std::endl; node_stream<> ns(nodes); - if (is_terminal(nodes)) { + if (nodes->is_terminal()) { out << "\t" << ns.pull().value() << " [shape=box];" << std::endl; @@ -40,9 +43,9 @@ namespace adiar::internal } out << "\tn" << ptr_uint64(false)._raw - << " [label=\"" << file_t::false_print << "\"];" << std::endl; + << " [label=\"" << nodes_t::false_print << "\"];" << std::endl; out << "\tn" << ptr_uint64(true)._raw - << " [label=\"" << file_t::true_print << "\"];" << std::endl; + << " [label=\"" << nodes_t::true_print << "\"];" << std::endl; out << std::endl << "\t// Arcs" << std::endl; @@ -79,18 +82,44 @@ namespace adiar::internal out << "}" << std::endl; } - template - void output_dot(const file_t& nodes, const std::string &filename) + ////////////////////////////////////////////////////////////////////////////// + /// \brief Output a container of nodes to a given file name + ////////////////////////////////////////////////////////////////////////////// + template + inline void __print_dot(const dd_t& dd, const std::string& filename) { + // Create output stream for file std::ofstream out; out.open(filename); - output_dot(nodes, out); + // Print to output + __print_dot(dd, out); + + // Close out.close(); } - inline void output_dot(const shared_levelized_file& arcs, - const std::string &filename) + // TODO: print_dot(const shared_levelized_file& nodes, ...) + + ////////////////////////////////////////////////////////////////////////////// + /// \brief Output a decision diagram to a given output stream. + ////////////////////////////////////////////////////////////////////////////// + template + void print_dot(const dd_t& dd, std::ostream &out) + { __print_dot(dd, out); } + + ////////////////////////////////////////////////////////////////////////////// + /// \brief Output a decision diagram to a given file + ////////////////////////////////////////////////////////////////////////////// + template + void print_dot(const dd_t& dd, const std::string &filename) + { __print_dot(dd, filename); } + + ////////////////////////////////////////////////////////////////////////////// + /// \brief Print dot file of an intermediate output of arcs. + ////////////////////////////////////////////////////////////////////////////// + inline void print_dot(const shared_levelized_file& arcs, + const std::string &filename) { std::ofstream out; out.open(filename); @@ -128,6 +157,8 @@ namespace adiar::internal out << "\t{ rank=min; s0 s1 }" << std::endl << "}" << std::endl; out.close(); } + + // TODO: generalize for non-sharing arc files and std::ostream } #endif // ADIAR_INTERNAL_DOT_H diff --git a/src/adiar/internal/io/arc_file.cpp b/src/adiar/internal/io/arc_file.cpp index 7a844e1f7..acd4a430d 100644 --- a/src/adiar/internal/io/arc_file.cpp +++ b/src/adiar/internal/io/arc_file.cpp @@ -2,5 +2,5 @@ namespace adiar::internal { - stats_t::arc_file_t stats_arc_file; + statistics::arc_file_t stats_arc_file; } diff --git a/src/adiar/internal/io/arc_file.h b/src/adiar/internal/io/arc_file.h index 18cd4c80b..dce9fb550 100644 --- a/src/adiar/internal/io/arc_file.h +++ b/src/adiar/internal/io/arc_file.h @@ -12,7 +12,7 @@ namespace adiar::internal ////////////////////////////////////////////////////////////////////////////// /// \brief Struct holding statistics on arc files ////////////////////////////////////////////////////////////////////////////// - extern stats_t::arc_file_t stats_arc_file; + extern statistics::arc_file_t stats_arc_file; // TODO (ADD): // TODO (QMDD): @@ -37,17 +37,17 @@ namespace adiar::internal //////////////////////////////////////////////////////////////////////////// /// \brief File index for internal arcs. //////////////////////////////////////////////////////////////////////////// - static constexpr size_t IDX__INTERNAL = 0u; + static constexpr size_t idx__internal = 0u; //////////////////////////////////////////////////////////////////////////// /// \brief File index for terminal arcs generated out-of-order. //////////////////////////////////////////////////////////////////////////// - static constexpr size_t IDX__TERMINALS__IN_ORDER = 1u; + static constexpr size_t idx__terminals__in_order = 1u; //////////////////////////////////////////////////////////////////////////// /// \brief File index for terminal arcs generated out-of-order. //////////////////////////////////////////////////////////////////////////// - static constexpr size_t IDX__TERMINALS__OUT_OF_ORDER = 2u; + static constexpr size_t idx__terminals__out_of_order = 2u; //////////////////////////////////////////////////////////////////////////// /// \brief Text to pretty-print in '.dot' output. @@ -73,7 +73,7 @@ namespace adiar::internal /// counting any arcs to terminals). ////////////////////////////////////////////////////////////////////////// // TODO: use array of size 1? - cut_size_t max_1level_cut = MAX_CUT; + cut::size_type max_1level_cut = cut::max; ////////////////////////////////////////////////////////////////////////// /// \brief The number of false and true terminals in the file. Index 0 @@ -82,7 +82,7 @@ namespace adiar::internal ////////////////////////////////////////////////////////////////////////// size_t number_of_terminals[2] = { 0, 0 }; - // TODO: if allowing to be a terminal (with NIL -> {0,1} arcs), then + // TODO: if allowing to be a terminal (with nil -> {0,1} arcs), then // create base_stats class to inherit here and in node_file from. }; }; @@ -91,10 +91,10 @@ namespace adiar::internal // for .sort<0>()). // // To this end: - // - Rename 'levelized_file' to '__levelized_file'. + // - Rename 'levelized_file' to '__levelized_file'. // - // - Make 'levelized_file' be a class that publicly inherit the - // base class '__levelized_file'. + // - Make 'levelized_file' be a class that publicly inherit the + // base class '__levelized_file'. // // - Add a specialization for 'levelized_file' that also adds the // 'untranspose' function. diff --git a/src/adiar/internal/io/arc_stream.h b/src/adiar/internal/io/arc_stream.h index e2fab20fa..330ca0dd3 100644 --- a/src/adiar/internal/io/arc_stream.h +++ b/src/adiar/internal/io/arc_stream.h @@ -1,6 +1,7 @@ #ifndef ADIAR_INTERNAL_IO_ARC_STREAM_H #define ADIAR_INTERNAL_IO_ARC_STREAM_H +#include #include #include #include @@ -25,14 +26,14 @@ namespace adiar::internal } private: - static constexpr size_t IDX__INTERNAL = - file_traits::IDX__INTERNAL; + static constexpr size_t idx__internal = + file_traits::idx__internal; - static constexpr size_t IDX__TERMINALS__IN_ORDER = - file_traits::IDX__TERMINALS__IN_ORDER; + static constexpr size_t idx__terminals__in_order = + file_traits::idx__terminals__in_order; - static constexpr size_t IDX__TERMINALS__OUT_OF_ORDER = - file_traits::IDX__TERMINALS__OUT_OF_ORDER; + static constexpr size_t idx__terminals__out_of_order = + file_traits::idx__terminals__out_of_order; //////////////////////////////////////////////////////////////////////////// /// \brief Keep track of the number of unread terminals @@ -101,19 +102,19 @@ namespace adiar::internal /// \brief Whether the stream contains more internal arcs. //////////////////////////////////////////////////////////////////////////// bool can_pull_internal() const - { return parent_t::template can_pull(); } + { return parent_t::template can_pull(); } //////////////////////////////////////////////////////////////////////////// /// \brief Obtain the next internal arc (and move the read head). //////////////////////////////////////////////////////////////////////////// const arc pull_internal() - { return parent_t::template pull(); } + { return parent_t::template pull(); } //////////////////////////////////////////////////////////////////////////// /// \brief Obtain the next internal arc (but do not move the read head). //////////////////////////////////////////////////////////////////////////// const arc peek_internal() - { return parent_t::template peek(); } + { return parent_t::template peek(); } private: //////////////////////////////////////////////////////////////////////////// @@ -123,20 +124,20 @@ namespace adiar::internal bool take_in_order_terminal() { const bool in_order_pullable = - parent_t::template can_pull(); + parent_t::template can_pull(); const bool out_of_order_pullable = - parent_t::template can_pull(); + parent_t::template can_pull(); if (in_order_pullable != out_of_order_pullable) { return in_order_pullable; } - const arc::ptr_t in_order_source = - parent_t::template peek().source(); + const arc::pointer_type in_order_source = + parent_t::template peek().source(); - const arc::ptr_t out_of_order_source = - parent_t::template peek().source(); + const arc::pointer_type out_of_order_source = + parent_t::template peek().source(); if constexpr (reverse) { return in_order_source < out_of_order_source; @@ -172,8 +173,8 @@ namespace adiar::internal const arc pull_terminal() { const arc a = take_in_order_terminal() - ? parent_t::template pull() - : parent_t::template pull(); + ? parent_t::template pull() + : parent_t::template pull(); adiar_assert(_unread_terminals[a.target().value()] > 0, "Terminal counter should not be zero"); @@ -188,8 +189,8 @@ namespace adiar::internal const arc peek_terminal() { return take_in_order_terminal() - ? parent_t::template peek() - : parent_t::template peek(); + ? parent_t::template peek() + : parent_t::template peek(); } }; } diff --git a/src/adiar/internal/io/arc_writer.h b/src/adiar/internal/io/arc_writer.h index 6cae53fc5..cddcdfc53 100644 --- a/src/adiar/internal/io/arc_writer.h +++ b/src/adiar/internal/io/arc_writer.h @@ -1,6 +1,7 @@ #ifndef ADIAR_INTERNAL_IO_ARC_WRITER_H #define ADIAR_INTERNAL_IO_ARC_WRITER_H +#include #include #include #include @@ -20,14 +21,14 @@ namespace adiar::internal arc __latest_terminal; private: - static constexpr size_t IDX__INTERNAL = - file_traits::IDX__INTERNAL; + static constexpr size_t idx__internal = + file_traits::idx__internal; - static constexpr size_t IDX__TERMINALS__IN_ORDER = - file_traits::IDX__TERMINALS__IN_ORDER; + static constexpr size_t idx__terminals__in_order = + file_traits::idx__terminals__in_order; - static constexpr size_t IDX__TERMINALS__OUT_OF_ORDER = - file_traits::IDX__TERMINALS__OUT_OF_ORDER; + static constexpr size_t idx__terminals__out_of_order = + file_traits::idx__terminals__out_of_order; public: //////////////////////////////////////////////////////////////////////////// @@ -107,11 +108,11 @@ namespace adiar::internal if (!attached()) return; #ifdef ADIAR_STATS - if (_elem_writers[IDX__TERMINALS__OUT_OF_ORDER].size() != 0u) { + if (_elem_writers[idx__terminals__out_of_order].size() != 0u) { stats_arc_file.sort_out_of_order += 1; } #endif - _elem_writers[IDX__TERMINALS__OUT_OF_ORDER].sort(); + _elem_writers[idx__terminals__out_of_order].sort(); levelized_file_writer::detach(); } @@ -146,7 +147,7 @@ namespace adiar::internal ////////////////////////////////////////////////////////////////////////////// /// \brief Push an arc to the relevant underlying file. /// - /// \param a An arc with `a.target() != a::ptr_t::NIL`. + /// \param a An arc with `a.target() != a::pointer_type::nil`. /// /// \pre `attached() == true`. /// @@ -154,7 +155,7 @@ namespace adiar::internal ////////////////////////////////////////////////////////////////////////////// void push(const arc &a) { - adiar_assert(!a.target().is_nil(), "Should not push an arc to NIL."); + adiar_assert(!a.target().is_nil(), "Should not push an arc to nil."); if (a.target().is_node()) { push_internal(a); } else { // a.target().is_terminal() @@ -186,7 +187,7 @@ namespace adiar::internal #ifdef ADIAR_STATS stats_arc_file.push_internal += 1; #endif - levelized_file_writer::template push(a); + levelized_file_writer::template push(a); } ////////////////////////////////////////////////////////////////////////////// @@ -207,13 +208,13 @@ namespace adiar::internal #ifdef ADIAR_STATS stats_arc_file.push_in_order += 1; #endif - levelized_file_writer::template push(a); + levelized_file_writer::template push(a); } else { // Given arc is 'out-of-order' compared to latest 'in-order' pushed #ifdef ADIAR_STATS stats_arc_file.push_out_of_order += 1; #endif - levelized_file_writer::template push(a); + levelized_file_writer::template push(a); } _file_ptr->number_of_terminals[a.target().value()]++; diff --git a/src/adiar/internal/io/file.h b/src/adiar/internal/io/file.h index 485da0dae..fb1ecc145 100644 --- a/src/adiar/internal/io/file.h +++ b/src/adiar/internal/io/file.h @@ -37,27 +37,27 @@ namespace adiar::internal /// file's content is part of the type and to provide auxiliary /// functions. /// - /// \param elem_type Type of the file's content. + /// \tparam value_t Type of the file's content. ////////////////////////////////////////////////////////////////////////////// - template // <-- header_t + template // <-- header_t class file // : public file_traits::stats { public: //////////////////////////////////////////////////////////////////////////// /// \brief Type of the file's elements. //////////////////////////////////////////////////////////////////////////// - typedef elem_type elem_t; + using value_type = value_t; - static_assert(std::is_pod::value, "File content must be a POD"); + static_assert(std::is_pod::value, "File content must be a POD"); public: //////////////////////////////////////////////////////////////////////////// /// \brief Access flags to be used privately within reader's and writers. //////////////////////////////////////////////////////////////////////////// - typedef tpie::access_type access_t; + using access_type = tpie::access_type; - static constexpr access_t read_access = tpie::access_type::access_read; - static constexpr access_t write_access = tpie::access_type::access_write; + static constexpr access_type read_access = tpie::access_type::access_read; + static constexpr access_type write_access = tpie::access_type::access_write; private: //////////////////////////////////////////////////////////////////////////// @@ -74,17 +74,17 @@ namespace adiar::internal //////////////////////////////////////////////////////////////////////////// // Befriend the few places that need direct access to these variables. - template + template friend class file_stream; - template + template friend class file_writer; - template + template friend class levelized_file; // Remove? - template + template friend class levelized_file_writer; public: @@ -153,7 +153,7 @@ namespace adiar::internal { if (!exists()) { return 0u; } - tpie::file_stream fs; + tpie::file_stream fs; fs.open(_tpie_file, read_access); return fs.size(); } @@ -171,7 +171,7 @@ namespace adiar::internal if (exists()) return; // The file exists on disk, after opening it with write_access. - tpie::file_stream fs; + tpie::file_stream fs; fs.open(_tpie_file, write_access); } @@ -260,7 +260,7 @@ namespace adiar::internal std::filesystem::rename(path(), new_path); } catch(std::filesystem::filesystem_error& e1) { #ifndef NDEBUG - std::cerr << "Adiar: unable to move file in O(1) time" << std::endl + std::cerr << "Adiar: unable to move file in O(1) time" << std::endl << " what(): " << e1.what() << std::endl; #endif // Did the file disappear and everything just is in shambles? @@ -275,7 +275,7 @@ namespace adiar::internal std::filesystem::remove(path()); } catch (std::filesystem::filesystem_error& e2) { #ifndef NDEBUG - std::cerr << "Adiar: unable to copy-delete file in O(N) time" << std::endl + std::cerr << "Adiar: unable to copy-delete file in O(N) time" << std::endl << " what(): " << e2.what() << std::endl; #endif throw static_cast(e2); @@ -295,7 +295,7 @@ namespace adiar::internal /// \pre `is_persistent() == false` and `file_stream` nor `file_writer` is /// attached to this file. //////////////////////////////////////////////////////////////////////////// - template > + template > void sort(pred_t pred = pred_t()) { // Disallow sorting a persistent file @@ -306,7 +306,7 @@ namespace adiar::internal if (size() == 0u) return; // Use TPIE's file sorting. - tpie::file_stream fs; + tpie::file_stream fs; fs.open(_tpie_file); tpie::progress_indicator_null pi; @@ -320,11 +320,11 @@ namespace adiar::internal /// \remark This new file is a temporary file and must be marked persisted /// to be kept existing beyond the object's lifetime. //////////////////////////////////////////////////////////////////////////// - static file copy(const file &f) + static file copy(const file &f) { - if (!f.exists()) { return file(); } + if (!f.exists()) { return file(); } - file ret; + file ret; std::filesystem::copy(f.path(), ret.path()); return ret; } diff --git a/src/adiar/internal/io/file_stream.h b/src/adiar/internal/io/file_stream.h index 32013b1c6..3b88c7705 100644 --- a/src/adiar/internal/io/file_stream.h +++ b/src/adiar/internal/io/file_stream.h @@ -4,6 +4,7 @@ #include #include +#include #include #include @@ -18,20 +19,20 @@ namespace adiar::internal /// /// \param file_t The type of the shared pointer to a file ////////////////////////////////////////////////////////////////////////////// - template + template class file_stream { public: //////////////////////////////////////////////////////////////////////////// /// \brief Type of the file's elements. //////////////////////////////////////////////////////////////////////////// - typedef elem_type elem_t; + using value_type = value_t; public: //////////////////////////////////////////////////////////////////////////// static size_t memory_usage() { - return tpie::file_stream::memory_usage(); + return tpie::file_stream::memory_usage(); } private: @@ -39,7 +40,7 @@ namespace adiar::internal /// \brief Buffer of a single element, since TPIE does not support a /// `peek_back` function yet (TPIE Issue #187). //////////////////////////////////////////////////////////////////////////// - mutable elem_t _peeked; + mutable value_type _peeked; //////////////////////////////////////////////////////////////////////////// /// \brief Whether an \em unpulled element is stored in `_peeked`. @@ -54,7 +55,7 @@ namespace adiar::internal //////////////////////////////////////////////////////////////////////////// /// \brief TPIE's file stream object to read the file with. //////////////////////////////////////////////////////////////////////////// - mutable typename tpie::file_stream _stream; + mutable typename tpie::file_stream _stream; //////////////////////////////////////////////////////////////////////////// /// \brief If attached to a shared file then hook into the reference @@ -70,20 +71,20 @@ namespace adiar::internal file_stream() { } //////////////////////////////////////////////////////////////////////////// - file_stream(const file_stream &) = delete; - file_stream(file_stream &&) = delete; + file_stream(const file_stream &) = delete; + file_stream(file_stream &&) = delete; //////////////////////////////////////////////////////////////////////////// - /// \brief Construct attached to a given shared `file`. + /// \brief Construct attached to a given shared `file`. //////////////////////////////////////////////////////////////////////////// - file_stream(const file &f, + file_stream(const file &f, bool negate = false) { attach(f, negate); } //////////////////////////////////////////////////////////////////////////// - /// \brief Construct attached to a given shared `file`. + /// \brief Construct attached to a given shared `file`. //////////////////////////////////////////////////////////////////////////// - file_stream(const adiar::shared_ptr> &f, + file_stream(const adiar::shared_ptr> &f, bool negate = false) { attach(f, negate); } @@ -95,7 +96,7 @@ namespace adiar::internal protected: //////////////////////////////////////////////////////////////////////////// - void attach(const file &f, + void attach(const file &f, const adiar::shared_ptr &shared_ptr, bool negate) { @@ -110,7 +111,7 @@ namespace adiar::internal f.__touch(); // Open the stream to the file - _stream.open(f._tpie_file, file::read_access); + _stream.open(f._tpie_file, file::read_access); reset(); // Store negation flag. @@ -128,7 +129,7 @@ namespace adiar::internal /// /// \pre No `file_writer` is currently attached to this file. //////////////////////////////////////////////////////////////////////////// - void attach(const file &f, + void attach(const file &f, bool negate = false) { attach(f, nullptr, negate); @@ -139,7 +140,7 @@ namespace adiar::internal /// /// \pre No `file_writer` is currently attached to this file. //////////////////////////////////////////////////////////////////////////// - void attach(const adiar::shared_ptr> &f, + void attach(const adiar::shared_ptr> &f, bool negate = false) { attach(*f, f, negate); @@ -195,15 +196,15 @@ namespace adiar::internal private: //////////////////////////////////////////////////////////////////////////// - const elem_t __read() + const value_type __read() { - elem_t e; + value_type v; if constexpr (REVERSE) { - e = _stream.read_back(); + v = _stream.read_back(); } else { - e = _stream.read(); + v = _stream.read(); } - return _negate ? ~e : e; + return _negate ? ~v : v; } public: @@ -212,7 +213,7 @@ namespace adiar::internal /// /// \pre `can_pull() == true`. //////////////////////////////////////////////////////////////////////////// - const elem_t pull() + const value_type pull() { adiar_assert(can_pull()); if (_has_peeked) { @@ -228,7 +229,7 @@ namespace adiar::internal /// /// \pre `can_pull() == true`. //////////////////////////////////////////////////////////////////////////// - const elem_t peek() + const value_type peek() { adiar_assert(can_pull()); if (!_has_peeked) { @@ -247,8 +248,8 @@ namespace adiar::internal /// /// \pre The content is in ascending order and `can_pull() == true`. //////////////////////////////////////////////////////////////////////////// - template - const elem_t seek(seek_t tgt) + template + const value_type seek(seek_t tgt) { // Notice, the peek() also changes the state of '_peeked' and // '_has_peeked'. This initializes the invariant for 'seek' that '_peeked' diff --git a/src/adiar/internal/io/file_writer.h b/src/adiar/internal/io/file_writer.h index 023b6fe17..b465e3da5 100644 --- a/src/adiar/internal/io/file_writer.h +++ b/src/adiar/internal/io/file_writer.h @@ -16,22 +16,22 @@ namespace adiar::internal /// \brief Write-only access to a simple file including a consistency check /// on the given input. /// - /// \param elem_t Type of the file's content. + /// \tparam value_t Type of the file's content. /// /// \details The consistency check verifies, whether something is allowed to /// come after something else. In all our current use-cases, the /// check induces a total ordering. ////////////////////////////////////////////////////////////////////////////// - template + template class file_writer { public: - typedef elem_type elem_t; + using value_type = value_t; public: static size_t memory_usage() { - return tpie::file_stream::memory_usage(); + return tpie::file_stream::memory_usage(); } private: @@ -45,7 +45,7 @@ namespace adiar::internal //////////////////////////////////////////////////////////////////////////// /// \brief TPIE's file stream object to write elements with. //////////////////////////////////////////////////////////////////////////// - tpie::file_stream _stream; + tpie::file_stream _stream; public: //////////////////////////////////////////////////////////////////////////// @@ -55,19 +55,19 @@ namespace adiar::internal { } //////////////////////////////////////////////////////////////////////////// - /// \brief Construct attached to a given `file`. + /// \brief Construct attached to a given `file`. /// /// \pre No `file_stream` is currently attached to this file. //////////////////////////////////////////////////////////////////////////// - file_writer(file &f) + file_writer(file &f) { attach(f); } //////////////////////////////////////////////////////////////////////////// - /// \brief Construct attached to a given shared `file`. + /// \brief Construct attached to a given shared `file`. /// /// \pre No `file_stream` is currently attached to this file. //////////////////////////////////////////////////////////////////////////// - file_writer(adiar::shared_ptr> &f) + file_writer(adiar::shared_ptr> &f) { attach(f); } //////////////////////////////////////////////////////////////////////////// @@ -78,7 +78,7 @@ namespace adiar::internal protected: //////////////////////////////////////////////////////////////////////////// - void attach(file &f, adiar::shared_ptr p) + void attach(file &f, adiar::shared_ptr p) { if (f.is_persistent()) throw runtime_error("Cannot attach writer to a persisted file"); @@ -86,7 +86,7 @@ namespace adiar::internal if (attached()) { detach(); } _file_ptr = p; - _stream.open(f._tpie_file, file::write_access); + _stream.open(f._tpie_file, file::write_access); _stream.seek(0, tpie::file_stream_base::end); } @@ -105,7 +105,7 @@ namespace adiar::internal /// ensure, that the file in question is not destructed before /// `.detach()` is called. //////////////////////////////////////////////////////////////////////////// - void attach(file &f) + void attach(file &f) { attach(f, nullptr); } //////////////////////////////////////////////////////////////////////////// @@ -113,7 +113,7 @@ namespace adiar::internal /// /// \pre No `file_stream` is currently attached to this file. //////////////////////////////////////////////////////////////////////////// - void attach(adiar::shared_ptr> f) + void attach(adiar::shared_ptr> f) { attach(*f, f); } //////////////////////////////////////////////////////////////////////////// @@ -136,7 +136,7 @@ namespace adiar::internal /// /// \pre `attached() == true`. //////////////////////////////////////////////////////////////////////////// - void push(const elem_t &e) + void push(const value_type &e) { _stream.write(e); } //////////////////////////////////////////////////////////////////////////// @@ -144,7 +144,7 @@ namespace adiar::internal /// /// \pre `attached() == true`. //////////////////////////////////////////////////////////////////////////// - file_writer& operator<< (const elem_t& e) + file_writer& operator<< (const value_type& e) { this->push(e); return *this; @@ -179,7 +179,7 @@ namespace adiar::internal /// /// \pre `attached() == true`. //////////////////////////////////////////////////////////////////////////// - template > + template > void sort(const pred_t pred = pred_t()) { if (empty()) return; @@ -190,7 +190,7 @@ namespace adiar::internal }; // TODO: remove... - typedef file_writer label_writer; + using label_writer = file_writer ; } #endif // ADIAR_INTERNAL_IO_FILE_WRITER_H diff --git a/src/adiar/internal/io/levelized_file.h b/src/adiar/internal/io/levelized_file.h index dfef266b3..96f801a18 100644 --- a/src/adiar/internal/io/levelized_file.h +++ b/src/adiar/internal/io/levelized_file.h @@ -6,6 +6,7 @@ #include #include +#include #include #include #include @@ -38,19 +39,19 @@ namespace adiar::internal /// /// \param elem_type Type of the file's content. //////////////////////////////////////////////////////////////////////////// - template - class levelized_file : public file_traits::stats + template + class levelized_file : public file_traits::stats { public: //////////////////////////////////////////////////////////////////////////// /// \brief Type of the file's elements. //////////////////////////////////////////////////////////////////////////// - typedef elem_type elem_t; + using value_type = value_t; //////////////////////////////////////////////////////////////////////////// /// \brief Number of files to collectively represent a DAG. //////////////////////////////////////////////////////////////////////////// - static constexpr size_t FILES = file_traits::files; + static constexpr size_t FILES = file_traits::files; static_assert(0 < FILES, "The number of files must be positive"); private: @@ -99,7 +100,7 @@ namespace adiar::internal //////////////////////////////////////////////////////////////////////////// /// \brief Files describing the directed acyclic graph. //////////////////////////////////////////////////////////////////////////// - file _files [FILES]; + file _files [FILES]; //////////////////////////////////////////////////////////////////////////// /// \brief Whether the file paths in '_level_info_file' and '_files' are @@ -423,7 +424,7 @@ namespace adiar::internal /// \pre `is_persistent() == false` and no stream nor writer is attached to /// this file. //////////////////////////////////////////////////////////////////////////// - template > + template > void sort(size_t idx, pred_t pred = pred_t()) { throw_if_persistent(); @@ -439,12 +440,12 @@ namespace adiar::internal /// \remark This new file is a temporary file and must be marked persisted /// to be kept existing beyond the object's lifetime. //////////////////////////////////////////////////////////////////////////// - static levelized_file copy(const levelized_file &lf) + static levelized_file copy(const levelized_file &lf) { - levelized_file lf_copy; + levelized_file lf_copy; for (size_t idx = 0; idx < FILES; idx++) - lf_copy._files[idx] = file::copy(lf._files[idx]); + lf_copy._files[idx] = file::copy(lf._files[idx]); lf_copy._level_info_file = file::copy(lf._level_info_file); return lf_copy; diff --git a/src/adiar/internal/io/levelized_file_stream.h b/src/adiar/internal/io/levelized_file_stream.h index 74dffa005..1504fe51e 100644 --- a/src/adiar/internal/io/levelized_file_stream.h +++ b/src/adiar/internal/io/levelized_file_stream.h @@ -19,7 +19,7 @@ namespace adiar::internal ////////////////////////////////////////////////////////////////////////////// /// \brief File stream of levelized files. /// - /// \param T The type of the file(s)'s elements + /// \param value_t The type of the file(s)'s elements /// /// \param reverse Whether the reading direction should be reversed /// @@ -28,20 +28,22 @@ namespace adiar::internal /// is equivalent to not reversing the underlying stream. Hence, we do /// hide a negation of the \em reverse parameter. ////////////////////////////////////////////////////////////////////////////// - template + template class levelized_file_stream { public: - static constexpr size_t streams = file_traits::files; + using value_type = value_t; + + static constexpr size_t streams = file_traits::files; static_assert(0 < streams, "There must be at least a single file to attach to."); static size_t memory_usage() { - return streams * file_stream::memory_usage(); + return streams * file_stream::memory_usage(); } protected: - file_stream _streams[streams]; + file_stream _streams[streams]; public: //////////////////////////////////////////////////////////////////////////// @@ -51,20 +53,20 @@ namespace adiar::internal { } //////////////////////////////////////////////////////////////////////////// - levelized_file_stream(const levelized_file_stream &) = delete; - levelized_file_stream(levelized_file_stream &&) = delete; + levelized_file_stream(const levelized_file_stream &) = delete; + levelized_file_stream(levelized_file_stream &&) = delete; //////////////////////////////////////////////////////////////////////////// /// \brief Create attached to a levelized file. //////////////////////////////////////////////////////////////////////////// - levelized_file_stream(const levelized_file &lf, + levelized_file_stream(const levelized_file &lf, const bool negate = false) { attach(lf, negate); } //////////////////////////////////////////////////////////////////////////// /// \brief Create attached to a shared levelized file. //////////////////////////////////////////////////////////////////////////// - levelized_file_stream(const shared_ptr> &lf, + levelized_file_stream(const shared_ptr> &lf, const bool negate = false) { attach(lf, negate); } @@ -79,7 +81,7 @@ namespace adiar::internal /// /// \pre No `levelized_file_writer` is currently attached to this file. //////////////////////////////////////////////////////////////////////////// - void attach(const levelized_file &f, + void attach(const levelized_file &f, const bool negate = false) { if (!f.exists()) f.__touch(); @@ -93,7 +95,7 @@ namespace adiar::internal /// /// \pre No `levelized_file_writer` is currently attached to this file. //////////////////////////////////////////////////////////////////////////// - void attach(const shared_ptr> &f, + void attach(const shared_ptr> &f, const bool negate = false) { if (!f->exists()) f->touch(); @@ -153,7 +155,7 @@ namespace adiar::internal /// \pre `can_pull() == true`. //////////////////////////////////////////////////////////////////////////// template - elem_t pull() + value_type pull() { static_assert(s_idx < streams, "Sub-stream index must be within [0; streams)"); return _streams[s_idx].pull(); @@ -166,7 +168,7 @@ namespace adiar::internal /// \pre `can_pull() == true`. //////////////////////////////////////////////////////////////////////////// template - elem_t peek() + value_type peek() { static_assert(s_idx < streams, "Sub-stream index must be within [0; streams)"); return _streams[s_idx].peek(); @@ -207,15 +209,15 @@ namespace adiar::internal //////////////////////////////////////////////////////////////////////////// /// \brief Construct attached to a levelized file. //////////////////////////////////////////////////////////////////////////// - template - level_info_stream(const levelized_file &lf) + template + level_info_stream(const levelized_file &lf) { attach(lf); } //////////////////////////////////////////////////////////////////////////// /// \brief Construct attached to a shared levelized file. //////////////////////////////////////////////////////////////////////////// - template - level_info_stream(const adiar::shared_ptr> &lf) + template + level_info_stream(const adiar::shared_ptr> &lf) { attach(lf); } //////////////////////////////////////////////////////////////////////////// @@ -239,8 +241,8 @@ namespace adiar::internal //////////////////////////////////////////////////////////////////////////// /// \brief Attach to a levelized file. //////////////////////////////////////////////////////////////////////////// - template - void attach(const levelized_file &lf) + template + void attach(const levelized_file &lf) { if (!lf.exists()) lf.__touch(); parent_t::attach(lf._level_info_file, nullptr, false); @@ -249,8 +251,8 @@ namespace adiar::internal //////////////////////////////////////////////////////////////////////////// /// \brief Attach to a shared levelized file. //////////////////////////////////////////////////////////////////////////// - template - void attach(const adiar::shared_ptr> &lf) + template + void attach(const adiar::shared_ptr> &lf) { if (!lf->exists()) lf->touch(); parent_t::attach(lf->_level_info_file, lf, false); @@ -267,10 +269,10 @@ namespace adiar::internal //////////////////////////////////////////////////////////////////////////// void attach(const __dd &diagram) { - if (diagram.has<__dd::shared_arcs_t>()) { - attach(diagram.get<__dd::shared_arcs_t>()); - } else if (diagram.has<__dd::shared_nodes_t>()) { - attach(diagram.get<__dd::shared_nodes_t>()); + if (diagram.has<__dd::shared_arc_file_type>()) { + attach(diagram.get<__dd::shared_arc_file_type>()); + } else if (diagram.has<__dd::shared_node_file_type>()) { + attach(diagram.get<__dd::shared_node_file_type>()); } else { // We should never be in the case of hooking into a 'no_file'. That type // should only be used internally within an algorithm and never escape diff --git a/src/adiar/internal/io/levelized_file_writer.h b/src/adiar/internal/io/levelized_file_writer.h index f8f093036..f6f71233d 100644 --- a/src/adiar/internal/io/levelized_file_writer.h +++ b/src/adiar/internal/io/levelized_file_writer.h @@ -1,6 +1,7 @@ #ifndef ADIAR_INTERNAL_IO_LEVELIZED_FILE_WRITER_H #define ADIAR_INTERNAL_IO_LEVELIZED_FILE_WRITER_H +#include #include #include #include @@ -15,13 +16,15 @@ namespace adiar::internal /// /// \sa node_writer arc_writer ////////////////////////////////////////////////////////////////////////////// - template + template class levelized_file_writer { public: + using value_type = value_t; + static size_t memory_usage() { - return file_traits::files * file_writer::memory_usage() + return file_traits::files * file_writer::memory_usage() + 1u * file_writer::memory_usage(); } @@ -29,19 +32,19 @@ namespace adiar::internal //////////////////////////////////////////////////////////////////////////// /// \brief Pointer to update the meta information. //////////////////////////////////////////////////////////////////////////// - adiar::shared_ptr> _file_ptr; + adiar::shared_ptr> _file_ptr; //////////////////////////////////////////////////////////////////////////// /// \brief Writers for the file with level information. //////////////////////////////////////////////////////////////////////////// file_writer _level_writer; - static constexpr size_t ELEM_WRITERS = file_traits::files; + static constexpr size_t elem_writers = file_traits::files; //////////////////////////////////////////////////////////////////////////// - /// \brief Writers for each of the files with 'elem_t'. + /// \brief Writers for each of the files with 'value_type'. //////////////////////////////////////////////////////////////////////////// - file_writer _elem_writers [ELEM_WRITERS]; + file_writer _elem_writers [elem_writers]; public: //////////////////////////////////////////////////////////////////////////// @@ -54,7 +57,7 @@ namespace adiar::internal /// /// \pre No file stream or other writer is currently attached to this file. //////////////////////////////////////////////////////////////////////////// - levelized_file_writer(levelized_file &f) + levelized_file_writer(levelized_file &f) { attach(f); } //////////////////////////////////////////////////////////////////////////// @@ -62,7 +65,7 @@ namespace adiar::internal /// /// \pre No file stream or other writer is currently attached to this file. //////////////////////////////////////////////////////////////////////////// - levelized_file_writer(adiar::shared_ptr> f) + levelized_file_writer(adiar::shared_ptr> f) { attach(f); } //////////////////////////////////////////////////////////////////////////// @@ -79,31 +82,31 @@ namespace adiar::internal /// ensure, that the file in question is not destructed before /// `.detach()` is called. //////////////////////////////////////////////////////////////////////////// - void attach(levelized_file &f) + void attach(levelized_file &f) { if (attached()) { detach(); } // The stack variable is made accessible in '_file_ptr', but it should not // be garbage collected. Hence, we provide a do-nothing deleter to the // 'std::shared_ptr' directly. - _file_ptr = std::shared_ptr>(&f, [](void *) {}); + _file_ptr = std::shared_ptr>(&f, [](void *) {}); _level_writer.attach(f._level_info_file, nullptr); - for (size_t s_idx = 0; s_idx < file_traits::files; s_idx++) + for (size_t s_idx = 0; s_idx < file_traits::files; s_idx++) _elem_writers[s_idx].attach(f._files[s_idx], nullptr); } //////////////////////////////////////////////////////////////////////////// /// \brief Attach to a shared file. //////////////////////////////////////////////////////////////////////////// - void attach(adiar::shared_ptr> f) + void attach(adiar::shared_ptr> f) { if (attached()) { detach(); } _file_ptr = f; _level_writer.attach(f->_level_info_file, f); - for (size_t s_idx = 0; s_idx < file_traits::files; s_idx++) + for (size_t s_idx = 0; s_idx < file_traits::files; s_idx++) _elem_writers[s_idx].attach(f->_files[s_idx], f); } @@ -114,7 +117,7 @@ namespace adiar::internal { const bool res = _level_writer.attached(); #ifndef NDEBUG - for (size_t s_idx = 0; s_idx < ELEM_WRITERS; s_idx++) { + for (size_t s_idx = 0; s_idx < elem_writers; s_idx++) { adiar_assert(_elem_writers[s_idx].attached() == res, "Attachment ought to be synchronised."); } @@ -128,7 +131,7 @@ namespace adiar::internal void detach() { _level_writer.detach(); - for (size_t s_idx = 0; s_idx < ELEM_WRITERS; s_idx++) + for (size_t s_idx = 0; s_idx < elem_writers; s_idx++) _elem_writers[s_idx].detach(); _file_ptr.reset(); } @@ -152,7 +155,7 @@ namespace adiar::internal /// /// \pre `attached() == true`. //////////////////////////////////////////////////////////////////////////// - levelized_file_writer& operator<< (const level_info& li) + levelized_file_writer& operator<< (const level_info& li) { this->push(li); return *this; @@ -165,10 +168,10 @@ namespace adiar::internal /// \param e Element to push. //////////////////////////////////////////////////////////////////////////// template - void push(const elem_t &e) + void push(const value_type &e) { - static_assert(s_idx < ELEM_WRITERS, - "Sub-stream index must be within [0; ELEM_WRITERS)."); + static_assert(s_idx < elem_writers, + "Sub-stream index must be within [0; elem_writers)."); _elem_writers[s_idx].push(e); } @@ -179,8 +182,8 @@ namespace adiar::internal //////////////////////////////////////////////////////////////////////////// size_t size(const size_t s_idx) const { - adiar_assert(s_idx < ELEM_WRITERS, - "Sub-stream index must be within [0; ELEM_WRITERS)."); + adiar_assert(s_idx < elem_writers, + "Sub-stream index must be within [0; elem_writers)."); return _elem_writers[s_idx].size(); } @@ -191,7 +194,7 @@ namespace adiar::internal size_t size() const { size_t acc = 0u; - for (size_t s_idx = 0; s_idx < ELEM_WRITERS; s_idx++) { + for (size_t s_idx = 0; s_idx < elem_writers; s_idx++) { acc += size(s_idx); } return acc; @@ -208,7 +211,7 @@ namespace adiar::internal //////////////////////////////////////////////////////////////////////////// bool has_pushed() const { - for (size_t s_idx = 0; s_idx < ELEM_WRITERS; s_idx++) { + for (size_t s_idx = 0; s_idx < elem_writers; s_idx++) { if (size(s_idx) > 0) { return true; } } return levels() > 0; diff --git a/src/adiar/internal/io/node_arc_stream.h b/src/adiar/internal/io/node_arc_stream.h index 663a7ec57..d2213cb30 100644 --- a/src/adiar/internal/io/node_arc_stream.h +++ b/src/adiar/internal/io/node_arc_stream.h @@ -1,6 +1,7 @@ #ifndef ADIAR_INTERNAL_IO_NODE_ARC_STREAM_H #define ADIAR_INTERNAL_IO_NODE_ARC_STREAM_H +#include #include #include #include @@ -30,14 +31,14 @@ namespace adiar::internal } private: - static constexpr size_t IDX__INTERNAL = - file_traits::IDX__INTERNAL; + static constexpr size_t idx__internal = + file_traits::idx__internal; - static constexpr size_t IDX__TERMINALS__IN_ORDER = - file_traits::IDX__TERMINALS__IN_ORDER; + static constexpr size_t idx__terminals__in_order = + file_traits::idx__terminals__in_order; - static constexpr size_t IDX__TERMINALS__OUT_OF_ORDER = - file_traits::IDX__TERMINALS__OUT_OF_ORDER; + static constexpr size_t idx__terminals__out_of_order = + file_traits::idx__terminals__out_of_order; public: //////////////////////////////////////////////////////////////////////////// @@ -77,8 +78,8 @@ namespace adiar::internal node_arc_stream(const __dd &diagram) : parent_t(/*need to sort before attach*/) { - adiar_assert(diagram.template has<__dd::shared_arcs_t>()); - attach(diagram.template get<__dd::shared_arcs_t>(), diagram.negate); + adiar_assert(diagram.template has<__dd::shared_arc_file_type>()); + attach(diagram.template get<__dd::shared_arc_file_type>(), diagram.negate); } //////////////////////////////////////////////////////////////////////////// @@ -89,7 +90,7 @@ namespace adiar::internal void attach(levelized_file &file, const bool negate = false) { if (file.semi_transposed) { - file.sort(IDX__INTERNAL); + file.sort(idx__internal); file.semi_transposed = false; } parent_t::attach(file, negate); @@ -104,7 +105,7 @@ namespace adiar::internal const bool negate = false) { if (file->semi_transposed) { - file->sort(IDX__INTERNAL); + file->sort(idx__internal); file->semi_transposed = false; } parent_t::attach(file, negate); @@ -165,7 +166,7 @@ namespace adiar::internal /// /// \pre `can_pull() == true`. //////////////////////////////////////////////////////////////////////////// - const node seek(const node::uid_t &u); + const node seek(const node::uid_type &u); // TODO private: @@ -181,8 +182,8 @@ namespace adiar::internal if (!parent_t::can_pull_internal()) { return false; } } - const arc::ptr_t internal_source = parent_t::peek_internal().source(); - const arc::ptr_t terminal_source = parent_t::peek_terminal().source(); + const arc::pointer_type internal_source = parent_t::peek_internal().source(); + const arc::pointer_type terminal_source = parent_t::peek_terminal().source(); if constexpr (reverse) { return internal_source > terminal_source; diff --git a/src/adiar/internal/io/node_file.cpp b/src/adiar/internal/io/node_file.cpp index 99d1b26cc..021bfbbf8 100644 --- a/src/adiar/internal/io/node_file.cpp +++ b/src/adiar/internal/io/node_file.cpp @@ -2,5 +2,5 @@ namespace adiar::internal { - stats_t::node_file_t stats_node_file; + statistics::node_file_t stats_node_file; } diff --git a/src/adiar/internal/io/node_file.h b/src/adiar/internal/io/node_file.h index 222fa9929..0a9a122c2 100644 --- a/src/adiar/internal/io/node_file.h +++ b/src/adiar/internal/io/node_file.h @@ -2,6 +2,7 @@ #define ADIAR_INTERNAL_IO_NODE_FILE_H #include +#include #include #include #include @@ -12,7 +13,7 @@ namespace adiar::internal ////////////////////////////////////////////////////////////////////////////// /// \brief Struct holding statistics on node files ////////////////////////////////////////////////////////////////////////////// - extern stats_t::node_file_t stats_node_file; + extern statistics::node_file_t stats_node_file; ////////////////////////////////////////////////////////////////////////////// /// \brief A reduced Decision Diagram. @@ -57,22 +58,22 @@ namespace adiar::internal ////////////////////////////////////////////////////////////////////////// /// \brief An upper bound for the maximum 1-level cut of the DAG (with or /// without arcs to each respective terminal). Use - /// cut_type to index the desired variant of the type. + /// cut to index the desired variant of the type. /// - /// \sa cut_type + /// \sa cut ////////////////////////////////////////////////////////////////////////// cuts_t max_1level_cut = - { MAX_CUT, MAX_CUT, MAX_CUT, MAX_CUT }; + { cut::max, cut::max, cut::max, cut::max }; ////////////////////////////////////////////////////////////////////////// /// \brief An upper bound for the maximum 2-level cut of the DAG (with or /// without arcs to each respective terminal). Use - /// cut_type to index the desired variant of the type. + /// cut to index the desired variant of the type. /// - /// \sa cut_type + /// \sa cut ////////////////////////////////////////////////////////////////////////// cuts_t max_2level_cut = - { MAX_CUT, MAX_CUT, MAX_CUT, MAX_CUT }; + { cut::max, cut::max, cut::max, cut::max }; ////////////////////////////////////////////////////////////////////////// /// \brief The number of false and true terminals in the file. Index 0 diff --git a/src/adiar/internal/io/node_random_access.h b/src/adiar/internal/io/node_random_access.h index a27b35097..420658ab8 100644 --- a/src/adiar/internal/io/node_random_access.h +++ b/src/adiar/internal/io/node_random_access.h @@ -1,8 +1,8 @@ #ifndef ADIAR_INTERNAL_IO_NODE_RANDOM_ACCESS_H #define ADIAR_INTERNAL_IO_NODE_RANDOM_ACCESS_H +#include #include - #include #include @@ -14,36 +14,36 @@ namespace adiar::internal ////////////////////////////////////////////////////////////////////////////// /// \brief Random-access to the contents of a levelized file of node. ////////////////////////////////////////////////////////////////////////////// - template + template class node_random_access { static_assert(!reverse, "Reversed logic is not implemented."); - using uid_t = typename node_t::uid_t; - using label_t = typename node_t::label_t; - using id_t = typename node_t::id_t; + using uid_type = typename node_type::uid_type; + using label_type = typename node_type::label_type; + using id_type = typename node_type::id_type; public: static size_t memory_usage(tpie::memory_size_type max_width) { return node_stream::memory_usage() - + tpie::array::memory_usage(max_width); + + tpie::array::memory_usage(max_width); } static size_t memory_usage(const dd &diagram) { return node_stream::memory_usage() - + tpie::array::memory_usage(diagram->width); + + tpie::array::memory_usage(diagram->width); } public: //////////////////////////////////////////////////////////////////////////// /// \brief Value to mark there is no current level. //////////////////////////////////////////////////////////////////////////// - static constexpr label_t NO_LEVEL = -1; + static constexpr label_type no_level = -1; - static_assert(uid_t::MAX_LABEL < NO_LEVEL, - "'NO_LEVEL' should be an invalid label value"); + static_assert(uid_type::max_label < no_level, + "'no_level' should be an invalid label value"); private: //////////////////////////////////////////////////////////////////////////// @@ -55,27 +55,27 @@ namespace adiar::internal /// \brief Maximum width of the contents of 'lfs'. This is the maximum /// number of elements needed to be placed within. //////////////////////////////////////////////////////////////////////////// - const id_t _max_width; + const id_type _max_width; //////////////////////////////////////////////////////////////////////////// /// \brief Buffer with all elements of the current level. //////////////////////////////////////////////////////////////////////////// - tpie::array _level_buffer; + tpie::array _level_buffer; //////////////////////////////////////////////////////////////////////////// /// \brief Buffer with all elements of the current level. //////////////////////////////////////////////////////////////////////////// - label_t _curr_level = NO_LEVEL; + label_type _curr_level = no_level; //////////////////////////////////////////////////////////////////////////// /// \brief Width of the current level. //////////////////////////////////////////////////////////////////////////// - id_t _curr_width = 0; + id_type _curr_width = 0; //////////////////////////////////////////////////////////////////////////// /// \brief Root of the diagram. //////////////////////////////////////////////////////////////////////////// - uid_t _root; + uid_type _root; // TODO: Add canonicity flag to discern whether to compute the index (as // now) or to use binary search. @@ -92,7 +92,7 @@ namespace adiar::internal /// /// \pre The given levelized file is canonical. //////////////////////////////////////////////////////////////////////////// - node_random_access(const levelized_file &f, + node_random_access(const levelized_file &f, const bool negate = false) : _ns(f, negate), _max_width(f.width), _level_buffer(f.width) { @@ -105,7 +105,7 @@ namespace adiar::internal /// /// \pre The given shared levelized file is canonical. //////////////////////////////////////////////////////////////////////////// - node_random_access(const shared_ptr> &f, + node_random_access(const shared_ptr> &f, const bool negate = false) : _ns(f, negate), _max_width(f->width), _level_buffer(f->width) { @@ -141,7 +141,7 @@ namespace adiar::internal //////////////////////////////////////////////////////////////////////////// /// \brief Return root of the diagram. //////////////////////////////////////////////////////////////////////////// - uid_t root() const + uid_type root() const { return _root; } //////////////////////////////////////////////////////////////////////////// @@ -155,7 +155,7 @@ namespace adiar::internal /// /// \pre `has_next_level() == true` //////////////////////////////////////////////////////////////////////////// - label_t next_level() + label_type next_level() { return _ns.peek().uid().label(); } //////////////////////////////////////////////////////////////////////////// @@ -166,7 +166,7 @@ namespace adiar::internal /// /// \pre `has_current_level() == false` or `current_level() < level` //////////////////////////////////////////////////////////////////////////// - void setup_next_level(const label_t level) + void setup_next_level(const label_type level) { adiar_assert(!has_current_level() || current_level() < level); @@ -200,19 +200,19 @@ namespace adiar::internal /// \brief Whether there is any current level to access elements from. //////////////////////////////////////////////////////////////////////////// bool has_current_level() const - { return _curr_level != NO_LEVEL; } + { return _curr_level != no_level; } //////////////////////////////////////////////////////////////////////////// /// \brief The label of the current level. //////////////////////////////////////////////////////////////////////////// - label_t current_level() const + label_type current_level() const { return _curr_level; } //////////////////////////////////////////////////////////////////////////// /// \brief The width of the current level, i.e. the number of elements one /// can access to. //////////////////////////////////////////////////////////////////////////// - label_t current_width() const + label_type current_width() const { return _curr_width; } //////////////////////////////////////////////////////////////////////////// @@ -227,7 +227,7 @@ namespace adiar::internal /// /// \pre `idx < current_width()` //////////////////////////////////////////////////////////////////////////// - const node_t& at(id_t idx) const + const node_type& at(id_type idx) const { adiar_assert(idx < current_width()); return _level_buffer[idx]; @@ -236,12 +236,12 @@ namespace adiar::internal //////////////////////////////////////////////////////////////////////////// /// \brief Obtain the node with the given uid. //////////////////////////////////////////////////////////////////////////// - const node_t& at(uid_t u) const + const node_type& at(uid_type u) const { adiar_assert(u.label() == current_level()); // adiar_assert(... < current_width()); is in 'return at(...)' - return at(current_width() - ((uid_t::MAX_ID + 1u) - u.id())); + return at(current_width() - ((uid_type::max_id + 1u) - u.id())); } }; } diff --git a/src/adiar/internal/io/node_stream.h b/src/adiar/internal/io/node_stream.h index 888f7a3d8..003a8a4da 100644 --- a/src/adiar/internal/io/node_stream.h +++ b/src/adiar/internal/io/node_stream.h @@ -83,7 +83,7 @@ namespace adiar::internal /// /// \pre `can_pull() == true`. //////////////////////////////////////////////////////////////////////////// - const node seek(const node::uid_t &u) + const node seek(const node::uid_type &u) { return parent_t::_streams[0].seek(u); } }; } diff --git a/src/adiar/internal/io/node_writer.h b/src/adiar/internal/io/node_writer.h index 5e08e5ef6..fea13232c 100644 --- a/src/adiar/internal/io/node_writer.h +++ b/src/adiar/internal/io/node_writer.h @@ -2,6 +2,7 @@ #define ADIAR_INTERNAL_IO_NODE_WRITER_H #include +#include #include #include #include @@ -26,9 +27,9 @@ namespace adiar::internal node dummy() { // Notice, this goes around any of the consistency checks of 'node'! - return node(node::uid_t(0, 0), - node::ptr_t::NIL(), - node::ptr_t::NIL()); + return node(node::uid_type(0, 0), + node::pointer_type::nil(), + node::pointer_type::nil()); } //////////////////////////////////////////////////////////////////////////// @@ -57,11 +58,11 @@ namespace adiar::internal //////////////////////////////////////////////////////////////////////////// size_t _terminals_at_bottom[2] = { 0u, 0u }; - cut_size_t _max_1level_short_internal = 0u; - cut_size_t _curr_1level_short_internal = 0u; + cut::size_type _max_1level_short_internal = 0u; + cut::size_type _curr_1level_short_internal = 0u; - node::ptr_t _long_internal_ptr = node::ptr_t::NIL(); - cut_size_t _number_of_long_internal_arcs = 0u; + node::pointer_type _long_internal_ptr = node::pointer_type::nil(); + cut::size_type _number_of_long_internal_arcs = 0u; public: //////////////////////////////////////////////////////////////////////////// @@ -111,7 +112,7 @@ namespace adiar::internal _max_1level_short_internal = 0u; _curr_1level_short_internal = 0u; - _long_internal_ptr = node::ptr_t::NIL(); + _long_internal_ptr = node::pointer_type::nil(); _number_of_long_internal_arcs = 0u; } @@ -143,25 +144,25 @@ namespace adiar::internal _max_1level_short_internal = std::max(_max_1level_short_internal, _curr_1level_short_internal); - const cut_size_t max_1level_internal_cut = + const cut::size_type max_1level_internal_cut = _max_1level_short_internal + _number_of_long_internal_arcs; - _file_ptr->max_1level_cut[cut_type::INTERNAL] = max_1level_internal_cut; + _file_ptr->max_1level_cut[cut::Internal] = max_1level_internal_cut; const size_t terminals_above_bottom[2] = { _file_ptr->number_of_terminals[false] - _terminals_at_bottom[false], _file_ptr->number_of_terminals[true] - _terminals_at_bottom[true] }; - _file_ptr->max_1level_cut[cut_type::INTERNAL_FALSE] = + _file_ptr->max_1level_cut[cut::Internal_False] = std::max(max_1level_internal_cut + terminals_above_bottom[false], _file_ptr->number_of_terminals[false]); - _file_ptr->max_1level_cut[cut_type::INTERNAL_TRUE] = + _file_ptr->max_1level_cut[cut::Internal_True] = std::max(max_1level_internal_cut + terminals_above_bottom[true], _file_ptr->number_of_terminals[true]); - _file_ptr->max_1level_cut[cut_type::ALL] = + _file_ptr->max_1level_cut[cut::All] = std::max(max_1level_internal_cut + terminals_above_bottom[false] + terminals_above_bottom[true], _file_ptr->number_of_terminals[false] + _file_ptr->number_of_terminals[true]); } @@ -190,7 +191,7 @@ namespace adiar::internal } if (_latest_node == dummy()) { // First node pushed - _canonical = n.is_terminal() || n.id() == node::MAX_ID; + _canonical = n.is_terminal() || n.id() == node::max_id; if (n.is_terminal()) { _file_ptr->number_of_terminals[n.uid().value()]++; } @@ -209,7 +210,7 @@ namespace adiar::internal _canonical = id_diff && children_ordered; } else { - const bool id_reset = n.id() == node::MAX_ID; + const bool id_reset = n.id() == node::max_id; _canonical = id_reset; } } @@ -225,12 +226,12 @@ namespace adiar::internal _curr_1level_short_internal); _curr_1level_short_internal = 0u; - _long_internal_ptr = node::uid_t(_latest_node.label(), node::MAX_ID); + _long_internal_ptr = node::uid_type(_latest_node.label(), node::max_id); } } // 1-level cut - const bool is_pushing_to_bottom = _long_internal_ptr == node::ptr_t::NIL(); + const bool is_pushing_to_bottom = _long_internal_ptr == node::pointer_type::nil(); if (is_pushing_to_bottom && !n.is_terminal()) { _terminals_at_bottom[n.low().value()]++; _terminals_at_bottom[n.high().value()]++; @@ -345,21 +346,21 @@ namespace adiar::internal // ----------------------------------------------------------------------- // Upper bound for any directed cut based on number of internal nodes. - const cut_size_t max_cut = number_of_nodes < MAX_CUT // overflow? + const cut::size_type max_cut = number_of_nodes < cut::max // overflow? ? number_of_nodes + 1 - : MAX_CUT; + : cut::max; // ----------------------------------------------------------------------- // Upper bound on just 'all arcs'. This is better than 'max_cut' above, if // there are 'number_of_nodes' or more arcs to terminals. - const bool noa_overflow_safe = number_of_nodes <= MAX_CUT / 2u; + const bool noa_overflow_safe = number_of_nodes <= cut::max / 2u; const size_t number_of_arcs = 2u * number_of_nodes; const cuts_t all_arcs_cut = {{ - noa_overflow_safe ? number_of_arcs - number_of_false - number_of_true : MAX_CUT, - noa_overflow_safe ? number_of_arcs - number_of_true : MAX_CUT, - noa_overflow_safe ? number_of_arcs - number_of_false : MAX_CUT, - noa_overflow_safe ? number_of_arcs : MAX_CUT + noa_overflow_safe ? number_of_arcs - number_of_false - number_of_true : cut::max, + noa_overflow_safe ? number_of_arcs - number_of_true : cut::max, + noa_overflow_safe ? number_of_arcs - number_of_false : cut::max, + noa_overflow_safe ? number_of_arcs : cut::max }}; // ----------------------------------------------------------------------- @@ -367,15 +368,15 @@ namespace adiar::internal const bool is_terminal = number_of_false + number_of_true == 1; if (is_terminal) { - _file_ptr->max_1level_cut[cut_type::INTERNAL] = 0u; - _file_ptr->max_1level_cut[cut_type::INTERNAL_FALSE] = number_of_false; - _file_ptr->max_1level_cut[cut_type::INTERNAL_TRUE] = number_of_true; - _file_ptr->max_1level_cut[cut_type::ALL] = 1u; + _file_ptr->max_1level_cut[cut::Internal] = 0u; + _file_ptr->max_1level_cut[cut::Internal_False] = number_of_false; + _file_ptr->max_1level_cut[cut::Internal_True] = number_of_true; + _file_ptr->max_1level_cut[cut::All] = 1u; } else { - for(size_t ct = 0u; ct < CUT_TYPES; ct++) { + for(size_t ct = 0u; ct < cut::size; ct++) { // Use smallest sound upper bound. Since it is not a terminal, then there // must be at least one in-going arc to the root. - _file_ptr->max_1level_cut[ct] = std::max(1lu, std::min({ + _file_ptr->max_1level_cut[ct] = std::max(1lu, std::min({ _file_ptr->max_1level_cut[ct], max_cut, all_arcs_cut[ct] @@ -388,17 +389,17 @@ namespace adiar::internal const size_t number_of_levels = levelized_file_writer::levels(); if (is_terminal || number_of_nodes == number_of_levels) { - for(size_t ct = 0u; ct < CUT_TYPES; ct++) { + for(size_t ct = 0u; ct < cut::size; ct++) { _file_ptr->max_2level_cut[ct] = _file_ptr->max_1level_cut[ct]; } } else { // General case - for(size_t ct = 0u; ct < CUT_TYPES; ct++) { + for(size_t ct = 0u; ct < cut::size; ct++) { // Upper bound based on 1-level cut - const cut_size_t ub_from_1level_cut = - _file_ptr->max_1level_cut[ct] < MAX_CUT / 3u - ? ((_file_ptr->max_1level_cut[cut_type::INTERNAL] * 3u) / 2u - + (_file_ptr->max_1level_cut[ct] - _file_ptr->max_1level_cut[cut_type::INTERNAL])) - : MAX_CUT; + const cut::size_type ub_from_1level_cut = + _file_ptr->max_1level_cut[ct] < cut::max / 3u + ? ((_file_ptr->max_1level_cut[cut::Internal] * 3u) / 2u + + (_file_ptr->max_1level_cut[ct] - _file_ptr->max_1level_cut[cut::Internal])) + : cut::max; // Use smallest sound upper bound. _file_ptr->max_2level_cut[ct] = std::min({ @@ -413,14 +414,14 @@ namespace adiar::internal void max_cut(cuts_t &c, const cuts_t &o) { - for(size_t ct = 0u; ct < CUT_TYPES; ct++) { + for(size_t ct = 0u; ct < cut::size; ct++) { c[ct] = std::max(c[ct], o[ct]); } } void inc_cut(cuts_t &c, const cuts_t &o) { - for(size_t ct = 0u; ct < CUT_TYPES; ct++) { + for(size_t ct = 0u; ct < cut::size; ct++) { c[ct] += o[ct]; } } diff --git a/src/adiar/internal/io/shared_file_ptr.h b/src/adiar/internal/io/shared_file_ptr.h index 8dd84724d..5bb4d5d12 100644 --- a/src/adiar/internal/io/shared_file_ptr.h +++ b/src/adiar/internal/io/shared_file_ptr.h @@ -24,19 +24,19 @@ namespace adiar::internal /// /// \param file_type The type of the underlying file ////////////////////////////////////////////////////////////////////////////// - template - class shared_file_ptr : public shared_ptr + template + class shared_file_ptr : public shared_ptr { public: //////////////////////////////////////////////////////////////////////////// /// \brief Type of the file object. //////////////////////////////////////////////////////////////////////////// - typedef file_type file_t; + using file_type = file_t; //////////////////////////////////////////////////////////////////////////// /// \brief Type of the file's elements. //////////////////////////////////////////////////////////////////////////// - typedef typename file_t::elem_t elem_t; + using value_type = typename file_type::value_type; public: //////////////////////////////////////////////////////////////////////////// @@ -141,47 +141,47 @@ namespace adiar::internal ////////////////////////////////////////////////////////////////////////////// /// \brief Shared ownership of a file containing elements of the given type. ////////////////////////////////////////////////////////////////////////////// - template - using shared_file = shared_file_ptr>; + template + using shared_file = shared_file_ptr>; ////////////////////////////////////////////////////////////////////////////// /// \brief Creates a new (temporary) file with shared ownership. ////////////////////////////////////////////////////////////////////////////// - template - inline shared_file make_shared_file() { - return adiar::make_shared>(); + template + inline shared_file make_shared_file() { + return adiar::make_shared>(); } ////////////////////////////////////////////////////////////////////////////// /// \brief Open a persisted file with shared ownership. ////////////////////////////////////////////////////////////////////////////// - template - inline shared_file make_shared_file(const std::string &p) { - return adiar::make_shared>(p); + template + inline shared_file make_shared_file(const std::string &p) { + return adiar::make_shared>(p); } ////////////////////////////////////////////////////////////////////////////// /// \brief Shared ownership of a levelized file. ////////////////////////////////////////////////////////////////////////////// - template - using shared_levelized_file = shared_file_ptr>; + template + using shared_levelized_file = shared_file_ptr>; ////////////////////////////////////////////////////////////////////////////// /// \brief Creates a new (temporary) levelized file with shared ownership. ////////////////////////////////////////////////////////////////////////////// - template - inline shared_levelized_file + template + inline shared_levelized_file make_shared_levelized_file() { - return adiar::make_shared>(); + return adiar::make_shared>(); } ////////////////////////////////////////////////////////////////////////////// /// \brief Open a persisted file with shared ownership. ////////////////////////////////////////////////////////////////////////////// - template - inline shared_levelized_file + template + inline shared_levelized_file make_shared_levelized_file(const std::string &p) { - return adiar::make_shared>(p); + return adiar::make_shared>(p); } } diff --git a/src/adiar/internal/util.h b/src/adiar/internal/util.h index 2952f9027..b5e430dee 100644 --- a/src/adiar/internal/util.h +++ b/src/adiar/internal/util.h @@ -1,52 +1,81 @@ #ifndef ADIAR_INTERNAL_UTIL_H #define ADIAR_INTERNAL_UTIL_H +#include + #include #include #include #include #include +#include +#include #include #include - -// TODO: remove these imports #include #include -#include #include namespace adiar::internal { //////////////////////////////////////////////////////////////////////////// - /// \brief Template to hide how to extra the level from a certain data type. + /// \brief Template to hide how to obtain the level from a data type. //////////////////////////////////////////////////////////////////////////// template - inline ptr_uint64::label_t - __level_of(const T& t) - { return t.level(); } + inline ptr_uint64::label_type + level_of(const T& t) + { + if constexpr (std::is_integral::value) { + return t; + } else { + return t.level(); + } + } + + ////////////////////////////////////////////////////////////////////////////// + /// \brief Defines at compile time the type of the file stream to use for + /// reading the levels from some file(s). + ////////////////////////////////////////////////////////////////////////////// + template + struct level_stream_t + { + template + using stream_t = level_info_stream; + }; + + template<> + struct level_stream_t> + { + template + using stream_t = file_stream; + }; template<> - inline ptr_uint64::label_t - __level_of(const ptr_uint64::label_t& l) - { return l; } + struct level_stream_t> + { + template + using stream_t = file_stream; + }; //////////////////////////////////////////////////////////////////////////// /// \brief Obtain whether the levels in two files are disjoint. //////////////////////////////////////////////////////////////////////////// - // TODO: Move to dd_func - template, - typename in2_t = dd, typename stream2_t = level_info_stream<>> + // TODO: Move to dd_func? + template bool disjoint_levels(const in1_t &in1, const in2_t &in2) { + using stream1_t = typename level_stream_t::template stream_t; stream1_t s1(in1); + + using stream2_t = typename level_stream_t::template stream_t; stream2_t s2(in2); while(s1.can_pull() && s2.can_pull()) { - if (__level_of<>(s1.peek()) == __level_of<>(s2.peek())) { + if (level_of(s1.peek()) == level_of(s2.peek())) { return false; - } else if (__level_of<>(s1.peek()) < __level_of<>(s2.peek())) { + } else if (level_of(s1.peek()) < level_of(s2.peek())) { s1.pull(); } else { s2.pull(); @@ -58,10 +87,10 @@ namespace adiar::internal //////////////////////////////////////////////////////////////////////////// /// \brief Whether a certain level exists in a file. //////////////////////////////////////////////////////////////////////////// - // TODO: Move to dd_func + // TODO: Move to dd_func? template bool - has_level(const dd_t &in, const typename dd_t::label_t l) + has_level(const dd_t &in, const typename dd_t::label_type l) { level_info_stream<> in_meta(in); while(in_meta.can_pull()) { @@ -89,9 +118,8 @@ namespace adiar::internal /// /// \see reduce //////////////////////////////////////////////////////////////////////////// - // TODO: Move to dd_func template - inline shared_levelized_file + shared_levelized_file transpose(const dd_t &dd) { adiar_assert(!dd->is_terminal()); @@ -103,7 +131,7 @@ namespace adiar::internal { // Split every node into their arcs. node_stream ns(dd); while (ns.can_pull()) { - const typename dd_t::node_t n = ns.pull(); + const typename dd_t::node_type n = ns.pull(); // TODO (non-binary nodes): aw << low_arc_of(n); @@ -111,7 +139,7 @@ namespace adiar::internal } } { // Copy over meta information - af->max_1level_cut = dd->max_1level_cut[cut_type::INTERNAL]; + af->max_1level_cut = dd->max_1level_cut[cut::Internal]; level_info_stream<> lis(dd); while (lis.can_pull()) { @@ -121,7 +149,7 @@ namespace adiar::internal } // Sort internal arcs by their target - af->sort(file_traits::IDX__INTERNAL); + af->sort(file_traits::idx__internal); return af; } } diff --git a/src/adiar/memory_mode.cpp b/src/adiar/memory_mode.cpp index 97017c60d..db0bd5f1d 100644 --- a/src/adiar/memory_mode.cpp +++ b/src/adiar/memory_mode.cpp @@ -2,5 +2,5 @@ namespace adiar { - memory_mode_t memory_mode = memory_mode_t::AUTO; + memory_mode_t memory_mode = memory_mode_t::Auto; } diff --git a/src/adiar/memory_mode.h b/src/adiar/memory_mode.h index c230a9d8f..3624f1b58 100644 --- a/src/adiar/memory_mode.h +++ b/src/adiar/memory_mode.h @@ -26,14 +26,14 @@ namespace adiar /// \details /// | Enum Value | Effect | /// |------------|------------------------------------------------| - /// | `AUTO` | Automatically decide on type of memory to use. | - /// | `INTERNAL` | Always use *internal* memory. | - /// | `EXTERNAL` | Always use *external* memory. | + /// | `Auto` | Automatically decide on type of memory to use. | + /// | `Internal` | Always use *internal* memory. | + /// | `External` | Always use *external* memory. | ////////////////////////////////////////////////////////////////////////////// - enum class memory_mode_t { AUTO, INTERNAL, EXTERNAL }; + enum class memory_mode_t { Auto, Internal, External }; ////////////////////////////////////////////////////////////////////////////// - /// \brief The current memory mode (default: `AUTO`). + /// \brief The current memory mode (default: `Auto`). /// /// \details /// If you want to force *Adiar* to a specific memory mode then you should set the @@ -41,10 +41,10 @@ namespace adiar /// example, one can force *Adiar* always use internal memory with the /// following piece of code. /// ```cpp - /// adiar::memory_mode = adiar::memory_mode_t::INTERNAL + /// adiar::memory_mode = adiar::memory_mode_t::Internal /// ``` /// - /// \warning Using `INTERNAL` may lead to crashes if an input or output is + /// \warning Using `Internal` may lead to crashes if an input or output is /// too large! ////////////////////////////////////////////////////////////////////////////// extern memory_mode_t memory_mode; diff --git a/src/adiar/quantify_mode.cpp b/src/adiar/quantify_mode.cpp index bd66dfeed..d7f35c125 100644 --- a/src/adiar/quantify_mode.cpp +++ b/src/adiar/quantify_mode.cpp @@ -2,5 +2,5 @@ namespace adiar { - quantify_mode_t quantify_mode = quantify_mode_t::AUTO; + quantify_mode_t quantify_mode = quantify_mode_t::Auto; } diff --git a/src/adiar/quantify_mode.h b/src/adiar/quantify_mode.h index 621859d64..5ded68929 100644 --- a/src/adiar/quantify_mode.h +++ b/src/adiar/quantify_mode.h @@ -22,20 +22,20 @@ namespace adiar /// \details /// | Enum Value | Effect | /// |-------------|-------------------------------------------------------| - /// | `AUTO` | Automatically decide on the approach to use. | - /// | `NESTED` | Use the *nested sweeping* framework. | - /// | `PARTIAL` | Use repeated *partial quantification*. | - /// | `SINGLETON` | Quantify each variable *independently* one at a time. | + /// | `Auto` | Automatically decide on the approach to use. | + /// | `Nested` | Use the *nested sweeping* framework. | + /// | `Partial` | Use repeated *partial quantification*. | + /// | `Singleton` | Quantify each variable *independently* one at a time. | /// /// \remark Not all approaches can apply to each algorithm. If the desired /// approach does not apply, then an approach that is *less* than it - /// is used instead, e.g. if `PARTIAL` is picked but not possible then + /// is used instead, e.g. if `Partial` is picked but not possible then /// `INDIVIDUAL` is used. ////////////////////////////////////////////////////////////////////////////// - enum class quantify_mode_t { AUTO, NESTED, PARTIAL, SINGLETON }; + enum class quantify_mode_t { Auto, Nested, Partial, Singleton }; ////////////////////////////////////////////////////////////////////////////// - /// \brief The current quantification mode (default: `AUTO`). + /// \brief The current quantification mode (default: `Auto`). /// /// \details /// If you want to force *Adiar* to a specific quantify approach then you @@ -43,7 +43,7 @@ namespace adiar /// above four values. For example, one can force *Adiar* always use nested /// sweeping with the following piece of code. /// ```cpp - /// adiar::quantify_mode = adiar::quantify_mode_t::NESTED + /// adiar::quantify_mode = adiar::quantify_mode_t::Nested /// ``` ////////////////////////////////////////////////////////////////////////////// extern quantify_mode_t quantify_mode; diff --git a/src/adiar/statistics.cpp b/src/adiar/statistics.cpp index 609359b56..7bf62539a 100644 --- a/src/adiar/statistics.cpp +++ b/src/adiar/statistics.cpp @@ -17,7 +17,11 @@ namespace adiar { - stats_t adiar_stats() + // TODO: Move ownership of statistics object into `statistics.cpp`. This way, + // statistics do not need to be recompiled every time an algorithm is + // changed. + + statistics statistics_get() { #ifndef ADIAR_STATS std::cerr << "Statistics not gathered. Please compile with 'ADIAR_STATS'" << std::endl; @@ -48,7 +52,7 @@ namespace adiar }; } - void adiar_statsreset() + void statistics_reset() { // i/o internal::stats_arc_file = {}; @@ -160,7 +164,7 @@ namespace adiar indent_level--; } - void __printstat_lpq(std::ostream &o, const stats_t::levelized_priority_queue_t& stats) + void __printstat_lpq(std::ostream &o, const statistics::levelized_priority_queue_t& stats) { if (indent_level == 0) { o << indent << bold_on << "Levelized Priority Queue" << bold_off << endl; @@ -203,7 +207,7 @@ namespace adiar } - void __printstat_alg_base(std::ostream &o, const stats_t::__alg_base& stats) + void __printstat_alg_base(std::ostream &o, const statistics::__alg_base& stats) { o << indent << bold_on << "levelized priority queue" << bold_off << endl; @@ -546,7 +550,7 @@ namespace adiar } - void adiar_printstat(std::ostream &o) + void statistics_print(std::ostream &o) { o << bold_on << "Adiar statistics" << bold_off << endl; o << endl; diff --git a/src/adiar/statistics.h b/src/adiar/statistics.h index 4d599994f..ab0719e60 100644 --- a/src/adiar/statistics.h +++ b/src/adiar/statistics.h @@ -31,7 +31,7 @@ namespace adiar /// with actual statistics if Adiar is compiled with the `ADIAR_STATS` /// CMake variable set to `ON`. ////////////////////////////////////////////////////////////////////////////// - struct stats_t + struct statistics { //////////////////////////////////////////////////////////////////////////// // I/O @@ -488,23 +488,23 @@ namespace adiar ////////////////////////////////////////////////////////////////////////////// /// \brief Obtain a copy of all statistics gathered. /// - /// \copydoc stats_t + /// \copydoc statistics ////////////////////////////////////////////////////////////////////////////// - stats_t adiar_stats(); + statistics statistics_get(); ////////////////////////////////////////////////////////////////////////////// /// \brief Print statistics to an output stream (default `std::cout`). /// - /// \copydoc stats_t + /// \copydoc statistics ////////////////////////////////////////////////////////////////////////////// - void adiar_printstat(std::ostream &o = std::cout); + void statistics_print(std::ostream &o = std::cout); ////////////////////////////////////////////////////////////////////////////// /// \brief Resets all statistics to default value. /// - /// \see stats_t + /// \see statistics ////////////////////////////////////////////////////////////////////////////// - void adiar_statsreset(); + void statistics_reset(); /// \} ////////////////////////////////////////////////////////////////////////////// diff --git a/src/adiar/zdd.h b/src/adiar/zdd.h index 794814590..757c780f4 100644 --- a/src/adiar/zdd.h +++ b/src/adiar/zdd.h @@ -22,8 +22,6 @@ #include #include -#include - namespace adiar { ////////////////////////////////////////////////////////////////////////////// @@ -68,13 +66,15 @@ namespace adiar /// /// \param var The variable to be forced to true. /// - /// \param dom Generator function of the domain in *descending* order. + /// \param dom Generator function of the domain in *descending* order. When + /// none are left, it must return a value greater than + /// `zdd::max_label`. /// /// \pre The variable `var` should occur in `dom`. /// /// \throws invalid_argument If `dom` is not in *descending* order. ////////////////////////////////////////////////////////////////////////////// - zdd zdd_ithvar(zdd::label_t var, const generator &dom); + zdd zdd_ithvar(zdd::label_type var, const generator &dom); ////////////////////////////////////////////////////////////////////////////// /// \brief The set of bitvectors over a given domain where *var* is set to @@ -92,10 +92,8 @@ namespace adiar /// *descending* order. ////////////////////////////////////////////////////////////////////////////// template - zdd zdd_ithvar(zdd::label_t var, IT begin, IT end) - { - return zdd_ithvar(var, make_generator(begin, end)); - } + zdd zdd_ithvar(zdd::label_type var, IT begin, IT end) + { return zdd_ithvar(var, make_generator(begin, end)); } ////////////////////////////////////////////////////////////////////////////// /// \brief The set of bitvectors over the globally set domain where *var* @@ -103,10 +101,10 @@ namespace adiar /// /// \param var The variable to be forced to true. /// - /// \pre `adiar_has_domain() == true` and the variable `var` should + /// \pre `domain_isset() == true` and the variable `var` should /// occur in the global domain. ////////////////////////////////////////////////////////////////////////////// - zdd zdd_ithvar(zdd::label_t var); + zdd zdd_ithvar(zdd::label_type var); ////////////////////////////////////////////////////////////////////////////// /// \brief The set of bitvectors over a given domain where *var* is set to @@ -118,13 +116,15 @@ namespace adiar /// /// \param var The variable to be forced to false. /// - /// \param dom Generator function of the domain in *descending* order. + /// \param dom Generator function of the domain in *descending* order. When + /// none are left, it must return a value greater than + /// `zdd::max_label`. /// /// \pre The variable `var` should occur in `dom`. /// /// \throws invalid_argument If `dom` is not in *descending* order. ////////////////////////////////////////////////////////////////////////////// - zdd zdd_nithvar(zdd::label_t var, const generator &dom); + zdd zdd_nithvar(zdd::label_type var, const generator &dom); ////////////////////////////////////////////////////////////////////////////// /// \brief The set of bitvectors over a given domain where *var* is set @@ -142,10 +142,8 @@ namespace adiar /// *descending* order. ////////////////////////////////////////////////////////////////////////////// template - zdd zdd_nithvar(zdd::label_t var, IT begin, IT end) - { - return zdd_nithvar(var, make_generator(begin, end)); - } + zdd zdd_nithvar(zdd::label_type var, IT begin, IT end) + { return zdd_nithvar(var, make_generator(begin, end)); } ////////////////////////////////////////////////////////////////////////////// /// \brief The set of bitvectors over the globally set domain where *var* @@ -153,10 +151,10 @@ namespace adiar /// /// \param var The variable to be forced to false. /// - /// \pre `adiar_has_domain() == true` and the variable `var` should + /// \pre `domain_isset() == true` and the variable `var` should /// occur in the global domain. ////////////////////////////////////////////////////////////////////////////// - zdd zdd_nithvar(zdd::label_t var); + zdd zdd_nithvar(zdd::label_type var); ////////////////////////////////////////////////////////////////////////////// /// \brief The family { { 1, 2, ..., k } }. @@ -165,10 +163,12 @@ namespace adiar /// true child, and false otherwise. /// /// \param vars Generator function of the variables in *descending* order. + /// When none are left, it must return a value greater than + /// `zdd::max_label`. /// /// \throws invalid_argument If `vars` are not in *descending* order. ////////////////////////////////////////////////////////////////////////////// - zdd zdd_vars(const generator &vars); + zdd zdd_vars(const generator &vars); ////////////////////////////////////////////////////////////////////////////// /// \brief The family { { 1, 2, ..., k } }. @@ -182,22 +182,20 @@ namespace adiar ////////////////////////////////////////////////////////////////////////////// template zdd zdd_vars(IT begin, IT end) - { - return zdd_vars(make_generator(begin, end)); - } + { return zdd_vars(make_generator(begin, end)); } ////////////////////////////////////////////////////////////////////////////// /// \brief The family { {i} } . /// /// \details Creates a ZDD of a single node with label `var` and the /// children false and true. The given label must be smaller than - /// `zdd::MAX_LABEL`. + /// `zdd::max_label`. /// /// \param var The label of the desired variable to include /// /// \throws invalid_argument If `var` is a too large value. ////////////////////////////////////////////////////////////////////////////// - zdd zdd_singleton(zdd::label_t var); + zdd zdd_singleton(zdd::label_type var); ////////////////////////////////////////////////////////////////////////////// /// \brief The family { {1}, {2}, ..., {k} }. @@ -206,10 +204,12 @@ namespace adiar /// true child, and false otherwise. /// /// \param vars Generator function of the variables in *descending* order. + /// When none are left, it must return a value greater than + /// `zdd::max_label`. /// /// \throws invalid_argument If `vars` are not in *descending* order. ////////////////////////////////////////////////////////////////////////////// - zdd zdd_singletons(const generator &vars); + zdd zdd_singletons(const generator &vars); ////////////////////////////////////////////////////////////////////////////// /// \brief The family { {1}, {2}, ..., {k} }. @@ -223,9 +223,7 @@ namespace adiar ////////////////////////////////////////////////////////////////////////////// template zdd zdd_singletons(IT begin, IT end) - { - return zdd_singletons(make_generator(begin, end)); - } + { return zdd_singletons(make_generator(begin, end)); } ////////////////////////////////////////////////////////////////////////////// /// \brief The powerset of all given variables. @@ -234,10 +232,12 @@ namespace adiar /// child. /// /// \param vars Generator function of the variables in *descending* order. + /// When none are left, it must return a value greater than + /// `zdd::max_label`. /// /// \throws invalid_argument If `vars` are not in *ascending* order. ////////////////////////////////////////////////////////////////////////////// - zdd zdd_powerset(const generator &vars); + zdd zdd_powerset(const generator &vars); ////////////////////////////////////////////////////////////////////////////// /// \brief The powerset of all given variables. @@ -251,19 +251,18 @@ namespace adiar ////////////////////////////////////////////////////////////////////////////// template zdd zdd_powerset(IT begin, IT end) - { - return zdd_powerset(make_generator(begin, end)); - } + { return zdd_powerset(make_generator(begin, end)); } ////////////////////////////////////////////////////////////////////////////// /// \brief Bottom of the powerset lattice. /// /// \param vars Generator function of the variables in *descending* order. + /// When none are left, it must return a value greater than + /// `zdd::max_label`. /// /// \see zdd_empty ////////////////////////////////////////////////////////////////////////////// - inline zdd zdd_bot(const generator &/*dom*/) - { return zdd_empty(); } + zdd zdd_bot(const generator &dom); ////////////////////////////////////////////////////////////////////////////// /// \brief Bottom of the powerset lattice. @@ -275,16 +274,15 @@ namespace adiar /// \see zdd_empty ////////////////////////////////////////////////////////////////////////////// template - inline zdd zdd_bot(IT /*begin*/, IT /*end*/) - { return zdd_empty(); } + inline zdd zdd_bot(IT begin, IT end) + { return zdd_bot(make_generator(begin, end)); } ////////////////////////////////////////////////////////////////////////////// /// \brief Bottom of the powerset lattice. /// /// \see zdd_empty ////////////////////////////////////////////////////////////////////////////// - inline zdd zdd_bot() - { return zdd_empty(); } + zdd zdd_bot(); ////////////////////////////////////////////////////////////////////////////// /// \brief Top of the powerset lattice. @@ -293,8 +291,7 @@ namespace adiar /// /// \see zdd_powerset, zdd_null ////////////////////////////////////////////////////////////////////////////// - inline zdd zdd_top(const generator &dom) - { return zdd_powerset(dom); } + zdd zdd_top(const generator &dom); ////////////////////////////////////////////////////////////////////////////// /// \brief Top of the powerset lattice. @@ -307,7 +304,7 @@ namespace adiar ////////////////////////////////////////////////////////////////////////////// template inline zdd zdd_top(IT begin, IT end) - { return zdd_powerset(begin, end); } + { return zdd_top(make_generator(begin, end)); } ////////////////////////////////////////////////////////////////////////////// /// \brief Top of the powerset lattice. @@ -407,11 +404,13 @@ namespace adiar /// \param A ZDD to apply with the other. /// /// \param vars Generator function of labels to flip in *ascending* order. + /// When none are left, it must return a value greater than + /// `zdd::max_label`. /// /// \returns /// \f$ \{ \mathit{vars} \Delta a \mid a \in A \} \f$ ////////////////////////////////////////////////////////////////////////////// - __zdd zdd_change(const zdd &A, const generator &vars); + __zdd zdd_change(const zdd &A, const generator &vars); ////////////////////////////////////////////////////////////////////////////// /// \brief The symmetric difference between each set in the family and @@ -428,9 +427,7 @@ namespace adiar ////////////////////////////////////////////////////////////////////////////// template __zdd zdd_change(const zdd &A, IT begin, IT end) - { - return zdd_change(A, make_generator(begin, end)); - } + { return zdd_change(A, make_generator(begin, end)); } ////////////////////////////////////////////////////////////////////////////// /// \brief Complement of A within the given domain. @@ -441,7 +438,7 @@ namespace adiar /// /// \returns \f$ 2^{\mathit{dom}} \setminus A \f$ ////////////////////////////////////////////////////////////////////////////// - __zdd zdd_complement(const zdd &A, const generator &dom); + __zdd zdd_complement(const zdd &A, const generator &dom); ////////////////////////////////////////////////////////////////////////////// /// \brief Complement of A within the given domain. @@ -465,7 +462,7 @@ namespace adiar /// /// \returns \f$ 2^{\mathit{dom}} \setminus A \f$ /// - /// \see adiar_set_domain adiar_has_domain + /// \see domain_set domain_isset /// /// \pre The global \ref module__domain is set to a set of variables /// that is equals to or a superset of the variables in `A`. @@ -490,13 +487,14 @@ namespace adiar /// /// \param A Family of set to expand /// - /// \param vars Generator function of labels to expand with (in ascending - /// order). This set of labels may \em not occur in A + /// \param vars Generator function of labels to expand with in *ascending* + /// order. When none are left, it must return a value greater than + /// `zdd::max_label`. This set of labels may \em not occur in A. /// /// \returns /// \f$ \bigcup_{a \in A, i \in 2^{vars}} (a \cup i) \f$ ////////////////////////////////////////////////////////////////////////////// - __zdd zdd_expand(const zdd &A, const generator &vars); + __zdd zdd_expand(const zdd &A, const generator &vars); ////////////////////////////////////////////////////////////////////////////// /// \brief Expands the domain of the given ZDD to also include the given @@ -524,12 +522,13 @@ namespace adiar /// \param A Family of set /// /// \param vars Generator function of the variable labels to filter on in - /// *ascending* order. + /// *ascending* order. When none are left, it must return a value + /// greater than `zdd::max_label`. /// /// \returns /// \f$ \{ a \in A \mid \forall i \in \mathit{vars} : i \not\in a \} \f$ ////////////////////////////////////////////////////////////////////////////// - __zdd zdd_offset(const zdd &A, const generator &vars); + __zdd zdd_offset(const zdd &A, const generator &vars); ////////////////////////////////////////////////////////////////////////////// /// \brief Subset that do \em not include the given set of variables. @@ -553,12 +552,13 @@ namespace adiar /// \param A Family of set /// /// \param vars Generator function of the variable labels to filter on in - /// *ascending* order. + /// *ascending* order. When none are left, it must return a value + /// greater than `zdd::max_label`. /// /// \returns /// \f$ \{ a \in A \mid \forall i \in \mathit{vars} : i \in a \} \f$ ////////////////////////////////////////////////////////////////////////////// - __zdd zdd_onset(const zdd &A, const generator &vars); + __zdd zdd_onset(const zdd &A, const generator &vars); ////////////////////////////////////////////////////////////////////////////// /// \brief Subset that \em do include the given set of variables. @@ -587,10 +587,10 @@ namespace adiar /// \returns /// \f$ \prod_{\mathit{dom}}(A) = \{ a \setminus \mathit{dom}^c \mid a \in A \} \f$ ////////////////////////////////////////////////////////////////////////////// - __zdd zdd_project(const zdd &A, const predicate &dom); + __zdd zdd_project(const zdd &A, const predicate &dom); /// \cond - __zdd zdd_project(zdd &&A, const predicate &dom); + __zdd zdd_project(zdd &&A, const predicate &dom); /// \endcond ////////////////////////////////////////////////////////////////////////////// @@ -601,15 +601,15 @@ namespace adiar /// /// \param gen Generator function, that produces the variables of the domain in /// *descending* order. When none are left to-be quantified, it - /// returns a value larger than `bdd::MAX_LABEL`, e.g. -1. + /// returns a value larger than `zdd::max_label`, e.g. -1. /// /// \returns /// \f$ \prod_{\mathit{dom}}(A) = \{ a \setminus \mathit{dom}^c \mid a \in A \} \f$ ////////////////////////////////////////////////////////////////////////////// - __zdd zdd_project(const zdd &A, const generator &dom); + __zdd zdd_project(const zdd &A, const generator &dom); /// \cond - __zdd zdd_project(zdd &&A, const generator &dom); + __zdd zdd_project(zdd &&A, const generator &dom); /// \endcond ////////////////////////////////////////////////////////////////////////////// @@ -644,40 +644,36 @@ namespace adiar /// \{ ////////////////////////////////////////////////////////////////////////////// - /// \copydoc adiar::internal::is_canonical + /// \brief Check whether a given ZDD is canonical. + /// + /// \copydetails adiar::internal::dd_iscanonical ////////////////////////////////////////////////////////////////////////////// - inline bool is_canonical(const zdd& A) - { return internal::is_canonical(A); } + bool zdd_iscanonical(const zdd& A); ////////////////////////////////////////////////////////////////////////////// /// \brief Whether this ZDD represents a terminal. ////////////////////////////////////////////////////////////////////////////// - inline bool is_terminal(const zdd& A) - { return internal::is_terminal(A); } + bool zdd_isterminal(const zdd& A); ////////////////////////////////////////////////////////////////////////////// /// \brief Whether this ZDD represents false terminal. ////////////////////////////////////////////////////////////////////////////// - inline bool is_false(const zdd& A) - { return internal::is_false(A); } + bool zdd_isfalse(const zdd& A); ////////////////////////////////////////////////////////////////////////////// /// \brief Whether it is the empty family, i.e. Ø . ////////////////////////////////////////////////////////////////////////////// - inline bool is_empty(const zdd &A) - { return is_false(A); } + bool zdd_isempty(const zdd &A); ////////////////////////////////////////////////////////////////////////////// /// \brief Whether this BDD represents true terminal. ////////////////////////////////////////////////////////////////////////////// - inline bool is_true(const zdd& A) - { return internal::is_true(A); } + bool zdd_istrue(const zdd& A); ////////////////////////////////////////////////////////////////////////////// /// \brief Whether it is the null family, i.e. { Ø } . ////////////////////////////////////////////////////////////////////////////// - inline bool is_null(const zdd &A) - { return is_true(A); } + bool zdd_isnull(const zdd &A); ////////////////////////////////////////////////////////////////////////////// /// \brief Whether they represent the same family. @@ -698,8 +694,7 @@ namespace adiar ////////////////////////////////////////////////////////////////////////////// /// \brief Whether they represent two different families. ////////////////////////////////////////////////////////////////////////////// - inline bool zdd_unequal(const zdd &A, const zdd &B) - { return !zdd_equal(A,B); }; + bool zdd_unequal(const zdd &A, const zdd &B); ////////////////////////////////////////////////////////////////////////////// /// \see zdd_unequal @@ -742,8 +737,7 @@ namespace adiar ////////////////////////////////////////////////////////////////////////////// /// \brief Whether one family is a strict subset of the other. ////////////////////////////////////////////////////////////////////////////// - inline bool zdd_subset(const zdd &A, const zdd &B) - { return zdd_subseteq(A,B) && zdd_unequal(A,B); }; + bool zdd_subset(const zdd &A, const zdd &B); ////////////////////////////////////////////////////////////////////////////// /// \see zdd_subset @@ -790,7 +784,7 @@ namespace adiar /// \brief The number of variables that exist in the family of sets, i.e. the /// number of levels in the ZDD. ////////////////////////////////////////////////////////////////////////////// - zdd::label_t zdd_varcount(const zdd &A); + zdd::label_type zdd_varcount(const zdd &A); ////////////////////////////////////////////////////////////////////////////// /// \brief The number of sets in the family of sets. @@ -808,25 +802,24 @@ namespace adiar ////////////////////////////////////////////////////////////////////////////// /// \brief Get the minimal occurring variable in this ZDD. ////////////////////////////////////////////////////////////////////////////// - inline zdd::label_t min_var(const zdd &A) - { return internal::min_var(A); } + zdd::label_type zdd_minvar(const zdd &A); ////////////////////////////////////////////////////////////////////////////// /// \brief Get the maximal occurring variable in this ZDD. ////////////////////////////////////////////////////////////////////////////// - inline zdd::label_t max_var(const zdd &A) - { return internal::max_var(A); } + zdd::label_type zdd_maxvar(const zdd &A); ////////////////////////////////////////////////////////////////////////////// /// \brief Whether the family includes the given set of labels /// /// \param A Set of interest /// - /// \param a Generator of a bit-vector in *ascending* order. + /// \param a Generator of a bit-vector in *ascending* order. When none are left, + /// it must return a value greater than `zdd::max_label`. /// /// \returns Whether \f$ a \in A \f$ ////////////////////////////////////////////////////////////////////////////// - bool zdd_contains(const zdd &A, const generator &a); + bool zdd_contains(const zdd &A, const generator &a); ////////////////////////////////////////////////////////////////////////////// /// \brief Whether the family includes the given set of labels @@ -860,7 +853,7 @@ namespace adiar /// /// \pre `A != zdd_empty()` ////////////////////////////////////////////////////////////////////////////// - void zdd_minelem(const zdd &A, const consumer &cb); + void zdd_minelem(const zdd &A, const consumer &cb); ////////////////////////////////////////////////////////////////////////////// // TODO: Iterator-based output @@ -885,7 +878,7 @@ namespace adiar /// /// \pre `A != zdd_empty()` ////////////////////////////////////////////////////////////////////////////// - void zdd_maxelem(const zdd &A, const consumer &cb); + void zdd_maxelem(const zdd &A, const consumer &cb); ////////////////////////////////////////////////////////////////////////////// // TODO: Iterator-based output @@ -900,7 +893,7 @@ namespace adiar /// /// \param cb Callback function that consumes the levels in *ascending* order. ////////////////////////////////////////////////////////////////////////////// - void zdd_varprofile(const zdd &A, const consumer &cb); + void zdd_varprofile(const zdd &A, const consumer &cb); ////////////////////////////////////////////////////////////////////////////// /// \brief Write the labels of the ZDD's levels into the given container. @@ -937,12 +930,13 @@ namespace adiar /// /// \param f Boolean function with the given domain /// - /// \param dom Domain of all variables in *ascending* order. + /// \param dom Domain of all variables in *ascending* order. When none are + /// left it must return a value greater than `zdd::max_label`. /// /// \returns ZDD that is true for the exact same assignments to variables in /// the given domain. ////////////////////////////////////////////////////////////////////////////// - __zdd zdd_from(const bdd &f, const generator &dom); + __zdd zdd_from(const bdd &f, const generator &dom); ////////////////////////////////////////////////////////////////////////////// /// \brief Obtains the ZDD that represents the same function/set as the diff --git a/src/adiar/zdd/binop.cpp b/src/adiar/zdd/binop.cpp index 8f969a884..425a37fee 100644 --- a/src/adiar/zdd/binop.cpp +++ b/src/adiar/zdd/binop.cpp @@ -4,15 +4,16 @@ #include #include +#include #include #include namespace adiar { - bool can_left_shortcut_zdd(const bool_op &op, const zdd::ptr_t &terminal) + bool can_left_shortcut_zdd(const bool_op &op, const zdd::pointer_type &terminal) { - zdd::ptr_t terminal_F = zdd::ptr_t(false); - zdd::ptr_t terminal_T = zdd::ptr_t(true); + zdd::pointer_type terminal_F = zdd::pointer_type(false); + zdd::pointer_type terminal_T = zdd::pointer_type(true); return // Does it shortcut on this level? op(terminal, terminal_F) == terminal_F && op(terminal, terminal_T) == terminal_F @@ -20,10 +21,10 @@ namespace adiar && op(terminal_F, terminal_F) == terminal_F && op(terminal_F, terminal_T) == terminal_F; } - bool can_right_shortcut_zdd(const bool_op &op, const zdd::ptr_t &terminal) + bool can_right_shortcut_zdd(const bool_op &op, const zdd::pointer_type &terminal) { - zdd::ptr_t terminal_F = zdd::ptr_t(false); - zdd::ptr_t terminal_T = zdd::ptr_t(true); + zdd::pointer_type terminal_F = zdd::pointer_type(false); + zdd::pointer_type terminal_T = zdd::pointer_type(true); return // Does it shortcut on this level? op(terminal_F, terminal) == terminal_F && op(terminal_T, terminal) == terminal_F @@ -31,10 +32,10 @@ namespace adiar && op(terminal_F, terminal_F) == terminal_F && op(terminal_T, terminal_F) == terminal_F; } - bool zdd_skippable(const bool_op &op, const zdd::node_t::children_t &r_high) + bool zdd_skippable(const bool_op &op, const zdd::node_type::children_type &r_high) { return (r_high[0].is_terminal() && r_high[1].is_terminal() - && op(r_high[0], r_high[1]) == zdd::ptr_t(false)) + && op(r_high[0], r_high[1]) == zdd::pointer_type(false)) || (r_high[0].is_terminal() && can_left_shortcut_zdd(op, r_high[0])) || (r_high[1].is_terminal() && can_right_shortcut_zdd(op, r_high[1])); } @@ -50,8 +51,8 @@ namespace adiar const bool_op &op) { // Compute the results on all children. - zdd::ptr_t op_F = op(zdd::ptr_t(false), zdd::ptr_t(false)); - zdd::ptr_t op_T = op(zdd::ptr_t(true), zdd::ptr_t(true)); + zdd::pointer_type op_F = op(zdd::pointer_type(false), zdd::pointer_type(false)); + zdd::pointer_type op_T = op(zdd::pointer_type(true), zdd::pointer_type(true)); // Does it collapse to a terminal? if (op_F == op_T) { @@ -66,17 +67,17 @@ namespace adiar const zdd& zdd_2, const bool_op &op) { - adiar_assert(is_terminal(zdd_1) || is_terminal(zdd_2)); + adiar_assert(zdd_isterminal(zdd_1) || zdd_isterminal(zdd_2)); - const zdd::ptr_t terminal_F = zdd::ptr_t(false); + const zdd::pointer_type terminal_F = zdd::pointer_type(false); - if (is_terminal(zdd_1) && is_terminal(zdd_2)) { - const zdd::ptr_t p1 = value_of(zdd_1); - const zdd::ptr_t p2 = value_of(zdd_2); + if (zdd_isterminal(zdd_1) && zdd_isterminal(zdd_2)) { + const zdd::pointer_type p1 = dd_valueof(zdd_1); + const zdd::pointer_type p2 = dd_valueof(zdd_2); return zdd_terminal(op(p1, p2).value()); - } else if (is_terminal(zdd_1)) { - const zdd::ptr_t p1 = value_of(zdd_1); + } else if (zdd_isterminal(zdd_1)) { + const zdd::pointer_type p1 = dd_valueof(zdd_1); if (can_left_shortcut_zdd(op, p1)) { // Shortcuts the left-most path to {Ø} and all others to Ø @@ -86,7 +87,7 @@ namespace adiar return zdd_2; } } else { // if (is_terminal(zdd_2)) { - const zdd::ptr_t p2 = value_of(zdd_2); + const zdd::pointer_type p2 = dd_valueof(zdd_2); if (can_right_shortcut_zdd(op, p2)) { // Shortcuts the left-most path to {Ø} and all others to Ø @@ -100,32 +101,32 @@ namespace adiar } public: - static internal::cut_type left_cut(const bool_op &op) + static internal::cut left_cut(const bool_op &op) { - const bool incl_false = !can_left_shortcut_zdd(op, zdd::ptr_t(false)); - const bool incl_true = !can_left_shortcut_zdd(op, zdd::ptr_t(true)); + const bool incl_false = !can_left_shortcut_zdd(op, zdd::pointer_type(false)); + const bool incl_true = !can_left_shortcut_zdd(op, zdd::pointer_type(true)); - return internal::cut_type_with(incl_false, incl_true); + return internal::cut(incl_false, incl_true); } - static internal::cut_type right_cut(const bool_op &op) + static internal::cut right_cut(const bool_op &op) { - const bool incl_false = !can_right_shortcut_zdd(op, zdd::ptr_t(false)); - const bool incl_true = !can_right_shortcut_zdd(op, zdd::ptr_t(true)); + const bool incl_false = !can_right_shortcut_zdd(op, zdd::pointer_type(false)); + const bool incl_true = !can_right_shortcut_zdd(op, zdd::pointer_type(true)); - return internal::cut_type_with(incl_false, incl_true); + return internal::cut(incl_false, incl_true); } private: - static internal::tuple + static internal::tuple __resolve_request(const bool_op &op, - const internal::tuple &r) + const internal::tuple &r) { if (r[0].is_terminal() && can_left_shortcut_zdd(op, r[0])) { - return { r[0], zdd::ptr_t(true) }; + return { r[0], zdd::pointer_type(true) }; } if (r[1].is_terminal() && can_right_shortcut_zdd(op, r[1])) { - return { zdd::ptr_t(true), r[1] }; + return { zdd::pointer_type(true), r[1] }; } return r; } @@ -133,8 +134,8 @@ namespace adiar public: static internal::prod2_rec resolve_request(const bool_op &op, - const internal::tuple &r_low, - const internal::tuple &r_high) + const internal::tuple &r_low, + const internal::tuple &r_high) { // If r_high surely suppresses the node during the ZDD Reduce, then skip // creating it in the first place and just forward the edge to r_low. diff --git a/src/adiar/zdd/build.cpp b/src/adiar/zdd/build.cpp index 885040676..adac21faa 100644 --- a/src/adiar/zdd/build.cpp +++ b/src/adiar/zdd/build.cpp @@ -30,43 +30,43 @@ namespace adiar class zdd_ithvar_policy : public zdd_policy { private: - const zdd::label_t var; + const zdd::label_type var; public: - zdd_ithvar_policy(zdd::label_t v) : var(v) + zdd_ithvar_policy(zdd::label_type v) : var(v) { } public: static constexpr bool init_terminal = true; constexpr bool - skip(const zdd_policy::label_t &) const + skip(const zdd_policy::label_type &) const { return false; } - inline zdd_policy::node_t - make_node(const zdd_policy::label_t &l, const zdd_policy::ptr_t &r) const + inline zdd_policy::node_type + make_node(const zdd_policy::label_type &l, const zdd_policy::pointer_type &r) const { if (l == var) { - return zdd_policy::node_t(l, zdd_policy::MAX_ID, zdd_policy::ptr_t(false), r); + return zdd_policy::node_type(l, zdd_policy::max_id, zdd_policy::pointer_type(false), r); } - return zdd_policy::node_t(l, zdd_policy::MAX_ID, r, r); + return zdd_policy::node_type(l, zdd_policy::max_id, r, r); } }; - zdd zdd_ithvar(const zdd::label_t var, const generator &dom) + zdd zdd_ithvar(const zdd::label_type var, const generator &dom) { // TODO: Move empty dom edge-case inside of `internal::build_chain<>`? zdd_ithvar_policy p(var); const zdd res = internal::build_chain<>(p, dom); - return is_true(res) ? zdd_empty() : res; + return zdd_istrue(res) ? zdd_empty() : res; } - zdd zdd_ithvar(const zdd::label_t var) + zdd zdd_ithvar(const zdd::label_type var) { - const shared_file dom = adiar_get_domain(); - internal::file_stream ds(dom); + const shared_file dom = domain_get(); + internal::file_stream ds(dom); return zdd_ithvar(var, make_generator(ds)); } @@ -75,74 +75,89 @@ namespace adiar class zdd_nithvar_policy : public zdd_policy { private: - const zdd::label_t var; + const zdd::label_type var; public: - zdd_nithvar_policy(zdd::label_t v) : var(v) + zdd_nithvar_policy(zdd::label_type v) : var(v) { } public: static constexpr bool init_terminal = true; inline bool - skip(const zdd_policy::label_t &l) const + skip(const zdd_policy::label_type &l) const { return l == var; } - inline zdd_policy::node_t - make_node(const zdd_policy::label_t &l, const zdd_policy::ptr_t &r) const - { return zdd_policy::node_t(l, zdd_policy::MAX_ID, r, r); } + inline zdd_policy::node_type + make_node(const zdd_policy::label_type &l, const zdd_policy::pointer_type &r) const + { return zdd_policy::node_type(l, zdd_policy::max_id, r, r); } }; - zdd zdd_nithvar(const zdd::label_t var, const generator &dom) + zdd zdd_nithvar(const zdd::label_type var, const generator &dom) { zdd_nithvar_policy p(var); return internal::build_chain<>(p, dom); } - zdd zdd_nithvar(const zdd::label_t var) + zdd zdd_nithvar(const zdd::label_type var) { - const shared_file dom = adiar_get_domain(); - internal::file_stream ds(dom); + const shared_file dom = domain_get(); + internal::file_stream ds(dom); return zdd_nithvar(var, make_generator(ds)); } ////////////////////////////////////////////////////////////////////////////// - zdd zdd_vars(const generator &vars) + zdd zdd_vars(const generator &vars) { internal::chain_high p; return internal::build_chain<>(p, vars); } ////////////////////////////////////////////////////////////////////////////// - zdd zdd_singleton(const zdd::label_t label) + zdd zdd_singleton(const zdd::label_type label) { return internal::build_ithvar(label); } ////////////////////////////////////////////////////////////////////////////// - zdd zdd_singletons(const generator &vars) + zdd zdd_singletons(const generator &vars) { internal::chain_low p; return internal::build_chain<>(p, vars); } ////////////////////////////////////////////////////////////////////////////// - zdd zdd_powerset(const generator &vars) + zdd zdd_powerset(const generator &vars) { internal::chain_both p; return internal::build_chain<>(p, vars); } ////////////////////////////////////////////////////////////////////////////// + zdd zdd_bot(const generator &/*dom*/) + { + return zdd_empty(); + } + + zdd zdd_bot() + { + return zdd_empty(); + } + + zdd zdd_top(const generator &dom) + { + return zdd_powerset(dom); + } + zdd zdd_top() { - if (!adiar_has_domain()) { + if (!domain_isset()) { return zdd_null(); } - const shared_file dom = adiar_get_domain(); - internal::file_stream ds(dom); + const shared_file dom = domain_get(); + internal::file_stream ds(dom); return zdd_powerset(make_generator(ds)); } diff --git a/src/adiar/zdd/change.cpp b/src/adiar/zdd/change.cpp index 66372acc2..cd23adcca 100644 --- a/src/adiar/zdd/change.cpp +++ b/src/adiar/zdd/change.cpp @@ -28,11 +28,11 @@ namespace adiar static zdd on_terminal_input(const bool terminal_value, const zdd& dd, - const internal::shared_file &vars) + const internal::shared_file &vars) { // TODO: simplify with generator function as input if (terminal_value) { - internal::file_stream ls(vars); + internal::file_stream ls(vars); return zdd_vars(make_generator(ls)); } else { return dd; @@ -44,7 +44,7 @@ namespace adiar return zdd_terminal(terminal_value); } - static internal::intercut_rec hit_existing(const zdd::node_t &n) + static internal::intercut_rec hit_existing(const zdd::node_type &n) { if (n.low().is_false()) { return internal::intercut_rec_skipto { n.high() }; @@ -53,18 +53,18 @@ namespace adiar return internal::intercut_rec_output { n.high(), n.low() }; } - static internal::intercut_rec_output hit_cut(const zdd::ptr_t &target) + static internal::intercut_rec_output hit_cut(const zdd::pointer_type &target) { - return internal::intercut_rec_output { zdd::ptr_t(false), target }; + return internal::intercut_rec_output { zdd::pointer_type(false), target }; } - static internal::intercut_rec_output miss_existing(const zdd::node_t &n) + static internal::intercut_rec_output miss_existing(const zdd::node_type &n) { return internal::intercut_rec_output { n.low(), n.high() }; } }; - __zdd zdd_change(const zdd &dd, const generator &vars) + __zdd zdd_change(const zdd &dd, const generator &vars) { return internal::intercut(dd, vars); } diff --git a/src/adiar/zdd/complement.cpp b/src/adiar/zdd/complement.cpp index a62c61a8d..7dc808fed 100644 --- a/src/adiar/zdd/complement.cpp +++ b/src/adiar/zdd/complement.cpp @@ -2,6 +2,8 @@ #include #include + +#include #include #include #include @@ -26,18 +28,18 @@ namespace adiar static constexpr bool init_terminal = false; constexpr bool - skip(const typename dd_policy::label_t &) const + skip(const typename dd_policy::label_type &) const { return false; } inline - bdd::node_t - make_node(const zdd::label_t &l, const zdd::ptr_t &r) const + bdd::node_type + make_node(const zdd::label_type &l, const zdd::pointer_type &r) const { if (r.is_terminal()) { adiar_assert(r.value() == false, "Root should be Ø"); - return zdd::node_t(l, zdd::MAX_ID, r, zdd_policy::ptr_t(true)); + return zdd::node_type(l, zdd::max_id, r, zdd_policy::pointer_type(true)); } else { - return zdd::node_t(l, zdd::MAX_ID, r, r); + return zdd::node_type(l, zdd::max_id, r, r); } } @@ -52,10 +54,10 @@ namespace adiar } static zdd on_terminal_input(const bool terminal_value, const zdd& /*dd*/, - const shared_file &universe) + const shared_file &universe) { // TODO: remove - internal::file_stream ls(universe); + internal::file_stream ls(universe); if (terminal_value) { // Include everything but Ø on_true_terminal_chain_policy p; @@ -77,15 +79,15 @@ namespace adiar // Yet, this is only 2 nodes that we can kill; that is 4 arcs. This is 32 // bytes of data and very few computation cycles. For very large cases the // shortcutting in branch-prediction probably offsets this? - static internal::intercut_rec_output hit_existing(const zdd::node_t &n) + static internal::intercut_rec_output hit_existing(const zdd::node_type &n) { - const zdd::ptr_t low = n.low().is_terminal() ? negate(n.low()) : n.low(); - const zdd::ptr_t high = n.high().is_terminal() ? negate(n.high()) : n.high(); + const zdd::pointer_type low = n.low().is_terminal() ? negate(n.low()) : n.low(); + const zdd::pointer_type high = n.high().is_terminal() ? negate(n.high()) : n.high(); return internal::intercut_rec_output { low, high }; } - static internal::intercut_rec_output hit_cut(const zdd::ptr_t &target) + static internal::intercut_rec_output hit_cut(const zdd::pointer_type &target) { // T chain: We are definitely outside of the given set if (target.is_true()) { @@ -93,24 +95,24 @@ namespace adiar } // Otherwise, check whether this variable is true and so we move to the T chain - return internal::intercut_rec_output { target, zdd::ptr_t(true) }; + return internal::intercut_rec_output { target, zdd::pointer_type(true) }; } // LCOV_EXCL_START - static internal::intercut_rec_output miss_existing(const zdd::node_t &/*n*/) + static internal::intercut_rec_output miss_existing(const zdd::node_type &/*n*/) { adiar_unreachable(); } // LCOV_EXCL_STOP }; - __zdd zdd_complement(const zdd &dd, const generator &dom) + __zdd zdd_complement(const zdd &dd, const generator &dom) { return internal::intercut(dd, dom); } __zdd zdd_complement(const zdd &dd) { - const shared_file dom = adiar_get_domain(); - internal::file_stream ds(dom); + const shared_file dom = domain_get(); + internal::file_stream ds(dom); return internal::intercut (dd, make_generator(ds)); diff --git a/src/adiar/zdd/contains.cpp b/src/adiar/zdd/contains.cpp index d25e645e2..5756619d2 100644 --- a/src/adiar/zdd/contains.cpp +++ b/src/adiar/zdd/contains.cpp @@ -8,41 +8,41 @@ namespace adiar { class zdd_contains_visitor { - const generator &gen; + const generator &gen; bool has_l = false; - zdd::label_t l; + zdd::label_type l; // First visit is for the root bool is_first_visit = true; // Remember what we saw the last time - zdd::label_t visited_label; + zdd::label_type visited_label; bool terminal_val = false; public: - zdd_contains_visitor(const generator &a) + zdd_contains_visitor(const generator &a) : gen(a) { l = gen(); - has_l = l <= zdd::MAX_LABEL; + has_l = l <= zdd::max_label; } - inline zdd::ptr_t visit(const zdd::node_t &n) + inline zdd::pointer_type visit(const zdd::node_type &n) { visited_label = n.label(); - const zdd::ptr_t next_ptr = has_l && l == visited_label ? n.high() : n.low(); + const zdd::pointer_type next_ptr = has_l && l == visited_label ? n.high() : n.low(); if (has_l) { // Did we miss a label before the root? - if (is_first_visit && l < visited_label) { return zdd::ptr_t::NIL(); } + if (is_first_visit && l < visited_label) { return zdd::pointer_type::nil(); } // Will we miss a label? - if (l == visited_label && l <= zdd::MAX_LABEL) { l = gen(); } + if (l == visited_label && l <= zdd::max_label) { l = gen(); } if (next_ptr.is_node() && visited_label < l && l < next_ptr.label()) { - return zdd::ptr_t::NIL(); + return zdd::pointer_type::nil(); } } @@ -54,10 +54,10 @@ namespace adiar { terminal_val = s; } inline bool get_result() - { return terminal_val && zdd::MAX_LABEL < l; } + { return terminal_val && zdd::max_label < l; } }; - bool zdd_contains(const zdd &zdd, const generator &a) + bool zdd_contains(const zdd &zdd, const generator &a) { zdd_contains_visitor v(a); internal::traverse(zdd, v); diff --git a/src/adiar/zdd/count.cpp b/src/adiar/zdd/count.cpp index 93cc05b16..e9f623aca 100644 --- a/src/adiar/zdd/count.cpp +++ b/src/adiar/zdd/count.cpp @@ -2,24 +2,25 @@ #include #include +#include #include namespace adiar { size_t zdd_nodecount(const zdd &A) { - return is_terminal(A) ? 0u : A->size(); + return internal::dd_nodecount(A); } - zdd::label_t zdd_varcount(const zdd &A) + zdd::label_type zdd_varcount(const zdd &A) { - return A->levels(); + return internal::dd_varcount(A); } uint64_t zdd_size(const zdd &A) { - return is_terminal(A) - ? value_of(A) + return zdd_isterminal(A) + ? internal::dd_valueof(A) : internal::count>(A, zdd_varcount(A)); } } diff --git a/src/adiar/zdd/elem.cpp b/src/adiar/zdd/elem.cpp index d0f5db20c..956a74af3 100644 --- a/src/adiar/zdd/elem.cpp +++ b/src/adiar/zdd/elem.cpp @@ -2,6 +2,7 @@ #include +#include #include #include #include @@ -13,7 +14,7 @@ namespace adiar { class zdd_sat_zdd_callback { - internal::shared_file _lf; + internal::shared_file _lf; internal::label_writer _lw; public: @@ -21,28 +22,28 @@ namespace adiar : _lw(_lf) { } - void operator() (zdd::label_t x) + void operator() (zdd::label_type x) { _lw << x; } zdd get_zdd() { _lw.detach(); - internal::file_stream _ls(_lf); + internal::file_stream _ls(_lf); return zdd_vars(make_generator(_ls)); } }; class zdd_sat_lambda_callback { - const consumer &_c; + const consumer &_c; public: - zdd_sat_lambda_callback(const consumer &lambda) + zdd_sat_lambda_callback(const consumer &lambda) : _c(lambda) { } - void operator() (zdd::label_t x) const + void operator() (zdd::label_type x) const { _c(x); } }; @@ -62,10 +63,10 @@ namespace adiar : _callback(cb) { } - zdd::ptr_t visit(const zdd::node_t n) + zdd::pointer_type visit(const zdd::node_type n) { adiar_assert(!n.high().is_terminal() || n.high().value(), "high terminals are never false"); - const zdd::ptr_t next_ptr = _visitor.visit(n); + const zdd::pointer_type next_ptr = _visitor.visit(n); if (next_ptr == n.high() && (next_ptr != n.low() || visitor_t::default_direction)) { _callback(n.label()); @@ -86,7 +87,7 @@ namespace adiar return _cb.get_zdd(); } - void zdd_minelem(const zdd &A, const consumer &cb) + void zdd_minelem(const zdd &A, const consumer &cb) { zdd_sat_lambda_callback _cb(cb); zdd_sat_visitor v(_cb); @@ -101,7 +102,7 @@ namespace adiar return _cb.get_zdd(); } - void zdd_maxelem(const zdd &A, const consumer &cb) + void zdd_maxelem(const zdd &A, const consumer &cb) { zdd_sat_lambda_callback _cb(cb); zdd_sat_visitor v(_cb); diff --git a/src/adiar/zdd/expand.cpp b/src/adiar/zdd/expand.cpp index 40a526a8b..584318ef3 100644 --- a/src/adiar/zdd/expand.cpp +++ b/src/adiar/zdd/expand.cpp @@ -30,11 +30,11 @@ namespace adiar static zdd on_terminal_input(const bool terminal_value, const zdd& dd, - const internal::shared_file &labels) + const internal::shared_file &labels) { // TODO: simplify when labels are a generator if (terminal_value) { - internal::file_stream ls(labels); + internal::file_stream ls(labels); return zdd_powerset(make_generator(ls)); } else { return dd; @@ -47,25 +47,25 @@ namespace adiar // LCOV_EXCL_STOP // LCOV_EXCL_START - static inline internal::intercut_rec hit_existing(const zdd::node_t &/*n*/) + static inline internal::intercut_rec hit_existing(const zdd::node_type &/*n*/) { // The user should NOT have supplied a label that hits any existing nodes. adiar_unreachable(); } // LCOV_EXCL_STOP - static inline internal::intercut_rec_output hit_cut(const zdd::ptr_t &target) + static inline internal::intercut_rec_output hit_cut(const zdd::pointer_type &target) { return internal::intercut_rec_output { target, target }; } - static inline internal::intercut_rec_output miss_existing(const zdd::node_t &n) + static inline internal::intercut_rec_output miss_existing(const zdd::node_type &n) { return internal::intercut_rec_output { n.low(), n.high() }; } }; - __zdd zdd_expand(const zdd &dd, const generator &vars) + __zdd zdd_expand(const zdd &dd, const generator &vars) { return internal::intercut(dd, vars); } diff --git a/src/adiar/zdd/pred.cpp b/src/adiar/zdd/pred.cpp index 7f20dca8f..c60485f63 100644 --- a/src/adiar/zdd/pred.cpp +++ b/src/adiar/zdd/pred.cpp @@ -7,18 +7,53 @@ namespace adiar { + bool zdd_iscanonical(const zdd& A) + { + return internal::dd_iscanonical(A); + } + + bool zdd_isterminal(const zdd& A) + { + return internal::dd_isterminal(A); + } + + bool zdd_isfalse(const zdd& A) + { + return internal::dd_isfalse(A); + } + + bool zdd_isempty(const zdd &A) + { + return zdd_isfalse(A); + } + + bool zdd_istrue(const zdd& A) + { + return internal::dd_istrue(A); + } + + bool zdd_isnull(const zdd &A) + { + return zdd_istrue(A); + } + bool zdd_equal(const zdd &s1, const zdd &s2) { return internal::is_isomorphic(s1, s2); } + bool zdd_unequal(const zdd &A, const zdd &B) + { + return !zdd_equal(A,B); + } + ////////////////////////////////////////////////////////////////////////////// - template + template class ignore_levels { public: - static size_t pq1_upper_bound(const internal::shared_levelized_file &in_1, - const internal::shared_levelized_file &in_2) + static size_t pq1_upper_bound(const internal::shared_levelized_file &in_1, + const internal::shared_levelized_file &in_2) { const safe_size_t max_2level_cut_1 = in_1->max_2level_cut[ct_1]; const safe_size_t max_2level_cut_2 = in_2->max_2level_cut[ct_2]; @@ -26,8 +61,8 @@ namespace adiar return to_size(max_2level_cut_1 * max_2level_cut_2); } - static size_t pq2_upper_bound(const internal::shared_levelized_file &in_1, - const internal::shared_levelized_file &in_2) + static size_t pq2_upper_bound(const internal::shared_levelized_file &in_1, + const internal::shared_levelized_file &in_2) { const safe_size_t max_1level_cut_1 = in_1->max_1level_cut[ct_1]; const safe_size_t max_1level_cut_2 = in_2->max_1level_cut[ct_2]; @@ -41,11 +76,11 @@ namespace adiar } public: - ignore_levels(const internal::shared_levelized_file &/*f1*/, - const internal::shared_levelized_file &/*f2*/) + ignore_levels(const internal::shared_levelized_file &/*f1*/, + const internal::shared_levelized_file &/*f2*/) { /* do nothing */ } - void next_level(zdd::label_t /* level */) + void next_level(zdd::label_type /* level */) { /* do nothing */ } bool on_step() @@ -59,7 +94,7 @@ namespace adiar , public internal::prod2_mixed_level_merger { public: - typedef ignore_levels level_check_t; + using level_check_t = ignore_levels; public: static constexpr size_t lookahead_bound() @@ -68,7 +103,7 @@ namespace adiar } public: - static bool resolve_terminals(const zdd::node_t &v1, const zdd::node_t &v2, bool &ret_value) + static bool resolve_terminals(const zdd::node_type &v1, const zdd::node_type &v2, bool &ret_value) { if (v1.is_terminal() && v2.is_terminal()) { ret_value = !v1.value() || v2.value(); @@ -84,7 +119,7 @@ namespace adiar } public: - static bool resolve_singletons(const zdd::node_t &v1, const zdd::node_t &v2) + static bool resolve_singletons(const zdd::node_type &v1, const zdd::node_type &v2) { return v1.label() == v2.label() && v1.low() <= v2.low() && v1.high() <= v2.high(); @@ -92,7 +127,7 @@ namespace adiar public: template - static bool resolve_request(pq_1_t &pq, const internal::tuple &rp) + static bool resolve_request(pq_1_t &pq, const internal::tuple &rp) { // Are they both a terminal? If so, check whether the left-hand side is true // and not the right, which would contradict being an implication (i.e. @@ -130,13 +165,19 @@ namespace adiar return internal::comparison_check(s1, s2); } + ////////////////////////////////////////////////////////////////////////////// + bool zdd_subset(const zdd &A, const zdd &B) + { + return zdd_subseteq(A,B) && zdd_unequal(A,B); + } + ////////////////////////////////////////////////////////////////////////////// class zdd_disjoint_policy : public zdd_policy , public internal::prod2_mixed_level_merger { public: - typedef ignore_levels level_check_t; + using level_check_t = ignore_levels; public: static constexpr size_t lookahead_bound() @@ -145,14 +186,14 @@ namespace adiar } public: - static bool resolve_terminals(const zdd::node_t &v1, const zdd::node_t &v2, bool &ret_value) + static bool resolve_terminals(const zdd::node_type &v1, const zdd::node_type &v2, bool &ret_value) { ret_value = v1.is_false() || v2.is_false(); return (v1.is_terminal() && v2.is_terminal()) || ret_value; } public: - static bool resolve_singletons(const zdd::node_t &v1, const zdd::node_t &v2) + static bool resolve_singletons(const zdd::node_type &v1, const zdd::node_type &v2) { return v1.label() != v2.label() || v1.low() != v2.low() @@ -161,7 +202,7 @@ namespace adiar public: template - static bool resolve_request(pq_1_t &pq, const internal::tuple &rp) + static bool resolve_request(pq_1_t &pq, const internal::tuple &rp) { // Are they both a terminal? If so, check whether they both are true, which // verify there is a satisfiying conjunction (i.e. representing a shared @@ -193,7 +234,7 @@ namespace adiar bool zdd_disjoint(const zdd &s1, const zdd &s2) { if (s1.file == s2.file) { - return is_false(s1); + return zdd_isfalse(s1); } return internal::comparison_check(s1, s2); diff --git a/src/adiar/zdd/project.cpp b/src/adiar/zdd/project.cpp index ef27d757f..e8b241db7 100644 --- a/src/adiar/zdd/project.cpp +++ b/src/adiar/zdd/project.cpp @@ -3,6 +3,7 @@ #include +#include #include #include #include @@ -14,8 +15,8 @@ namespace adiar class zdd_project_policy : public zdd_policy { public: - static inline zdd::ptr_t - resolve_root(const zdd::node_t &r, const bool_op &/*op*/) + static inline zdd::pointer_type + resolve_root(const zdd::node_type &r, const bool_op &/*op*/) { // TODO: should all but the last case not have a 'suppression taint'? @@ -39,22 +40,22 @@ namespace adiar public: static inline bool - keep_terminal(const bool_op &/*op*/, const zdd::ptr_t &p) + keep_terminal(const bool_op &/*op*/, const zdd::pointer_type &p) { return p.value(); } static constexpr bool - collapse_to_terminal(const bool_op &/*op*/, const zdd::ptr_t &/*p*/) + collapse_to_terminal(const bool_op &/*op*/, const zdd::pointer_type &/*p*/) { return false; } public: - static inline internal::cut_type + static inline internal::cut cut_with_terminals(const bool_op &/*op*/) { - return internal::cut_type::ALL; + return internal::cut::All; } public: @@ -62,22 +63,22 @@ namespace adiar }; ////////////////////////////////////////////////////////////////////////////// - __zdd zdd_project(const zdd &A, const predicate &dom) + __zdd zdd_project(const zdd &A, const predicate &dom) { return internal::quantify(A, dom, or_op); } - __zdd zdd_project(zdd &&A, const predicate &dom) + __zdd zdd_project(zdd &&A, const predicate &dom) { return internal::quantify(std::forward(A), dom, or_op); } - __zdd zdd_project(const zdd &A, const generator &dom) + __zdd zdd_project(const zdd &A, const generator &dom) { return internal::quantify(A, dom, or_op); } - __zdd zdd_project(zdd &&A, const generator &dom) + __zdd zdd_project(zdd &&A, const generator &dom) { return internal::quantify(A, dom, or_op); } diff --git a/src/adiar/zdd/subset.cpp b/src/adiar/zdd/subset.cpp index 119d7ed67..306f4d076 100644 --- a/src/adiar/zdd/subset.cpp +++ b/src/adiar/zdd/subset.cpp @@ -11,47 +11,47 @@ namespace adiar template class zdd_subset_labels { - const generator &gen; + const generator &gen; /// \brief The current level (including the current algorithm level) - zdd::label_t l_incl = zdd::MAX_LABEL+1; + zdd::label_type l_incl = zdd::max_label+1; /// \brief The next level (definitely excluding the current level) - zdd::label_t l_excl = zdd::MAX_LABEL+1; + zdd::label_type l_excl = zdd::max_label+1; /// We will rememeber how far the algorithm in substitution.h has got - zdd::label_t alg_level = 0; + zdd::label_type alg_level = 0; public: /// We will remember whether any level of the input actually matched. bool l_match = false; public: - zdd_subset_labels(const generator &g) + zdd_subset_labels(const generator &g) : gen(g) { l_incl = gen(); - if (l_incl <= zdd::MAX_LABEL) { l_excl = gen(); } + if (l_incl <= zdd::max_label) { l_excl = gen(); } } private: /// \brief Forwards through the input to the given level - inline void forward_to_level(const zdd::label_t new_level) + inline void forward_to_level(const zdd::label_type new_level) { adiar_assert(alg_level <= new_level, "The algorithm should ask for the levels in increasing order."); alg_level = new_level; - while (l_incl <= zdd::MAX_LABEL && l_incl < new_level) { + while (l_incl <= zdd::max_label && l_incl < new_level) { l_incl = std::move(l_excl); - if (l_incl <= zdd::MAX_LABEL) { l_excl = gen(); }; + if (l_incl <= zdd::max_label) { l_excl = gen(); }; } } public: /// \brief Obtain the assignment for the current level - assignment assignment_for_level(const zdd::label_t new_level) + assignment assignment_for_level(const zdd::label_type new_level) { forward_to_level(new_level); @@ -65,11 +65,11 @@ namespace adiar /// \brief Whether the manager has a next level (including the current) bool has_level_incl() { - return l_incl <= zdd::MAX_LABEL && alg_level <= l_incl; + return l_incl <= zdd::max_label && alg_level <= l_incl; } /// \brief Get the current level (including the current algorithm level) - zdd::label_t level_incl() + zdd::label_type level_incl() { return l_incl; } @@ -77,11 +77,11 @@ namespace adiar /// \brief Whether the manager has a level ahead of the current bool has_level_excl() { - return (l_incl <= zdd::MAX_LABEL && alg_level < l_incl) || l_excl <= zdd::MAX_LABEL; + return (l_incl <= zdd::max_label && alg_level < l_incl) || l_excl <= zdd::max_label; } /// \brief Get the next level (excluding the current one) - zdd::label_t level_excl() + zdd::label_type level_excl() { if (alg_level < l_incl) { return l_incl; } return l_excl; @@ -93,14 +93,14 @@ namespace adiar class zdd_offset_policy : public zdd_policy { public: - static internal::substitute_rec keep_node(const zdd::node_t &n, assignment_mgr &/*amgr*/) + static internal::substitute_rec keep_node(const zdd::node_type &n, assignment_mgr &/*amgr*/) { return internal::substitute_rec_output { n }; } - static internal::substitute_rec fix_false(const zdd::node_t &n, assignment_mgr &/*amgr*/) + static internal::substitute_rec fix_false(const zdd::node_type &n, assignment_mgr &/*amgr*/) { return internal::substitute_rec_skipto { n.low() }; } // LCOV_EXCL_START - static internal::substitute_rec fix_true(const zdd::node_t &/*n*/, assignment_mgr &/*amgr*/) + static internal::substitute_rec fix_true(const zdd::node_type &/*n*/, assignment_mgr &/*amgr*/) { adiar_unreachable(); } // LCOV_EXCL_STOP @@ -109,10 +109,10 @@ namespace adiar { return zdd_terminal(terminal_val); } }; - __zdd zdd_offset(const zdd &A, const generator &vars) + __zdd zdd_offset(const zdd &A, const generator &vars) { // Both { Ø }, and Ø cannot have more variables removed - if (is_terminal(A)) { return A; } + if (zdd_isterminal(A)) { return A; } zdd_subset_labels amgr(vars); @@ -134,38 +134,38 @@ namespace adiar class zdd_onset_policy : public zdd_policy { public: - static internal::substitute_rec keep_node(const zdd::node_t &n, assignment_mgr &amgr) + static internal::substitute_rec keep_node(const zdd::node_type &n, assignment_mgr &amgr) { if (amgr.has_level_incl()) { // If recursion goes past the intended level, then it is replaced with // the false terminal. - const zdd::ptr_t low = n.low().is_terminal() || n.low().label() > amgr.level_incl() - ? zdd::ptr_t(false) + const zdd::pointer_type low = n.low().is_terminal() || n.low().label() > amgr.level_incl() + ? zdd::pointer_type(false) : n.low(); // If this applies to high, then the node should be skipped entirely. if (n.high().is_terminal() || n.high().label() > amgr.level_incl()) { return internal::substitute_rec_skipto { low }; } - return internal::substitute_rec_output { zdd::node_t(n.uid(), low, n.high()) }; + return internal::substitute_rec_output { zdd::node_type(n.uid(), low, n.high()) }; } return internal::substitute_rec_output { n }; } // LCOV_EXCL_START - static internal::substitute_rec fix_false(const zdd::node_t &/*n*/, assignment_mgr &/*amgr*/) + static internal::substitute_rec fix_false(const zdd::node_type &/*n*/, assignment_mgr &/*amgr*/) { adiar_unreachable(); } // LCOV_EXCL_STOP - static internal::substitute_rec fix_true(const zdd::node_t &n, assignment_mgr &amgr) + static internal::substitute_rec fix_true(const zdd::node_type &n, assignment_mgr &amgr) { if (amgr.has_level_excl()) { if (n.high().is_terminal() || n.high().label() > amgr.level_excl()) { - return internal::substitute_rec_skipto { zdd::ptr_t(false) }; + return internal::substitute_rec_skipto { zdd::pointer_type(false) }; } } - return internal::substitute_rec_output { zdd::node_t(n.uid(), zdd::ptr_t(false), n.high()) }; + return internal::substitute_rec_output { zdd::node_type(n.uid(), zdd::pointer_type(false), n.high()) }; } public: @@ -175,9 +175,9 @@ namespace adiar } }; - __zdd zdd_onset(const zdd &A, const generator &xs) + __zdd zdd_onset(const zdd &A, const generator &xs) { - if (is_false(A)) { return A; } + if (zdd_isfalse(A)) { return A; } zdd_subset_labels amgr(xs); @@ -187,7 +187,7 @@ namespace adiar } // If `A` is { Ø } and `xs` is non-empty, then it trivially collapses to Ø. - if (is_true(A)) { + if (zdd_istrue(A)) { return zdd_empty(); } diff --git a/src/adiar/zdd/zdd.cpp b/src/adiar/zdd/zdd.cpp index f8b410fbe..0659a0274 100644 --- a/src/adiar/zdd/zdd.cpp +++ b/src/adiar/zdd/zdd.cpp @@ -5,6 +5,7 @@ #include #include +#include #include #include #include @@ -23,11 +24,11 @@ namespace adiar : internal::__dd() { } - __zdd::__zdd(const internal::__dd::shared_nodes_t &f) + __zdd::__zdd(const internal::__dd::shared_node_file_type &f) : internal::__dd(f) { } - __zdd::__zdd(const internal::__dd::shared_arcs_t &f) + __zdd::__zdd(const internal::__dd::shared_arc_file_type &f) : internal::__dd(f) { } @@ -37,43 +38,45 @@ namespace adiar ////////////////////////////////////////////////////////////////////////////// // 'zdd' Constructors - zdd::zdd(const internal::dd::shared_nodes_t &f, bool negate) - : internal::dd(f, negate) - { } - zdd::zdd() : zdd(zdd_empty()) { } - zdd::zdd(bool v) - : zdd(zdd_terminal(v)) + zdd::zdd(terminal_type t) + : zdd(zdd_terminal(t)) { } - zdd::zdd(const zdd &o) - : internal::dd(o) + zdd::zdd(const internal::dd::shared_node_file_type &A, bool negate) + : internal::dd(A, negate) + { + if (negate) { throw invalid_argument("ZDDs cannot be negated"); } + } + + zdd::zdd(const zdd &A) + : internal::dd(A) { } - zdd::zdd(zdd &&o) - : internal::dd(o) + zdd::zdd(zdd &&A) + : internal::dd(A) { } - zdd::zdd(__zdd &&o) - : internal::dd(internal::reduce(std::forward<__zdd>(o))) + zdd::zdd(__zdd &&A) + : internal::dd(internal::reduce(std::move(A))) { } ////////////////////////////////////////////////////////////////////////////// // Operators #define __zdd_oper(out_t, op) \ out_t operator op (__zdd &&lhs, __zdd &&rhs) { \ - return zdd(std::forward<__zdd>(lhs)) op zdd(std::forward<__zdd>(rhs)); \ + return zdd(std::move(lhs)) op zdd(std::move(rhs)); \ } \ \ out_t operator op (const zdd &lhs, __zdd &&rhs) { \ - return lhs op zdd(std::forward<__zdd>(rhs)); \ + return lhs op zdd(std::move(rhs)); \ } \ \ out_t operator op (__zdd &&lhs, const zdd &rhs) { \ - return zdd(std::forward<__zdd>(lhs)) op rhs; \ + return zdd(std::move(lhs)) op rhs; \ } __zdd_oper(__zdd, &) @@ -97,7 +100,7 @@ namespace adiar zdd& zdd::operator= (__zdd &&other) { deref(); - return (*this = internal::reduce(std::forward<__zdd>(other))); + return (*this = internal::reduce(std::move(other))); } __zdd operator~ (const zdd &A) @@ -107,7 +110,7 @@ namespace adiar __zdd operator~ (__zdd &&A) { - return ~zdd(std::forward<__zdd>(A)); + return ~zdd(std::move(A)); } __zdd operator& (const zdd& lhs, const zdd& rhs) @@ -190,14 +193,24 @@ namespace adiar ////////////////////////////////////////////////////////////////////////////// // Input variables - void zdd_varprofile(const zdd &A, const consumer &cb) + zdd::label_type zdd_minvar(const zdd &A) + { + return internal::dd_minvar(A); + } + + zdd::label_type zdd_maxvar(const zdd &A) + { + return internal::dd_maxvar(A); + } + + void zdd_varprofile(const zdd &A, const consumer &cb) { return internal::dd_varprofile(A, cb); } ////////////////////////////////////////////////////////////////////////////// // Conversion - __zdd zdd_from(const bdd &f, const generator &dom) + __zdd zdd_from(const bdd &f, const generator &dom) { return internal::intercut> (f, dom); @@ -205,8 +218,8 @@ namespace adiar __zdd zdd_from(const bdd &f) { - const shared_file dom = adiar_get_domain(); - internal::file_stream ds(dom); + const shared_file dom = domain_get(); + internal::file_stream ds(dom); return internal::intercut> (f, make_generator(ds)); @@ -216,11 +229,11 @@ namespace adiar // Debug void zdd_printdot(const zdd &A, std::ostream &out) { - internal::output_dot(A, out); + internal::print_dot(A, out); } void zdd_printdot(const zdd &A, const std::string &file_name) { - internal::output_dot(A, file_name); + internal::print_dot(A, file_name); } } diff --git a/src/adiar/zdd/zdd.h b/src/adiar/zdd/zdd.h index 897f5d0a5..5f93ca2c3 100644 --- a/src/adiar/zdd/zdd.h +++ b/src/adiar/zdd/zdd.h @@ -3,8 +3,6 @@ #include -#include -#include #include #include @@ -28,10 +26,10 @@ namespace adiar __zdd(); //////////////////////////////////////////////////////////////////////////// - __zdd(const internal::__dd::shared_nodes_t &f); + __zdd(const internal::__dd::shared_node_file_type &f); //////////////////////////////////////////////////////////////////////////// - __zdd(const internal::__dd::shared_arcs_t &f); + __zdd(const internal::__dd::shared_arc_file_type &f); //////////////////////////////////////////////////////////////////////////// __zdd(const zdd &zdd); @@ -60,7 +58,7 @@ namespace adiar // |- functions friend size_t zdd_nodecount(const zdd&); - friend zdd::label_t zdd_varcount(const zdd&); + friend zdd::label_type zdd_varcount(const zdd&); friend bool zdd_subseteq(const zdd&, const zdd&); friend bool zdd_disjoint(const zdd &, const zdd &); @@ -82,22 +80,50 @@ namespace adiar // Constructors public: //////////////////////////////////////////////////////////////////////////// - zdd(const internal::dd::shared_nodes_t &f, bool negate = false); - + /// \brief Default construction, creating the empty set Ø. + /// + /// \see zdd_empty //////////////////////////////////////////////////////////////////////////// zdd(); //////////////////////////////////////////////////////////////////////////// - zdd(bool v); + /// \brief Implicit conversion from a terminal value to respectively + /// construct Ø and {Ø} from respectively 0 and 1. + /// + /// \see zdd_terminal, zdd_empty, zdd_null + //////////////////////////////////////////////////////////////////////////// + zdd(zdd::terminal_type t); + + /// \cond + //////////////////////////////////////////////////////////////////////////// + /// \brief Constructor to wrap the node-based result of an algorithm. + //////////////////////////////////////////////////////////////////////////// + zdd(const zdd::shared_node_file_type &A, bool negate = false); + /// \endcond //////////////////////////////////////////////////////////////////////////// - zdd(const zdd &o); + /// \brief Copy construction, incrementing thre reference count on the file + /// underneath. + //////////////////////////////////////////////////////////////////////////// + zdd(const zdd &oA); //////////////////////////////////////////////////////////////////////////// - zdd(zdd &&o); + /// \brief Move construction, taking over ownership of the files underneath. + //////////////////////////////////////////////////////////////////////////// + zdd(zdd &&A); //////////////////////////////////////////////////////////////////////////// - zdd(__zdd &&o); + /// \brief Implicit move conversion from a possibly to-be reduced result + /// from an algorithm to a `zdd`. + /// + /// \details Since the `adiar::internal::reduce` algorithm is run as part of + /// this constructor, the scoping rules ensure we garbage collect + /// irrelevant files as early as possible. + /// + /// \remark Since the value `o` is forced to be moved, we force the content + /// of `o` to be destructed after finishing the *Reduce* algorithm. + //////////////////////////////////////////////////////////////////////////// + zdd(__zdd &&A); //////////////////////////////////////////////////////////////////////////// // Accessors overwrite @@ -109,7 +135,7 @@ namespace adiar /// /// \param ct The type of the cut to obtain //////////////////////////////////////////////////////////////////////////// - internal::cut_size_t max_1level_cut(const internal::cut_type ct) const + internal::cut::size_type max_1level_cut(const internal::cut ct) const { return add_false_cofactor(ct, file->max_1level_cut); } @@ -120,23 +146,25 @@ namespace adiar /// /// \param ct The type of the cut to obtain //////////////////////////////////////////////////////////////////////////// - internal::cut_size_t max_2level_cut(const internal::cut_type ct) const + internal::cut::size_type max_2level_cut(const internal::cut ct) const { return add_false_cofactor(ct, file->max_2level_cut); } + /// \endcond private: + /// \cond //////////////////////////////////////////////////////////////////////////// /// \brief Accounts for the false arc added due to using a co-factor. //////////////////////////////////////////////////////////////////////////// - internal::cut_size_t add_false_cofactor(const internal::cut_type ct, const internal::cuts_t &ilevel_cuts) const + internal::cut::size_type add_false_cofactor(const internal::cut ct, const internal::cuts_t &ilevel_cuts) const { const safe_size_t cut_size = ilevel_cuts[ct]; // Bit-mask (allowing implicit conversion to size_t with bit-operators) to // get the cut-type WITHOUT the false arcs. - constexpr size_t bit_mask = internal::cut_type::INTERNAL_TRUE; - const internal::cut_type ct_excl_false = static_cast(ct & bit_mask); + constexpr size_t bit_mask = internal::cut::Internal_True; + const internal::cut ct_excl_false = static_cast(ct & bit_mask); // In product construction algorithms we need to take into account the // (single) suppressed false arc, which may suddenly become visible (e.g. @@ -149,10 +177,10 @@ namespace adiar // // - If the requested cut does not include false arcs. // - // - If the cut size is strictly larger than the corresponding cut_type + // - If the cut size is strictly larger than the corresponding cut // excluding false. In this case, we already have a false arc to pair // with. - const size_t add_suppressed = !includes_terminal(ct, false) && cut_size == ilevel_cuts[ct_excl_false]; + const size_t add_suppressed = !ct.includes(false) && cut_size == ilevel_cuts[ct_excl_false]; return to_size(cut_size + add_suppressed); } diff --git a/src/adiar/zdd/zdd_policy.h b/src/adiar/zdd/zdd_policy.h index a70d11850..dcb3a2519 100644 --- a/src/adiar/zdd/zdd_policy.h +++ b/src/adiar/zdd/zdd_policy.h @@ -12,10 +12,10 @@ namespace adiar ////////////////////////////////////////////////////////////////////////////// /// \brief Logic related to being a 'Zero-suppressed' Decision Diagram. ////////////////////////////////////////////////////////////////////////////// - typedef internal::dd_policy zdd_policy; + using zdd_policy = internal::dd_policy; template<> - inline zdd::ptr_t + inline zdd::pointer_type zdd_policy::reduction_rule(const node &n) { if (n.high().is_false()) { return n.low(); } @@ -23,29 +23,29 @@ namespace adiar } template<> - inline zdd::node_t::children_t - zdd_policy::reduction_rule_inv(const zdd::ptr_t &child) + inline zdd::node_type::children_type + zdd_policy::reduction_rule_inv(const zdd::pointer_type &child) { - return { child, zdd::ptr_t(false) }; + return { child, zdd::pointer_type(false) }; } // TODO: stop using these in favour of 'reduction_rule_inv' above template<> inline void zdd_policy::compute_cofactor(bool on_curr_level, - /*const*/ zdd::ptr_t &, - zdd::ptr_t &high) + /*const*/ zdd::pointer_type &, + zdd::pointer_type &high) { - if (!on_curr_level) { high = zdd::ptr_t(false); } + if (!on_curr_level) { high = zdd::pointer_type(false); } } template<> - inline zdd::node_t::children_t + inline zdd::node_type::children_type zdd_policy::compute_cofactor(const bool on_curr_level, - const zdd::node_t::children_t &children) + const zdd::node_type::children_type &children) { if (!on_curr_level) { - return zdd::node_t::children_t(children[false], zdd::ptr_t(false)); + return zdd::node_type::children_type(children[false], zdd::pointer_type(false)); } return children; } diff --git a/src/main.cpp b/src/main.cpp index a6f551960..94e47b434 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -30,7 +30,7 @@ int main(int argc, char* argv[]) { // ===== Your code ends here ===== } - adiar::adiar_printstat(); + adiar::statistics_print(); adiar::adiar_deinit(); exit(0); diff --git a/test/adiar/bdd/test_apply.cpp b/test/adiar/bdd/test_apply.cpp index b7e7cbbfa..6d4b596d6 100644 --- a/test/adiar/bdd/test_apply.cpp +++ b/test/adiar/bdd/test_apply.cpp @@ -3,8 +3,8 @@ go_bandit([]() { describe("adiar/bdd/apply.cpp", []() { // Setup shared bdd's - shared_levelized_file bdd_F; - shared_levelized_file bdd_T; + shared_levelized_file bdd_F; + shared_levelized_file bdd_T; { // Garbage collect writers to free write-lock node_writer nw_F(bdd_F); @@ -18,26 +18,26 @@ go_bandit([]() { ptr_uint64 terminal_T = ptr_uint64(true); ptr_uint64 terminal_F = ptr_uint64(false); - shared_levelized_file bdd_x0; - shared_levelized_file bdd_not_x0; - shared_levelized_file bdd_x1; - shared_levelized_file bdd_x2; + shared_levelized_file bdd_x0; + shared_levelized_file bdd_not_x0; + shared_levelized_file bdd_x1; + shared_levelized_file bdd_x2; { // Garbage collect writers early node_writer nw_x0(bdd_x0); - nw_x0 << node(0, node::MAX_ID, terminal_F, terminal_T); + nw_x0 << node(0, node::max_id, terminal_F, terminal_T); node_writer nw_not_x0(bdd_not_x0); - nw_not_x0 << node(0, node::MAX_ID, terminal_T, terminal_F); + nw_not_x0 << node(0, node::max_id, terminal_T, terminal_F); node_writer nw_x1(bdd_x1); - nw_x1 << node(1, node::MAX_ID, terminal_F, terminal_T); + nw_x1 << node(1, node::max_id, terminal_F, terminal_T); node_writer nw_x2(bdd_x2); - nw_x2 << node(2, node::MAX_ID, terminal_F, terminal_T); + nw_x2 << node(2, node::max_id, terminal_F, terminal_T); } - shared_levelized_file bdd_1; + shared_levelized_file bdd_1; /* // 1 ---- x0 // / \ @@ -50,18 +50,18 @@ go_bandit([]() { // F T */ - node n1_5 = node(3, node::MAX_ID, terminal_F, terminal_T); - node n1_4 = node(2, node::MAX_ID, terminal_T, n1_5.uid()); - node n1_3 = node(2, node::MAX_ID-1, terminal_F, terminal_T); - node n1_2 = node(1, node::MAX_ID, n1_3.uid(), n1_4.uid()); - node n1_1 = node(0, node::MAX_ID, n1_3.uid(), n1_2.uid()); + node n1_5 = node(3, node::max_id, terminal_F, terminal_T); + node n1_4 = node(2, node::max_id, terminal_T, n1_5.uid()); + node n1_3 = node(2, node::max_id-1, terminal_F, terminal_T); + node n1_2 = node(1, node::max_id, n1_3.uid(), n1_4.uid()); + node n1_1 = node(0, node::max_id, n1_3.uid(), n1_2.uid()); { // Garbage collect early and free write-lock node_writer nw_1(bdd_1); nw_1 << n1_5 << n1_4 << n1_3 << n1_2 << n1_1; } - shared_levelized_file bdd_2; + shared_levelized_file bdd_2; /* // ---- x0 // @@ -74,15 +74,15 @@ go_bandit([]() { // T F */ - node n2_2 = node(3, node::MAX_ID, terminal_T, terminal_F); - node n2_1 = node(1, node::MAX_ID, n2_2.uid(), terminal_T); + node n2_2 = node(3, node::max_id, terminal_T, terminal_F); + node n2_1 = node(1, node::max_id, n2_2.uid(), terminal_T); { // Garbage collect early and free write-lock node_writer nw_2(bdd_2); nw_2 << n2_2 << n2_1; } - shared_levelized_file bdd_3; + shared_levelized_file bdd_3; /* // 1 ---- x0 // / \ @@ -98,14 +98,14 @@ go_bandit([]() { // F T */ - node n3_8 = node(3, node::MAX_ID, terminal_F, terminal_T); - node n3_7 = node(2, node::MAX_ID, terminal_T, terminal_F); - node n3_6 = node(2, node::MAX_ID - 1, n3_8.uid(), terminal_T); - node n3_5 = node(2, node::MAX_ID - 2, terminal_T, n3_8.uid()); - node n3_4 = node(2, node::MAX_ID - 3, terminal_F, terminal_T); - node n3_3 = node(1, node::MAX_ID, n3_4.uid(), n3_6.uid()); - node n3_2 = node(1, node::MAX_ID - 1, n3_5.uid(), n3_7.uid()); - node n3_1 = node(0, node::MAX_ID, n3_2.uid(), n3_3.uid()); + node n3_8 = node(3, node::max_id, terminal_F, terminal_T); + node n3_7 = node(2, node::max_id, terminal_T, terminal_F); + node n3_6 = node(2, node::max_id - 1, n3_8.uid(), terminal_T); + node n3_5 = node(2, node::max_id - 2, terminal_T, n3_8.uid()); + node n3_4 = node(2, node::max_id - 3, terminal_F, terminal_T); + node n3_3 = node(1, node::max_id, n3_4.uid(), n3_6.uid()); + node n3_2 = node(1, node::max_id - 1, n3_5.uid(), n3_7.uid()); + node n3_1 = node(0, node::max_id, n3_2.uid(), n3_3.uid()); { // Garbage collect early and free write-lock node_writer nw_3(bdd_3); @@ -113,7 +113,7 @@ go_bandit([]() { } // TODO: should these be defined here? - shared_levelized_file bdd_0xnor2; + shared_levelized_file bdd_0xnor2; /* // 1 ---- x0 // / \ @@ -124,9 +124,9 @@ go_bandit([]() { // T F F T */ - node nx_3 = node(2, node::MAX_ID, terminal_F, terminal_T); - node nx_2 = node(2, node::MAX_ID - 1, terminal_T, terminal_F); - node nx_1 = node(0, node::MAX_ID, nx_2, nx_3); + node nx_3 = node(2, node::max_id, terminal_F, terminal_T); + node nx_2 = node(2, node::max_id - 1, terminal_T, terminal_F); + node nx_1 = node(0, node::max_id, nx_2, nx_3); { // Garbage collect early and free write-lock node_writer nw_x(bdd_0xnor2); @@ -134,7 +134,7 @@ go_bandit([]() { } // Some are shared, and some are not - easier to find with all in one location - cluttering maybe though? - shared_levelized_file bdd_thin; + shared_levelized_file bdd_thin; /* // 1 ---- x0 // / \ @@ -147,11 +147,11 @@ go_bandit([]() { // T F F T */ - node nt_5 = node(2, node::MAX_ID, terminal_F, terminal_T); - node nt_4 = node(2, node::MAX_ID - 1, terminal_T, terminal_F); - node nt_3 = node(1, node::MAX_ID, nt_4, nt_5); - node nt_2 = node(1, node::MAX_ID - 1, nt_5, nt_4); - node nt_1 = node(0, node::MAX_ID, nt_2, nt_3); + node nt_5 = node(2, node::max_id, terminal_F, terminal_T); + node nt_4 = node(2, node::max_id - 1, terminal_T, terminal_F); + node nt_3 = node(1, node::max_id, nt_4, nt_5); + node nt_2 = node(1, node::max_id - 1, nt_5, nt_4); + node nt_1 = node(0, node::max_id, nt_2, nt_3); { // Garbage collect early and free write-lock node_writer nw_t(bdd_thin); @@ -161,7 +161,7 @@ go_bandit([]() { AssertThat(bdd_thin->canonical, Is().EqualTo(true)); AssertThat(bdd_thin->width, Is().EqualTo(2u)); - shared_levelized_file bdd_wide; + shared_levelized_file bdd_wide; /* // 1 ---- x0 // / \ @@ -175,13 +175,13 @@ go_bandit([]() { // F T */ - node nw_7 = node(3, node::MAX_ID, terminal_F, terminal_T); - node nw_6 = node(2, node::MAX_ID, terminal_F, terminal_T); - node nw_5 = node(2, node::MAX_ID - 1, terminal_T, terminal_F); - node nw_4 = node(2, node::MAX_ID - 2, terminal_F, nw_7); - node nw_3 = node(1, node::MAX_ID, nw_6, nw_5); - node nw_2 = node(1, node::MAX_ID - 1, nw_5, nw_4); - node nw_1 = node(0, node::MAX_ID, nw_2, nw_3); + node nw_7 = node(3, node::max_id, terminal_F, terminal_T); + node nw_6 = node(2, node::max_id, terminal_F, terminal_T); + node nw_5 = node(2, node::max_id - 1, terminal_T, terminal_F); + node nw_4 = node(2, node::max_id - 2, terminal_F, nw_7); + node nw_3 = node(1, node::max_id, nw_6, nw_5); + node nw_2 = node(1, node::max_id - 1, nw_5, nw_4); + node nw_1 = node(0, node::max_id, nw_2, nw_3); { // Garbage collect early and free write-lock node_writer nw_w(bdd_wide); @@ -191,7 +191,7 @@ go_bandit([]() { // bdd_wide->canonical == true // bdd_wide->width == 3u - shared_levelized_file bdd_canon; + shared_levelized_file bdd_canon; /* // 1 ---- x0 // / \ @@ -205,15 +205,15 @@ go_bandit([]() { // T F F T */ - node nc_9 = node(3, node::MAX_ID, terminal_F, terminal_T); - node nc_8 = node(3, node::MAX_ID - 1, terminal_T, terminal_F); - node nc_7 = node(2, node::MAX_ID, terminal_F, terminal_T); - node nc_6 = node(2, node::MAX_ID - 1, terminal_T, terminal_F); - node nc_5 = node(2, node::MAX_ID - 2, terminal_F, nc_9); - node nc_4 = node(2, node::MAX_ID - 3, terminal_F, nc_8); - node nc_3 = node(1, node::MAX_ID, nc_5, nc_7); - node nc_2 = node(1, node::MAX_ID - 1, nc_4, nc_6); - node nc_1 = node(0, node::MAX_ID, nc_2, nc_3); + node nc_9 = node(3, node::max_id, terminal_F, terminal_T); + node nc_8 = node(3, node::max_id - 1, terminal_T, terminal_F); + node nc_7 = node(2, node::max_id, terminal_F, terminal_T); + node nc_6 = node(2, node::max_id - 1, terminal_T, terminal_F); + node nc_5 = node(2, node::max_id - 2, terminal_F, nc_9); + node nc_4 = node(2, node::max_id - 3, terminal_F, nc_8); + node nc_3 = node(1, node::max_id, nc_5, nc_7); + node nc_2 = node(1, node::max_id - 1, nc_4, nc_6); + node nc_1 = node(0, node::max_id, nc_2, nc_3); { // Garbage collect early and free write-lock node_writer nw_c(bdd_canon); @@ -223,7 +223,7 @@ go_bandit([]() { // bdd_canon->canonical == true // bdd_canon->width == 4u - shared_levelized_file bdd_non_canon; + shared_levelized_file bdd_non_canon; /* // 1 ---- x0 // / \ @@ -237,13 +237,13 @@ go_bandit([]() { // T F */ - node nn_7 = node(3, node::MAX_ID, terminal_T, terminal_F); - node nn_6 = node(2, node::MAX_ID, terminal_F, terminal_T); - node nn_5 = node(2, node::MAX_ID - 1, nn_7, terminal_F); - node nn_4 = node(2, node::MAX_ID - 2, terminal_T, terminal_F); - node nn_3 = node(1, node::MAX_ID, nn_6, nn_4); - node nn_2 = node(1, node::MAX_ID - 1, nn_4, nn_5); - node nn_1 = node(0, node::MAX_ID, nn_2, nn_3); + node nn_7 = node(3, node::max_id, terminal_T, terminal_F); + node nn_6 = node(2, node::max_id, terminal_F, terminal_T); + node nn_5 = node(2, node::max_id - 1, nn_7, terminal_F); + node nn_4 = node(2, node::max_id - 2, terminal_T, terminal_F); + node nn_3 = node(1, node::max_id, nn_6, nn_4); + node nn_2 = node(1, node::max_id - 1, nn_4, nn_5); + node nn_1 = node(0, node::max_id, nn_2, nn_3); { // Garbage collect early and free write-lock node_writer nw_n(bdd_non_canon); @@ -266,19 +266,19 @@ go_bandit([]() { AssertThat(out_nodes.can_pull(), Is().False()); - AssertThat(out.get>()->levels(), Is().EqualTo(0u)); + AssertThat(out.get>()->levels(), Is().EqualTo(0u)); - AssertThat(out.get>()->max_1level_cut[cut_type::INTERNAL], Is().EqualTo(0u)); - AssertThat(out.get>()->max_1level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(1u)); - AssertThat(out.get>()->max_1level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(0u)); - AssertThat(out.get>()->max_1level_cut[cut_type::ALL], Is().EqualTo(1u)); + AssertThat(out.get>()->max_1level_cut[cut::Internal], Is().EqualTo(0u)); + AssertThat(out.get>()->max_1level_cut[cut::Internal_False], Is().EqualTo(1u)); + AssertThat(out.get>()->max_1level_cut[cut::Internal_True], Is().EqualTo(0u)); + AssertThat(out.get>()->max_1level_cut[cut::All], Is().EqualTo(1u)); - AssertThat(out.get>()->number_of_terminals[false], Is().EqualTo(1u)); - AssertThat(out.get>()->number_of_terminals[true], Is().EqualTo(0u)); + AssertThat(out.get>()->number_of_terminals[false], Is().EqualTo(1u)); + AssertThat(out.get>()->number_of_terminals[true], Is().EqualTo(0u)); }); it("should resolve T /\\ T terminal-only BDDs", [&]() { - shared_levelized_file bdd_T2; + shared_levelized_file bdd_T2; { node_writer w(bdd_T2); w << node(true); @@ -292,21 +292,21 @@ go_bandit([]() { AssertThat(out_nodes.can_pull(), Is().False()); - AssertThat(out.get>()->levels(), Is().EqualTo(0u)); + AssertThat(out.get>()->levels(), Is().EqualTo(0u)); - AssertThat(out.get>()->max_1level_cut[cut_type::INTERNAL], Is().EqualTo(0u)); - AssertThat(out.get>()->max_1level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(0u)); - AssertThat(out.get>()->max_1level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(1u)); - AssertThat(out.get>()->max_1level_cut[cut_type::ALL], Is().EqualTo(1u)); + AssertThat(out.get>()->max_1level_cut[cut::Internal], Is().EqualTo(0u)); + AssertThat(out.get>()->max_1level_cut[cut::Internal_False], Is().EqualTo(0u)); + AssertThat(out.get>()->max_1level_cut[cut::Internal_True], Is().EqualTo(1u)); + AssertThat(out.get>()->max_1level_cut[cut::All], Is().EqualTo(1u)); - AssertThat(out.get>()->number_of_terminals[false], Is().EqualTo(0u)); - AssertThat(out.get>()->number_of_terminals[true], Is().EqualTo(1u)); + AssertThat(out.get>()->number_of_terminals[false], Is().EqualTo(0u)); + AssertThat(out.get>()->number_of_terminals[true], Is().EqualTo(1u)); }); it("should shortcut on irrelevance on x0 /\\ T", [&]() { __bdd out = bdd_and(bdd_x0, bdd_T); - AssertThat(out.get>(), Is().EqualTo(bdd_x0)); + AssertThat(out.get>(), Is().EqualTo(bdd_x0)); AssertThat(out.negate, Is().False()); }); @@ -320,15 +320,15 @@ go_bandit([]() { AssertThat(out_nodes.can_pull(), Is().False()); - AssertThat(out.get>()->levels(), Is().EqualTo(0u)); + AssertThat(out.get>()->levels(), Is().EqualTo(0u)); - AssertThat(out.get>()->max_1level_cut[cut_type::INTERNAL], Is().EqualTo(0u)); - AssertThat(out.get>()->max_1level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(1u)); - AssertThat(out.get>()->max_1level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(0u)); - AssertThat(out.get>()->max_1level_cut[cut_type::ALL], Is().EqualTo(1u)); + AssertThat(out.get>()->max_1level_cut[cut::Internal], Is().EqualTo(0u)); + AssertThat(out.get>()->max_1level_cut[cut::Internal_False], Is().EqualTo(1u)); + AssertThat(out.get>()->max_1level_cut[cut::Internal_True], Is().EqualTo(0u)); + AssertThat(out.get>()->max_1level_cut[cut::All], Is().EqualTo(1u)); - AssertThat(out.get>()->number_of_terminals[false], Is().EqualTo(1u)); - AssertThat(out.get>()->number_of_terminals[true], Is().EqualTo(0u)); + AssertThat(out.get>()->number_of_terminals[false], Is().EqualTo(1u)); + AssertThat(out.get>()->number_of_terminals[true], Is().EqualTo(0u)); }); it("should shortcut F /\\ [2]", [&]() { @@ -341,21 +341,21 @@ go_bandit([]() { AssertThat(out_nodes.can_pull(), Is().False()); - AssertThat(out.get>()->levels(), Is().EqualTo(0u)); + AssertThat(out.get>()->levels(), Is().EqualTo(0u)); - AssertThat(out.get>()->max_1level_cut[cut_type::INTERNAL], Is().EqualTo(0u)); - AssertThat(out.get>()->max_1level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(1u)); - AssertThat(out.get>()->max_1level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(0u)); - AssertThat(out.get>()->max_1level_cut[cut_type::ALL], Is().EqualTo(1u)); + AssertThat(out.get>()->max_1level_cut[cut::Internal], Is().EqualTo(0u)); + AssertThat(out.get>()->max_1level_cut[cut::Internal_False], Is().EqualTo(1u)); + AssertThat(out.get>()->max_1level_cut[cut::Internal_True], Is().EqualTo(0u)); + AssertThat(out.get>()->max_1level_cut[cut::All], Is().EqualTo(1u)); - AssertThat(out.get>()->number_of_terminals[false], Is().EqualTo(1u)); - AssertThat(out.get>()->number_of_terminals[true], Is().EqualTo(0u)); + AssertThat(out.get>()->number_of_terminals[false], Is().EqualTo(1u)); + AssertThat(out.get>()->number_of_terminals[true], Is().EqualTo(0u)); }); it("should return input on being given the same BDD twice", [&]() { __bdd out = bdd_and(bdd_1, bdd_1); - AssertThat(out.get>(), Is().EqualTo(bdd_1)); + AssertThat(out.get>(), Is().EqualTo(bdd_1)); AssertThat(out.negate, Is().False()); }); }); @@ -364,14 +364,14 @@ go_bandit([]() { it("should shortcut on negating on T and x0", [&]() { __bdd out = bdd_nand(bdd_x0, bdd_T); - AssertThat(out.get>(), Is().EqualTo(bdd_x0)); + AssertThat(out.get>(), Is().EqualTo(bdd_x0)); AssertThat(out.negate, Is().True()); }); it("should shortcut on negating on T and x0", [&]() { __bdd out = bdd_nand(bdd_x0, bdd_T); - AssertThat(out.get>(), Is().EqualTo(bdd_x0)); + AssertThat(out.get>(), Is().EqualTo(bdd_x0)); AssertThat(out.negate, Is().True()); }); @@ -385,15 +385,15 @@ go_bandit([]() { AssertThat(out_nodes.can_pull(), Is().False()); - AssertThat(out.get>()->levels(), Is().EqualTo(0u)); + AssertThat(out.get>()->levels(), Is().EqualTo(0u)); - AssertThat(out.get>()->max_1level_cut[cut_type::INTERNAL], Is().EqualTo(0u)); - AssertThat(out.get>()->max_1level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(0u)); - AssertThat(out.get>()->max_1level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(1u)); - AssertThat(out.get>()->max_1level_cut[cut_type::ALL], Is().EqualTo(1u)); + AssertThat(out.get>()->max_1level_cut[cut::Internal], Is().EqualTo(0u)); + AssertThat(out.get>()->max_1level_cut[cut::Internal_False], Is().EqualTo(0u)); + AssertThat(out.get>()->max_1level_cut[cut::Internal_True], Is().EqualTo(1u)); + AssertThat(out.get>()->max_1level_cut[cut::All], Is().EqualTo(1u)); - AssertThat(out.get>()->number_of_terminals[false], Is().EqualTo(0u)); - AssertThat(out.get>()->number_of_terminals[true], Is().EqualTo(1u)); + AssertThat(out.get>()->number_of_terminals[false], Is().EqualTo(0u)); + AssertThat(out.get>()->number_of_terminals[true], Is().EqualTo(1u)); }); }); @@ -407,19 +407,19 @@ go_bandit([]() { AssertThat(out_nodes.can_pull(), Is().False()); - AssertThat(out.get>()->levels(), Is().EqualTo(0u)); + AssertThat(out.get>()->levels(), Is().EqualTo(0u)); - AssertThat(out.get>()->max_1level_cut[cut_type::INTERNAL], Is().EqualTo(0u)); - AssertThat(out.get>()->max_1level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(0u)); - AssertThat(out.get>()->max_1level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(1u)); - AssertThat(out.get>()->max_1level_cut[cut_type::ALL], Is().EqualTo(1u)); + AssertThat(out.get>()->max_1level_cut[cut::Internal], Is().EqualTo(0u)); + AssertThat(out.get>()->max_1level_cut[cut::Internal_False], Is().EqualTo(0u)); + AssertThat(out.get>()->max_1level_cut[cut::Internal_True], Is().EqualTo(1u)); + AssertThat(out.get>()->max_1level_cut[cut::All], Is().EqualTo(1u)); - AssertThat(out.get>()->number_of_terminals[false], Is().EqualTo(0u)); - AssertThat(out.get>()->number_of_terminals[true], Is().EqualTo(1u)); + AssertThat(out.get>()->number_of_terminals[false], Is().EqualTo(0u)); + AssertThat(out.get>()->number_of_terminals[true], Is().EqualTo(1u)); }); it("should resolve F \\/ F terminal-only BDDs", [&]() { - shared_levelized_file bdd_F2; + shared_levelized_file bdd_F2; { node_writer w(bdd_F2); @@ -434,28 +434,28 @@ go_bandit([]() { AssertThat(out_nodes.can_pull(), Is().False()); - AssertThat(out.get>()->levels(), Is().EqualTo(0u)); + AssertThat(out.get>()->levels(), Is().EqualTo(0u)); - AssertThat(out.get>()->max_1level_cut[cut_type::INTERNAL], Is().EqualTo(0u)); - AssertThat(out.get>()->max_1level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(1u)); - AssertThat(out.get>()->max_1level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(0u)); - AssertThat(out.get>()->max_1level_cut[cut_type::ALL], Is().EqualTo(1u)); + AssertThat(out.get>()->max_1level_cut[cut::Internal], Is().EqualTo(0u)); + AssertThat(out.get>()->max_1level_cut[cut::Internal_False], Is().EqualTo(1u)); + AssertThat(out.get>()->max_1level_cut[cut::Internal_True], Is().EqualTo(0u)); + AssertThat(out.get>()->max_1level_cut[cut::All], Is().EqualTo(1u)); - AssertThat(out.get>()->number_of_terminals[false], Is().EqualTo(1u)); - AssertThat(out.get>()->number_of_terminals[true], Is().EqualTo(0u)); + AssertThat(out.get>()->number_of_terminals[false], Is().EqualTo(1u)); + AssertThat(out.get>()->number_of_terminals[true], Is().EqualTo(0u)); }); it("should shortcut on irrelevance on x0 \\/ F", [&]() { __bdd out = bdd_or(bdd_x0, bdd_F); - AssertThat(out.get>(), Is().EqualTo(bdd_x0)); + AssertThat(out.get>(), Is().EqualTo(bdd_x0)); AssertThat(out.negate, Is().False()); }); it("should OR shortcut on irrelevance F \\/ x0", [&]() { __bdd out = bdd_or(bdd_F, bdd_x0); - AssertThat(out.get>(), Is().EqualTo(bdd_x0)); + AssertThat(out.get>(), Is().EqualTo(bdd_x0)); AssertThat(out.negate, Is().False()); }); @@ -469,15 +469,15 @@ go_bandit([]() { AssertThat(out_nodes.can_pull(), Is().False()); - AssertThat(out.get>()->levels(), Is().EqualTo(0u)); + AssertThat(out.get>()->levels(), Is().EqualTo(0u)); - AssertThat(out.get>()->max_1level_cut[cut_type::INTERNAL], Is().EqualTo(0u)); - AssertThat(out.get>()->max_1level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(0u)); - AssertThat(out.get>()->max_1level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(1u)); - AssertThat(out.get>()->max_1level_cut[cut_type::ALL], Is().EqualTo(1u)); + AssertThat(out.get>()->max_1level_cut[cut::Internal], Is().EqualTo(0u)); + AssertThat(out.get>()->max_1level_cut[cut::Internal_False], Is().EqualTo(0u)); + AssertThat(out.get>()->max_1level_cut[cut::Internal_True], Is().EqualTo(1u)); + AssertThat(out.get>()->max_1level_cut[cut::All], Is().EqualTo(1u)); - AssertThat(out.get>()->number_of_terminals[false], Is().EqualTo(0u)); - AssertThat(out.get>()->number_of_terminals[true], Is().EqualTo(1u)); + AssertThat(out.get>()->number_of_terminals[false], Is().EqualTo(0u)); + AssertThat(out.get>()->number_of_terminals[true], Is().EqualTo(1u)); }); it("should compute (and shortcut) [2] \\/ T", [&]() { @@ -490,15 +490,15 @@ go_bandit([]() { AssertThat(out_nodes.can_pull(), Is().False()); - AssertThat(out.get>()->levels(), Is().EqualTo(0u)); + AssertThat(out.get>()->levels(), Is().EqualTo(0u)); - AssertThat(out.get>()->max_1level_cut[cut_type::INTERNAL], Is().EqualTo(0u)); - AssertThat(out.get>()->max_1level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(0u)); - AssertThat(out.get>()->max_1level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(1u)); - AssertThat(out.get>()->max_1level_cut[cut_type::ALL], Is().EqualTo(1u)); + AssertThat(out.get>()->max_1level_cut[cut::Internal], Is().EqualTo(0u)); + AssertThat(out.get>()->max_1level_cut[cut::Internal_False], Is().EqualTo(0u)); + AssertThat(out.get>()->max_1level_cut[cut::Internal_True], Is().EqualTo(1u)); + AssertThat(out.get>()->max_1level_cut[cut::All], Is().EqualTo(1u)); - AssertThat(out.get>()->number_of_terminals[false], Is().EqualTo(0u)); - AssertThat(out.get>()->number_of_terminals[true], Is().EqualTo(1u)); + AssertThat(out.get>()->number_of_terminals[false], Is().EqualTo(0u)); + AssertThat(out.get>()->number_of_terminals[true], Is().EqualTo(1u)); }); }); @@ -513,15 +513,15 @@ go_bandit([]() { AssertThat(out_nodes.can_pull(), Is().False()); - AssertThat(out.get>()->levels(), Is().EqualTo(0u)); + AssertThat(out.get>()->levels(), Is().EqualTo(0u)); - AssertThat(out.get>()->max_1level_cut[cut_type::INTERNAL], Is().EqualTo(0u)); - AssertThat(out.get>()->max_1level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(1u)); - AssertThat(out.get>()->max_1level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(0u)); - AssertThat(out.get>()->max_1level_cut[cut_type::ALL], Is().EqualTo(1u)); + AssertThat(out.get>()->max_1level_cut[cut::Internal], Is().EqualTo(0u)); + AssertThat(out.get>()->max_1level_cut[cut::Internal_False], Is().EqualTo(1u)); + AssertThat(out.get>()->max_1level_cut[cut::Internal_True], Is().EqualTo(0u)); + AssertThat(out.get>()->max_1level_cut[cut::All], Is().EqualTo(1u)); - AssertThat(out.get>()->number_of_terminals[false], Is().EqualTo(1u)); - AssertThat(out.get>()->number_of_terminals[true], Is().EqualTo(0u)); + AssertThat(out.get>()->number_of_terminals[false], Is().EqualTo(1u)); + AssertThat(out.get>()->number_of_terminals[true], Is().EqualTo(0u)); }); }); @@ -535,15 +535,15 @@ go_bandit([]() { AssertThat(out_nodes.can_pull(), Is().False()); - AssertThat(out.get>()->levels(), Is().EqualTo(0u)); + AssertThat(out.get>()->levels(), Is().EqualTo(0u)); - AssertThat(out.get>()->max_1level_cut[cut_type::INTERNAL], Is().EqualTo(0u)); - AssertThat(out.get>()->max_1level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(0u)); - AssertThat(out.get>()->max_1level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(1u)); - AssertThat(out.get>()->max_1level_cut[cut_type::ALL], Is().EqualTo(1u)); + AssertThat(out.get>()->max_1level_cut[cut::Internal], Is().EqualTo(0u)); + AssertThat(out.get>()->max_1level_cut[cut::Internal_False], Is().EqualTo(0u)); + AssertThat(out.get>()->max_1level_cut[cut::Internal_True], Is().EqualTo(1u)); + AssertThat(out.get>()->max_1level_cut[cut::All], Is().EqualTo(1u)); - AssertThat(out.get>()->number_of_terminals[false], Is().EqualTo(0u)); - AssertThat(out.get>()->number_of_terminals[true], Is().EqualTo(1u)); + AssertThat(out.get>()->number_of_terminals[false], Is().EqualTo(0u)); + AssertThat(out.get>()->number_of_terminals[true], Is().EqualTo(1u)); }); it("should resolve T ^ T terminal-only BDDs", [&]() { @@ -555,28 +555,28 @@ go_bandit([]() { AssertThat(out_nodes.can_pull(), Is().False()); - AssertThat(out.get>()->levels(), Is().EqualTo(0u)); + AssertThat(out.get>()->levels(), Is().EqualTo(0u)); - AssertThat(out.get>()->max_1level_cut[cut_type::INTERNAL], Is().EqualTo(0u)); - AssertThat(out.get>()->max_1level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(1u)); - AssertThat(out.get>()->max_1level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(0u)); - AssertThat(out.get>()->max_1level_cut[cut_type::ALL], Is().EqualTo(1u)); + AssertThat(out.get>()->max_1level_cut[cut::Internal], Is().EqualTo(0u)); + AssertThat(out.get>()->max_1level_cut[cut::Internal_False], Is().EqualTo(1u)); + AssertThat(out.get>()->max_1level_cut[cut::Internal_True], Is().EqualTo(0u)); + AssertThat(out.get>()->max_1level_cut[cut::All], Is().EqualTo(1u)); - AssertThat(out.get>()->number_of_terminals[false], Is().EqualTo(1u)); - AssertThat(out.get>()->number_of_terminals[true], Is().EqualTo(0u)); + AssertThat(out.get>()->number_of_terminals[false], Is().EqualTo(1u)); + AssertThat(out.get>()->number_of_terminals[true], Is().EqualTo(0u)); }); it("should shortcut on negating on x0 ^ T", [&]() { __bdd out = bdd_xor(bdd_x0, bdd_T); - AssertThat(out.get>(), Is().EqualTo(bdd_x0)); + AssertThat(out.get>(), Is().EqualTo(bdd_x0)); AssertThat(out.negate, Is().True()); }); it("should shortcut on negating on T ^ x0", [&]() { __bdd out = bdd_xor(bdd_x0, bdd_T); - AssertThat(out.get>(), Is().EqualTo(bdd_x0)); + AssertThat(out.get>(), Is().EqualTo(bdd_x0)); AssertThat(out.negate, Is().True()); }); @@ -590,15 +590,15 @@ go_bandit([]() { AssertThat(out_nodes.can_pull(), Is().False()); - AssertThat(out.get>()->levels(), Is().EqualTo(0u)); + AssertThat(out.get>()->levels(), Is().EqualTo(0u)); - AssertThat(out.get>()->max_1level_cut[cut_type::INTERNAL], Is().EqualTo(0u)); - AssertThat(out.get>()->max_1level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(1u)); - AssertThat(out.get>()->max_1level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(0u)); - AssertThat(out.get>()->max_1level_cut[cut_type::ALL], Is().EqualTo(1u)); + AssertThat(out.get>()->max_1level_cut[cut::Internal], Is().EqualTo(0u)); + AssertThat(out.get>()->max_1level_cut[cut::Internal_False], Is().EqualTo(1u)); + AssertThat(out.get>()->max_1level_cut[cut::Internal_True], Is().EqualTo(0u)); + AssertThat(out.get>()->max_1level_cut[cut::All], Is().EqualTo(1u)); - AssertThat(out.get>()->number_of_terminals[false], Is().EqualTo(1u)); - AssertThat(out.get>()->number_of_terminals[true], Is().EqualTo(0u)); + AssertThat(out.get>()->number_of_terminals[false], Is().EqualTo(1u)); + AssertThat(out.get>()->number_of_terminals[true], Is().EqualTo(0u)); }); it("should collapse on the same BDD twice to a terminal, when both are negated", [&]() { @@ -611,15 +611,15 @@ go_bandit([]() { AssertThat(out_nodes.can_pull(), Is().False()); - AssertThat(out.get>()->levels(), Is().EqualTo(0u)); + AssertThat(out.get>()->levels(), Is().EqualTo(0u)); - AssertThat(out.get>()->max_1level_cut[cut_type::INTERNAL], Is().EqualTo(0u)); - AssertThat(out.get>()->max_1level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(1u)); - AssertThat(out.get>()->max_1level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(0u)); - AssertThat(out.get>()->max_1level_cut[cut_type::ALL], Is().EqualTo(1u)); + AssertThat(out.get>()->max_1level_cut[cut::Internal], Is().EqualTo(0u)); + AssertThat(out.get>()->max_1level_cut[cut::Internal_False], Is().EqualTo(1u)); + AssertThat(out.get>()->max_1level_cut[cut::Internal_True], Is().EqualTo(0u)); + AssertThat(out.get>()->max_1level_cut[cut::All], Is().EqualTo(1u)); - AssertThat(out.get>()->number_of_terminals[false], Is().EqualTo(1u)); - AssertThat(out.get>()->number_of_terminals[true], Is().EqualTo(0u)); + AssertThat(out.get>()->number_of_terminals[false], Is().EqualTo(1u)); + AssertThat(out.get>()->number_of_terminals[true], Is().EqualTo(0u)); }); }); @@ -633,15 +633,15 @@ go_bandit([]() { AssertThat(out_nodes.can_pull(), Is().False()); - AssertThat(out.get>()->levels(), Is().EqualTo(0u)); + AssertThat(out.get>()->levels(), Is().EqualTo(0u)); - AssertThat(out.get>()->max_1level_cut[cut_type::INTERNAL], Is().EqualTo(0u)); - AssertThat(out.get>()->max_1level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(0u)); - AssertThat(out.get>()->max_1level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(1u)); - AssertThat(out.get>()->max_1level_cut[cut_type::ALL], Is().EqualTo(1u)); + AssertThat(out.get>()->max_1level_cut[cut::Internal], Is().EqualTo(0u)); + AssertThat(out.get>()->max_1level_cut[cut::Internal_False], Is().EqualTo(0u)); + AssertThat(out.get>()->max_1level_cut[cut::Internal_True], Is().EqualTo(1u)); + AssertThat(out.get>()->max_1level_cut[cut::All], Is().EqualTo(1u)); - AssertThat(out.get>()->number_of_terminals[false], Is().EqualTo(0u)); - AssertThat(out.get>()->number_of_terminals[true], Is().EqualTo(1u)); + AssertThat(out.get>()->number_of_terminals[false], Is().EqualTo(0u)); + AssertThat(out.get>()->number_of_terminals[true], Is().EqualTo(1u)); }); it("should resolve T -> F terminal-only BDDs", [&]() { @@ -653,15 +653,15 @@ go_bandit([]() { AssertThat(out_nodes.can_pull(), Is().False()); - AssertThat(out.get>()->levels(), Is().EqualTo(0u)); + AssertThat(out.get>()->levels(), Is().EqualTo(0u)); - AssertThat(out.get>()->max_1level_cut[cut_type::INTERNAL], Is().EqualTo(0u)); - AssertThat(out.get>()->max_1level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(1u)); - AssertThat(out.get>()->max_1level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(0u)); - AssertThat(out.get>()->max_1level_cut[cut_type::ALL], Is().EqualTo(1u)); + AssertThat(out.get>()->max_1level_cut[cut::Internal], Is().EqualTo(0u)); + AssertThat(out.get>()->max_1level_cut[cut::Internal_False], Is().EqualTo(1u)); + AssertThat(out.get>()->max_1level_cut[cut::Internal_True], Is().EqualTo(0u)); + AssertThat(out.get>()->max_1level_cut[cut::All], Is().EqualTo(1u)); - AssertThat(out.get>()->number_of_terminals[false], Is().EqualTo(1u)); - AssertThat(out.get>()->number_of_terminals[true], Is().EqualTo(0u)); + AssertThat(out.get>()->number_of_terminals[false], Is().EqualTo(1u)); + AssertThat(out.get>()->number_of_terminals[true], Is().EqualTo(0u)); }); it("should resolve T -> T terminal-only BDDs", [&]() { @@ -673,21 +673,21 @@ go_bandit([]() { AssertThat(out_nodes.can_pull(), Is().False()); - AssertThat(out.get>()->levels(), Is().EqualTo(0u)); + AssertThat(out.get>()->levels(), Is().EqualTo(0u)); - AssertThat(out.get>()->max_1level_cut[cut_type::INTERNAL], Is().EqualTo(0u)); - AssertThat(out.get>()->max_1level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(0u)); - AssertThat(out.get>()->max_1level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(1u)); - AssertThat(out.get>()->max_1level_cut[cut_type::ALL], Is().EqualTo(1u)); + AssertThat(out.get>()->max_1level_cut[cut::Internal], Is().EqualTo(0u)); + AssertThat(out.get>()->max_1level_cut[cut::Internal_False], Is().EqualTo(0u)); + AssertThat(out.get>()->max_1level_cut[cut::Internal_True], Is().EqualTo(1u)); + AssertThat(out.get>()->max_1level_cut[cut::All], Is().EqualTo(1u)); - AssertThat(out.get>()->number_of_terminals[false], Is().EqualTo(0u)); - AssertThat(out.get>()->number_of_terminals[true], Is().EqualTo(1u)); + AssertThat(out.get>()->number_of_terminals[false], Is().EqualTo(0u)); + AssertThat(out.get>()->number_of_terminals[true], Is().EqualTo(1u)); }); it("should shortcut on irrelevance on T -> x0", [&]() { __bdd out = bdd_imp(bdd_T, bdd_x0); - AssertThat(out.get>(), Is().EqualTo(bdd_x0)); + AssertThat(out.get>(), Is().EqualTo(bdd_x0)); AssertThat(out.negate, Is().False()); }); @@ -701,28 +701,28 @@ go_bandit([]() { AssertThat(out_nodes.can_pull(), Is().False()); - AssertThat(out.get>()->levels(), Is().EqualTo(0u)); + AssertThat(out.get>()->levels(), Is().EqualTo(0u)); - AssertThat(out.get>()->max_1level_cut[cut_type::INTERNAL], Is().EqualTo(0u)); - AssertThat(out.get>()->max_1level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(0u)); - AssertThat(out.get>()->max_1level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(1u)); - AssertThat(out.get>()->max_1level_cut[cut_type::ALL], Is().EqualTo(1u)); + AssertThat(out.get>()->max_1level_cut[cut::Internal], Is().EqualTo(0u)); + AssertThat(out.get>()->max_1level_cut[cut::Internal_False], Is().EqualTo(0u)); + AssertThat(out.get>()->max_1level_cut[cut::Internal_True], Is().EqualTo(1u)); + AssertThat(out.get>()->max_1level_cut[cut::All], Is().EqualTo(1u)); - AssertThat(out.get>()->number_of_terminals[false], Is().EqualTo(0u)); - AssertThat(out.get>()->number_of_terminals[true], Is().EqualTo(1u)); + AssertThat(out.get>()->number_of_terminals[false], Is().EqualTo(0u)); + AssertThat(out.get>()->number_of_terminals[true], Is().EqualTo(1u)); }); it("should return the input when given the same BDD twice, where one is negated [1]", [&]() { __bdd out = bdd_imp(bdd_not(bdd_2), bdd_2); - AssertThat(out.get>(), Is().EqualTo(bdd_2)); + AssertThat(out.get>(), Is().EqualTo(bdd_2)); AssertThat(out.negate, Is().False()); // negated the already negated input doubly-negating }); it("should return input when given the same BDD twice, where one is negated [2]", [&]() { __bdd out = bdd_imp(bdd_2, bdd_not(bdd_2)); - AssertThat(out.get>(), Is().EqualTo(bdd_2)); + AssertThat(out.get>(), Is().EqualTo(bdd_2)); AssertThat(out.negate, Is().True()); // negated the first of the two }); }); @@ -730,7 +730,7 @@ go_bandit([]() { describe("access mode: priority queues", [&]() { // Set access mode to priority queues for this batch of tests - access_mode = access_mode_t::PQ; + access_mode = access_mode_t::Priority_Queue; /* The product construction of bbd_1 and bdd_2 above is as follows in sorted order. // @@ -904,7 +904,7 @@ go_bandit([]() { // The second version is the same but has the nodes 3 and 4 mirrored // and the T terminals are replaced with an arc to a node for x3. - shared_levelized_file bdd_group_1, bdd_group_2; + shared_levelized_file bdd_group_1, bdd_group_2; { // Garbage collect writers to free write-lock node_writer w1(bdd_group_1); w1 << node(2,1, ptr_uint64(false), ptr_uint64(true)) @@ -1617,12 +1617,12 @@ go_bandit([]() { }); // Reset access mode - access_mode = access_mode_t::AUTO; + access_mode = access_mode_t::Auto; }); describe("access mode: random access", [&]() { // Set access mode to random access for this batch of tests - access_mode = access_mode_t::RA; + access_mode = access_mode_t::Random_Access; // Trivial canonical: bdd_F, bdd_T, bdd_x0, bdd_not_x0, bdd_x1, bdd_x2 // Canonical: bdd_2 @@ -1860,7 +1860,7 @@ go_bandit([]() { }); it("handles requests where scanning index is on a later level", [&]() { - shared_levelized_file bdd_ra; + shared_levelized_file bdd_ra; /* // 1 ---- x0 // / \ @@ -1871,9 +1871,9 @@ go_bandit([]() { // F T */ - node nra_3 = node(2, node::MAX_ID, terminal_F, terminal_T); - node nra_2 = node(1, node::MAX_ID, terminal_F, nra_3); - node nra_1 = node(0, node::MAX_ID, terminal_F, nra_2); + node nra_3 = node(2, node::max_id, terminal_F, terminal_T); + node nra_2 = node(1, node::max_id, terminal_F, nra_3); + node nra_1 = node(0, node::max_id, terminal_F, nra_2); { // Garbage collect early and free write-lock node_writer nw_ra(bdd_ra); @@ -1957,7 +1957,7 @@ go_bandit([]() { }); it("should sort requests first by scanning index then by random acces index", [&]() { - shared_levelized_file bdd_wide2; + shared_levelized_file bdd_wide2; /* // 1 ---- x0 // / \ @@ -1972,13 +1972,13 @@ go_bandit([]() { // F T */ - node nw_7 = node(3, node::MAX_ID, terminal_F, terminal_T); - node nw_6 = node(2, node::MAX_ID, terminal_F, terminal_T); - node nw_5 = node(2, node::MAX_ID - 1, terminal_T, terminal_F); - node nw_4 = node(2, node::MAX_ID - 2, terminal_F, nw_7); - node nw_3 = node(1, node::MAX_ID, nw_4, nw_6); - node nw_2 = node(1, node::MAX_ID - 1, nw_4, nw_5); - node nw_1 = node(0, node::MAX_ID, nw_2, nw_3); + node nw_7 = node(3, node::max_id, terminal_F, terminal_T); + node nw_6 = node(2, node::max_id, terminal_F, terminal_T); + node nw_5 = node(2, node::max_id - 1, terminal_T, terminal_F); + node nw_4 = node(2, node::max_id - 2, terminal_F, nw_7); + node nw_3 = node(1, node::max_id, nw_4, nw_6); + node nw_2 = node(1, node::max_id - 1, nw_4, nw_5); + node nw_1 = node(0, node::max_id, nw_2, nw_3); { // Garbage collect early and free write-lock node_writer nw_w(bdd_wide2); @@ -2532,7 +2532,7 @@ go_bandit([]() { }); // Reset access mode - access_mode = access_mode_t::AUTO; + access_mode = access_mode_t::Auto; }); }); }); diff --git a/test/adiar/bdd/test_bdd.cpp b/test/adiar/bdd/test_bdd.cpp index cff2282ec..2a051754d 100644 --- a/test/adiar/bdd/test_bdd.cpp +++ b/test/adiar/bdd/test_bdd.cpp @@ -2,46 +2,46 @@ go_bandit([]() { describe("src/adiar/bdd.h", []() { - shared_levelized_file x0_nf; + shared_levelized_file x0_nf; { node_writer nw_0(x0_nf); - nw_0 << node(0, node::MAX_ID, + nw_0 << node(0, node::max_id, ptr_uint64(false), ptr_uint64(true)); } bdd x0(x0_nf); - shared_levelized_file x1_nf; + shared_levelized_file x1_nf; { node_writer nw_1(x1_nf); - nw_1 << node(1, node::MAX_ID, + nw_1 << node(1, node::max_id, ptr_uint64(false), ptr_uint64(true)); } bdd x1(x1_nf); - shared_levelized_file x0_and_x1_nf; + shared_levelized_file x0_and_x1_nf; { node_writer nw_01(x0_and_x1_nf); - nw_01 << node(1, node::MAX_ID, + nw_01 << node(1, node::max_id, ptr_uint64(false), ptr_uint64(true)); - nw_01 << node(0, node::MAX_ID, + nw_01 << node(0, node::max_id, ptr_uint64(false), - ptr_uint64(1, ptr_uint64::MAX_ID)); + ptr_uint64(1, ptr_uint64::max_id)); } bdd x0_and_x1(x0_and_x1_nf); bdd x0_nand_x1(x0_and_x1_nf, true); - shared_levelized_file terminal_T_nf; + shared_levelized_file terminal_T_nf; { node_writer nw_T(terminal_T_nf); @@ -50,7 +50,7 @@ go_bandit([]() { bdd terminal_T(terminal_T_nf); - shared_levelized_file terminal_F_nf; + shared_levelized_file terminal_F_nf; { node_writer nw_F(terminal_F_nf); @@ -62,30 +62,30 @@ go_bandit([]() { describe("__bdd", [&]() { it("should copy-construct values from bdd", [&]() { __bdd t1 = bdd(x0_and_x1); - AssertThat(t1.has>(), Is().True()); - AssertThat(t1.get>(), Is().EqualTo(x0_and_x1_nf)); + AssertThat(t1.has>(), Is().True()); + AssertThat(t1.get>(), Is().EqualTo(x0_and_x1_nf)); AssertThat(t1.negate, Is().False()); }); it("should copy-construct values from negated bdd", [&]() { __bdd t2 = bdd(x0_nand_x1); - AssertThat(t2.has>(), Is().True()); - AssertThat(t2.get>(), Is().EqualTo(x0_and_x1_nf)); + AssertThat(t2.has>(), Is().True()); + AssertThat(t2.get>(), Is().EqualTo(x0_and_x1_nf)); AssertThat(t2.negate, Is().True()); }); it("should copy-construct values from __bdd", [&]() { __bdd t1 = x0_and_x1; __bdd t2 = t1; - AssertThat(t2.has>(), Is().True()); - AssertThat(t2.get>(), Is().EqualTo(x0_and_x1_nf)); + AssertThat(t2.has>(), Is().True()); + AssertThat(t2.get>(), Is().EqualTo(x0_and_x1_nf)); AssertThat(t2.negate, Is().False()); }); - it("should copy-construct values from shared_levelized_file", [&]() { + it("should copy-construct values from shared_levelized_file", [&]() { __bdd t1 = x0_and_x1; - AssertThat(t1.has>(), Is().True()); - AssertThat(t1.get>(), Is().EqualTo(x0_and_x1_nf)); + AssertThat(t1.has>(), Is().True()); + AssertThat(t1.get>(), Is().EqualTo(x0_and_x1_nf)); AssertThat(t1.negate, Is().False()); }); @@ -128,7 +128,7 @@ go_bandit([]() { AssertThat(t2, Is().EqualTo(terminal_F)); }); - it("should copy-construct shared_levelized_file and negation back to bdd", [&]() { + it("should copy-construct shared_levelized_file and negation back to bdd", [&]() { bdd t2 = bdd(__bdd(x0_and_x1)); AssertThat(t2.file_ptr(), Is().EqualTo(x0_and_x1_nf)); AssertThat(t2.is_negated(), Is().False()); @@ -151,18 +151,18 @@ go_bandit([]() { AssertThat(x0_and_x1, Is().Not().EqualTo(x0_nand_x1)); }); - shared_levelized_file x0_and_x1_nf2; + shared_levelized_file x0_and_x1_nf2; { node_writer nw_01(x0_and_x1_nf2); - nw_01 << node(1, node::MAX_ID, + nw_01 << node(1, node::max_id, ptr_uint64(false), ptr_uint64(true)); - nw_01 << node(0, node::MAX_ID, + nw_01 << node(0, node::max_id, ptr_uint64(false), - ptr_uint64(1, ptr_uint64::MAX_ID)); + ptr_uint64(1, ptr_uint64::max_id)); } it("should check (x0 & x1) == (x0 & x1)", [&]() { diff --git a/test/adiar/bdd/test_build.cpp b/test/adiar/bdd/test_build.cpp index 8d3319522..64bf20a98 100644 --- a/test/adiar/bdd/test_build.cpp +++ b/test/adiar/bdd/test_build.cpp @@ -17,19 +17,19 @@ go_bandit([]() { level_info_test_stream ms(res); AssertThat(ms.can_pull(), Is().False()); - AssertThat(adiar::is_canonical(res), Is().True()); + AssertThat(bdd_iscanonical(res), Is().True()); AssertThat(res->width, Is().EqualTo(0u)); - AssertThat(res->max_1level_cut[cut_type::INTERNAL], Is().EqualTo(0u)); - AssertThat(res->max_1level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(0u)); - AssertThat(res->max_1level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(1u)); - AssertThat(res->max_1level_cut[cut_type::ALL], Is().EqualTo(1u)); + AssertThat(res->max_1level_cut[cut::Internal], Is().EqualTo(0u)); + AssertThat(res->max_1level_cut[cut::Internal_False], Is().EqualTo(0u)); + AssertThat(res->max_1level_cut[cut::Internal_True], Is().EqualTo(1u)); + AssertThat(res->max_1level_cut[cut::All], Is().EqualTo(1u)); - AssertThat(res->max_2level_cut[cut_type::INTERNAL], Is().EqualTo(0u)); - AssertThat(res->max_2level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(0u)); - AssertThat(res->max_2level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(1u)); - AssertThat(res->max_2level_cut[cut_type::ALL], Is().EqualTo(1u)); + AssertThat(res->max_2level_cut[cut::Internal], Is().EqualTo(0u)); + AssertThat(res->max_2level_cut[cut::Internal_False], Is().EqualTo(0u)); + AssertThat(res->max_2level_cut[cut::Internal_True], Is().EqualTo(1u)); + AssertThat(res->max_2level_cut[cut::All], Is().EqualTo(1u)); AssertThat(res->number_of_terminals[false], Is().EqualTo(0u)); AssertThat(res->number_of_terminals[true], Is().EqualTo(1u)); @@ -48,17 +48,17 @@ go_bandit([]() { AssertThat(res->width, Is().EqualTo(0u)); - AssertThat(res->max_1level_cut[cut_type::INTERNAL], Is().EqualTo(0u)); - AssertThat(res->max_1level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(0u)); - AssertThat(res->max_1level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(1u)); - AssertThat(res->max_1level_cut[cut_type::ALL], Is().EqualTo(1u)); + AssertThat(res->max_1level_cut[cut::Internal], Is().EqualTo(0u)); + AssertThat(res->max_1level_cut[cut::Internal_False], Is().EqualTo(0u)); + AssertThat(res->max_1level_cut[cut::Internal_True], Is().EqualTo(1u)); + AssertThat(res->max_1level_cut[cut::All], Is().EqualTo(1u)); - AssertThat(res->max_2level_cut[cut_type::INTERNAL], Is().EqualTo(0u)); - AssertThat(res->max_2level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(0u)); - AssertThat(res->max_2level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(1u)); - AssertThat(res->max_2level_cut[cut_type::ALL], Is().EqualTo(1u)); + AssertThat(res->max_2level_cut[cut::Internal], Is().EqualTo(0u)); + AssertThat(res->max_2level_cut[cut::Internal_False], Is().EqualTo(0u)); + AssertThat(res->max_2level_cut[cut::Internal_True], Is().EqualTo(1u)); + AssertThat(res->max_2level_cut[cut::All], Is().EqualTo(1u)); - AssertThat(adiar::is_canonical(res), Is().True()); + AssertThat(bdd_iscanonical(res), Is().True()); AssertThat(res->number_of_terminals[false], Is().EqualTo(0u)); AssertThat(res->number_of_terminals[true], Is().EqualTo(1u)); @@ -77,17 +77,17 @@ go_bandit([]() { AssertThat(res->width, Is().EqualTo(0u)); - AssertThat(res->max_1level_cut[cut_type::INTERNAL], Is().EqualTo(0u)); - AssertThat(res->max_1level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(0u)); - AssertThat(res->max_1level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(1u)); - AssertThat(res->max_1level_cut[cut_type::ALL], Is().EqualTo(1u)); + AssertThat(res->max_1level_cut[cut::Internal], Is().EqualTo(0u)); + AssertThat(res->max_1level_cut[cut::Internal_False], Is().EqualTo(0u)); + AssertThat(res->max_1level_cut[cut::Internal_True], Is().EqualTo(1u)); + AssertThat(res->max_1level_cut[cut::All], Is().EqualTo(1u)); - AssertThat(res->max_2level_cut[cut_type::INTERNAL], Is().EqualTo(0u)); - AssertThat(res->max_2level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(0u)); - AssertThat(res->max_2level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(1u)); - AssertThat(res->max_2level_cut[cut_type::ALL], Is().EqualTo(1u)); + AssertThat(res->max_2level_cut[cut::Internal], Is().EqualTo(0u)); + AssertThat(res->max_2level_cut[cut::Internal_False], Is().EqualTo(0u)); + AssertThat(res->max_2level_cut[cut::Internal_True], Is().EqualTo(1u)); + AssertThat(res->max_2level_cut[cut::All], Is().EqualTo(1u)); - AssertThat(adiar::is_canonical(res), Is().True()); + AssertThat(bdd_iscanonical(res), Is().True()); AssertThat(res->number_of_terminals[false], Is().EqualTo(0u)); AssertThat(res->number_of_terminals[true], Is().EqualTo(1u)); @@ -106,17 +106,17 @@ go_bandit([]() { AssertThat(res->width, Is().EqualTo(0u)); - AssertThat(res->max_1level_cut[cut_type::INTERNAL], Is().EqualTo(0u)); - AssertThat(res->max_1level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(1u)); - AssertThat(res->max_1level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(0u)); - AssertThat(res->max_1level_cut[cut_type::ALL], Is().EqualTo(1u)); + AssertThat(res->max_1level_cut[cut::Internal], Is().EqualTo(0u)); + AssertThat(res->max_1level_cut[cut::Internal_False], Is().EqualTo(1u)); + AssertThat(res->max_1level_cut[cut::Internal_True], Is().EqualTo(0u)); + AssertThat(res->max_1level_cut[cut::All], Is().EqualTo(1u)); - AssertThat(res->max_2level_cut[cut_type::INTERNAL], Is().EqualTo(0u)); - AssertThat(res->max_2level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(1u)); - AssertThat(res->max_2level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(0u)); - AssertThat(res->max_2level_cut[cut_type::ALL], Is().EqualTo(1u)); + AssertThat(res->max_2level_cut[cut::Internal], Is().EqualTo(0u)); + AssertThat(res->max_2level_cut[cut::Internal_False], Is().EqualTo(1u)); + AssertThat(res->max_2level_cut[cut::Internal_True], Is().EqualTo(0u)); + AssertThat(res->max_2level_cut[cut::All], Is().EqualTo(1u)); - AssertThat(adiar::is_canonical(res), Is().True()); + AssertThat(bdd_iscanonical(res), Is().True()); AssertThat(res->number_of_terminals[false], Is().EqualTo(1u)); AssertThat(res->number_of_terminals[true], Is().EqualTo(0u)); @@ -135,17 +135,17 @@ go_bandit([]() { AssertThat(res->width, Is().EqualTo(0u)); - AssertThat(res->max_1level_cut[cut_type::INTERNAL], Is().EqualTo(0u)); - AssertThat(res->max_1level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(1u)); - AssertThat(res->max_1level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(0u)); - AssertThat(res->max_1level_cut[cut_type::ALL], Is().EqualTo(1u)); + AssertThat(res->max_1level_cut[cut::Internal], Is().EqualTo(0u)); + AssertThat(res->max_1level_cut[cut::Internal_False], Is().EqualTo(1u)); + AssertThat(res->max_1level_cut[cut::Internal_True], Is().EqualTo(0u)); + AssertThat(res->max_1level_cut[cut::All], Is().EqualTo(1u)); - AssertThat(res->max_2level_cut[cut_type::INTERNAL], Is().EqualTo(0u)); - AssertThat(res->max_2level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(1u)); - AssertThat(res->max_2level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(0u)); - AssertThat(res->max_2level_cut[cut_type::ALL], Is().EqualTo(1u)); + AssertThat(res->max_2level_cut[cut::Internal], Is().EqualTo(0u)); + AssertThat(res->max_2level_cut[cut::Internal_False], Is().EqualTo(1u)); + AssertThat(res->max_2level_cut[cut::Internal_True], Is().EqualTo(0u)); + AssertThat(res->max_2level_cut[cut::All], Is().EqualTo(1u)); - AssertThat(adiar::is_canonical(res), Is().True()); + AssertThat(bdd_iscanonical(res), Is().True()); AssertThat(res->number_of_terminals[false], Is().EqualTo(1u)); AssertThat(res->number_of_terminals[true], Is().EqualTo(0u)); @@ -164,17 +164,17 @@ go_bandit([]() { AssertThat(res->width, Is().EqualTo(0u)); - AssertThat(res->max_1level_cut[cut_type::INTERNAL], Is().EqualTo(0u)); - AssertThat(res->max_1level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(1u)); - AssertThat(res->max_1level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(0u)); - AssertThat(res->max_1level_cut[cut_type::ALL], Is().EqualTo(1u)); + AssertThat(res->max_1level_cut[cut::Internal], Is().EqualTo(0u)); + AssertThat(res->max_1level_cut[cut::Internal_False], Is().EqualTo(1u)); + AssertThat(res->max_1level_cut[cut::Internal_True], Is().EqualTo(0u)); + AssertThat(res->max_1level_cut[cut::All], Is().EqualTo(1u)); - AssertThat(res->max_2level_cut[cut_type::INTERNAL], Is().EqualTo(0u)); - AssertThat(res->max_2level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(1u)); - AssertThat(res->max_2level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(0u)); - AssertThat(res->max_2level_cut[cut_type::ALL], Is().EqualTo(1u)); + AssertThat(res->max_2level_cut[cut::Internal], Is().EqualTo(0u)); + AssertThat(res->max_2level_cut[cut::Internal_False], Is().EqualTo(1u)); + AssertThat(res->max_2level_cut[cut::Internal_True], Is().EqualTo(0u)); + AssertThat(res->max_2level_cut[cut::All], Is().EqualTo(1u)); - AssertThat(adiar::is_canonical(res), Is().True()); + AssertThat(bdd_iscanonical(res), Is().True()); AssertThat(res->number_of_terminals[false], Is().EqualTo(1u)); AssertThat(res->number_of_terminals[true], Is().EqualTo(0u)); @@ -187,7 +187,7 @@ go_bandit([]() { node_test_stream ns(res); AssertThat(ns.can_pull(), Is().True()); - AssertThat(ns.pull(), Is().EqualTo(node(0, node::MAX_ID, terminal_F, terminal_T))); + AssertThat(ns.pull(), Is().EqualTo(node(0, node::max_id, terminal_F, terminal_T))); AssertThat(ns.can_pull(), Is().False()); level_info_test_stream ms(res); @@ -198,17 +198,17 @@ go_bandit([]() { AssertThat(res->width, Is().EqualTo(1u)); - AssertThat(res->max_1level_cut[cut_type::INTERNAL], Is().EqualTo(1u)); - AssertThat(res->max_1level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(1u)); - AssertThat(res->max_1level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(1u)); - AssertThat(res->max_1level_cut[cut_type::ALL], Is().EqualTo(2u)); + AssertThat(res->max_1level_cut[cut::Internal], Is().EqualTo(1u)); + AssertThat(res->max_1level_cut[cut::Internal_False], Is().EqualTo(1u)); + AssertThat(res->max_1level_cut[cut::Internal_True], Is().EqualTo(1u)); + AssertThat(res->max_1level_cut[cut::All], Is().EqualTo(2u)); - AssertThat(res->max_2level_cut[cut_type::INTERNAL], Is().EqualTo(1u)); - AssertThat(res->max_2level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(1u)); - AssertThat(res->max_2level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(1u)); - AssertThat(res->max_2level_cut[cut_type::ALL], Is().EqualTo(2u)); + AssertThat(res->max_2level_cut[cut::Internal], Is().EqualTo(1u)); + AssertThat(res->max_2level_cut[cut::Internal_False], Is().EqualTo(1u)); + AssertThat(res->max_2level_cut[cut::Internal_True], Is().EqualTo(1u)); + AssertThat(res->max_2level_cut[cut::All], Is().EqualTo(2u)); - AssertThat(adiar::is_canonical(res), Is().True()); + AssertThat(bdd_iscanonical(res), Is().True()); AssertThat(res->number_of_terminals[false], Is().EqualTo(1u)); AssertThat(res->number_of_terminals[true], Is().EqualTo(1u)); @@ -219,7 +219,7 @@ go_bandit([]() { node_test_stream ns(res); AssertThat(ns.can_pull(), Is().True()); - AssertThat(ns.pull(), Is().EqualTo(node(42, node::MAX_ID, terminal_F, terminal_T))); + AssertThat(ns.pull(), Is().EqualTo(node(42, node::max_id, terminal_F, terminal_T))); AssertThat(ns.can_pull(), Is().False()); level_info_test_stream ms(res); @@ -230,24 +230,24 @@ go_bandit([]() { AssertThat(res->width, Is().EqualTo(1u)); - AssertThat(res->max_1level_cut[cut_type::INTERNAL], Is().EqualTo(1u)); - AssertThat(res->max_1level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(1u)); - AssertThat(res->max_1level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(1u)); - AssertThat(res->max_1level_cut[cut_type::ALL], Is().EqualTo(2u)); + AssertThat(res->max_1level_cut[cut::Internal], Is().EqualTo(1u)); + AssertThat(res->max_1level_cut[cut::Internal_False], Is().EqualTo(1u)); + AssertThat(res->max_1level_cut[cut::Internal_True], Is().EqualTo(1u)); + AssertThat(res->max_1level_cut[cut::All], Is().EqualTo(2u)); - AssertThat(res->max_2level_cut[cut_type::INTERNAL], Is().EqualTo(1u)); - AssertThat(res->max_2level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(1u)); - AssertThat(res->max_2level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(1u)); - AssertThat(res->max_2level_cut[cut_type::ALL], Is().EqualTo(2u)); + AssertThat(res->max_2level_cut[cut::Internal], Is().EqualTo(1u)); + AssertThat(res->max_2level_cut[cut::Internal_False], Is().EqualTo(1u)); + AssertThat(res->max_2level_cut[cut::Internal_True], Is().EqualTo(1u)); + AssertThat(res->max_2level_cut[cut::All], Is().EqualTo(2u)); - AssertThat(adiar::is_canonical(res), Is().True()); + AssertThat(bdd_iscanonical(res), Is().True()); AssertThat(res->number_of_terminals[false], Is().EqualTo(1u)); AssertThat(res->number_of_terminals[true], Is().EqualTo(1u)); }); it("throws exception for a too large label", []() { - AssertThrows(invalid_argument, bdd_nithvar(bdd::MAX_LABEL+1)); + AssertThrows(invalid_argument, bdd_nithvar(bdd::max_label+1)); }); }); @@ -257,7 +257,7 @@ go_bandit([]() { node_test_stream ns(res); AssertThat(ns.can_pull(), Is().True()); - AssertThat(ns.pull(), Is().EqualTo(node(1, node::MAX_ID, terminal_T, terminal_F))); + AssertThat(ns.pull(), Is().EqualTo(node(1, node::max_id, terminal_T, terminal_F))); AssertThat(ns.can_pull(), Is().False()); level_info_test_stream ms(res); @@ -268,17 +268,17 @@ go_bandit([]() { AssertThat(res->width, Is().EqualTo(1u)); - AssertThat(res->max_1level_cut[cut_type::INTERNAL], Is().EqualTo(1u)); - AssertThat(res->max_1level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(1u)); - AssertThat(res->max_1level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(1u)); - AssertThat(res->max_1level_cut[cut_type::ALL], Is().EqualTo(2u)); + AssertThat(res->max_1level_cut[cut::Internal], Is().EqualTo(1u)); + AssertThat(res->max_1level_cut[cut::Internal_False], Is().EqualTo(1u)); + AssertThat(res->max_1level_cut[cut::Internal_True], Is().EqualTo(1u)); + AssertThat(res->max_1level_cut[cut::All], Is().EqualTo(2u)); - AssertThat(res->max_2level_cut[cut_type::INTERNAL], Is().EqualTo(1u)); - AssertThat(res->max_2level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(1u)); - AssertThat(res->max_2level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(1u)); - AssertThat(res->max_2level_cut[cut_type::ALL], Is().EqualTo(2u)); + AssertThat(res->max_2level_cut[cut::Internal], Is().EqualTo(1u)); + AssertThat(res->max_2level_cut[cut::Internal_False], Is().EqualTo(1u)); + AssertThat(res->max_2level_cut[cut::Internal_True], Is().EqualTo(1u)); + AssertThat(res->max_2level_cut[cut::All], Is().EqualTo(2u)); - AssertThat(adiar::is_canonical(res), Is().True()); + AssertThat(bdd_iscanonical(res), Is().True()); AssertThat(res->number_of_terminals[false], Is().EqualTo(1u)); AssertThat(res->number_of_terminals[true], Is().EqualTo(1u)); @@ -289,7 +289,7 @@ go_bandit([]() { node_test_stream ns(res); AssertThat(ns.can_pull(), Is().True()); - AssertThat(ns.pull(), Is().EqualTo(node(3, node::MAX_ID, terminal_T, terminal_F))); + AssertThat(ns.pull(), Is().EqualTo(node(3, node::max_id, terminal_T, terminal_F))); AssertThat(ns.can_pull(), Is().False()); level_info_test_stream ms(res); @@ -300,24 +300,24 @@ go_bandit([]() { AssertThat(res->width, Is().EqualTo(1u)); - AssertThat(res->max_1level_cut[cut_type::INTERNAL], Is().EqualTo(1u)); - AssertThat(res->max_1level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(1u)); - AssertThat(res->max_1level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(1u)); - AssertThat(res->max_1level_cut[cut_type::ALL], Is().EqualTo(2u)); + AssertThat(res->max_1level_cut[cut::Internal], Is().EqualTo(1u)); + AssertThat(res->max_1level_cut[cut::Internal_False], Is().EqualTo(1u)); + AssertThat(res->max_1level_cut[cut::Internal_True], Is().EqualTo(1u)); + AssertThat(res->max_1level_cut[cut::All], Is().EqualTo(2u)); - AssertThat(res->max_2level_cut[cut_type::INTERNAL], Is().EqualTo(1u)); - AssertThat(res->max_2level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(1u)); - AssertThat(res->max_2level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(1u)); - AssertThat(res->max_2level_cut[cut_type::ALL], Is().EqualTo(2u)); + AssertThat(res->max_2level_cut[cut::Internal], Is().EqualTo(1u)); + AssertThat(res->max_2level_cut[cut::Internal_False], Is().EqualTo(1u)); + AssertThat(res->max_2level_cut[cut::Internal_True], Is().EqualTo(1u)); + AssertThat(res->max_2level_cut[cut::All], Is().EqualTo(2u)); - AssertThat(adiar::is_canonical(res), Is().True()); + AssertThat(bdd_iscanonical(res), Is().True()); AssertThat(res->number_of_terminals[false], Is().EqualTo(1u)); AssertThat(res->number_of_terminals[true], Is().EqualTo(1u)); }); it("throws exception for a too large label", []() { - AssertThrows(invalid_argument, bdd_nithvar(bdd::MAX_LABEL+1)); + AssertThrows(invalid_argument, bdd_nithvar(bdd::max_label+1)); }); }); @@ -333,19 +333,19 @@ go_bandit([]() { node_test_stream ns(res); AssertThat(ns.can_pull(), Is().True()); - AssertThat(ns.pull(), Is().EqualTo(node(5, node::MAX_ID, + AssertThat(ns.pull(), Is().EqualTo(node(5, node::max_id, terminal_F, terminal_T))); AssertThat(ns.can_pull(), Is().True()); - AssertThat(ns.pull(), Is().EqualTo(node(2, node::MAX_ID, + AssertThat(ns.pull(), Is().EqualTo(node(2, node::max_id, terminal_F, - ptr_uint64(5, ptr_uint64::MAX_ID)))); + ptr_uint64(5, ptr_uint64::max_id)))); AssertThat(ns.can_pull(), Is().True()); - AssertThat(ns.pull(), Is().EqualTo(node(1, node::MAX_ID, + AssertThat(ns.pull(), Is().EqualTo(node(1, node::max_id, terminal_F, - ptr_uint64(2, ptr_uint64::MAX_ID)))); + ptr_uint64(2, ptr_uint64::max_id)))); AssertThat(ns.can_pull(), Is().False()); @@ -364,17 +364,17 @@ go_bandit([]() { AssertThat(res->width, Is().EqualTo(1u)); - AssertThat(res->max_1level_cut[cut_type::INTERNAL], Is().EqualTo(1u)); - AssertThat(res->max_1level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(3u)); - AssertThat(res->max_1level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(1u)); - AssertThat(res->max_1level_cut[cut_type::ALL], Is().EqualTo(4u)); + AssertThat(res->max_1level_cut[cut::Internal], Is().EqualTo(1u)); + AssertThat(res->max_1level_cut[cut::Internal_False], Is().EqualTo(3u)); + AssertThat(res->max_1level_cut[cut::Internal_True], Is().EqualTo(1u)); + AssertThat(res->max_1level_cut[cut::All], Is().EqualTo(4u)); - AssertThat(res->max_2level_cut[cut_type::INTERNAL], Is().EqualTo(1u)); - AssertThat(res->max_2level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(3u)); - AssertThat(res->max_2level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(1u)); - AssertThat(res->max_2level_cut[cut_type::ALL], Is().EqualTo(4u)); + AssertThat(res->max_2level_cut[cut::Internal], Is().EqualTo(1u)); + AssertThat(res->max_2level_cut[cut::Internal_False], Is().EqualTo(3u)); + AssertThat(res->max_2level_cut[cut::Internal_True], Is().EqualTo(1u)); + AssertThat(res->max_2level_cut[cut::All], Is().EqualTo(4u)); - AssertThat(adiar::is_canonical(res), Is().True()); + AssertThat(bdd_iscanonical(res), Is().True()); AssertThat(res->number_of_terminals[false], Is().EqualTo(3u)); AssertThat(res->number_of_terminals[true], Is().EqualTo(1u)); @@ -395,17 +395,17 @@ go_bandit([]() { AssertThat(res->width, Is().EqualTo(0u)); - AssertThat(res->max_1level_cut[cut_type::INTERNAL], Is().EqualTo(0u)); - AssertThat(res->max_1level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(0u)); - AssertThat(res->max_1level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(1u)); - AssertThat(res->max_1level_cut[cut_type::ALL], Is().EqualTo(1u)); + AssertThat(res->max_1level_cut[cut::Internal], Is().EqualTo(0u)); + AssertThat(res->max_1level_cut[cut::Internal_False], Is().EqualTo(0u)); + AssertThat(res->max_1level_cut[cut::Internal_True], Is().EqualTo(1u)); + AssertThat(res->max_1level_cut[cut::All], Is().EqualTo(1u)); - AssertThat(res->max_2level_cut[cut_type::INTERNAL], Is().EqualTo(0u)); - AssertThat(res->max_2level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(0u)); - AssertThat(res->max_2level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(1u)); - AssertThat(res->max_2level_cut[cut_type::ALL], Is().EqualTo(1u)); + AssertThat(res->max_2level_cut[cut::Internal], Is().EqualTo(0u)); + AssertThat(res->max_2level_cut[cut::Internal_False], Is().EqualTo(0u)); + AssertThat(res->max_2level_cut[cut::Internal_True], Is().EqualTo(1u)); + AssertThat(res->max_2level_cut[cut::All], Is().EqualTo(1u)); - AssertThat(adiar::is_canonical(res), Is().True()); + AssertThat(bdd_iscanonical(res), Is().True()); AssertThat(res->number_of_terminals[false], Is().EqualTo(0u)); AssertThat(res->number_of_terminals[true], Is().EqualTo(1u)); @@ -418,19 +418,19 @@ go_bandit([]() { node_test_stream ns(res); AssertThat(ns.can_pull(), Is().True()); - AssertThat(ns.pull(), Is().EqualTo(node(5, node::MAX_ID, + AssertThat(ns.pull(), Is().EqualTo(node(5, node::max_id, terminal_F, terminal_T))); AssertThat(ns.can_pull(), Is().True()); - AssertThat(ns.pull(), Is().EqualTo(node(2, node::MAX_ID, + AssertThat(ns.pull(), Is().EqualTo(node(2, node::max_id, terminal_F, - ptr_uint64(5, ptr_uint64::MAX_ID)))); + ptr_uint64(5, ptr_uint64::max_id)))); AssertThat(ns.can_pull(), Is().True()); - AssertThat(ns.pull(), Is().EqualTo(node(1, node::MAX_ID, + AssertThat(ns.pull(), Is().EqualTo(node(1, node::max_id, terminal_F, - ptr_uint64(2, ptr_uint64::MAX_ID)))); + ptr_uint64(2, ptr_uint64::max_id)))); AssertThat(ns.can_pull(), Is().False()); @@ -449,17 +449,17 @@ go_bandit([]() { AssertThat(res->width, Is().EqualTo(1u)); - AssertThat(res->max_1level_cut[cut_type::INTERNAL], Is().EqualTo(1u)); - AssertThat(res->max_1level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(3u)); - AssertThat(res->max_1level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(1u)); - AssertThat(res->max_1level_cut[cut_type::ALL], Is().EqualTo(4u)); + AssertThat(res->max_1level_cut[cut::Internal], Is().EqualTo(1u)); + AssertThat(res->max_1level_cut[cut::Internal_False], Is().EqualTo(3u)); + AssertThat(res->max_1level_cut[cut::Internal_True], Is().EqualTo(1u)); + AssertThat(res->max_1level_cut[cut::All], Is().EqualTo(4u)); - AssertThat(res->max_2level_cut[cut_type::INTERNAL], Is().EqualTo(1u)); - AssertThat(res->max_2level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(3u)); - AssertThat(res->max_2level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(1u)); - AssertThat(res->max_2level_cut[cut_type::ALL], Is().EqualTo(4u)); + AssertThat(res->max_2level_cut[cut::Internal], Is().EqualTo(1u)); + AssertThat(res->max_2level_cut[cut::Internal_False], Is().EqualTo(3u)); + AssertThat(res->max_2level_cut[cut::Internal_True], Is().EqualTo(1u)); + AssertThat(res->max_2level_cut[cut::All], Is().EqualTo(4u)); - AssertThat(adiar::is_canonical(res), Is().True()); + AssertThat(bdd_iscanonical(res), Is().True()); AssertThat(res->number_of_terminals[false], Is().EqualTo(3u)); AssertThat(res->number_of_terminals[true], Is().EqualTo(1u)); @@ -484,18 +484,18 @@ go_bandit([]() { node_test_stream ns(res); AssertThat(ns.can_pull(), Is().True()); - AssertThat(ns.pull(), Is().EqualTo(node(5, node::MAX_ID, + AssertThat(ns.pull(), Is().EqualTo(node(5, node::max_id, terminal_F, terminal_T))); AssertThat(ns.can_pull(), Is().True()); - AssertThat(ns.pull(), Is().EqualTo(node(2, node::MAX_ID, - ptr_uint64(5, ptr_uint64::MAX_ID), + AssertThat(ns.pull(), Is().EqualTo(node(2, node::max_id, + ptr_uint64(5, ptr_uint64::max_id), terminal_T))); AssertThat(ns.can_pull(), Is().True()); - AssertThat(ns.pull(), Is().EqualTo(node(1, node::MAX_ID, - ptr_uint64(2, ptr_uint64::MAX_ID), + AssertThat(ns.pull(), Is().EqualTo(node(1, node::max_id, + ptr_uint64(2, ptr_uint64::max_id), terminal_T))); AssertThat(ns.can_pull(), Is().False()); @@ -515,17 +515,17 @@ go_bandit([]() { AssertThat(res->width, Is().EqualTo(1u)); - AssertThat(res->max_1level_cut[cut_type::INTERNAL], Is().EqualTo(1u)); - AssertThat(res->max_1level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(1u)); - AssertThat(res->max_1level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(3u)); - AssertThat(res->max_1level_cut[cut_type::ALL], Is().EqualTo(4u)); + AssertThat(res->max_1level_cut[cut::Internal], Is().EqualTo(1u)); + AssertThat(res->max_1level_cut[cut::Internal_False], Is().EqualTo(1u)); + AssertThat(res->max_1level_cut[cut::Internal_True], Is().EqualTo(3u)); + AssertThat(res->max_1level_cut[cut::All], Is().EqualTo(4u)); - AssertThat(res->max_2level_cut[cut_type::INTERNAL], Is().EqualTo(1u)); - AssertThat(res->max_2level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(1u)); - AssertThat(res->max_2level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(3u)); - AssertThat(res->max_2level_cut[cut_type::ALL], Is().EqualTo(4u)); + AssertThat(res->max_2level_cut[cut::Internal], Is().EqualTo(1u)); + AssertThat(res->max_2level_cut[cut::Internal_False], Is().EqualTo(1u)); + AssertThat(res->max_2level_cut[cut::Internal_True], Is().EqualTo(3u)); + AssertThat(res->max_2level_cut[cut::All], Is().EqualTo(4u)); - AssertThat(adiar::is_canonical(res), Is().True()); + AssertThat(bdd_iscanonical(res), Is().True()); AssertThat(res->number_of_terminals[false], Is().EqualTo(1u)); AssertThat(res->number_of_terminals[true], Is().EqualTo(3u)); @@ -546,12 +546,12 @@ go_bandit([]() { AssertThat(res->width, Is().EqualTo(0u)); - AssertThat(res->max_1level_cut[cut_type::INTERNAL], Is().EqualTo(0u)); - AssertThat(res->max_1level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(1u)); - AssertThat(res->max_1level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(0u)); - AssertThat(res->max_1level_cut[cut_type::ALL], Is().EqualTo(1u)); + AssertThat(res->max_1level_cut[cut::Internal], Is().EqualTo(0u)); + AssertThat(res->max_1level_cut[cut::Internal_False], Is().EqualTo(1u)); + AssertThat(res->max_1level_cut[cut::Internal_True], Is().EqualTo(0u)); + AssertThat(res->max_1level_cut[cut::All], Is().EqualTo(1u)); - AssertThat(adiar::is_canonical(res), Is().True()); + AssertThat(bdd_iscanonical(res), Is().True()); AssertThat(res->number_of_terminals[false], Is().EqualTo(1u)); AssertThat(res->number_of_terminals[true], Is().EqualTo(0u)); @@ -564,18 +564,18 @@ go_bandit([]() { node_test_stream ns(res); AssertThat(ns.can_pull(), Is().True()); - AssertThat(ns.pull(), Is().EqualTo(node(5, node::MAX_ID, + AssertThat(ns.pull(), Is().EqualTo(node(5, node::max_id, terminal_F, terminal_T))); AssertThat(ns.can_pull(), Is().True()); - AssertThat(ns.pull(), Is().EqualTo(node(2, node::MAX_ID, - ptr_uint64(5, ptr_uint64::MAX_ID), + AssertThat(ns.pull(), Is().EqualTo(node(2, node::max_id, + ptr_uint64(5, ptr_uint64::max_id), terminal_T))); AssertThat(ns.can_pull(), Is().True()); - AssertThat(ns.pull(), Is().EqualTo(node(1, node::MAX_ID, - ptr_uint64(2, ptr_uint64::MAX_ID), + AssertThat(ns.pull(), Is().EqualTo(node(1, node::max_id, + ptr_uint64(2, ptr_uint64::max_id), terminal_T))); AssertThat(ns.can_pull(), Is().False()); @@ -595,17 +595,17 @@ go_bandit([]() { AssertThat(res->width, Is().EqualTo(1u)); - AssertThat(res->max_1level_cut[cut_type::INTERNAL], Is().EqualTo(1u)); - AssertThat(res->max_1level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(1u)); - AssertThat(res->max_1level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(3u)); - AssertThat(res->max_1level_cut[cut_type::ALL], Is().EqualTo(4u)); + AssertThat(res->max_1level_cut[cut::Internal], Is().EqualTo(1u)); + AssertThat(res->max_1level_cut[cut::Internal_False], Is().EqualTo(1u)); + AssertThat(res->max_1level_cut[cut::Internal_True], Is().EqualTo(3u)); + AssertThat(res->max_1level_cut[cut::All], Is().EqualTo(4u)); - AssertThat(res->max_2level_cut[cut_type::INTERNAL], Is().EqualTo(1u)); - AssertThat(res->max_2level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(1u)); - AssertThat(res->max_2level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(3u)); - AssertThat(res->max_2level_cut[cut_type::ALL], Is().EqualTo(4u)); + AssertThat(res->max_2level_cut[cut::Internal], Is().EqualTo(1u)); + AssertThat(res->max_2level_cut[cut::Internal_False], Is().EqualTo(1u)); + AssertThat(res->max_2level_cut[cut::Internal_True], Is().EqualTo(3u)); + AssertThat(res->max_2level_cut[cut::All], Is().EqualTo(4u)); - AssertThat(adiar::is_canonical(res), Is().True()); + AssertThat(bdd_iscanonical(res), Is().True()); AssertThat(res->number_of_terminals[false], Is().EqualTo(1u)); AssertThat(res->number_of_terminals[true], Is().EqualTo(3u)); diff --git a/test/adiar/bdd/test_count.cpp b/test/adiar/bdd/test_count.cpp index 536e62944..f054ea30d 100644 --- a/test/adiar/bdd/test_count.cpp +++ b/test/adiar/bdd/test_count.cpp @@ -5,7 +5,7 @@ go_bandit([]() { ptr_uint64 terminal_T = ptr_uint64(true); ptr_uint64 terminal_F = ptr_uint64(false); - shared_levelized_file bdd_1; + shared_levelized_file bdd_1; /* 1 ---- x0 / \ @@ -28,7 +28,7 @@ go_bandit([]() { nw_1 << n4 << n3 << n2 << n1; } - shared_levelized_file bdd_2; + shared_levelized_file bdd_2; /* ---- x0 @@ -47,7 +47,7 @@ go_bandit([]() { nw_2 << n2 << n1; } - shared_levelized_file bdd_3; + shared_levelized_file bdd_3; /* ---- x0 @@ -67,7 +67,7 @@ go_bandit([]() { nw_3 << n3 << n2 << n1; } - shared_levelized_file bdd_4; + shared_levelized_file bdd_4; /* __1__ ---- x0 / \ @@ -93,7 +93,7 @@ go_bandit([]() { nw_4 << n6 << n5 << n4 << n3 << n2 << n1; } - shared_levelized_file bdd_T; + shared_levelized_file bdd_T; /* T */ @@ -103,7 +103,7 @@ go_bandit([]() { nw_T << node(true); } - shared_levelized_file bdd_F; + shared_levelized_file bdd_F; /* F */ @@ -113,7 +113,7 @@ go_bandit([]() { nw_F << node(false); } - shared_levelized_file bdd_root_1; + shared_levelized_file bdd_root_1; /* 1 ---- x1 / \ @@ -126,8 +126,8 @@ go_bandit([]() { } // Set domain to be empty - adiar::shared_file empty_dom; - adiar_set_domain(empty_dom); + adiar::shared_file empty_dom; + domain_set(empty_dom); describe("bdd_nodecount", [&]() { it("can count number of nodes", [&]() { @@ -292,12 +292,12 @@ go_bandit([]() { }); describe("bdd_satcount(f) [non-empty dom]", [&]() { - adiar::shared_file dom; + adiar::shared_file dom; { label_writer lw(dom); lw << 0 << 1 << 2 << 3 << 4 << 5 << 6; } - adiar_set_domain(dom); + domain_set(dom); it("can count assignments leading to T terminals [1]", [&]() { AssertThat(bdd_satcount(bdd_1), Is().EqualTo(8u * 5u)); diff --git a/test/adiar/bdd/test_evaluate.cpp b/test/adiar/bdd/test_evaluate.cpp index af1720ee7..3570fb79f 100644 --- a/test/adiar/bdd/test_evaluate.cpp +++ b/test/adiar/bdd/test_evaluate.cpp @@ -6,7 +6,7 @@ go_bandit([]() { ptr_uint64 terminal_T = ptr_uint64(true); ptr_uint64 terminal_F = ptr_uint64(false); - shared_levelized_file bdd; + shared_levelized_file bdd; /* // 1 ---- x0 // / \ @@ -30,7 +30,7 @@ go_bandit([]() { nw << n5 << n4 << n3 << n2 << n1; } - shared_levelized_file skip_bdd; + shared_levelized_file skip_bdd; /* // 1 ---- x0 // / \ @@ -55,7 +55,7 @@ go_bandit([]() { skip_nw << skip_n4 << skip_n3 << skip_n2 << skip_n1; } - shared_levelized_file non_zero_bdd; + shared_levelized_file non_zero_bdd; /* // ---- x0 // @@ -69,13 +69,13 @@ go_bandit([]() { nw << node(1,0, terminal_F, terminal_T); } - shared_levelized_file bdd_F; + shared_levelized_file bdd_F; { // Garbage collect writer to free write-lock node_writer nw(bdd_F); nw << node(false); } - shared_levelized_file bdd_T; + shared_levelized_file bdd_T; { // Garbage collect writer to free write-lock node_writer nw(bdd_T); nw << node(true); @@ -83,222 +83,222 @@ go_bandit([]() { describe("bdd_eval(bdd, adiar::shared_file<...>)", [&]() { it("returns F on test BDD with assignment (F,F,F,T)", [&]() { - adiar::shared_file> ass; + adiar::shared_file> ass; { // Garbage collect writer to free write-lock - adiar::file_writer> aw(ass); + adiar::file_writer> aw(ass); - aw << map_pair(0, false) - << map_pair(1, false) - << map_pair(2, false) - << map_pair(3, true); + aw << map_pair(0, false) + << map_pair(1, false) + << map_pair(2, false) + << map_pair(3, true); } AssertThat(bdd_eval(bdd, ass), Is().False()); }); it("returns F on test BDD with assignment (F,_,F,T)", [&]() { - adiar::shared_file> ass; + adiar::shared_file> ass; { // Garbage collect writer to free write-lock - adiar::file_writer> aw(ass); + adiar::file_writer> aw(ass); - aw << map_pair(0, false) - << map_pair(2, false) - << map_pair(3, true); + aw << map_pair(0, false) + << map_pair(2, false) + << map_pair(3, true); } AssertThat(bdd_eval(bdd, ass), Is().False()); }); it("returns T on test BDD with assignment (F,T,T,T)", [&]() { - adiar::shared_file> ass; + adiar::shared_file> ass; { // Garbage collect writer to free write-lock - adiar::file_writer> aw(ass); + adiar::file_writer> aw(ass); - aw << map_pair(0, false) - << map_pair(1, true) - << map_pair(2, true) - << map_pair(3, true); + aw << map_pair(0, false) + << map_pair(1, true) + << map_pair(2, true) + << map_pair(3, true); } AssertThat(bdd_eval(bdd, ass), Is().True()); }); it("returns F on test BDD with assignment (T,F,F,T)", [&]() { - adiar::shared_file> ass; + adiar::shared_file> ass; { // Garbage collect writer to free write-lock - adiar::file_writer> aw(ass); + adiar::file_writer> aw(ass); - aw << map_pair(0, true) - << map_pair(1, false) - << map_pair(2, false) - << map_pair(3, true); + aw << map_pair(0, true) + << map_pair(1, false) + << map_pair(2, false) + << map_pair(3, true); } AssertThat(bdd_eval(bdd, ass), Is().False()); }); it("returns T on test BDD with assignment (T,F,T,F)", [&]() { - adiar::shared_file> ass; + adiar::shared_file> ass; { // Garbage collect writer to free write-lock - adiar::file_writer> aw(ass); + adiar::file_writer> aw(ass); - aw << map_pair(0, true) - << map_pair(1, false) - << map_pair(2, true) - << map_pair(3, false); + aw << map_pair(0, true) + << map_pair(1, false) + << map_pair(2, true) + << map_pair(3, false); } AssertThat(bdd_eval(bdd, ass), Is().True()); }); it("returns T on test BDD with assignment (T,T,F,T)", [&]() { - adiar::shared_file> ass; + adiar::shared_file> ass; { // Garbage collect writer to free write-lock - adiar::file_writer> aw(ass); + adiar::file_writer> aw(ass); - aw << map_pair(0, true) - << map_pair(1, true) - << map_pair(2, false) - << map_pair(3, true); + aw << map_pair(0, true) + << map_pair(1, true) + << map_pair(2, false) + << map_pair(3, true); } AssertThat(bdd_eval(bdd, ass), Is().True()); }); it("returns T on test BDD with assignment (T,T,T,F)", [&]() { - adiar::shared_file> ass; + adiar::shared_file> ass; { // Garbage collect writer to free write-lock - adiar::file_writer> aw(ass); + adiar::file_writer> aw(ass); - aw << map_pair(0, true) - << map_pair(1, true) - << map_pair(2, true) - << map_pair(3, false); + aw << map_pair(0, true) + << map_pair(1, true) + << map_pair(2, true) + << map_pair(3, false); } AssertThat(bdd_eval(bdd, ass), Is().False()); }); it("returns T on test BDD with assignment (T,T,T,T)", [&]() { - adiar::shared_file> ass; + adiar::shared_file> ass; { // Garbage collect writer to free write-lock - adiar::file_writer> aw(ass); + adiar::file_writer> aw(ass); - aw << map_pair(0, true) - << map_pair(1, true) - << map_pair(2, true) - << map_pair(3, true); + aw << map_pair(0, true) + << map_pair(1, true) + << map_pair(2, true) + << map_pair(3, true); } AssertThat(bdd_eval(bdd, ass), Is().True()); }); it("should be able to evaluate BDD that skips level [1]", [&skip_bdd]() { - adiar::shared_file> ass; + adiar::shared_file> ass; { // Garbage collect writer to free write-lock - adiar::file_writer> aw(ass); + adiar::file_writer> aw(ass); - aw << map_pair(0, false) - << map_pair(1, true) - << map_pair(2, false) - << map_pair(3, true) - << map_pair(4, true); + aw << map_pair(0, false) + << map_pair(1, true) + << map_pair(2, false) + << map_pair(3, true) + << map_pair(4, true); } AssertThat(bdd_eval(skip_bdd, ass), Is().False()); }); it("should be able to evaluate BDD that skips level [2]", [&skip_bdd]() { - adiar::shared_file> ass; + adiar::shared_file> ass; { // Garbage collect writer to free write-lock - adiar::file_writer> aw(ass); + adiar::file_writer> aw(ass); - aw << map_pair(0, true) - << map_pair(1, false) - << map_pair(2, true) - << map_pair(3, true) - << map_pair(4, false); + aw << map_pair(0, true) + << map_pair(1, false) + << map_pair(2, true) + << map_pair(3, true) + << map_pair(4, false); } AssertThat(bdd_eval(skip_bdd, ass), Is().False()); }); it("returns T on BDD with non-zero root with assignment (F,T)", [&]() { - adiar::shared_file> ass; + adiar::shared_file> ass; { // Garbage collect writer to free write-lock - adiar::file_writer> aw(ass); + adiar::file_writer> aw(ass); - aw << map_pair(0, false) - << map_pair(1, true); + aw << map_pair(0, false) + << map_pair(1, true); } AssertThat(bdd_eval(non_zero_bdd, ass), Is().True()); }); it("returns F on F terminal-only BDD", [&]() { - adiar::shared_file> ass; + adiar::shared_file> ass; { // Garbage collect writer to free write-lock - adiar::file_writer> aw(ass); + adiar::file_writer> aw(ass); - aw << map_pair(0, true) - << map_pair(1, false) - << map_pair(2, false) - << map_pair(3, true); + aw << map_pair(0, true) + << map_pair(1, false) + << map_pair(2, false) + << map_pair(3, true); } AssertThat(bdd_eval(bdd_F, ass), Is().False()); }); it("returns F on F terminal-only BDD with empty assignment", [&]() { - adiar::shared_file> ass; + adiar::shared_file> ass; AssertThat(bdd_eval(bdd_F, ass), Is().False()); }); it("returns T on T terminal-only BDD", [&]() { - adiar::shared_file> ass; + adiar::shared_file> ass; { // Garbage collect writer to free write-lock - adiar::file_writer> aw(ass); + adiar::file_writer> aw(ass); - aw << map_pair(0, true) - << map_pair(1, true) - << map_pair(2, false) - << map_pair(3, true); + aw << map_pair(0, true) + << map_pair(1, true) + << map_pair(2, false) + << map_pair(3, true); } AssertThat(bdd_eval(bdd_T, ass), Is().True()); }); it("returns T on T terminal-only BDD with empty assignment", [&]() { - adiar::shared_file> ass; + adiar::shared_file> ass; AssertThat(bdd_eval(bdd_T, ass), Is().True()); }); it("throws exception when given non-ascending list of assignments", [&]() { - adiar::shared_file> ass; + adiar::shared_file> ass; { // Garbage collect writer to free write-lock - adiar::file_writer> aw(ass); + adiar::file_writer> aw(ass); - aw << map_pair(0, true) - << map_pair(2, true) - << map_pair(1, true) - << map_pair(3, true) - << map_pair(4, true) + aw << map_pair(0, true) + << map_pair(2, true) + << map_pair(1, true) + << map_pair(3, true) + << map_pair(4, true) ; } @@ -306,13 +306,13 @@ go_bandit([]() { }); it("throws exception when running out of assignments", [&]() { - adiar::shared_file> ass; + adiar::shared_file> ass; { // Garbage collect writer to free write-lock - adiar::file_writer> aw(ass); + adiar::file_writer> aw(ass); - aw << map_pair(0, true) - << map_pair(1, true) + aw << map_pair(0, true) + << map_pair(1, true) ; } @@ -320,15 +320,15 @@ go_bandit([]() { }); it("throws exception when list is missing a needed assignment", [&]() { - adiar::shared_file> ass; + adiar::shared_file> ass; { // Garbage collect writer to free write-lock - adiar::file_writer> aw(ass); + adiar::file_writer> aw(ass); - aw << map_pair(0, true) - << map_pair(1, true) - << map_pair(3, true) - << map_pair(4, true) + aw << map_pair(0, true) + << map_pair(1, true) + << map_pair(3, true) + << map_pair(4, true) ; } @@ -338,91 +338,91 @@ go_bandit([]() { describe("bdd_eval(bdd, predicate<...>)", [&]() { it("returns F on test BDD with assignment 'l -> l = 3'", [&]() { - auto af = [](const bdd::label_t l) { + auto af = [](const bdd::label_type l) { return l == 3; }; AssertThat(bdd_eval(bdd, af), Is().False()); }); it("returns T on test BDD with assignment 'l -> l % 2 == 0'", [&]() { - auto af = [](const bdd::label_t l) { + auto af = [](const bdd::label_type l) { return (l & 1u) == 0; }; AssertThat(bdd_eval(bdd, af), Is().True()); }); it("returns T on test BDD with assignment 'l -> l > 0'", [&]() { - auto af = [](const bdd::label_t l) { + auto af = [](const bdd::label_type l) { return l > 0; }; AssertThat(bdd_eval(bdd, af), Is().True()); }); it("returns F on test BDD with assignment 'l -> l == 0 || l == 3'", [&]() { - auto af = [](const bdd::label_t l) { + auto af = [](const bdd::label_type l) { return l == 0 || l == 3; }; AssertThat(bdd_eval(bdd, af), Is().False()); }); it("returns F on test BDD with assignment 'l -> l % 2 == 1'", [&]() { - auto af = [](const bdd::label_t l) { + auto af = [](const bdd::label_type l) { return (l & 1) == 1; }; AssertThat(bdd_eval(bdd, af), Is().False()); }); it("returns T on test BDD with assignment 'l -> l != 2'", [&]() { - auto af = [](const bdd::label_t l) { + auto af = [](const bdd::label_type l) { return l != 2; }; AssertThat(bdd_eval(bdd, af), Is().True()); }); it("returns F on test BDD with assignment 'l -> l < 3'", [&]() { - auto af = [](const bdd::label_t l) { + auto af = [](const bdd::label_type l) { return l < 3; }; AssertThat(bdd_eval(bdd, af), Is().False()); }); it("returns T on test BDD with assignment '_ -> true'", [&]() { - auto af = [](const bdd::label_t) { + auto af = [](const bdd::label_type) { return true; }; AssertThat(bdd_eval(bdd, af), Is().True()); }); it("returns F on BDD that skips with assignment 'l -> l == 1 || l > 2'", [&]() { - auto af = [](const bdd::label_t l) { + auto af = [](const bdd::label_type l) { return l == 1 || l > 2; }; AssertThat(bdd_eval(skip_bdd, af), Is().False()); }); it("returns F on BDD that skips with assignment 'l -> l != 1 && l < 4'", [&]() { - auto af = [](const bdd::label_t l) { + auto af = [](const bdd::label_type l) { return l != 1 && l < 4; }; AssertThat(bdd_eval(skip_bdd, af), Is().False()); }); it("returns T on BDD with non-zero root with assignment 'l -> l == 1'", [&]() { - auto af = [](const bdd::label_t l) { + auto af = [](const bdd::label_type l) { return l == 1; }; AssertThat(bdd_eval(non_zero_bdd, af), Is().True()); }); it("returns F on F terminal-only BDD with assignment '_ -> true'", [&]() { - auto af = [](const bdd::label_t) { + auto af = [](const bdd::label_type) { return true; }; AssertThat(bdd_eval(bdd_F, af), Is().False()); }); it("returns T on T terminal-only BDD with assignment '_ -> false'", [&]() { - auto af = [](const bdd::label_t) { + auto af = [](const bdd::label_type) { return false; }; AssertThat(bdd_eval(bdd_T, af), Is().True()); @@ -434,19 +434,19 @@ go_bandit([]() { ptr_uint64 terminal_T = ptr_uint64(true); ptr_uint64 terminal_F = ptr_uint64(false); - shared_levelized_file bdd_T; + shared_levelized_file bdd_T; { node_writer nw(bdd_T); nw << node(true); } - shared_levelized_file bdd_F; + shared_levelized_file bdd_F; { node_writer nw(bdd_F); nw << node(false); } - shared_levelized_file bdd_0; + shared_levelized_file bdd_0; /* // 1 ---- x0 // / \ @@ -457,7 +457,7 @@ go_bandit([]() { nw << node(0,0, terminal_F, terminal_T); } - shared_levelized_file bdd_1; + shared_levelized_file bdd_1; /* // 1 ---- x0 // / \ @@ -481,7 +481,7 @@ go_bandit([]() { nw << n5 << n4 << n3 << n2 << n1; } - shared_levelized_file bdd_2; + shared_levelized_file bdd_2; /* // 1 ---- x0 // / \ @@ -508,7 +508,7 @@ go_bandit([]() { nw << n6 << n5 << n4 << n3 << n2 << n1; } - shared_levelized_file bdd_3; + shared_levelized_file bdd_3; /* // 1 ---- x1 // / \ @@ -530,7 +530,7 @@ go_bandit([]() { } describe("bdd_satmin(f) [bdd levels]", [&]() { - adiar_unset_domain(); + domain_unset(); it("returns same file for true terminal", [&]() { bdd out = bdd_satmin(bdd_T); @@ -549,7 +549,7 @@ go_bandit([]() { node_test_stream out_nodes(out); AssertThat(out_nodes.can_pull(), Is().True()); - AssertThat(out_nodes.pull(), Is().EqualTo(node(0, bdd::MAX_ID, + AssertThat(out_nodes.pull(), Is().EqualTo(node(0, bdd::max_id, terminal_F, terminal_T))); @@ -562,15 +562,15 @@ go_bandit([]() { AssertThat(out_meta.can_pull(), Is().False()); - AssertThat(out->max_1level_cut[cut_type::INTERNAL], Is().EqualTo(1u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(1u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(1u)); - AssertThat(out->max_1level_cut[cut_type::ALL], Is().EqualTo(2u)); + AssertThat(out->max_1level_cut[cut::Internal], Is().EqualTo(1u)); + AssertThat(out->max_1level_cut[cut::Internal_False], Is().EqualTo(1u)); + AssertThat(out->max_1level_cut[cut::Internal_True], Is().EqualTo(1u)); + AssertThat(out->max_1level_cut[cut::All], Is().EqualTo(2u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL], Is().EqualTo(1u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(1u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(1u)); - AssertThat(out->max_2level_cut[cut_type::ALL], Is().EqualTo(2u)); + AssertThat(out->max_2level_cut[cut::Internal], Is().EqualTo(1u)); + AssertThat(out->max_2level_cut[cut::Internal_False], Is().EqualTo(1u)); + AssertThat(out->max_2level_cut[cut::Internal_True], Is().EqualTo(1u)); + AssertThat(out->max_2level_cut[cut::All], Is().EqualTo(2u)); AssertThat(out->number_of_terminals[false], Is().EqualTo(1u)); AssertThat(out->number_of_terminals[true], Is().EqualTo(1u)); @@ -583,23 +583,23 @@ go_bandit([]() { node_test_stream out_nodes(out); AssertThat(out_nodes.can_pull(), Is().True()); - AssertThat(out_nodes.pull(), Is().EqualTo(node(3, bdd::MAX_ID, + AssertThat(out_nodes.pull(), Is().EqualTo(node(3, bdd::max_id, terminal_F, terminal_T))); AssertThat(out_nodes.can_pull(), Is().True()); - AssertThat(out_nodes.pull(), Is().EqualTo(node(2, bdd::MAX_ID, + AssertThat(out_nodes.pull(), Is().EqualTo(node(2, bdd::max_id, terminal_F, - bdd::ptr_t(3, bdd::MAX_ID)))); + bdd::pointer_type(3, bdd::max_id)))); AssertThat(out_nodes.can_pull(), Is().True()); - AssertThat(out_nodes.pull(), Is().EqualTo(node(1, bdd::MAX_ID, - bdd::ptr_t(2, bdd::MAX_ID), + AssertThat(out_nodes.pull(), Is().EqualTo(node(1, bdd::max_id, + bdd::pointer_type(2, bdd::max_id), terminal_F))); AssertThat(out_nodes.can_pull(), Is().True()); - AssertThat(out_nodes.pull(), Is().EqualTo(node(0, bdd::MAX_ID, - bdd::ptr_t(1, bdd::MAX_ID), + AssertThat(out_nodes.pull(), Is().EqualTo(node(0, bdd::max_id, + bdd::pointer_type(1, bdd::max_id), terminal_F))); AssertThat(out_nodes.can_pull(), Is().False()); @@ -620,15 +620,15 @@ go_bandit([]() { AssertThat(out_meta.can_pull(), Is().False()); - AssertThat(out->max_1level_cut[cut_type::INTERNAL], Is().EqualTo(1u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(4u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(1u)); - AssertThat(out->max_1level_cut[cut_type::ALL], Is().EqualTo(5u)); + AssertThat(out->max_1level_cut[cut::Internal], Is().EqualTo(1u)); + AssertThat(out->max_1level_cut[cut::Internal_False], Is().EqualTo(4u)); + AssertThat(out->max_1level_cut[cut::Internal_True], Is().EqualTo(1u)); + AssertThat(out->max_1level_cut[cut::All], Is().EqualTo(5u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL], Is().EqualTo(1u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(4u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(1u)); - AssertThat(out->max_2level_cut[cut_type::ALL], Is().EqualTo(5u)); + AssertThat(out->max_2level_cut[cut::Internal], Is().EqualTo(1u)); + AssertThat(out->max_2level_cut[cut::Internal_False], Is().EqualTo(4u)); + AssertThat(out->max_2level_cut[cut::Internal_True], Is().EqualTo(1u)); + AssertThat(out->max_2level_cut[cut::All], Is().EqualTo(5u)); AssertThat(out->number_of_terminals[false], Is().EqualTo(4u)); AssertThat(out->number_of_terminals[true], Is().EqualTo(1u)); @@ -641,23 +641,23 @@ go_bandit([]() { node_test_stream out_nodes(out); AssertThat(out_nodes.can_pull(), Is().True()); - AssertThat(out_nodes.pull(), Is().EqualTo(node(3, bdd::MAX_ID, + AssertThat(out_nodes.pull(), Is().EqualTo(node(3, bdd::max_id, terminal_T, terminal_F))); AssertThat(out_nodes.can_pull(), Is().True()); - AssertThat(out_nodes.pull(), Is().EqualTo(node(2, bdd::MAX_ID, - bdd::ptr_t(3, bdd::MAX_ID), + AssertThat(out_nodes.pull(), Is().EqualTo(node(2, bdd::max_id, + bdd::pointer_type(3, bdd::max_id), terminal_F))); AssertThat(out_nodes.can_pull(), Is().True()); - AssertThat(out_nodes.pull(), Is().EqualTo(node(1, bdd::MAX_ID, - bdd::ptr_t(2, bdd::MAX_ID), + AssertThat(out_nodes.pull(), Is().EqualTo(node(1, bdd::max_id, + bdd::pointer_type(2, bdd::max_id), terminal_F))); AssertThat(out_nodes.can_pull(), Is().True()); - AssertThat(out_nodes.pull(), Is().EqualTo(node(0, bdd::MAX_ID, - bdd::ptr_t(1, bdd::MAX_ID), + AssertThat(out_nodes.pull(), Is().EqualTo(node(0, bdd::max_id, + bdd::pointer_type(1, bdd::max_id), terminal_F))); AssertThat(out_nodes.can_pull(), Is().False()); @@ -678,15 +678,15 @@ go_bandit([]() { AssertThat(out_meta.can_pull(), Is().False()); - AssertThat(out->max_1level_cut[cut_type::INTERNAL], Is().EqualTo(1u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(4u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(1u)); - AssertThat(out->max_1level_cut[cut_type::ALL], Is().EqualTo(5u)); + AssertThat(out->max_1level_cut[cut::Internal], Is().EqualTo(1u)); + AssertThat(out->max_1level_cut[cut::Internal_False], Is().EqualTo(4u)); + AssertThat(out->max_1level_cut[cut::Internal_True], Is().EqualTo(1u)); + AssertThat(out->max_1level_cut[cut::All], Is().EqualTo(5u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL], Is().EqualTo(1u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(4u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(1u)); - AssertThat(out->max_2level_cut[cut_type::ALL], Is().EqualTo(5u)); + AssertThat(out->max_2level_cut[cut::Internal], Is().EqualTo(1u)); + AssertThat(out->max_2level_cut[cut::Internal_False], Is().EqualTo(4u)); + AssertThat(out->max_2level_cut[cut::Internal_True], Is().EqualTo(1u)); + AssertThat(out->max_2level_cut[cut::All], Is().EqualTo(5u)); AssertThat(out->number_of_terminals[false], Is().EqualTo(4u)); AssertThat(out->number_of_terminals[true], Is().EqualTo(1u)); @@ -699,23 +699,23 @@ go_bandit([]() { node_test_stream out_nodes(out); AssertThat(out_nodes.can_pull(), Is().True()); - AssertThat(out_nodes.pull(), Is().EqualTo(node(3, bdd::MAX_ID, + AssertThat(out_nodes.pull(), Is().EqualTo(node(3, bdd::max_id, terminal_T, terminal_F))); AssertThat(out_nodes.can_pull(), Is().True()); - AssertThat(out_nodes.pull(), Is().EqualTo(node(2, bdd::MAX_ID, + AssertThat(out_nodes.pull(), Is().EqualTo(node(2, bdd::max_id, terminal_F, - bdd::ptr_t(3, bdd::MAX_ID)))); + bdd::pointer_type(3, bdd::max_id)))); AssertThat(out_nodes.can_pull(), Is().True()); - AssertThat(out_nodes.pull(), Is().EqualTo(node(1, bdd::MAX_ID, - bdd::ptr_t(2, bdd::MAX_ID), + AssertThat(out_nodes.pull(), Is().EqualTo(node(1, bdd::max_id, + bdd::pointer_type(2, bdd::max_id), terminal_F))); AssertThat(out_nodes.can_pull(), Is().True()); - AssertThat(out_nodes.pull(), Is().EqualTo(node(0, bdd::MAX_ID, - bdd::ptr_t(1, bdd::MAX_ID), + AssertThat(out_nodes.pull(), Is().EqualTo(node(0, bdd::max_id, + bdd::pointer_type(1, bdd::max_id), terminal_F))); AssertThat(out_nodes.can_pull(), Is().False()); @@ -736,15 +736,15 @@ go_bandit([]() { AssertThat(out_meta.can_pull(), Is().False()); - AssertThat(out->max_1level_cut[cut_type::INTERNAL], Is().EqualTo(1u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(4u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(1u)); - AssertThat(out->max_1level_cut[cut_type::ALL], Is().EqualTo(5u)); + AssertThat(out->max_1level_cut[cut::Internal], Is().EqualTo(1u)); + AssertThat(out->max_1level_cut[cut::Internal_False], Is().EqualTo(4u)); + AssertThat(out->max_1level_cut[cut::Internal_True], Is().EqualTo(1u)); + AssertThat(out->max_1level_cut[cut::All], Is().EqualTo(5u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL], Is().EqualTo(1u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(4u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(1u)); - AssertThat(out->max_2level_cut[cut_type::ALL], Is().EqualTo(5u)); + AssertThat(out->max_2level_cut[cut::Internal], Is().EqualTo(1u)); + AssertThat(out->max_2level_cut[cut::Internal_False], Is().EqualTo(4u)); + AssertThat(out->max_2level_cut[cut::Internal_True], Is().EqualTo(1u)); + AssertThat(out->max_2level_cut[cut::All], Is().EqualTo(5u)); AssertThat(out->number_of_terminals[false], Is().EqualTo(4u)); AssertThat(out->number_of_terminals[true], Is().EqualTo(1u)); @@ -758,18 +758,18 @@ go_bandit([]() { node_test_stream out_nodes(out); AssertThat(out_nodes.can_pull(), Is().True()); - AssertThat(out_nodes.pull(), Is().EqualTo(node(5, bdd::MAX_ID, + AssertThat(out_nodes.pull(), Is().EqualTo(node(5, bdd::max_id, terminal_T, terminal_F))); AssertThat(out_nodes.can_pull(), Is().True()); - AssertThat(out_nodes.pull(), Is().EqualTo(node(3, bdd::MAX_ID, - bdd::ptr_t(5, bdd::MAX_ID), + AssertThat(out_nodes.pull(), Is().EqualTo(node(3, bdd::max_id, + bdd::pointer_type(5, bdd::max_id), terminal_F))); AssertThat(out_nodes.can_pull(), Is().True()); - AssertThat(out_nodes.pull(), Is().EqualTo(node(1, bdd::MAX_ID, - bdd::ptr_t(3, bdd::MAX_ID), + AssertThat(out_nodes.pull(), Is().EqualTo(node(1, bdd::max_id, + bdd::pointer_type(3, bdd::max_id), terminal_F))); AssertThat(out_nodes.can_pull(), Is().False()); @@ -787,15 +787,15 @@ go_bandit([]() { AssertThat(out_meta.can_pull(), Is().False()); - AssertThat(out->max_1level_cut[cut_type::INTERNAL], Is().EqualTo(1u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(3u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(1u)); - AssertThat(out->max_1level_cut[cut_type::ALL], Is().EqualTo(4u)); + AssertThat(out->max_1level_cut[cut::Internal], Is().EqualTo(1u)); + AssertThat(out->max_1level_cut[cut::Internal_False], Is().EqualTo(3u)); + AssertThat(out->max_1level_cut[cut::Internal_True], Is().EqualTo(1u)); + AssertThat(out->max_1level_cut[cut::All], Is().EqualTo(4u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL], Is().EqualTo(1u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(3u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(1u)); - AssertThat(out->max_2level_cut[cut_type::ALL], Is().EqualTo(4u)); + AssertThat(out->max_2level_cut[cut::Internal], Is().EqualTo(1u)); + AssertThat(out->max_2level_cut[cut::Internal_False], Is().EqualTo(3u)); + AssertThat(out->max_2level_cut[cut::Internal_True], Is().EqualTo(1u)); + AssertThat(out->max_2level_cut[cut::All], Is().EqualTo(4u)); AssertThat(out->number_of_terminals[false], Is().EqualTo(3u)); AssertThat(out->number_of_terminals[true], Is().EqualTo(1u)); @@ -804,26 +804,26 @@ go_bandit([]() { describe("bdd_satmin(f) [domain]", [&]() { it("should retrieve evaluation [0] in domain { 0,1,2 }", [&]() { - adiar_set_domain(3); + domain_set(3); bdd out = bdd_satmin(bdd_0); // Check it looks all right node_test_stream out_nodes(out); AssertThat(out_nodes.can_pull(), Is().True()); - AssertThat(out_nodes.pull(), Is().EqualTo(node(2, bdd::MAX_ID, + AssertThat(out_nodes.pull(), Is().EqualTo(node(2, bdd::max_id, terminal_T, terminal_F))); AssertThat(out_nodes.can_pull(), Is().True()); - AssertThat(out_nodes.pull(), Is().EqualTo(node(1, bdd::MAX_ID, - bdd::ptr_t(2, bdd::MAX_ID), + AssertThat(out_nodes.pull(), Is().EqualTo(node(1, bdd::max_id, + bdd::pointer_type(2, bdd::max_id), terminal_F))); AssertThat(out_nodes.can_pull(), Is().True()); - AssertThat(out_nodes.pull(), Is().EqualTo(node(0, bdd::MAX_ID, + AssertThat(out_nodes.pull(), Is().EqualTo(node(0, bdd::max_id, terminal_F, - bdd::ptr_t(1, bdd::MAX_ID)))); + bdd::pointer_type(1, bdd::max_id)))); AssertThat(out_nodes.can_pull(), Is().False()); @@ -840,23 +840,23 @@ go_bandit([]() { AssertThat(out_meta.can_pull(), Is().False()); - AssertThat(out->max_1level_cut[cut_type::INTERNAL], Is().EqualTo(1u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(3u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(1u)); - AssertThat(out->max_1level_cut[cut_type::ALL], Is().EqualTo(4u)); + AssertThat(out->max_1level_cut[cut::Internal], Is().EqualTo(1u)); + AssertThat(out->max_1level_cut[cut::Internal_False], Is().EqualTo(3u)); + AssertThat(out->max_1level_cut[cut::Internal_True], Is().EqualTo(1u)); + AssertThat(out->max_1level_cut[cut::All], Is().EqualTo(4u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL], Is().EqualTo(1u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(3u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(1u)); - AssertThat(out->max_2level_cut[cut_type::ALL], Is().EqualTo(4u)); + AssertThat(out->max_2level_cut[cut::Internal], Is().EqualTo(1u)); + AssertThat(out->max_2level_cut[cut::Internal_False], Is().EqualTo(3u)); + AssertThat(out->max_2level_cut[cut::Internal_True], Is().EqualTo(1u)); + AssertThat(out->max_2level_cut[cut::All], Is().EqualTo(4u)); AssertThat(out->number_of_terminals[false], Is().EqualTo(3u)); AssertThat(out->number_of_terminals[true], Is().EqualTo(1u)); }); it("should retrieve evaluation [2] in domain { 0,2,4 }", [&]() { - std::vector dom = { 0,2,4 }; - adiar_set_domain(dom.begin(), dom.end()); + std::vector dom = { 0,2,4 }; + domain_set(dom.begin(), dom.end()); bdd out = bdd_satmin(bdd_2); @@ -864,28 +864,28 @@ go_bandit([]() { node_test_stream out_nodes(out); AssertThat(out_nodes.can_pull(), Is().True()); - AssertThat(out_nodes.pull(), Is().EqualTo(node(4, bdd::MAX_ID, + AssertThat(out_nodes.pull(), Is().EqualTo(node(4, bdd::max_id, terminal_T, terminal_F))); AssertThat(out_nodes.can_pull(), Is().True()); - AssertThat(out_nodes.pull(), Is().EqualTo(node(3, bdd::MAX_ID, - bdd::ptr_t(4, bdd::MAX_ID), + AssertThat(out_nodes.pull(), Is().EqualTo(node(3, bdd::max_id, + bdd::pointer_type(4, bdd::max_id), terminal_F))); AssertThat(out_nodes.can_pull(), Is().True()); - AssertThat(out_nodes.pull(), Is().EqualTo(node(2, bdd::MAX_ID, + AssertThat(out_nodes.pull(), Is().EqualTo(node(2, bdd::max_id, terminal_F, - bdd::ptr_t(3, bdd::MAX_ID)))); + bdd::pointer_type(3, bdd::max_id)))); AssertThat(out_nodes.can_pull(), Is().True()); - AssertThat(out_nodes.pull(), Is().EqualTo(node(1, bdd::MAX_ID, - bdd::ptr_t(2, bdd::MAX_ID), + AssertThat(out_nodes.pull(), Is().EqualTo(node(1, bdd::max_id, + bdd::pointer_type(2, bdd::max_id), terminal_F))); AssertThat(out_nodes.can_pull(), Is().True()); - AssertThat(out_nodes.pull(), Is().EqualTo(node(0, bdd::MAX_ID, - bdd::ptr_t(1, bdd::MAX_ID), + AssertThat(out_nodes.pull(), Is().EqualTo(node(0, bdd::max_id, + bdd::pointer_type(1, bdd::max_id), terminal_F))); AssertThat(out_nodes.can_pull(), Is().False()); @@ -909,29 +909,29 @@ go_bandit([]() { AssertThat(out_meta.can_pull(), Is().False()); - AssertThat(out->max_1level_cut[cut_type::INTERNAL], Is().EqualTo(1u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(5u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(1u)); - AssertThat(out->max_1level_cut[cut_type::ALL], Is().EqualTo(6u)); + AssertThat(out->max_1level_cut[cut::Internal], Is().EqualTo(1u)); + AssertThat(out->max_1level_cut[cut::Internal_False], Is().EqualTo(5u)); + AssertThat(out->max_1level_cut[cut::Internal_True], Is().EqualTo(1u)); + AssertThat(out->max_1level_cut[cut::All], Is().EqualTo(6u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL], Is().EqualTo(1u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(5u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(1u)); - AssertThat(out->max_2level_cut[cut_type::ALL], Is().EqualTo(6u)); + AssertThat(out->max_2level_cut[cut::Internal], Is().EqualTo(1u)); + AssertThat(out->max_2level_cut[cut::Internal_False], Is().EqualTo(5u)); + AssertThat(out->max_2level_cut[cut::Internal_True], Is().EqualTo(1u)); + AssertThat(out->max_2level_cut[cut::All], Is().EqualTo(6u)); AssertThat(out->number_of_terminals[false], Is().EqualTo(5u)); AssertThat(out->number_of_terminals[true], Is().EqualTo(1u)); }); - adiar_unset_domain(); + domain_unset(); }); describe("bdd_satmin(f, cb) [bdd levels]", [&]() { - adiar_unset_domain(); + domain_unset(); it("is never called for true terminal", [&]() { size_t calls = 0u; - const auto cb = [&calls](bdd::label_t, bool) { calls++; }; + const auto cb = [&calls](bdd::label_type, bool) { calls++; }; bdd_satmin(bdd_T, cb); AssertThat(calls, Is().EqualTo(0u)); @@ -939,7 +939,7 @@ go_bandit([]() { it("is never called for false terminal", [&]() { size_t calls = 0u; - const auto cb = [&calls](bdd::label_t, bool) { calls++; }; + const auto cb = [&calls](bdd::label_type, bool) { calls++; }; bdd_satmin(bdd_F, cb); AssertThat(calls, Is().EqualTo(0u)); @@ -947,7 +947,7 @@ go_bandit([]() { it("is called once for [0]", [&]() { size_t calls = 0u; - const auto cb = [&calls](bdd::label_t x, bool v) { + const auto cb = [&calls](bdd::label_type x, bool v) { AssertThat(calls, Is().EqualTo(0u)); AssertThat(x, Is().EqualTo(0u)); AssertThat(v, Is().EqualTo(true)); @@ -961,10 +961,10 @@ go_bandit([]() { it("is called with expected evaluation [1]", [&]() { size_t calls = 0; - std::vector> expected = + std::vector> expected = { {0, false}, {1, false}, {2, true}, {3, true} }; - const auto cb = [&calls, &expected](bdd::label_t x, bool v) { + const auto cb = [&calls, &expected](bdd::label_type x, bool v) { AssertThat(calls, Is().LessThan(expected.size())); AssertThat(x, Is().EqualTo(expected.at(calls).first)); AssertThat(v, Is().EqualTo(expected.at(calls).second)); @@ -977,10 +977,10 @@ go_bandit([]() { it("is called with expected evaluation [~1]", [&]() { size_t calls = 0; - std::vector> expected = + std::vector> expected = { {0, false}, {1, false}, {2, false}, {3, false} }; - const auto cb = [&calls, &expected](bdd::label_t x, bool v) { + const auto cb = [&calls, &expected](bdd::label_type x, bool v) { AssertThat(calls, Is().LessThan(expected.size())); AssertThat(x, Is().EqualTo(expected.at(calls).first)); AssertThat(v, Is().EqualTo(expected.at(calls).second)); @@ -993,10 +993,10 @@ go_bandit([]() { it("is called with expected evaluation [2]", [&]() { size_t calls = 0; - std::vector> expected = + std::vector> expected = { {0, false}, {1, false}, {2, true}, {3, false} }; - const auto cb = [&calls, &expected](bdd::label_t x, bool v) { + const auto cb = [&calls, &expected](bdd::label_type x, bool v) { AssertThat(calls, Is().LessThan(expected.size())); AssertThat(x, Is().EqualTo(expected.at(calls).first)); AssertThat(v, Is().EqualTo(expected.at(calls).second)); @@ -1010,10 +1010,10 @@ go_bandit([]() { it("is called with expected evaluation [3]", [&]() { size_t calls = 0; - std::vector> expected = + std::vector> expected = { {1, false}, {3, false}, {5, false} }; - const auto cb = [&calls, &expected](bdd::label_t x, bool v) { + const auto cb = [&calls, &expected](bdd::label_type x, bool v) { AssertThat(calls, Is().LessThan(expected.size())); AssertThat(x, Is().EqualTo(expected.at(calls).first)); AssertThat(v, Is().EqualTo(expected.at(calls).second)); @@ -1027,13 +1027,13 @@ go_bandit([]() { describe("bdd_satmin(f, cb) [bdd levels]", [&]() { it("is called with full domain for [0]", [&]() { - adiar_set_domain(2); + domain_set(2); size_t calls = 0; - std::vector> expected = + std::vector> expected = { {0, true}, {1, false} }; - const auto cb = [&calls, &expected](bdd::label_t x, bool v) { + const auto cb = [&calls, &expected](bdd::label_type x, bool v) { AssertThat(calls, Is().LessThan(expected.size())); AssertThat(x, Is().EqualTo(expected.at(calls).first)); AssertThat(v, Is().EqualTo(expected.at(calls).second)); @@ -1046,14 +1046,14 @@ go_bandit([]() { }); it("is called with expected evaluation [2]", [&]() { - std::vector dom = { 0,2,4 }; - adiar_set_domain(dom.begin(), dom.end()); + std::vector dom = { 0,2,4 }; + domain_set(dom.begin(), dom.end()); size_t calls = 0; - std::vector> expected = + std::vector> expected = { {0, false}, {1, false}, {2, true}, {3, false}, {4, false} }; - const auto cb = [&calls, &expected](bdd::label_t x, bool v) { + const auto cb = [&calls, &expected](bdd::label_type x, bool v) { AssertThat(calls, Is().LessThan(expected.size())); AssertThat(x, Is().EqualTo(expected.at(calls).first)); AssertThat(v, Is().EqualTo(expected.at(calls).second)); @@ -1067,7 +1067,7 @@ go_bandit([]() { }); describe("bdd_satmin(f, begin, end) [bdd levels]", [&]() { - adiar_unset_domain(); + domain_unset(); // TODO }); @@ -1077,7 +1077,7 @@ go_bandit([]() { }); describe("bdd_satmax(f) [bdd levels]", [&]() { - adiar_unset_domain(); + domain_unset(); it("should retrieve maximal evaluation [1]", [&]() { bdd out = bdd_satmax(bdd_1); @@ -1086,24 +1086,24 @@ go_bandit([]() { node_test_stream out_nodes(out); AssertThat(out_nodes.can_pull(), Is().True()); - AssertThat(out_nodes.pull(), Is().EqualTo(node(3, bdd::MAX_ID, + AssertThat(out_nodes.pull(), Is().EqualTo(node(3, bdd::max_id, terminal_F, terminal_T))); AssertThat(out_nodes.can_pull(), Is().True()); - AssertThat(out_nodes.pull(), Is().EqualTo(node(2, bdd::MAX_ID, - bdd::ptr_t(3, bdd::MAX_ID), + AssertThat(out_nodes.pull(), Is().EqualTo(node(2, bdd::max_id, + bdd::pointer_type(3, bdd::max_id), terminal_F))); AssertThat(out_nodes.can_pull(), Is().True()); - AssertThat(out_nodes.pull(), Is().EqualTo(node(1, bdd::MAX_ID, + AssertThat(out_nodes.pull(), Is().EqualTo(node(1, bdd::max_id, terminal_F, - bdd::ptr_t(2, bdd::MAX_ID)))); + bdd::pointer_type(2, bdd::max_id)))); AssertThat(out_nodes.can_pull(), Is().True()); - AssertThat(out_nodes.pull(), Is().EqualTo(node(0, bdd::MAX_ID, + AssertThat(out_nodes.pull(), Is().EqualTo(node(0, bdd::max_id, terminal_F, - bdd::ptr_t(1, bdd::MAX_ID)))); + bdd::pointer_type(1, bdd::max_id)))); AssertThat(out_nodes.can_pull(), Is().False()); @@ -1123,15 +1123,15 @@ go_bandit([]() { AssertThat(out_meta.can_pull(), Is().False()); - AssertThat(out->max_1level_cut[cut_type::INTERNAL], Is().EqualTo(1u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(4u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(1u)); - AssertThat(out->max_1level_cut[cut_type::ALL], Is().EqualTo(5u)); + AssertThat(out->max_1level_cut[cut::Internal], Is().EqualTo(1u)); + AssertThat(out->max_1level_cut[cut::Internal_False], Is().EqualTo(4u)); + AssertThat(out->max_1level_cut[cut::Internal_True], Is().EqualTo(1u)); + AssertThat(out->max_1level_cut[cut::All], Is().EqualTo(5u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL], Is().EqualTo(1u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(4u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(1u)); - AssertThat(out->max_2level_cut[cut_type::ALL], Is().EqualTo(5u)); + AssertThat(out->max_2level_cut[cut::Internal], Is().EqualTo(1u)); + AssertThat(out->max_2level_cut[cut::Internal_False], Is().EqualTo(4u)); + AssertThat(out->max_2level_cut[cut::Internal_True], Is().EqualTo(1u)); + AssertThat(out->max_2level_cut[cut::All], Is().EqualTo(5u)); AssertThat(out->number_of_terminals[false], Is().EqualTo(4u)); AssertThat(out->number_of_terminals[true], Is().EqualTo(1u)); @@ -1144,24 +1144,24 @@ go_bandit([]() { node_test_stream out_nodes(out); AssertThat(out_nodes.can_pull(), Is().True()); - AssertThat(out_nodes.pull(), Is().EqualTo(node(3, bdd::MAX_ID, + AssertThat(out_nodes.pull(), Is().EqualTo(node(3, bdd::max_id, terminal_F, terminal_T))); AssertThat(out_nodes.can_pull(), Is().True()); - AssertThat(out_nodes.pull(), Is().EqualTo(node(2, bdd::MAX_ID, + AssertThat(out_nodes.pull(), Is().EqualTo(node(2, bdd::max_id, terminal_F, - bdd::ptr_t(3, bdd::MAX_ID)))); + bdd::pointer_type(3, bdd::max_id)))); AssertThat(out_nodes.can_pull(), Is().True()); - AssertThat(out_nodes.pull(), Is().EqualTo(node(1, bdd::MAX_ID, + AssertThat(out_nodes.pull(), Is().EqualTo(node(1, bdd::max_id, terminal_F, - bdd::ptr_t(2, bdd::MAX_ID)))); + bdd::pointer_type(2, bdd::max_id)))); AssertThat(out_nodes.can_pull(), Is().True()); - AssertThat(out_nodes.pull(), Is().EqualTo(node(0, bdd::MAX_ID, + AssertThat(out_nodes.pull(), Is().EqualTo(node(0, bdd::max_id, terminal_F, - bdd::ptr_t(1, bdd::MAX_ID)))); + bdd::pointer_type(1, bdd::max_id)))); AssertThat(out_nodes.can_pull(), Is().False()); @@ -1181,15 +1181,15 @@ go_bandit([]() { AssertThat(out_meta.can_pull(), Is().False()); - AssertThat(out->max_1level_cut[cut_type::INTERNAL], Is().EqualTo(1u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(4u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(1u)); - AssertThat(out->max_1level_cut[cut_type::ALL], Is().EqualTo(5u)); + AssertThat(out->max_1level_cut[cut::Internal], Is().EqualTo(1u)); + AssertThat(out->max_1level_cut[cut::Internal_False], Is().EqualTo(4u)); + AssertThat(out->max_1level_cut[cut::Internal_True], Is().EqualTo(1u)); + AssertThat(out->max_1level_cut[cut::All], Is().EqualTo(5u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL], Is().EqualTo(1u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(4u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(1u)); - AssertThat(out->max_2level_cut[cut_type::ALL], Is().EqualTo(5u)); + AssertThat(out->max_2level_cut[cut::Internal], Is().EqualTo(1u)); + AssertThat(out->max_2level_cut[cut::Internal_False], Is().EqualTo(4u)); + AssertThat(out->max_2level_cut[cut::Internal_True], Is().EqualTo(1u)); + AssertThat(out->max_2level_cut[cut::All], Is().EqualTo(5u)); AssertThat(out->number_of_terminals[false], Is().EqualTo(4u)); AssertThat(out->number_of_terminals[true], Is().EqualTo(1u)); @@ -1202,24 +1202,24 @@ go_bandit([]() { node_test_stream out_nodes(out); AssertThat(out_nodes.can_pull(), Is().True()); - AssertThat(out_nodes.pull(), Is().EqualTo(node(3, bdd::MAX_ID, + AssertThat(out_nodes.pull(), Is().EqualTo(node(3, bdd::max_id, terminal_F, terminal_T))); AssertThat(out_nodes.can_pull(), Is().True()); - AssertThat(out_nodes.pull(), Is().EqualTo(node(2, bdd::MAX_ID, + AssertThat(out_nodes.pull(), Is().EqualTo(node(2, bdd::max_id, terminal_F, - bdd::ptr_t(3, bdd::MAX_ID)))); + bdd::pointer_type(3, bdd::max_id)))); AssertThat(out_nodes.can_pull(), Is().True()); - AssertThat(out_nodes.pull(), Is().EqualTo(node(1, bdd::MAX_ID, + AssertThat(out_nodes.pull(), Is().EqualTo(node(1, bdd::max_id, terminal_F, - bdd::ptr_t(2, bdd::MAX_ID)))); + bdd::pointer_type(2, bdd::max_id)))); AssertThat(out_nodes.can_pull(), Is().True()); - AssertThat(out_nodes.pull(), Is().EqualTo(node(0, bdd::MAX_ID, + AssertThat(out_nodes.pull(), Is().EqualTo(node(0, bdd::max_id, terminal_F, - bdd::ptr_t(1, bdd::MAX_ID)))); + bdd::pointer_type(1, bdd::max_id)))); AssertThat(out_nodes.can_pull(), Is().False()); @@ -1239,15 +1239,15 @@ go_bandit([]() { AssertThat(out_meta.can_pull(), Is().False()); - AssertThat(out->max_1level_cut[cut_type::INTERNAL], Is().EqualTo(1u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(4u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(1u)); - AssertThat(out->max_1level_cut[cut_type::ALL], Is().EqualTo(5u)); + AssertThat(out->max_1level_cut[cut::Internal], Is().EqualTo(1u)); + AssertThat(out->max_1level_cut[cut::Internal_False], Is().EqualTo(4u)); + AssertThat(out->max_1level_cut[cut::Internal_True], Is().EqualTo(1u)); + AssertThat(out->max_1level_cut[cut::All], Is().EqualTo(5u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL], Is().EqualTo(1u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(4u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(1u)); - AssertThat(out->max_2level_cut[cut_type::ALL], Is().EqualTo(5u)); + AssertThat(out->max_2level_cut[cut::Internal], Is().EqualTo(1u)); + AssertThat(out->max_2level_cut[cut::Internal_False], Is().EqualTo(4u)); + AssertThat(out->max_2level_cut[cut::Internal_True], Is().EqualTo(1u)); + AssertThat(out->max_2level_cut[cut::All], Is().EqualTo(5u)); AssertThat(out->number_of_terminals[false], Is().EqualTo(4u)); AssertThat(out->number_of_terminals[true], Is().EqualTo(1u)); @@ -1260,24 +1260,24 @@ go_bandit([]() { node_test_stream out_nodes(out); AssertThat(out_nodes.can_pull(), Is().True()); - AssertThat(out_nodes.pull(), Is().EqualTo(node(3, bdd::MAX_ID, + AssertThat(out_nodes.pull(), Is().EqualTo(node(3, bdd::max_id, terminal_F, terminal_T))); AssertThat(out_nodes.can_pull(), Is().True()); - AssertThat(out_nodes.pull(), Is().EqualTo(node(2, bdd::MAX_ID, - bdd::ptr_t(3, bdd::MAX_ID), + AssertThat(out_nodes.pull(), Is().EqualTo(node(2, bdd::max_id, + bdd::pointer_type(3, bdd::max_id), terminal_F))); AssertThat(out_nodes.can_pull(), Is().True()); - AssertThat(out_nodes.pull(), Is().EqualTo(node(1, bdd::MAX_ID, + AssertThat(out_nodes.pull(), Is().EqualTo(node(1, bdd::max_id, terminal_F, - bdd::ptr_t(2, bdd::MAX_ID)))); + bdd::pointer_type(2, bdd::max_id)))); AssertThat(out_nodes.can_pull(), Is().True()); - AssertThat(out_nodes.pull(), Is().EqualTo(node(0, bdd::MAX_ID, + AssertThat(out_nodes.pull(), Is().EqualTo(node(0, bdd::max_id, terminal_F, - bdd::ptr_t(1, bdd::MAX_ID)))); + bdd::pointer_type(1, bdd::max_id)))); AssertThat(out_nodes.can_pull(), Is().False()); @@ -1297,15 +1297,15 @@ go_bandit([]() { AssertThat(out_meta.can_pull(), Is().False()); - AssertThat(out->max_1level_cut[cut_type::INTERNAL], Is().EqualTo(1u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(4u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(1u)); - AssertThat(out->max_1level_cut[cut_type::ALL], Is().EqualTo(5u)); + AssertThat(out->max_1level_cut[cut::Internal], Is().EqualTo(1u)); + AssertThat(out->max_1level_cut[cut::Internal_False], Is().EqualTo(4u)); + AssertThat(out->max_1level_cut[cut::Internal_True], Is().EqualTo(1u)); + AssertThat(out->max_1level_cut[cut::All], Is().EqualTo(5u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL], Is().EqualTo(1u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(4u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(1u)); - AssertThat(out->max_2level_cut[cut_type::ALL], Is().EqualTo(5u)); + AssertThat(out->max_2level_cut[cut::Internal], Is().EqualTo(1u)); + AssertThat(out->max_2level_cut[cut::Internal_False], Is().EqualTo(4u)); + AssertThat(out->max_2level_cut[cut::Internal_True], Is().EqualTo(1u)); + AssertThat(out->max_2level_cut[cut::All], Is().EqualTo(5u)); AssertThat(out->number_of_terminals[false], Is().EqualTo(4u)); AssertThat(out->number_of_terminals[true], Is().EqualTo(1u)); @@ -1318,19 +1318,19 @@ go_bandit([]() { node_test_stream out_nodes(out); AssertThat(out_nodes.can_pull(), Is().True()); - AssertThat(out_nodes.pull(), Is().EqualTo(node(5, bdd::MAX_ID, + AssertThat(out_nodes.pull(), Is().EqualTo(node(5, bdd::max_id, terminal_F, terminal_T))); AssertThat(out_nodes.can_pull(), Is().True()); - AssertThat(out_nodes.pull(), Is().EqualTo(node(3, bdd::MAX_ID, + AssertThat(out_nodes.pull(), Is().EqualTo(node(3, bdd::max_id, terminal_F, - bdd::ptr_t(5, bdd::MAX_ID)))); + bdd::pointer_type(5, bdd::max_id)))); AssertThat(out_nodes.can_pull(), Is().True()); - AssertThat(out_nodes.pull(), Is().EqualTo(node(1, bdd::MAX_ID, + AssertThat(out_nodes.pull(), Is().EqualTo(node(1, bdd::max_id, terminal_F, - bdd::ptr_t(3, bdd::MAX_ID)))); + bdd::pointer_type(3, bdd::max_id)))); AssertThat(out_nodes.can_pull(), Is().False()); @@ -1347,15 +1347,15 @@ go_bandit([]() { AssertThat(out_meta.can_pull(), Is().False()); - AssertThat(out->max_1level_cut[cut_type::INTERNAL], Is().EqualTo(1u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(3u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(1u)); - AssertThat(out->max_1level_cut[cut_type::ALL], Is().EqualTo(4u)); + AssertThat(out->max_1level_cut[cut::Internal], Is().EqualTo(1u)); + AssertThat(out->max_1level_cut[cut::Internal_False], Is().EqualTo(3u)); + AssertThat(out->max_1level_cut[cut::Internal_True], Is().EqualTo(1u)); + AssertThat(out->max_1level_cut[cut::All], Is().EqualTo(4u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL], Is().EqualTo(1u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(3u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(1u)); - AssertThat(out->max_2level_cut[cut_type::ALL], Is().EqualTo(4u)); + AssertThat(out->max_2level_cut[cut::Internal], Is().EqualTo(1u)); + AssertThat(out->max_2level_cut[cut::Internal_False], Is().EqualTo(3u)); + AssertThat(out->max_2level_cut[cut::Internal_True], Is().EqualTo(1u)); + AssertThat(out->max_2level_cut[cut::All], Is().EqualTo(4u)); AssertThat(out->number_of_terminals[false], Is().EqualTo(3u)); AssertThat(out->number_of_terminals[true], Is().EqualTo(1u)); @@ -1368,19 +1368,19 @@ go_bandit([]() { node_test_stream out_nodes(out); AssertThat(out_nodes.can_pull(), Is().True()); - AssertThat(out_nodes.pull(), Is().EqualTo(node(5, bdd::MAX_ID, + AssertThat(out_nodes.pull(), Is().EqualTo(node(5, bdd::max_id, terminal_T, terminal_F))); AssertThat(out_nodes.can_pull(), Is().True()); - AssertThat(out_nodes.pull(), Is().EqualTo(node(3, bdd::MAX_ID, + AssertThat(out_nodes.pull(), Is().EqualTo(node(3, bdd::max_id, terminal_F, - bdd::ptr_t(5, bdd::MAX_ID)))); + bdd::pointer_type(5, bdd::max_id)))); AssertThat(out_nodes.can_pull(), Is().True()); - AssertThat(out_nodes.pull(), Is().EqualTo(node(1, bdd::MAX_ID, + AssertThat(out_nodes.pull(), Is().EqualTo(node(1, bdd::max_id, terminal_F, - bdd::ptr_t(3, bdd::MAX_ID)))); + bdd::pointer_type(3, bdd::max_id)))); AssertThat(out_nodes.can_pull(), Is().False()); @@ -1397,15 +1397,15 @@ go_bandit([]() { AssertThat(out_meta.can_pull(), Is().False()); - AssertThat(out->max_1level_cut[cut_type::INTERNAL], Is().EqualTo(1u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(3u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(1u)); - AssertThat(out->max_1level_cut[cut_type::ALL], Is().EqualTo(4u)); + AssertThat(out->max_1level_cut[cut::Internal], Is().EqualTo(1u)); + AssertThat(out->max_1level_cut[cut::Internal_False], Is().EqualTo(3u)); + AssertThat(out->max_1level_cut[cut::Internal_True], Is().EqualTo(1u)); + AssertThat(out->max_1level_cut[cut::All], Is().EqualTo(4u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL], Is().EqualTo(1u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(3u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(1u)); - AssertThat(out->max_2level_cut[cut_type::ALL], Is().EqualTo(4u)); + AssertThat(out->max_2level_cut[cut::Internal], Is().EqualTo(1u)); + AssertThat(out->max_2level_cut[cut::Internal_False], Is().EqualTo(3u)); + AssertThat(out->max_2level_cut[cut::Internal_True], Is().EqualTo(1u)); + AssertThat(out->max_2level_cut[cut::All], Is().EqualTo(4u)); AssertThat(out->number_of_terminals[false], Is().EqualTo(3u)); AssertThat(out->number_of_terminals[true], Is().EqualTo(1u)); @@ -1414,41 +1414,41 @@ go_bandit([]() { describe("bdd_satmax(f) [domain]", [&]() { it("should retrieve maximal evaluation [~1] in domain { 0, 1, ..., 5 }", [&]() { - adiar_set_domain(6); + domain_set(6); bdd out = bdd_satmax(bdd_1); // Check it looks all right node_test_stream out_nodes(out); AssertThat(out_nodes.can_pull(), Is().True()); - AssertThat(out_nodes.pull(), Is().EqualTo(node(5, bdd::MAX_ID, + AssertThat(out_nodes.pull(), Is().EqualTo(node(5, bdd::max_id, terminal_F, terminal_T))); AssertThat(out_nodes.can_pull(), Is().True()); - AssertThat(out_nodes.pull(), Is().EqualTo(node(4, bdd::MAX_ID, + AssertThat(out_nodes.pull(), Is().EqualTo(node(4, bdd::max_id, terminal_F, - bdd::ptr_t(5, bdd::MAX_ID)))); + bdd::pointer_type(5, bdd::max_id)))); AssertThat(out_nodes.can_pull(), Is().True()); - AssertThat(out_nodes.pull(), Is().EqualTo(node(3, bdd::MAX_ID, + AssertThat(out_nodes.pull(), Is().EqualTo(node(3, bdd::max_id, terminal_F, - bdd::ptr_t(4, bdd::MAX_ID)))); + bdd::pointer_type(4, bdd::max_id)))); AssertThat(out_nodes.can_pull(), Is().True()); - AssertThat(out_nodes.pull(), Is().EqualTo(node(2, bdd::MAX_ID, - bdd::ptr_t(3, bdd::MAX_ID), + AssertThat(out_nodes.pull(), Is().EqualTo(node(2, bdd::max_id, + bdd::pointer_type(3, bdd::max_id), terminal_F))); AssertThat(out_nodes.can_pull(), Is().True()); - AssertThat(out_nodes.pull(), Is().EqualTo(node(1, bdd::MAX_ID, + AssertThat(out_nodes.pull(), Is().EqualTo(node(1, bdd::max_id, terminal_F, - bdd::ptr_t(2, bdd::MAX_ID)))); + bdd::pointer_type(2, bdd::max_id)))); AssertThat(out_nodes.can_pull(), Is().True()); - AssertThat(out_nodes.pull(), Is().EqualTo(node(0, bdd::MAX_ID, + AssertThat(out_nodes.pull(), Is().EqualTo(node(0, bdd::max_id, terminal_F, - bdd::ptr_t(1, bdd::MAX_ID)))); + bdd::pointer_type(1, bdd::max_id)))); AssertThat(out_nodes.can_pull(), Is().False()); @@ -1474,22 +1474,22 @@ go_bandit([]() { AssertThat(out_meta.can_pull(), Is().False()); - AssertThat(out->max_1level_cut[cut_type::INTERNAL], Is().EqualTo(1u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(6u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(1u)); - AssertThat(out->max_1level_cut[cut_type::ALL], Is().EqualTo(7u)); + AssertThat(out->max_1level_cut[cut::Internal], Is().EqualTo(1u)); + AssertThat(out->max_1level_cut[cut::Internal_False], Is().EqualTo(6u)); + AssertThat(out->max_1level_cut[cut::Internal_True], Is().EqualTo(1u)); + AssertThat(out->max_1level_cut[cut::All], Is().EqualTo(7u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL], Is().EqualTo(1u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(6u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(1u)); - AssertThat(out->max_2level_cut[cut_type::ALL], Is().EqualTo(7u)); + AssertThat(out->max_2level_cut[cut::Internal], Is().EqualTo(1u)); + AssertThat(out->max_2level_cut[cut::Internal_False], Is().EqualTo(6u)); + AssertThat(out->max_2level_cut[cut::Internal_True], Is().EqualTo(1u)); + AssertThat(out->max_2level_cut[cut::All], Is().EqualTo(7u)); AssertThat(out->number_of_terminals[false], Is().EqualTo(6u)); AssertThat(out->number_of_terminals[true], Is().EqualTo(1u)); }); it("should retrieve maximal evaluation [~2] in domain { 0, 1, ..., 5 }", [&]() { - adiar_set_domain(5); + domain_set(5); bdd out = bdd_satmax(bdd_not(bdd_2)); @@ -1497,29 +1497,29 @@ go_bandit([]() { node_test_stream out_nodes(out); AssertThat(out_nodes.can_pull(), Is().True()); - AssertThat(out_nodes.pull(), Is().EqualTo(node(4, bdd::MAX_ID, + AssertThat(out_nodes.pull(), Is().EqualTo(node(4, bdd::max_id, terminal_F, terminal_T))); AssertThat(out_nodes.can_pull(), Is().True()); - AssertThat(out_nodes.pull(), Is().EqualTo(node(3, bdd::MAX_ID, + AssertThat(out_nodes.pull(), Is().EqualTo(node(3, bdd::max_id, terminal_F, - bdd::ptr_t(4, bdd::MAX_ID)))); + bdd::pointer_type(4, bdd::max_id)))); AssertThat(out_nodes.can_pull(), Is().True()); - AssertThat(out_nodes.pull(), Is().EqualTo(node(2, bdd::MAX_ID, - bdd::ptr_t(3, bdd::MAX_ID), + AssertThat(out_nodes.pull(), Is().EqualTo(node(2, bdd::max_id, + bdd::pointer_type(3, bdd::max_id), terminal_F))); AssertThat(out_nodes.can_pull(), Is().True()); - AssertThat(out_nodes.pull(), Is().EqualTo(node(1, bdd::MAX_ID, + AssertThat(out_nodes.pull(), Is().EqualTo(node(1, bdd::max_id, terminal_F, - bdd::ptr_t(2, bdd::MAX_ID)))); + bdd::pointer_type(2, bdd::max_id)))); AssertThat(out_nodes.can_pull(), Is().True()); - AssertThat(out_nodes.pull(), Is().EqualTo(node(0, bdd::MAX_ID, + AssertThat(out_nodes.pull(), Is().EqualTo(node(0, bdd::max_id, terminal_F, - bdd::ptr_t(1, bdd::MAX_ID)))); + bdd::pointer_type(1, bdd::max_id)))); AssertThat(out_nodes.can_pull(), Is().False()); @@ -1542,23 +1542,23 @@ go_bandit([]() { AssertThat(out_meta.can_pull(), Is().False()); - AssertThat(out->max_1level_cut[cut_type::INTERNAL], Is().EqualTo(1u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(5u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(1u)); - AssertThat(out->max_1level_cut[cut_type::ALL], Is().EqualTo(6u)); + AssertThat(out->max_1level_cut[cut::Internal], Is().EqualTo(1u)); + AssertThat(out->max_1level_cut[cut::Internal_False], Is().EqualTo(5u)); + AssertThat(out->max_1level_cut[cut::Internal_True], Is().EqualTo(1u)); + AssertThat(out->max_1level_cut[cut::All], Is().EqualTo(6u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL], Is().EqualTo(1u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(5u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(1u)); - AssertThat(out->max_2level_cut[cut_type::ALL], Is().EqualTo(6u)); + AssertThat(out->max_2level_cut[cut::Internal], Is().EqualTo(1u)); + AssertThat(out->max_2level_cut[cut::Internal_False], Is().EqualTo(5u)); + AssertThat(out->max_2level_cut[cut::Internal_True], Is().EqualTo(1u)); + AssertThat(out->max_2level_cut[cut::All], Is().EqualTo(6u)); AssertThat(out->number_of_terminals[false], Is().EqualTo(5u)); AssertThat(out->number_of_terminals[true], Is().EqualTo(1u)); }); it("should retrieve maximal evaluation [~2] in domain { 0, 2, 4 }", [&]() { - std::vector dom = { 0,2,4 }; - adiar_set_domain(dom.begin(), dom.end()); + std::vector dom = { 0,2,4 }; + domain_set(dom.begin(), dom.end()); bdd out = bdd_satmax(bdd_not(bdd_2)); @@ -1566,25 +1566,25 @@ go_bandit([]() { node_test_stream out_nodes(out); AssertThat(out_nodes.can_pull(), Is().True()); - AssertThat(out_nodes.pull(), Is().EqualTo(node(4, bdd::MAX_ID, + AssertThat(out_nodes.pull(), Is().EqualTo(node(4, bdd::max_id, terminal_F, terminal_T))); // Notice, this variable is outside the domain but on the traversed path! AssertThat(out_nodes.can_pull(), Is().True()); - AssertThat(out_nodes.pull(), Is().EqualTo(node(3, bdd::MAX_ID, + AssertThat(out_nodes.pull(), Is().EqualTo(node(3, bdd::max_id, terminal_F, - bdd::ptr_t(4, bdd::MAX_ID)))); + bdd::pointer_type(4, bdd::max_id)))); AssertThat(out_nodes.can_pull(), Is().True()); - AssertThat(out_nodes.pull(), Is().EqualTo(node(2, bdd::MAX_ID, - bdd::ptr_t(3, bdd::MAX_ID), + AssertThat(out_nodes.pull(), Is().EqualTo(node(2, bdd::max_id, + bdd::pointer_type(3, bdd::max_id), terminal_F))); AssertThat(out_nodes.can_pull(), Is().True()); - AssertThat(out_nodes.pull(), Is().EqualTo(node(0, bdd::MAX_ID, + AssertThat(out_nodes.pull(), Is().EqualTo(node(0, bdd::max_id, terminal_F, - bdd::ptr_t(2, bdd::MAX_ID)))); + bdd::pointer_type(2, bdd::max_id)))); AssertThat(out_nodes.can_pull(), Is().False()); @@ -1604,32 +1604,32 @@ go_bandit([]() { AssertThat(out_meta.can_pull(), Is().False()); - AssertThat(out->max_1level_cut[cut_type::INTERNAL], Is().EqualTo(1u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(4u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(1u)); - AssertThat(out->max_1level_cut[cut_type::ALL], Is().EqualTo(5u)); + AssertThat(out->max_1level_cut[cut::Internal], Is().EqualTo(1u)); + AssertThat(out->max_1level_cut[cut::Internal_False], Is().EqualTo(4u)); + AssertThat(out->max_1level_cut[cut::Internal_True], Is().EqualTo(1u)); + AssertThat(out->max_1level_cut[cut::All], Is().EqualTo(5u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL], Is().EqualTo(1u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(4u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(1u)); - AssertThat(out->max_2level_cut[cut_type::ALL], Is().EqualTo(5u)); + AssertThat(out->max_2level_cut[cut::Internal], Is().EqualTo(1u)); + AssertThat(out->max_2level_cut[cut::Internal_False], Is().EqualTo(4u)); + AssertThat(out->max_2level_cut[cut::Internal_True], Is().EqualTo(1u)); + AssertThat(out->max_2level_cut[cut::All], Is().EqualTo(5u)); AssertThat(out->number_of_terminals[false], Is().EqualTo(4u)); AssertThat(out->number_of_terminals[true], Is().EqualTo(1u)); }); - adiar_unset_domain(); + domain_unset(); }); describe("bdd_satmax(f, cb) [bdd levels]", [&]() { - adiar_unset_domain(); + domain_unset(); it("should retrieve maximal evaluation [1]", [&]() { size_t calls = 0; - std::vector> expected = + std::vector> expected = { {0, true}, {1, true}, {2, false}, {3, true} }; - const auto cb = [&calls, &expected](bdd::label_t x, bool v) { + const auto cb = [&calls, &expected](bdd::label_type x, bool v) { AssertThat(calls, Is().LessThan(expected.size())); AssertThat(x, Is().EqualTo(expected.at(calls).first)); AssertThat(v, Is().EqualTo(expected.at(calls).second)); @@ -1642,10 +1642,10 @@ go_bandit([]() { it("should retrieve maximal evaluation [~1]", [&]() { size_t calls = 0; - std::vector> expected = + std::vector> expected = { {0, true}, {1, true}, {2, true}, {3, true} }; - const auto cb = [&calls, &expected](bdd::label_t x, bool v) { + const auto cb = [&calls, &expected](bdd::label_type x, bool v) { AssertThat(calls, Is().LessThan(expected.size())); AssertThat(x, Is().EqualTo(expected.at(calls).first)); AssertThat(v, Is().EqualTo(expected.at(calls).second)); @@ -1658,10 +1658,10 @@ go_bandit([]() { it("should retrieve maximal evaluation [2]", [&]() { size_t calls = 0; - std::vector> expected = + std::vector> expected = { {0, true}, {1, true}, {2, true}, {3, true} }; - const auto cb = [&calls, &expected](bdd::label_t x, bool v) { + const auto cb = [&calls, &expected](bdd::label_type x, bool v) { AssertThat(calls, Is().LessThan(expected.size())); AssertThat(x, Is().EqualTo(expected.at(calls).first)); AssertThat(v, Is().EqualTo(expected.at(calls).second)); @@ -1674,10 +1674,10 @@ go_bandit([]() { it("should retrieve maximal evaluation [~2]", [&]() { size_t calls = 0; - std::vector> expected = + std::vector> expected = { {0, true}, {1, true}, {2, false}, {3, true} }; - const auto cb = [&calls, &expected](bdd::label_t x, bool v) { + const auto cb = [&calls, &expected](bdd::label_type x, bool v) { AssertThat(calls, Is().LessThan(expected.size())); AssertThat(x, Is().EqualTo(expected.at(calls).first)); AssertThat(v, Is().EqualTo(expected.at(calls).second)); @@ -1690,10 +1690,10 @@ go_bandit([]() { it("should retrieve maximal evaluation [3]", [&]() { size_t calls = 0; - std::vector> expected = + std::vector> expected = { {1, true}, {3, true}, {5, true} }; - const auto cb = [&calls, &expected](bdd::label_t x, bool v) { + const auto cb = [&calls, &expected](bdd::label_type x, bool v) { AssertThat(calls, Is().LessThan(expected.size())); AssertThat(x, Is().EqualTo(expected.at(calls).first)); AssertThat(v, Is().EqualTo(expected.at(calls).second)); @@ -1706,10 +1706,10 @@ go_bandit([]() { it("should retrieve maximal evaluation [~3]", [&]() { size_t calls = 0; - std::vector> expected = + std::vector> expected = { {1, true}, {3, true}, {5, false} }; - const auto cb = [&calls, &expected](bdd::label_t x, bool v) { + const auto cb = [&calls, &expected](bdd::label_type x, bool v) { AssertThat(calls, Is().LessThan(expected.size())); AssertThat(x, Is().EqualTo(expected.at(calls).first)); AssertThat(v, Is().EqualTo(expected.at(calls).second)); @@ -1723,13 +1723,13 @@ go_bandit([]() { describe("bdd_satmax(f, cb) [domain]", [&]() { it("should retrieve maximal evaluation [~1] in domain { 0, 1, ..., 5 }", [&]() { - adiar_set_domain(6); + domain_set(6); size_t calls = 0; - std::vector> expected = + std::vector> expected = { {0, true}, {1, true}, {2, false}, {3, true}, {4, true}, {5, true} }; - const auto cb = [&calls, &expected](bdd::label_t x, bool v) { + const auto cb = [&calls, &expected](bdd::label_type x, bool v) { AssertThat(calls, Is().LessThan(expected.size())); AssertThat(x, Is().EqualTo(expected.at(calls).first)); AssertThat(v, Is().EqualTo(expected.at(calls).second)); @@ -1741,13 +1741,13 @@ go_bandit([]() { }); it("should retrieve maximal evaluation [~2] in domain { 0, 1, ..., 5 }", [&]() { - adiar_set_domain(5); + domain_set(5); size_t calls = 0; - std::vector> expected = + std::vector> expected = { {0, true}, {1, true}, {2, false}, {3, true}, {4, true} }; - const auto cb = [&calls, &expected](bdd::label_t x, bool v) { + const auto cb = [&calls, &expected](bdd::label_type x, bool v) { AssertThat(calls, Is().LessThan(expected.size())); AssertThat(x, Is().EqualTo(expected.at(calls).first)); AssertThat(v, Is().EqualTo(expected.at(calls).second)); @@ -1759,16 +1759,16 @@ go_bandit([]() { }); it("should retrieve maximal evaluation [~2] in domain { 0, 2, 4 }", [&]() { - std::vector dom = { 0,2,4 }; - adiar_set_domain(dom.begin(), dom.end()); + std::vector dom = { 0,2,4 }; + domain_set(dom.begin(), dom.end()); bdd out = bdd_satmax(bdd_not(bdd_2)); size_t calls = 0; - std::vector> expected = + std::vector> expected = { {0, true}, {2, false}, {3, true}, {4, true} }; - const auto cb = [&calls, &expected](bdd::label_t x, bool v) { + const auto cb = [&calls, &expected](bdd::label_type x, bool v) { AssertThat(calls, Is().LessThan(expected.size())); AssertThat(x, Is().EqualTo(expected.at(calls).first)); AssertThat(v, Is().EqualTo(expected.at(calls).second)); @@ -1779,11 +1779,11 @@ go_bandit([]() { AssertThat(calls, Is().EqualTo(3u + 1u)); }); - adiar_unset_domain(); + domain_unset(); }); describe("bdd_satmax(f, begin, end) [bdd levels]", [&]() { - adiar_unset_domain(); + domain_unset(); // TODO }); diff --git a/test/adiar/bdd/test_if_then_else.cpp b/test/adiar/bdd/test_if_then_else.cpp index b05c8cac6..0abf84e39 100644 --- a/test/adiar/bdd/test_if_then_else.cpp +++ b/test/adiar/bdd/test_if_then_else.cpp @@ -5,15 +5,15 @@ go_bandit([]() { ptr_uint64 terminal_T = ptr_uint64(true); ptr_uint64 terminal_F = ptr_uint64(false); - shared_levelized_file bdd_F; - shared_levelized_file bdd_T; - shared_levelized_file bdd_x0; - shared_levelized_file bdd_not_x0; - shared_levelized_file bdd_x1; - shared_levelized_file bdd_not_x1; - shared_levelized_file bdd_x2; - shared_levelized_file bdd_x0_xor_x1; - shared_levelized_file bdd_x0_xor_x2; + shared_levelized_file bdd_F; + shared_levelized_file bdd_T; + shared_levelized_file bdd_x0; + shared_levelized_file bdd_not_x0; + shared_levelized_file bdd_x1; + shared_levelized_file bdd_not_x1; + shared_levelized_file bdd_x2; + shared_levelized_file bdd_x0_xor_x1; + shared_levelized_file bdd_x0_xor_x2; { // Garbage collect writers to free write-lock node_writer nw_F(bdd_F); @@ -48,7 +48,7 @@ go_bandit([]() { << node(0,0,ptr_uint64(2,0),ptr_uint64(2,1)); } - shared_levelized_file bdd_1; + shared_levelized_file bdd_1; /* // _1_ ---- x0 // / \ @@ -73,7 +73,7 @@ go_bandit([]() { ; } - shared_levelized_file bdd_2; + shared_levelized_file bdd_2; /* // __1__ ---- x0 // / \ @@ -100,7 +100,7 @@ go_bandit([]() { ; } - shared_levelized_file bdd_3; + shared_levelized_file bdd_3; /* // __1__ ---- x0 // / \ @@ -124,7 +124,7 @@ go_bandit([]() { ; } - shared_levelized_file bdd_4; + shared_levelized_file bdd_4; /* // __1__ ---- x0 // / \ @@ -148,7 +148,7 @@ go_bandit([]() { ; } - shared_levelized_file bdd_5; + shared_levelized_file bdd_5; /* // __1__ ---- x0 // / \ @@ -171,7 +171,7 @@ go_bandit([]() { ; } - shared_levelized_file bdd_6; + shared_levelized_file bdd_6; /* // 1 ---- x0 // / \ @@ -190,7 +190,7 @@ go_bandit([]() { ; } - shared_levelized_file bdd_not_6; + shared_levelized_file bdd_not_6; /* // 1 ---- x0 // / \ @@ -209,7 +209,7 @@ go_bandit([]() { ; } - shared_levelized_file bdd_7; + shared_levelized_file bdd_7; /* // 1 ---- x0 // / \ @@ -232,7 +232,7 @@ go_bandit([]() { ; } - shared_levelized_file bdd_8; + shared_levelized_file bdd_8; /* // 1 ---- x0 // / \ @@ -258,7 +258,7 @@ go_bandit([]() { it("should give back first file on if-true (true ? x0 : x1)", [&]() { __bdd out = bdd_ite(bdd_T, bdd_x0, bdd_x1); - AssertThat(out.get>(), Is().EqualTo(bdd_x0)); + AssertThat(out.get>(), Is().EqualTo(bdd_x0)); AssertThat(out.negate, Is().False()); }); @@ -267,14 +267,14 @@ go_bandit([]() { // different files. __bdd out = bdd_ite(bdd_T, bdd_not(bdd_x0), bdd_not_x0); - AssertThat(out.get>(), Is().EqualTo(bdd_x0)); + AssertThat(out.get>(), Is().EqualTo(bdd_x0)); AssertThat(out.negate, Is().True()); }); it("should give back second file on if-false (false ? x0 : x1)", [&]() { __bdd out = bdd_ite(bdd_F, bdd_x0, bdd_x1); - AssertThat(out.get>(), Is().EqualTo(bdd_x1)); + AssertThat(out.get>(), Is().EqualTo(bdd_x1)); AssertThat(out.negate, Is().False()); }); @@ -283,7 +283,7 @@ go_bandit([]() { // different files. __bdd out = bdd_ite(bdd_F, bdd_not_x1, bdd_not(bdd_x1)); - AssertThat(out.get>(), Is().EqualTo(bdd_x1)); + AssertThat(out.get>(), Is().EqualTo(bdd_x1)); AssertThat(out.negate, Is().True()); }); @@ -291,14 +291,14 @@ go_bandit([]() { it("should return 'then' file if 'else' file is the same [1]", [&]() { __bdd out = bdd_ite(bdd_x0, bdd_x1, bdd_x1); - AssertThat(out.get>(), Is().EqualTo(bdd_x1)); + AssertThat(out.get>(), Is().EqualTo(bdd_x1)); AssertThat(out.negate, Is().False()); }); it("should return 'then' file if 'else' file is the same [2]", [&]() { __bdd out = bdd_ite(bdd_x0, bdd_not(bdd_x1), bdd_not(bdd_x1)); - AssertThat(out.get>(), Is().EqualTo(bdd_x1)); + AssertThat(out.get>(), Is().EqualTo(bdd_x1)); AssertThat(out.negate, Is().True()); }); }); @@ -341,10 +341,10 @@ go_bandit([]() { AssertThat(levels.can_pull(), Is().False()); - AssertThat(out.get<__bdd::shared_arcs_t>()->max_1level_cut, Is().EqualTo(2u)); + AssertThat(out.get<__bdd::shared_arc_file_type>()->max_1level_cut, Is().EqualTo(2u)); - AssertThat(out.get<__bdd::shared_arcs_t>()->number_of_terminals[false], Is().EqualTo(2u)); - AssertThat(out.get<__bdd::shared_arcs_t>()->number_of_terminals[true], Is().EqualTo(2u)); + AssertThat(out.get<__bdd::shared_arc_file_type>()->number_of_terminals[false], Is().EqualTo(2u)); + AssertThat(out.get<__bdd::shared_arc_file_type>()->number_of_terminals[true], Is().EqualTo(2u)); }); it("should create XNOR of x0 and ~x1 (x0 ? ~x1 : x1) due to same file", [&]() { @@ -384,10 +384,10 @@ go_bandit([]() { AssertThat(levels.can_pull(), Is().False()); - AssertThat(out.get<__bdd::shared_arcs_t>()->max_1level_cut, Is().EqualTo(2u)); + AssertThat(out.get<__bdd::shared_arc_file_type>()->max_1level_cut, Is().EqualTo(2u)); - AssertThat(out.get<__bdd::shared_arcs_t>()->number_of_terminals[false], Is().EqualTo(2u)); - AssertThat(out.get<__bdd::shared_arcs_t>()->number_of_terminals[true], Is().EqualTo(2u)); + AssertThat(out.get<__bdd::shared_arc_file_type>()->number_of_terminals[false], Is().EqualTo(2u)); + AssertThat(out.get<__bdd::shared_arc_file_type>()->number_of_terminals[true], Is().EqualTo(2u)); }); it("should create OR of x0 and x1 (x0 ? x0 : x1) due to same file", [&]() { @@ -421,10 +421,10 @@ go_bandit([]() { AssertThat(levels.can_pull(), Is().False()); - AssertThat(out.get<__bdd::shared_arcs_t>()->max_1level_cut, Is().EqualTo(1u)); + AssertThat(out.get<__bdd::shared_arc_file_type>()->max_1level_cut, Is().EqualTo(1u)); - AssertThat(out.get<__bdd::shared_arcs_t>()->number_of_terminals[false], Is().EqualTo(1u)); - AssertThat(out.get<__bdd::shared_arcs_t>()->number_of_terminals[true], Is().EqualTo(2u)); + AssertThat(out.get<__bdd::shared_arc_file_type>()->number_of_terminals[false], Is().EqualTo(1u)); + AssertThat(out.get<__bdd::shared_arc_file_type>()->number_of_terminals[true], Is().EqualTo(2u)); }); it("should create AND of x0 (negated) and x1 (x0 ? ~x0 : x1) due to same file", [&]() { @@ -458,10 +458,10 @@ go_bandit([]() { AssertThat(levels.can_pull(), Is().False()); - AssertThat(out.get<__bdd::shared_arcs_t>()->max_1level_cut, Is().EqualTo(1u)); + AssertThat(out.get<__bdd::shared_arc_file_type>()->max_1level_cut, Is().EqualTo(1u)); - AssertThat(out.get<__bdd::shared_arcs_t>()->number_of_terminals[false], Is().EqualTo(2u)); - AssertThat(out.get<__bdd::shared_arcs_t>()->number_of_terminals[true], Is().EqualTo(1u)); + AssertThat(out.get<__bdd::shared_arc_file_type>()->number_of_terminals[false], Is().EqualTo(2u)); + AssertThat(out.get<__bdd::shared_arc_file_type>()->number_of_terminals[true], Is().EqualTo(1u)); }); it("should create AND of x0 and x1 (x0 ? x1 : x0) due to same file", [&]() { @@ -495,10 +495,10 @@ go_bandit([]() { AssertThat(levels.can_pull(), Is().False()); - AssertThat(out.get<__bdd::shared_arcs_t>()->max_1level_cut, Is().EqualTo(1u)); + AssertThat(out.get<__bdd::shared_arc_file_type>()->max_1level_cut, Is().EqualTo(1u)); - AssertThat(out.get<__bdd::shared_arcs_t>()->number_of_terminals[false], Is().EqualTo(2u)); - AssertThat(out.get<__bdd::shared_arcs_t>()->number_of_terminals[true], Is().EqualTo(1u)); + AssertThat(out.get<__bdd::shared_arc_file_type>()->number_of_terminals[false], Is().EqualTo(2u)); + AssertThat(out.get<__bdd::shared_arc_file_type>()->number_of_terminals[true], Is().EqualTo(1u)); }); it("should create IMPLIES of x0 and x1 (x0 ? x1 : ~x0) due to same file", [&]() { @@ -532,10 +532,10 @@ go_bandit([]() { AssertThat(levels.can_pull(), Is().False()); - AssertThat(out.get<__bdd::shared_arcs_t>()->max_1level_cut, Is().EqualTo(1u)); + AssertThat(out.get<__bdd::shared_arc_file_type>()->max_1level_cut, Is().EqualTo(1u)); - AssertThat(out.get<__bdd::shared_arcs_t>()->number_of_terminals[false], Is().EqualTo(1u)); - AssertThat(out.get<__bdd::shared_arcs_t>()->number_of_terminals[true], Is().EqualTo(2u)); + AssertThat(out.get<__bdd::shared_arc_file_type>()->number_of_terminals[false], Is().EqualTo(1u)); + AssertThat(out.get<__bdd::shared_arc_file_type>()->number_of_terminals[true], Is().EqualTo(2u)); }); it("should create OR of x0 and x1 (x0 ? T : x1)", [&]() { @@ -569,10 +569,10 @@ go_bandit([]() { AssertThat(levels.can_pull(), Is().False()); - AssertThat(out.get<__bdd::shared_arcs_t>()->max_1level_cut, Is().EqualTo(1u)); + AssertThat(out.get<__bdd::shared_arc_file_type>()->max_1level_cut, Is().EqualTo(1u)); - AssertThat(out.get<__bdd::shared_arcs_t>()->number_of_terminals[false], Is().EqualTo(1u)); - AssertThat(out.get<__bdd::shared_arcs_t>()->number_of_terminals[true], Is().EqualTo(2u)); + AssertThat(out.get<__bdd::shared_arc_file_type>()->number_of_terminals[false], Is().EqualTo(1u)); + AssertThat(out.get<__bdd::shared_arc_file_type>()->number_of_terminals[true], Is().EqualTo(2u)); }); it("should create AND of x0 (negated) and x1 (x0 ? F : x1)", [&]() { @@ -606,10 +606,10 @@ go_bandit([]() { AssertThat(levels.can_pull(), Is().False()); - AssertThat(out.get<__bdd::shared_arcs_t>()->max_1level_cut, Is().EqualTo(1u)); + AssertThat(out.get<__bdd::shared_arc_file_type>()->max_1level_cut, Is().EqualTo(1u)); - AssertThat(out.get<__bdd::shared_arcs_t>()->number_of_terminals[false], Is().EqualTo(2u)); - AssertThat(out.get<__bdd::shared_arcs_t>()->number_of_terminals[true], Is().EqualTo(1u)); + AssertThat(out.get<__bdd::shared_arc_file_type>()->number_of_terminals[false], Is().EqualTo(2u)); + AssertThat(out.get<__bdd::shared_arc_file_type>()->number_of_terminals[true], Is().EqualTo(1u)); }); it("should create IMPLIES of x0 and x1 (x0 ? x1 : T)", [&]() { @@ -643,10 +643,10 @@ go_bandit([]() { AssertThat(levels.can_pull(), Is().False()); - AssertThat(out.get<__bdd::shared_arcs_t>()->max_1level_cut, Is().EqualTo(1u)); + AssertThat(out.get<__bdd::shared_arc_file_type>()->max_1level_cut, Is().EqualTo(1u)); - AssertThat(out.get<__bdd::shared_arcs_t>()->number_of_terminals[false], Is().EqualTo(1u)); - AssertThat(out.get<__bdd::shared_arcs_t>()->number_of_terminals[true], Is().EqualTo(2u)); + AssertThat(out.get<__bdd::shared_arc_file_type>()->number_of_terminals[false], Is().EqualTo(1u)); + AssertThat(out.get<__bdd::shared_arc_file_type>()->number_of_terminals[true], Is().EqualTo(2u)); }); it("should create AND of x0 and x1 (x0 ? x1 : F)", [&]() { @@ -680,10 +680,10 @@ go_bandit([]() { AssertThat(levels.can_pull(), Is().False()); - AssertThat(out.get<__bdd::shared_arcs_t>()->max_1level_cut, Is().EqualTo(1u)); + AssertThat(out.get<__bdd::shared_arc_file_type>()->max_1level_cut, Is().EqualTo(1u)); - AssertThat(out.get<__bdd::shared_arcs_t>()->number_of_terminals[false], Is().EqualTo(2u)); - AssertThat(out.get<__bdd::shared_arcs_t>()->number_of_terminals[true], Is().EqualTo(1u)); + AssertThat(out.get<__bdd::shared_arc_file_type>()->number_of_terminals[false], Is().EqualTo(2u)); + AssertThat(out.get<__bdd::shared_arc_file_type>()->number_of_terminals[true], Is().EqualTo(1u)); }); }); @@ -734,10 +734,10 @@ go_bandit([]() { AssertThat(levels.can_pull(), Is().False()); - AssertThat((std::get<__bdd::shared_arcs_t>(out._union))->max_1level_cut, Is().EqualTo(2u)); + AssertThat((std::get<__bdd::shared_arc_file_type>(out._union))->max_1level_cut, Is().EqualTo(2u)); - AssertThat(out.get<__bdd::shared_arcs_t>()->number_of_terminals[false], Is().EqualTo(2u)); - AssertThat(out.get<__bdd::shared_arcs_t>()->number_of_terminals[true], Is().EqualTo(2u)); + AssertThat(out.get<__bdd::shared_arc_file_type>()->number_of_terminals[false], Is().EqualTo(2u)); + AssertThat(out.get<__bdd::shared_arc_file_type>()->number_of_terminals[true], Is().EqualTo(2u)); }); it("should compute x1 ? ~x0 : x0", [&]() { @@ -786,10 +786,10 @@ go_bandit([]() { AssertThat(levels.can_pull(), Is().False()); - AssertThat(out.get<__bdd::shared_arcs_t>()->max_1level_cut, Is().EqualTo(2u)); + AssertThat(out.get<__bdd::shared_arc_file_type>()->max_1level_cut, Is().EqualTo(2u)); - AssertThat(out.get<__bdd::shared_arcs_t>()->number_of_terminals[false], Is().EqualTo(2u)); - AssertThat(out.get<__bdd::shared_arcs_t>()->number_of_terminals[true], Is().EqualTo(2u)); + AssertThat(out.get<__bdd::shared_arc_file_type>()->number_of_terminals[false], Is().EqualTo(2u)); + AssertThat(out.get<__bdd::shared_arc_file_type>()->number_of_terminals[true], Is().EqualTo(2u)); }); it("should compute x1 ? x0 : ~x0", [&]() { @@ -838,16 +838,16 @@ go_bandit([]() { AssertThat(levels.can_pull(), Is().False()); - AssertThat(out.get<__bdd::shared_arcs_t>()->max_1level_cut, Is().EqualTo(2u)); + AssertThat(out.get<__bdd::shared_arc_file_type>()->max_1level_cut, Is().EqualTo(2u)); - AssertThat(out.get<__bdd::shared_arcs_t>()->number_of_terminals[false], Is().EqualTo(2u)); - AssertThat(out.get<__bdd::shared_arcs_t>()->number_of_terminals[true], Is().EqualTo(2u)); + AssertThat(out.get<__bdd::shared_arc_file_type>()->number_of_terminals[false], Is().EqualTo(2u)); + AssertThat(out.get<__bdd::shared_arc_file_type>()->number_of_terminals[true], Is().EqualTo(2u)); }); it("should compute ~x2 ? (x0^x1) : ~(x0^x1)", [&]() { // Create an XNOR input where one needs to forward data across the // level once to resolve the request - shared_levelized_file bdd_x0_xnor_x1; + shared_levelized_file bdd_x0_xnor_x1; { node_writer nw_x0_xnor_x1(bdd_x0_xnor_x1); nw_x0_xnor_x1 << node(1,1,terminal_T,terminal_F) @@ -915,14 +915,14 @@ go_bandit([]() { AssertThat(levels.can_pull(), Is().False()); - AssertThat(out.get<__bdd::shared_arcs_t>()->max_1level_cut, Is().EqualTo(4u)); + AssertThat(out.get<__bdd::shared_arc_file_type>()->max_1level_cut, Is().EqualTo(4u)); - AssertThat(out.get<__bdd::shared_arcs_t>()->number_of_terminals[false], Is().EqualTo(2u)); - AssertThat(out.get<__bdd::shared_arcs_t>()->number_of_terminals[true], Is().EqualTo(2u)); + AssertThat(out.get<__bdd::shared_arc_file_type>()->number_of_terminals[false], Is().EqualTo(2u)); + AssertThat(out.get<__bdd::shared_arc_file_type>()->number_of_terminals[true], Is().EqualTo(2u)); }); it("should compute x3 ? (x1 & x2) : bdd_1", [&]() { - shared_levelized_file bdd_x3; + shared_levelized_file bdd_x3; /* // 1 ---- x3 // / \ @@ -933,7 +933,7 @@ go_bandit([]() { nw_x3 << node(3,0,terminal_F,terminal_T); } - shared_levelized_file bdd_x1_and_x2; + shared_levelized_file bdd_x1_and_x2; /* // 1 ---- x1 // / \ @@ -1056,10 +1056,10 @@ go_bandit([]() { AssertThat(levels.can_pull(), Is().False()); - AssertThat(out.get<__bdd::shared_arcs_t>()->max_1level_cut, Is().EqualTo(6u)); + AssertThat(out.get<__bdd::shared_arc_file_type>()->max_1level_cut, Is().EqualTo(6u)); - AssertThat(out.get<__bdd::shared_arcs_t>()->number_of_terminals[false], Is().EqualTo(5u)); - AssertThat(out.get<__bdd::shared_arcs_t>()->number_of_terminals[true], Is().EqualTo(3u)); + AssertThat(out.get<__bdd::shared_arc_file_type>()->number_of_terminals[false], Is().EqualTo(5u)); + AssertThat(out.get<__bdd::shared_arc_file_type>()->number_of_terminals[true], Is().EqualTo(3u)); }); it("should compute bdd_3 ? bdd_4 : bdd_5", [&]() { @@ -1154,10 +1154,10 @@ go_bandit([]() { AssertThat(levels.can_pull(), Is().False()); - AssertThat(out.get<__bdd::shared_arcs_t>()->max_1level_cut, Is().EqualTo(3u)); + AssertThat(out.get<__bdd::shared_arc_file_type>()->max_1level_cut, Is().EqualTo(3u)); - AssertThat(out.get<__bdd::shared_arcs_t>()->number_of_terminals[false], Is().EqualTo(5u)); - AssertThat(out.get<__bdd::shared_arcs_t>()->number_of_terminals[true], Is().EqualTo(4u)); + AssertThat(out.get<__bdd::shared_arc_file_type>()->number_of_terminals[false], Is().EqualTo(5u)); + AssertThat(out.get<__bdd::shared_arc_file_type>()->number_of_terminals[true], Is().EqualTo(4u)); }); it("should compute bdd_6 ? x0^x2 : bdd_not_6", [&]() { @@ -1226,10 +1226,10 @@ go_bandit([]() { AssertThat(levels.can_pull(), Is().False()); - AssertThat(out.get<__bdd::shared_arcs_t>()->max_1level_cut, Is().EqualTo(2u)); + AssertThat(out.get<__bdd::shared_arc_file_type>()->max_1level_cut, Is().EqualTo(2u)); - AssertThat(out.get<__bdd::shared_arcs_t>()->number_of_terminals[false], Is().EqualTo(1u)); - AssertThat(out.get<__bdd::shared_arcs_t>()->number_of_terminals[true], Is().EqualTo(4u)); + AssertThat(out.get<__bdd::shared_arc_file_type>()->number_of_terminals[false], Is().EqualTo(1u)); + AssertThat(out.get<__bdd::shared_arc_file_type>()->number_of_terminals[true], Is().EqualTo(4u)); }); @@ -1299,14 +1299,14 @@ go_bandit([]() { AssertThat(levels.can_pull(), Is().False()); - AssertThat(out.get<__bdd::shared_arcs_t>()->max_1level_cut, Is().EqualTo(2u)); + AssertThat(out.get<__bdd::shared_arc_file_type>()->max_1level_cut, Is().EqualTo(2u)); - AssertThat(out.get<__bdd::shared_arcs_t>()->number_of_terminals[false], Is().EqualTo(4u)); - AssertThat(out.get<__bdd::shared_arcs_t>()->number_of_terminals[true], Is().EqualTo(1u)); + AssertThat(out.get<__bdd::shared_arc_file_type>()->number_of_terminals[false], Is().EqualTo(4u)); + AssertThat(out.get<__bdd::shared_arc_file_type>()->number_of_terminals[true], Is().EqualTo(1u)); }); it("should compute ~(x0^x2) ? ~x2 : bdd_1", [&]() { - shared_levelized_file bdd_x0_xnor_x2; + shared_levelized_file bdd_x0_xnor_x2; /* // _1_ // / \ @@ -1413,14 +1413,14 @@ go_bandit([]() { AssertThat(levels.can_pull(), Is().False()); - AssertThat(out.get<__bdd::shared_arcs_t>()->max_1level_cut, Is().EqualTo(4u)); + AssertThat(out.get<__bdd::shared_arc_file_type>()->max_1level_cut, Is().EqualTo(4u)); - AssertThat(out.get<__bdd::shared_arcs_t>()->number_of_terminals[false], Is().EqualTo(3u)); - AssertThat(out.get<__bdd::shared_arcs_t>()->number_of_terminals[true], Is().EqualTo(5u)); + AssertThat(out.get<__bdd::shared_arc_file_type>()->number_of_terminals[false], Is().EqualTo(3u)); + AssertThat(out.get<__bdd::shared_arc_file_type>()->number_of_terminals[true], Is().EqualTo(5u)); }); it("should compute (x1^x2) ? bdd_1 : bdd_2", [&]() { - shared_levelized_file bdd_x1_xor_x2_2; + shared_levelized_file bdd_x1_xor_x2_2; /* // _1_ ---- x1 // / \ @@ -1525,14 +1525,14 @@ go_bandit([]() { AssertThat(levels.can_pull(), Is().False()); - AssertThat(out.get<__bdd::shared_arcs_t>()->max_1level_cut, Is().EqualTo(4u)); + AssertThat(out.get<__bdd::shared_arc_file_type>()->max_1level_cut, Is().EqualTo(4u)); - AssertThat(out.get<__bdd::shared_arcs_t>()->number_of_terminals[false], Is().EqualTo(3u)); - AssertThat(out.get<__bdd::shared_arcs_t>()->number_of_terminals[true], Is().EqualTo(6u)); + AssertThat(out.get<__bdd::shared_arc_file_type>()->number_of_terminals[false], Is().EqualTo(3u)); + AssertThat(out.get<__bdd::shared_arc_file_type>()->number_of_terminals[true], Is().EqualTo(6u)); }); it("should compute (~x0 & ~x1 & x2) ? bdd_2 : bdd_4", [&]() { - shared_levelized_file bdd_if; + shared_levelized_file bdd_if; /* // 1 ---- x0 // / \ @@ -1634,14 +1634,14 @@ go_bandit([]() { AssertThat(levels.can_pull(), Is().False()); - AssertThat(out.get<__bdd::shared_arcs_t>()->max_1level_cut, Is().EqualTo(3u)); + AssertThat(out.get<__bdd::shared_arc_file_type>()->max_1level_cut, Is().EqualTo(3u)); - AssertThat(out.get<__bdd::shared_arcs_t>()->number_of_terminals[false], Is().EqualTo(5u)); - AssertThat(out.get<__bdd::shared_arcs_t>()->number_of_terminals[true], Is().EqualTo(4u)); + AssertThat(out.get<__bdd::shared_arc_file_type>()->number_of_terminals[false], Is().EqualTo(5u)); + AssertThat(out.get<__bdd::shared_arc_file_type>()->number_of_terminals[true], Is().EqualTo(4u)); }); it("should compute (x0 | (x1 & x2)) ? bdd_8 : bdd_7", [&]() { - shared_levelized_file bdd_if; + shared_levelized_file bdd_if; /* // 1 ---- x0 // / \ @@ -1728,10 +1728,10 @@ go_bandit([]() { AssertThat(levels.can_pull(), Is().False()); - AssertThat(out.get<__bdd::shared_arcs_t>()->max_1level_cut, Is().EqualTo(4u)); + AssertThat(out.get<__bdd::shared_arc_file_type>()->max_1level_cut, Is().EqualTo(4u)); - AssertThat(out.get<__bdd::shared_arcs_t>()->number_of_terminals[false], Is().EqualTo(3u)); - AssertThat(out.get<__bdd::shared_arcs_t>()->number_of_terminals[true], Is().EqualTo(2u)); + AssertThat(out.get<__bdd::shared_arc_file_type>()->number_of_terminals[false], Is().EqualTo(3u)); + AssertThat(out.get<__bdd::shared_arc_file_type>()->number_of_terminals[true], Is().EqualTo(2u)); }); it("should compute bdd_6 ? bdd_4 : bdd_2", [&]() { @@ -1820,16 +1820,16 @@ go_bandit([]() { AssertThat(levels.can_pull(), Is().False()); - AssertThat(out.get<__bdd::shared_arcs_t>()->max_1level_cut, Is().EqualTo(4u)); + AssertThat(out.get<__bdd::shared_arc_file_type>()->max_1level_cut, Is().EqualTo(4u)); - AssertThat(out.get<__bdd::shared_arcs_t>()->number_of_terminals[false], Is().EqualTo(5u)); - AssertThat(out.get<__bdd::shared_arcs_t>()->number_of_terminals[true], Is().EqualTo(5u)); + AssertThat(out.get<__bdd::shared_arc_file_type>()->number_of_terminals[false], Is().EqualTo(5u)); + AssertThat(out.get<__bdd::shared_arc_file_type>()->number_of_terminals[true], Is().EqualTo(5u)); }); }); describe("Zipping", [&]() { it("should merely zip disjunct levels if possible [1]", [&]() { - shared_levelized_file bdd_x1_and_x3; + shared_levelized_file bdd_x1_and_x3; /* // 1 ---- x1 // / \ @@ -1845,7 +1845,7 @@ go_bandit([]() { } __bdd out = bdd_ite(bdd_x0, bdd_x2, bdd_x1_and_x3); - AssertThat(out.get>()->canonical, Is().False()); + AssertThat(out.get>()->canonical, Is().False()); node_test_stream ns(out); @@ -1887,22 +1887,22 @@ go_bandit([]() { AssertThat(levels.can_pull(), Is().False()); - AssertThat(out.get>()->max_1level_cut[cut_type::INTERNAL], Is().GreaterThanOrEqualTo(2u)); - AssertThat(out.get>()->max_1level_cut[cut_type::INTERNAL_FALSE], Is().GreaterThanOrEqualTo(3u)); - AssertThat(out.get>()->max_1level_cut[cut_type::INTERNAL_TRUE], Is().GreaterThanOrEqualTo(2u)); - AssertThat(out.get>()->max_1level_cut[cut_type::ALL], Is().GreaterThanOrEqualTo(5u)); + AssertThat(out.get>()->max_1level_cut[cut::Internal], Is().GreaterThanOrEqualTo(2u)); + AssertThat(out.get>()->max_1level_cut[cut::Internal_False], Is().GreaterThanOrEqualTo(3u)); + AssertThat(out.get>()->max_1level_cut[cut::Internal_True], Is().GreaterThanOrEqualTo(2u)); + AssertThat(out.get>()->max_1level_cut[cut::All], Is().GreaterThanOrEqualTo(5u)); - AssertThat(out.get>()->max_2level_cut[cut_type::INTERNAL], Is().GreaterThanOrEqualTo(2u)); - AssertThat(out.get>()->max_2level_cut[cut_type::INTERNAL_FALSE], Is().GreaterThanOrEqualTo(3u)); - AssertThat(out.get>()->max_2level_cut[cut_type::INTERNAL_TRUE], Is().GreaterThanOrEqualTo(2u)); - AssertThat(out.get>()->max_2level_cut[cut_type::ALL], Is().GreaterThanOrEqualTo(5u)); + AssertThat(out.get>()->max_2level_cut[cut::Internal], Is().GreaterThanOrEqualTo(2u)); + AssertThat(out.get>()->max_2level_cut[cut::Internal_False], Is().GreaterThanOrEqualTo(3u)); + AssertThat(out.get>()->max_2level_cut[cut::Internal_True], Is().GreaterThanOrEqualTo(2u)); + AssertThat(out.get>()->max_2level_cut[cut::All], Is().GreaterThanOrEqualTo(5u)); - AssertThat(out.get>()->number_of_terminals[false], Is().EqualTo(3u)); - AssertThat(out.get>()->number_of_terminals[true], Is().EqualTo(2u)); + AssertThat(out.get>()->number_of_terminals[false], Is().EqualTo(3u)); + AssertThat(out.get>()->number_of_terminals[true], Is().EqualTo(2u)); }); it("should merely zip disjunct levels if possible [2]", [&]() { - shared_levelized_file bdd_then; + shared_levelized_file bdd_then; /* // _1_ ---- x2 // / \ @@ -1925,7 +1925,7 @@ go_bandit([]() { << node(2,0,ptr_uint64(3,0),ptr_uint64(3,2)); // 1 } - shared_levelized_file bdd_else; + shared_levelized_file bdd_else; /* // _1_ ---- x5 // / \ @@ -1943,7 +1943,7 @@ go_bandit([]() { } __bdd out = bdd_ite(bdd_not(bdd_x0_xor_x1), bdd_then, bdd_else); - AssertThat(out.get>()->canonical, Is().False()); + AssertThat(out.get>()->canonical, Is().False()); node_test_stream ns(out); @@ -2037,126 +2037,126 @@ go_bandit([]() { AssertThat(levels.can_pull(), Is().False()); - AssertThat(out.get>()->max_1level_cut[cut_type::INTERNAL], Is().GreaterThanOrEqualTo(4u)); - AssertThat(out.get>()->max_1level_cut[cut_type::INTERNAL_FALSE], Is().GreaterThanOrEqualTo(4u)); - AssertThat(out.get>()->max_1level_cut[cut_type::INTERNAL_TRUE], Is().GreaterThanOrEqualTo(7u)); - AssertThat(out.get>()->max_1level_cut[cut_type::ALL], Is().GreaterThanOrEqualTo(11u)); + AssertThat(out.get>()->max_1level_cut[cut::Internal], Is().GreaterThanOrEqualTo(4u)); + AssertThat(out.get>()->max_1level_cut[cut::Internal_False], Is().GreaterThanOrEqualTo(4u)); + AssertThat(out.get>()->max_1level_cut[cut::Internal_True], Is().GreaterThanOrEqualTo(7u)); + AssertThat(out.get>()->max_1level_cut[cut::All], Is().GreaterThanOrEqualTo(11u)); - AssertThat(out.get>()->max_2level_cut[cut_type::INTERNAL], Is().GreaterThanOrEqualTo(4u)); - AssertThat(out.get>()->max_2level_cut[cut_type::INTERNAL_FALSE], Is().GreaterThanOrEqualTo(4u)); - AssertThat(out.get>()->max_2level_cut[cut_type::INTERNAL_TRUE], Is().GreaterThanOrEqualTo(7u)); - AssertThat(out.get>()->max_2level_cut[cut_type::ALL], Is().GreaterThanOrEqualTo(11u)); + AssertThat(out.get>()->max_2level_cut[cut::Internal], Is().GreaterThanOrEqualTo(4u)); + AssertThat(out.get>()->max_2level_cut[cut::Internal_False], Is().GreaterThanOrEqualTo(4u)); + AssertThat(out.get>()->max_2level_cut[cut::Internal_True], Is().GreaterThanOrEqualTo(7u)); + AssertThat(out.get>()->max_2level_cut[cut::All], Is().GreaterThanOrEqualTo(11u)); - AssertThat(out.get>()->number_of_terminals[false], Is().EqualTo(4u)); - AssertThat(out.get>()->number_of_terminals[true], Is().EqualTo(7u)); + AssertThat(out.get>()->number_of_terminals[false], Is().EqualTo(4u)); + AssertThat(out.get>()->number_of_terminals[true], Is().EqualTo(7u)); }); it("can derive canonicity when zipping with one-node 'if'", [&]() { - shared_levelized_file bdd_if; + shared_levelized_file bdd_if; { node_writer nw_if(bdd_if); - nw_if << node(0, node::MAX_ID,terminal_T,terminal_F); + nw_if << node(0, node::max_id,terminal_T,terminal_F); } - shared_levelized_file bdd_a; + shared_levelized_file bdd_a; { node_writer nw_a(bdd_a); - nw_a << node(2, node::MAX_ID,terminal_F,terminal_T); + nw_a << node(2, node::max_id,terminal_F,terminal_T); } - shared_levelized_file bdd_b; + shared_levelized_file bdd_b; { node_writer nw_b(bdd_b); - nw_b << node(1, node::MAX_ID,terminal_T,terminal_F); + nw_b << node(1, node::max_id,terminal_T,terminal_F); } bdd out_1 = bdd_ite(bdd_if, bdd_a, bdd_b); - AssertThat(adiar::is_canonical(out_1), Is().True()); + AssertThat(bdd_iscanonical(out_1), Is().True()); bdd out_1n = bdd_ite(bdd_not(bdd_if), bdd_a, bdd_b); - AssertThat(adiar::is_canonical(out_1n), Is().True()); + AssertThat(bdd_iscanonical(out_1n), Is().True()); bdd out_2 = bdd_ite(bdd_if, bdd_b, bdd_a); - AssertThat(adiar::is_canonical(out_2), Is().True()); + AssertThat(bdd_iscanonical(out_2), Is().True()); bdd out_2n = bdd_ite(bdd_not(bdd_if), bdd_b, bdd_a); - AssertThat(adiar::is_canonical(out_2n), Is().True()); + AssertThat(bdd_iscanonical(out_2n), Is().True()); }); it("can derive canonicity when zipping negated 'then' or 'else'", [&]() { - shared_levelized_file bdd_if; + shared_levelized_file bdd_if; { node_writer nw_if(bdd_if); - nw_if << node(0, node::MAX_ID,terminal_T,terminal_F); + nw_if << node(0, node::max_id,terminal_T,terminal_F); } - AssertThat(adiar::is_canonical(bdd(bdd_if)), Is().True()); + AssertThat(bdd_iscanonical(bdd(bdd_if)), Is().True()); - shared_levelized_file bdd_a; + shared_levelized_file bdd_a; { node_writer nw_a(bdd_a); - nw_a << node(2, node::MAX_ID,terminal_F,terminal_T); + nw_a << node(2, node::max_id,terminal_F,terminal_T); } - AssertThat(adiar::is_canonical(bdd(bdd_a)), Is().True()); + AssertThat(bdd_iscanonical(bdd(bdd_a)), Is().True()); - shared_levelized_file bdd_b; + shared_levelized_file bdd_b; { node_writer nw_b(bdd_b); - nw_b << node(3, node::MAX_ID, terminal_F, terminal_T) - << node(3, node::MAX_ID-1, terminal_T, terminal_F) - << node(1, node::MAX_ID, ptr_uint64(3, ptr_uint64::MAX_ID), ptr_uint64(3, ptr_uint64::MAX_ID)); + nw_b << node(3, node::max_id, terminal_F, terminal_T) + << node(3, node::max_id-1, terminal_T, terminal_F) + << node(1, node::max_id, ptr_uint64(3, ptr_uint64::max_id), ptr_uint64(3, ptr_uint64::max_id)); } - AssertThat(adiar::is_canonical(bdd(bdd_b)), Is().True()); + AssertThat(bdd_iscanonical(bdd(bdd_b)), Is().True()); - shared_levelized_file bdd_c; + shared_levelized_file bdd_c; { node_writer nw_c(bdd_c); - nw_c << node(1, node::MAX_ID, terminal_T, terminal_F); + nw_c << node(1, node::max_id, terminal_T, terminal_F); } - AssertThat(adiar::is_canonical(bdd(bdd_c)), Is().True()); + AssertThat(bdd_iscanonical(bdd(bdd_c)), Is().True()); bdd out_1 = bdd_ite(bdd_if, bdd_not(bdd_a), bdd_b); - AssertThat(adiar::is_canonical(out_1), Is().True()); + AssertThat(bdd_iscanonical(out_1), Is().True()); bdd out_2 = bdd_ite(bdd_if, bdd_a, bdd_not(bdd_b)); - AssertThat(adiar::is_canonical(out_2), Is().False()); + AssertThat(bdd_iscanonical(out_2), Is().False()); bdd out_3 = bdd_ite(bdd_if, bdd_a, bdd_not(bdd_c)); - AssertThat(adiar::is_canonical(out_3), Is().True()); + AssertThat(bdd_iscanonical(out_3), Is().True()); bdd out_4 = bdd_ite(bdd_if, bdd_not(bdd_b), bdd_not(bdd_a)); - AssertThat(adiar::is_canonical(out_4), Is().False()); + AssertThat(bdd_iscanonical(out_4), Is().False()); }); it("can derive canonicity when zipping 'if' with multiple nodes on a level", [&]() { - shared_levelized_file bdd_if; + shared_levelized_file bdd_if; { node_writer nw_if(bdd_if); - nw_if << node(1, node::MAX_ID, terminal_T, terminal_T) - << node(1, node::MAX_ID-1, terminal_F, terminal_F) - << node(0, node::MAX_ID, ptr_uint64(1, ptr_uint64::MAX_ID-1), ptr_uint64(1, ptr_uint64::MAX_ID)); + nw_if << node(1, node::max_id, terminal_T, terminal_T) + << node(1, node::max_id-1, terminal_F, terminal_F) + << node(0, node::max_id, ptr_uint64(1, ptr_uint64::max_id-1), ptr_uint64(1, ptr_uint64::max_id)); } - shared_levelized_file bdd_a; + shared_levelized_file bdd_a; { node_writer nw_a(bdd_a); - nw_a << node(3, node::MAX_ID,terminal_F,terminal_T); + nw_a << node(3, node::max_id,terminal_F,terminal_T); } - shared_levelized_file bdd_b; + shared_levelized_file bdd_b; { node_writer nw_b(bdd_b); - nw_b << node(2, node::MAX_ID,terminal_T,terminal_F); + nw_b << node(2, node::max_id,terminal_T,terminal_F); } bdd out_1 = bdd_ite(bdd_if, bdd_a, bdd_b); - AssertThat(adiar::is_canonical(out_1), Is().True()); + AssertThat(bdd_iscanonical(out_1), Is().True()); bdd out_2 = bdd_ite(bdd_not(bdd_if), bdd_a, bdd_b); - AssertThat(adiar::is_canonical(out_2), Is().False()); + AssertThat(bdd_iscanonical(out_2), Is().False()); bdd out_3 = bdd_ite(bdd_not(bdd_if), bdd_b, bdd_a); - AssertThat(adiar::is_canonical(out_3), Is().True()); + AssertThat(bdd_iscanonical(out_3), Is().True()); }); it("should not zip if bdd_then is not beyond max_var of bdd_if", [&]() { @@ -2205,10 +2205,10 @@ go_bandit([]() { AssertThat(levels.can_pull(), Is().False()); - AssertThat(out.get<__bdd::shared_arcs_t>()->max_1level_cut, Is().GreaterThanOrEqualTo(2u)); + AssertThat(out.get<__bdd::shared_arc_file_type>()->max_1level_cut, Is().GreaterThanOrEqualTo(2u)); - AssertThat(out.get<__bdd::shared_arcs_t>()->number_of_terminals[false], Is().EqualTo(2u)); - AssertThat(out.get<__bdd::shared_arcs_t>()->number_of_terminals[true], Is().EqualTo(2u)); + AssertThat(out.get<__bdd::shared_arc_file_type>()->number_of_terminals[false], Is().EqualTo(2u)); + AssertThat(out.get<__bdd::shared_arc_file_type>()->number_of_terminals[true], Is().EqualTo(2u)); }); it("should not zip if bdd_else is not beyond max_var of bdd_if", [&]() { @@ -2257,10 +2257,10 @@ go_bandit([]() { AssertThat(levels.can_pull(), Is().False()); - AssertThat(out.get<__bdd::shared_arcs_t>()->max_1level_cut, Is().GreaterThanOrEqualTo(2u)); + AssertThat(out.get<__bdd::shared_arc_file_type>()->max_1level_cut, Is().GreaterThanOrEqualTo(2u)); - AssertThat(out.get<__bdd::shared_arcs_t>()->number_of_terminals[false], Is().EqualTo(2u)); - AssertThat(out.get<__bdd::shared_arcs_t>()->number_of_terminals[true], Is().EqualTo(2u)); + AssertThat(out.get<__bdd::shared_arc_file_type>()->number_of_terminals[false], Is().EqualTo(2u)); + AssertThat(out.get<__bdd::shared_arc_file_type>()->number_of_terminals[true], Is().EqualTo(2u)); }); }); }); diff --git a/test/adiar/bdd/test_negate.cpp b/test/adiar/bdd/test_negate.cpp index c06ffe772..c6d35998a 100644 --- a/test/adiar/bdd/test_negate.cpp +++ b/test/adiar/bdd/test_negate.cpp @@ -2,7 +2,7 @@ go_bandit([]() { describe("adiar/bdd/negate.cpp", []() { - shared_levelized_file terminal_T_nf; + shared_levelized_file terminal_T_nf; { // Garbage collect writer to free write-lock node_writer nw(terminal_T_nf); @@ -11,7 +11,7 @@ go_bandit([]() { bdd terminal_T(terminal_T_nf); - shared_levelized_file terminal_F_nf; + shared_levelized_file terminal_F_nf; { // Garbage collect writer to free write-lock node_writer nw(terminal_F_nf); @@ -20,7 +20,7 @@ go_bandit([]() { bdd terminal_F(terminal_F_nf); - shared_levelized_file bdd_1_nf; + shared_levelized_file bdd_1_nf; /* 1 ---- x0 / \ @@ -37,14 +37,14 @@ go_bandit([]() { { // Garbage collect writer to free write-lock node_writer nw(bdd_1_nf); - nw << node(2, node::MAX_ID, terminal_F_ptr, terminal_T_ptr) - << node(1, node::MAX_ID, ptr_uint64(2, ptr_uint64::MAX_ID), terminal_T_ptr) - << node(0, node::MAX_ID, ptr_uint64(2, ptr_uint64::MAX_ID), ptr_uint64(1, ptr_uint64::MAX_ID)); + nw << node(2, node::max_id, terminal_F_ptr, terminal_T_ptr) + << node(1, node::max_id, ptr_uint64(2, ptr_uint64::max_id), terminal_T_ptr) + << node(0, node::max_id, ptr_uint64(2, ptr_uint64::max_id), ptr_uint64(1, ptr_uint64::max_id)); } bdd bdd_1(bdd_1_nf); - shared_levelized_file bdd_2_nf; + shared_levelized_file bdd_2_nf; /* 1 ---- x0 / \ @@ -59,10 +59,10 @@ go_bandit([]() { { // Garbage collect writer to free write-lock node_writer nw(bdd_2_nf); - nw << node(2, node::MAX_ID, terminal_F_ptr, terminal_T_ptr) - << node(1, node::MAX_ID, ptr_uint64(2, ptr_uint64::MAX_ID), terminal_T_ptr) - << node(1, node::MAX_ID-1, terminal_T_ptr, ptr_uint64(2, ptr_uint64::MAX_ID)) - << node(0, node::MAX_ID, ptr_uint64(1, ptr_uint64::MAX_ID-1), ptr_uint64(1, ptr_uint64::MAX_ID)); + nw << node(2, node::max_id, terminal_F_ptr, terminal_T_ptr) + << node(1, node::max_id, ptr_uint64(2, ptr_uint64::max_id), terminal_T_ptr) + << node(1, node::max_id-1, terminal_T_ptr, ptr_uint64(2, ptr_uint64::max_id)) + << node(0, node::max_id, ptr_uint64(1, ptr_uint64::max_id-1), ptr_uint64(1, ptr_uint64::max_id)); } bdd bdd_2(bdd_2_nf); @@ -98,19 +98,19 @@ go_bandit([]() { node_test_stream ns(out); AssertThat(ns.can_pull(), Is().True()); - AssertThat(ns.pull(), Is().EqualTo(node(2, node::MAX_ID, + AssertThat(ns.pull(), Is().EqualTo(node(2, node::max_id, terminal_F_ptr, terminal_T_ptr))); AssertThat(ns.can_pull(), Is().True()); - AssertThat(ns.pull(), Is().EqualTo(node(1, node::MAX_ID, - ptr_uint64(2, ptr_uint64::MAX_ID), + AssertThat(ns.pull(), Is().EqualTo(node(1, node::max_id, + ptr_uint64(2, ptr_uint64::max_id), terminal_T_ptr))); AssertThat(ns.can_pull(), Is().True()); - AssertThat(ns.pull(), Is().EqualTo(node(0, node::MAX_ID, - ptr_uint64(2, ptr_uint64::MAX_ID), - ptr_uint64(1, ptr_uint64::MAX_ID)))); + AssertThat(ns.pull(), Is().EqualTo(node(0, node::max_id, + ptr_uint64(2, ptr_uint64::max_id), + ptr_uint64(1, ptr_uint64::max_id)))); AssertThat(ns.can_pull(), Is().False()); }); @@ -145,19 +145,19 @@ go_bandit([]() { node_test_stream ns(out); AssertThat(ns.can_pull(), Is().True()); - AssertThat(ns.pull(), Is().EqualTo(node(2, node::MAX_ID, + AssertThat(ns.pull(), Is().EqualTo(node(2, node::max_id, terminal_T_ptr, terminal_F_ptr))); AssertThat(ns.can_pull(), Is().True()); - AssertThat(ns.pull(), Is().EqualTo(node(1, node::MAX_ID, - ptr_uint64(2, ptr_uint64::MAX_ID), + AssertThat(ns.pull(), Is().EqualTo(node(1, node::max_id, + ptr_uint64(2, ptr_uint64::max_id), terminal_F_ptr))); AssertThat(ns.can_pull(), Is().True()); - AssertThat(ns.pull(), Is().EqualTo(node(0, node::MAX_ID, - ptr_uint64(2, ptr_uint64::MAX_ID), - ptr_uint64(1, ptr_uint64::MAX_ID)))); + AssertThat(ns.pull(), Is().EqualTo(node(0, node::max_id, + ptr_uint64(2, ptr_uint64::max_id), + ptr_uint64(1, ptr_uint64::max_id)))); AssertThat(ns.can_pull(), Is().False()); }); @@ -170,19 +170,19 @@ go_bandit([]() { node_test_stream ns(out); AssertThat(ns.can_pull(), Is().True()); - AssertThat(ns.pull(), Is().EqualTo(node(2, node::MAX_ID, + AssertThat(ns.pull(), Is().EqualTo(node(2, node::max_id, terminal_F_ptr, terminal_T_ptr))); AssertThat(ns.can_pull(), Is().True()); - AssertThat(ns.pull(), Is().EqualTo(node(1, node::MAX_ID, - ptr_uint64(2, ptr_uint64::MAX_ID), + AssertThat(ns.pull(), Is().EqualTo(node(1, node::max_id, + ptr_uint64(2, ptr_uint64::max_id), terminal_T_ptr))); AssertThat(ns.can_pull(), Is().True()); - AssertThat(ns.pull(), Is().EqualTo(node(0, node::MAX_ID, - ptr_uint64(2, ptr_uint64::MAX_ID), - ptr_uint64(1, ptr_uint64::MAX_ID)))); + AssertThat(ns.pull(), Is().EqualTo(node(0, node::max_id, + ptr_uint64(2, ptr_uint64::max_id), + ptr_uint64(1, ptr_uint64::max_id)))); AssertThat(ns.can_pull(), Is().False()); }); @@ -193,25 +193,25 @@ go_bandit([]() { node_test_stream ns(out); AssertThat(ns.can_pull(), Is().True()); - AssertThat(ns.pull(), Is().EqualTo(node(2, node::MAX_ID, + AssertThat(ns.pull(), Is().EqualTo(node(2, node::max_id, terminal_T_ptr, terminal_F_ptr))); AssertThat(ns.can_pull(), Is().True()); - AssertThat(ns.pull(), Is().EqualTo(node(1, node::MAX_ID, - ptr_uint64(2, ptr_uint64::MAX_ID), + AssertThat(ns.pull(), Is().EqualTo(node(1, node::max_id, + ptr_uint64(2, ptr_uint64::max_id), terminal_F_ptr))); AssertThat(ns.can_pull(), Is().True()); - AssertThat(ns.pull(), Is().EqualTo(node(1, node::MAX_ID-1, + AssertThat(ns.pull(), Is().EqualTo(node(1, node::max_id-1, terminal_F_ptr, - ptr_uint64(2, ptr_uint64::MAX_ID)))); + ptr_uint64(2, ptr_uint64::max_id)))); AssertThat(ns.can_pull(), Is().True()); - AssertThat(ns.pull(), Is().EqualTo(node(0, node::MAX_ID, - ptr_uint64(1, ptr_uint64::MAX_ID-1), - ptr_uint64(1, ptr_uint64::MAX_ID)))); + AssertThat(ns.pull(), Is().EqualTo(node(0, node::max_id, + ptr_uint64(1, ptr_uint64::max_id-1), + ptr_uint64(1, ptr_uint64::max_id)))); AssertThat(ns.can_pull(), Is().False()); }); @@ -247,19 +247,19 @@ go_bandit([]() { node_test_stream ns(out); AssertThat(ns.can_pull(), Is().True()); - AssertThat(ns.pull(), Is().EqualTo(node(2, node::MAX_ID, + AssertThat(ns.pull(), Is().EqualTo(node(2, node::max_id, terminal_T_ptr, terminal_F_ptr))); AssertThat(ns.can_pull(), Is().True()); - AssertThat(ns.pull(), Is().EqualTo(node(1, node::MAX_ID, - ptr_uint64(2, ptr_uint64::MAX_ID), + AssertThat(ns.pull(), Is().EqualTo(node(1, node::max_id, + ptr_uint64(2, ptr_uint64::max_id), terminal_F_ptr))); AssertThat(ns.can_pull(), Is().True()); - AssertThat(ns.pull(), Is().EqualTo(node(0, node::MAX_ID, - ptr_uint64(2, ptr_uint64::MAX_ID), - ptr_uint64(1, ptr_uint64::MAX_ID)))); + AssertThat(ns.pull(), Is().EqualTo(node(0, node::max_id, + ptr_uint64(2, ptr_uint64::max_id), + ptr_uint64(1, ptr_uint64::max_id)))); AssertThat(ns.can_pull(), Is().False()); }); @@ -270,25 +270,25 @@ go_bandit([]() { node_test_stream ns(out); AssertThat(ns.can_pull(), Is().True()); - AssertThat(ns.pull(), Is().EqualTo(node(2, node::MAX_ID, + AssertThat(ns.pull(), Is().EqualTo(node(2, node::max_id, terminal_T_ptr, terminal_F_ptr))); AssertThat(ns.can_pull(), Is().True()); - AssertThat(ns.pull(), Is().EqualTo(node(1, node::MAX_ID, - ptr_uint64(2, ptr_uint64::MAX_ID), + AssertThat(ns.pull(), Is().EqualTo(node(1, node::max_id, + ptr_uint64(2, ptr_uint64::max_id), terminal_F_ptr))); AssertThat(ns.can_pull(), Is().True()); - AssertThat(ns.pull(), Is().EqualTo(node(1, node::MAX_ID-1, + AssertThat(ns.pull(), Is().EqualTo(node(1, node::max_id-1, terminal_F_ptr, - ptr_uint64(2, ptr_uint64::MAX_ID)))); + ptr_uint64(2, ptr_uint64::max_id)))); AssertThat(ns.can_pull(), Is().True()); - AssertThat(ns.pull(), Is().EqualTo(node(0, node::MAX_ID, - ptr_uint64(1, ptr_uint64::MAX_ID-1), - ptr_uint64(1, ptr_uint64::MAX_ID)))); + AssertThat(ns.pull(), Is().EqualTo(node(0, node::max_id, + ptr_uint64(1, ptr_uint64::max_id-1), + ptr_uint64(1, ptr_uint64::max_id)))); AssertThat(ns.can_pull(), Is().False()); }); diff --git a/test/adiar/bdd/test_quantify.cpp b/test/adiar/bdd/test_quantify.cpp index 8607c1216..73017a6c3 100644 --- a/test/adiar/bdd/test_quantify.cpp +++ b/test/adiar/bdd/test_quantify.cpp @@ -6,14 +6,14 @@ go_bandit([]() { describe("adiar/bdd/quantify.cpp", []() { //////////////////////////////////////////////////////////////////////// // Sink only BDDs - shared_levelized_file terminal_F; + shared_levelized_file terminal_F; { // Garbage collect writer to free write-lock} node_writer nw_F(terminal_F); nw_F << node(false); } - shared_levelized_file terminal_T; + shared_levelized_file terminal_T; { // Garbage collect writer to free write-lock node_writer nw_T(terminal_T); @@ -29,10 +29,10 @@ go_bandit([]() { // / \ // F T */ - shared_levelized_file bdd_1; + shared_levelized_file bdd_1; - const node n1_2 = node(1, node::MAX_ID, ptr_uint64(false), ptr_uint64(true)); - const node n1_1 = node(0, node::MAX_ID, ptr_uint64(true), n1_2.uid()); + const node n1_2 = node(1, node::max_id, ptr_uint64(false), ptr_uint64(true)); + const node n1_1 = node(0, node::max_id, ptr_uint64(true), n1_2.uid()); { // Garbage collect writer to free write-lock node_writer nw_1(bdd_1); @@ -50,13 +50,13 @@ go_bandit([]() { // / \ / \ // T F F T */ - shared_levelized_file bdd_2; + shared_levelized_file bdd_2; - const node n2_5 = node(2, node::MAX_ID, ptr_uint64(false), ptr_uint64(true)); - const node n2_4 = node(2, node::MAX_ID-1, ptr_uint64(true), ptr_uint64(false)); - const node n2_3 = node(1, node::MAX_ID, n2_5.uid(), ptr_uint64(false)); - const node n2_2 = node(1, node::MAX_ID-1, n2_4.uid(), n2_5.uid()); - const node n2_1 = node(0, node::MAX_ID, n2_2.uid(), n2_3.uid()); + const node n2_5 = node(2, node::max_id, ptr_uint64(false), ptr_uint64(true)); + const node n2_4 = node(2, node::max_id-1, ptr_uint64(true), ptr_uint64(false)); + const node n2_3 = node(1, node::max_id, n2_5.uid(), ptr_uint64(false)); + const node n2_2 = node(1, node::max_id-1, n2_4.uid(), n2_5.uid()); + const node n2_1 = node(0, node::max_id, n2_2.uid(), n2_3.uid()); { // Garbage collect writer to free write-lock node_writer nw_2(bdd_2); @@ -74,12 +74,12 @@ go_bandit([]() { // / \ / \ // T F F T */ - shared_levelized_file bdd_3; + shared_levelized_file bdd_3; - const node n3_4 = node(2, node::MAX_ID, ptr_uint64(false), ptr_uint64(true)); - const node n3_3 = node(2, node::MAX_ID-1, ptr_uint64(true), ptr_uint64(false)); - const node n3_2 = node(1, node::MAX_ID, n3_3.uid(), n3_4.uid()); - const node n3_1 = node(0, node::MAX_ID, n3_3.uid(), n3_2.uid()); + const node n3_4 = node(2, node::max_id, ptr_uint64(false), ptr_uint64(true)); + const node n3_3 = node(2, node::max_id-1, ptr_uint64(true), ptr_uint64(false)); + const node n3_2 = node(1, node::max_id, n3_3.uid(), n3_4.uid()); + const node n3_1 = node(0, node::max_id, n3_3.uid(), n3_2.uid()); { // Garbage collect writer to free write-lock node_writer nw_3(bdd_3); @@ -99,13 +99,13 @@ go_bandit([]() { // / \ // F T */ - shared_levelized_file bdd_4; + shared_levelized_file bdd_4; - const node n4_5 = node(3, node::MAX_ID, ptr_uint64(false), ptr_uint64(true)); - const node n4_4 = node(2, node::MAX_ID, n4_5.uid(), ptr_uint64(true)); - const node n4_3 = node(2, node::MAX_ID-1, ptr_uint64(false), n4_5.uid()); - const node n4_2 = node(1, node::MAX_ID, n4_3.uid(), n4_4.uid()); - const node n4_1 = node(0, node::MAX_ID, n4_3.uid(), n4_2.uid()); + const node n4_5 = node(3, node::max_id, ptr_uint64(false), ptr_uint64(true)); + const node n4_4 = node(2, node::max_id, n4_5.uid(), ptr_uint64(true)); + const node n4_3 = node(2, node::max_id-1, ptr_uint64(false), n4_5.uid()); + const node n4_2 = node(1, node::max_id, n4_3.uid(), n4_4.uid()); + const node n4_1 = node(0, node::max_id, n4_3.uid(), n4_2.uid()); { // Garbage collect writer to free write-lock node_writer nw_4(bdd_4); @@ -123,12 +123,12 @@ go_bandit([]() { // / \ / \ // F T T F */ - shared_levelized_file bdd_5; + shared_levelized_file bdd_5; - const node n5_4 = node(2, node::MAX_ID, ptr_uint64(true), ptr_uint64(false)); - const node n5_3 = node(2, node::MAX_ID-1, ptr_uint64(false), ptr_uint64(true)); - const node n5_2 = node(1, node::MAX_ID, n5_3.uid(), n5_4.uid()); - const node n5_1 = node(0, node::MAX_ID, ptr_uint64(false), n5_2.uid()); + const node n5_4 = node(2, node::max_id, ptr_uint64(true), ptr_uint64(false)); + const node n5_3 = node(2, node::max_id-1, ptr_uint64(false), ptr_uint64(true)); + const node n5_2 = node(1, node::max_id, n5_3.uid(), n5_4.uid()); + const node n5_1 = node(0, node::max_id, ptr_uint64(false), n5_2.uid()); { // Garbage collect writer to free write-lock node_writer nw_5(bdd_5); @@ -137,11 +137,11 @@ go_bandit([]() { //////////////////////////////////////////////////////////////////////////// // x2 variable BDD - shared_levelized_file bdd_x2; + shared_levelized_file bdd_x2; { // Garbage collect writer to free write-lock node_writer nw_x2(bdd_x2); - nw_x2 << node(2, node::MAX_ID, ptr_uint64(false), ptr_uint64(true)); + nw_x2 << node(2, node::max_id, ptr_uint64(false), ptr_uint64(true)); } //////////////////////////////////////////////////////////////////////////// @@ -158,36 +158,36 @@ go_bandit([]() { // / \ / \ // F T T F */ - shared_levelized_file bdd_6; + shared_levelized_file bdd_6; { // Garbage collect writer to free write-lock node_writer nw_6(bdd_6); - nw_6 << node(3, node::MAX_ID, ptr_uint64(false), ptr_uint64(true)) // 8 - << node(3, node::MAX_ID-1, ptr_uint64(true), ptr_uint64(false)) // 7 - << node(2, node::MAX_ID, ptr_uint64(3, ptr_uint64::MAX_ID), ptr_uint64(true)) // 6 - << node(2, node::MAX_ID-1, ptr_uint64(3, ptr_uint64::MAX_ID-1), ptr_uint64(false)) // 5 - << node(2, node::MAX_ID-2, ptr_uint64(false), ptr_uint64(3, ptr_uint64::MAX_ID)) // 4 - << node(1, node::MAX_ID, ptr_uint64(2, ptr_uint64::MAX_ID-2), ptr_uint64(2, ptr_uint64::MAX_ID)) // 3 - << node(1, node::MAX_ID-1, ptr_uint64(2, ptr_uint64::MAX_ID), ptr_uint64(2, ptr_uint64::MAX_ID-1)) // 2 - << node(0, node::MAX_ID, ptr_uint64(1, ptr_uint64::MAX_ID), ptr_uint64(1, ptr_uint64::MAX_ID-1)) // 1 + nw_6 << node(3, node::max_id, ptr_uint64(false), ptr_uint64(true)) // 8 + << node(3, node::max_id-1, ptr_uint64(true), ptr_uint64(false)) // 7 + << node(2, node::max_id, ptr_uint64(3, ptr_uint64::max_id), ptr_uint64(true)) // 6 + << node(2, node::max_id-1, ptr_uint64(3, ptr_uint64::max_id-1), ptr_uint64(false)) // 5 + << node(2, node::max_id-2, ptr_uint64(false), ptr_uint64(3, ptr_uint64::max_id)) // 4 + << node(1, node::max_id, ptr_uint64(2, ptr_uint64::max_id-2), ptr_uint64(2, ptr_uint64::max_id)) // 3 + << node(1, node::max_id-1, ptr_uint64(2, ptr_uint64::max_id), ptr_uint64(2, ptr_uint64::max_id-1)) // 2 + << node(0, node::max_id, ptr_uint64(1, ptr_uint64::max_id), ptr_uint64(1, ptr_uint64::max_id-1)) // 1 ; } // BDD 6 with an 'x4' instead of T that can collapse to T during the // transposition sweep - shared_levelized_file bdd_6_x4T; + shared_levelized_file bdd_6_x4T; { // Garbage collect writer to free write-lock node_writer nw_6(bdd_6_x4T); - nw_6 << node(4, node::MAX_ID, ptr_uint64(false), ptr_uint64(true)) // T - << node(3, node::MAX_ID, ptr_uint64(false), ptr_uint64(4, ptr_uint64::MAX_ID)) // 8 - << node(3, node::MAX_ID-1, ptr_uint64(4, ptr_uint64::MAX_ID), ptr_uint64(false)) // 7 - << node(2, node::MAX_ID, ptr_uint64(3, ptr_uint64::MAX_ID), ptr_uint64(4, ptr_uint64::MAX_ID)) // 6 - << node(2, node::MAX_ID-1, ptr_uint64(3, ptr_uint64::MAX_ID-1), ptr_uint64(false)) // 5 - << node(2, node::MAX_ID-2, ptr_uint64(false), ptr_uint64(3, ptr_uint64::MAX_ID)) // 4 - << node(1, node::MAX_ID, ptr_uint64(2, ptr_uint64::MAX_ID-2), ptr_uint64(2, ptr_uint64::MAX_ID)) // 3 - << node(1, node::MAX_ID-1, ptr_uint64(2, ptr_uint64::MAX_ID), ptr_uint64(2, ptr_uint64::MAX_ID-1)) // 2 - << node(0, node::MAX_ID, ptr_uint64(1, ptr_uint64::MAX_ID), ptr_uint64(1, ptr_uint64::MAX_ID-1)) // 1 + nw_6 << node(4, node::max_id, ptr_uint64(false), ptr_uint64(true)) // T + << node(3, node::max_id, ptr_uint64(false), ptr_uint64(4, ptr_uint64::max_id)) // 8 + << node(3, node::max_id-1, ptr_uint64(4, ptr_uint64::max_id), ptr_uint64(false)) // 7 + << node(2, node::max_id, ptr_uint64(3, ptr_uint64::max_id), ptr_uint64(4, ptr_uint64::max_id)) // 6 + << node(2, node::max_id-1, ptr_uint64(3, ptr_uint64::max_id-1), ptr_uint64(false)) // 5 + << node(2, node::max_id-2, ptr_uint64(false), ptr_uint64(3, ptr_uint64::max_id)) // 4 + << node(1, node::max_id, ptr_uint64(2, ptr_uint64::max_id-2), ptr_uint64(2, ptr_uint64::max_id)) // 3 + << node(1, node::max_id-1, ptr_uint64(2, ptr_uint64::max_id), ptr_uint64(2, ptr_uint64::max_id-1)) // 2 + << node(0, node::max_id, ptr_uint64(1, ptr_uint64::max_id), ptr_uint64(1, ptr_uint64::max_id-1)) // 1 ; } @@ -204,15 +204,15 @@ go_bandit([]() { // / \ / \ // T F F T */ - shared_levelized_file bdd_7; + shared_levelized_file bdd_7; { // Garbage collect writer to free write-lock node_writer nw_7(bdd_7); - nw_7 << node(2, node::MAX_ID, ptr_uint64(false), ptr_uint64(true)) // 5 - << node(2, node::MAX_ID-1, ptr_uint64(true), ptr_uint64(false)) // 4 - << node(1, node::MAX_ID, ptr_uint64(2, ptr_uint64::MAX_ID), ptr_uint64(2, ptr_uint64::MAX_ID-1)) // 3 - << node(1, node::MAX_ID-1, ptr_uint64(2, ptr_uint64::MAX_ID-1), ptr_uint64(2, ptr_uint64::MAX_ID)) // 2 - << node(0, node::MAX_ID, ptr_uint64(1, ptr_uint64::MAX_ID), ptr_uint64(1, ptr_uint64::MAX_ID-1)) // 1 + nw_7 << node(2, node::max_id, ptr_uint64(false), ptr_uint64(true)) // 5 + << node(2, node::max_id-1, ptr_uint64(true), ptr_uint64(false)) // 4 + << node(1, node::max_id, ptr_uint64(2, ptr_uint64::max_id), ptr_uint64(2, ptr_uint64::max_id-1)) // 3 + << node(1, node::max_id-1, ptr_uint64(2, ptr_uint64::max_id-1), ptr_uint64(2, ptr_uint64::max_id)) // 2 + << node(0, node::max_id, ptr_uint64(1, ptr_uint64::max_id), ptr_uint64(1, ptr_uint64::max_id-1)) // 1 ; } @@ -232,23 +232,23 @@ go_bandit([]() { // / \ // F T */ - shared_levelized_file bdd_8a, bdd_8b; + shared_levelized_file bdd_8a, bdd_8b; { // Garbage collect writer to free write-lock node_writer nw_8a(bdd_8a); - nw_8a << node(3, node::MAX_ID, ptr_uint64(false), ptr_uint64(true)) // 5 - << node(2, node::MAX_ID, ptr_uint64(false), ptr_uint64(3, ptr_uint64::MAX_ID)) // 4 - << node(2, node::MAX_ID-1, ptr_uint64(true), ptr_uint64(3, ptr_uint64::MAX_ID)) // 3 - << node(1, node::MAX_ID, ptr_uint64(2, ptr_uint64::MAX_ID-1), ptr_uint64(2, ptr_uint64::MAX_ID)) // 2 - << node(0, node::MAX_ID, ptr_uint64(1, ptr_uint64::MAX_ID), ptr_uint64(3, ptr_uint64::MAX_ID)) // 1 + nw_8a << node(3, node::max_id, ptr_uint64(false), ptr_uint64(true)) // 5 + << node(2, node::max_id, ptr_uint64(false), ptr_uint64(3, ptr_uint64::max_id)) // 4 + << node(2, node::max_id-1, ptr_uint64(true), ptr_uint64(3, ptr_uint64::max_id)) // 3 + << node(1, node::max_id, ptr_uint64(2, ptr_uint64::max_id-1), ptr_uint64(2, ptr_uint64::max_id)) // 2 + << node(0, node::max_id, ptr_uint64(1, ptr_uint64::max_id), ptr_uint64(3, ptr_uint64::max_id)) // 1 ; node_writer nw_8b(bdd_8b); - nw_8b << node(3, node::MAX_ID, ptr_uint64(false), ptr_uint64(true)) // 5 - << node(2, node::MAX_ID, ptr_uint64(3, ptr_uint64::MAX_ID), ptr_uint64(false)) // 4 - << node(2, node::MAX_ID-1, ptr_uint64(3, ptr_uint64::MAX_ID), ptr_uint64(true)) // 3 - << node(1, node::MAX_ID, ptr_uint64(2, ptr_uint64::MAX_ID-1), ptr_uint64(2, ptr_uint64::MAX_ID)) // 2 - << node(0, node::MAX_ID, ptr_uint64(1, ptr_uint64::MAX_ID), ptr_uint64(3, ptr_uint64::MAX_ID)) // 1 + nw_8b << node(3, node::max_id, ptr_uint64(false), ptr_uint64(true)) // 5 + << node(2, node::max_id, ptr_uint64(3, ptr_uint64::max_id), ptr_uint64(false)) // 4 + << node(2, node::max_id-1, ptr_uint64(3, ptr_uint64::max_id), ptr_uint64(true)) // 3 + << node(1, node::max_id, ptr_uint64(2, ptr_uint64::max_id-1), ptr_uint64(2, ptr_uint64::max_id)) // 2 + << node(0, node::max_id, ptr_uint64(1, ptr_uint64::max_id), ptr_uint64(3, ptr_uint64::max_id)) // 1 ; } @@ -269,16 +269,16 @@ go_bandit([]() { // / \ // F T */ - const node n9T_8 = node(6, node::MAX_ID, ptr_uint64(false), ptr_uint64(true)); - const node n9T_7 = node(5, node::MAX_ID, ptr_uint64(false), ptr_uint64(true)); - const node n9T_6 = node(4, node::MAX_ID, n9T_8.uid(), n9T_7.uid()); - const node n9T_5 = node(3, node::MAX_ID, ptr_uint64(false), ptr_uint64(true)); - const node n9T_4 = node(3, node::MAX_ID-1, n9T_6.uid(), ptr_uint64(false)); - const node n9T_3 = node(2, node::MAX_ID, n9T_5.uid(), n9T_7.uid()); - const node n9T_2 = node(2, node::MAX_ID-1, n9T_4.uid(), n9T_5.uid()); - const node n9T_1 = node(1, node::MAX_ID, n9T_2.uid(), n9T_3.uid()); - - shared_levelized_file bdd_9T; + const node n9T_8 = node(6, node::max_id, ptr_uint64(false), ptr_uint64(true)); + const node n9T_7 = node(5, node::max_id, ptr_uint64(false), ptr_uint64(true)); + const node n9T_6 = node(4, node::max_id, n9T_8.uid(), n9T_7.uid()); + const node n9T_5 = node(3, node::max_id, ptr_uint64(false), ptr_uint64(true)); + const node n9T_4 = node(3, node::max_id-1, n9T_6.uid(), ptr_uint64(false)); + const node n9T_3 = node(2, node::max_id, n9T_5.uid(), n9T_7.uid()); + const node n9T_2 = node(2, node::max_id-1, n9T_4.uid(), n9T_5.uid()); + const node n9T_1 = node(1, node::max_id, n9T_2.uid(), n9T_3.uid()); + + shared_levelized_file bdd_9T; { // Garbage collect writer to free write-lock node_writer nw(bdd_9T); nw << n9T_8 << n9T_7 << n9T_6 << n9T_5 << n9T_4 << n9T_3 << n9T_2 << n9T_1; @@ -301,16 +301,16 @@ go_bandit([]() { // / \ // F T */ - const node n9F_8 = node(6, node::MAX_ID, ptr_uint64(false), ptr_uint64(true)); - const node n9F_7 = node(5, node::MAX_ID, ptr_uint64(false), n9F_8.uid()); - const node n9F_6 = node(4, node::MAX_ID, ptr_uint64(false), n9F_7.uid()); - const node n9F_5 = node(3, node::MAX_ID, ptr_uint64(false), ptr_uint64(true)); - const node n9F_4 = node(3, node::MAX_ID-1, n9F_6.uid(), ptr_uint64(false)); - const node n9F_3 = node(2, node::MAX_ID, n9F_5.uid(), n9F_7.uid()); - const node n9F_2 = node(2, node::MAX_ID-1, n9F_4.uid(), n9F_5.uid()); - const node n9F_1 = node(1, node::MAX_ID, n9F_2.uid(), n9F_3.uid()); + const node n9F_8 = node(6, node::max_id, ptr_uint64(false), ptr_uint64(true)); + const node n9F_7 = node(5, node::max_id, ptr_uint64(false), n9F_8.uid()); + const node n9F_6 = node(4, node::max_id, ptr_uint64(false), n9F_7.uid()); + const node n9F_5 = node(3, node::max_id, ptr_uint64(false), ptr_uint64(true)); + const node n9F_4 = node(3, node::max_id-1, n9F_6.uid(), ptr_uint64(false)); + const node n9F_3 = node(2, node::max_id, n9F_5.uid(), n9F_7.uid()); + const node n9F_2 = node(2, node::max_id-1, n9F_4.uid(), n9F_5.uid()); + const node n9F_1 = node(1, node::max_id, n9F_2.uid(), n9F_3.uid()); - shared_levelized_file bdd_9F; + shared_levelized_file bdd_9F; { // Garbage collect writer to free write-lock node_writer nw(bdd_9F); @@ -332,16 +332,16 @@ go_bandit([]() { // / \ // F T */ - const node n10_8 = node(4, node::MAX_ID, ptr_uint64(false), ptr_uint64(true)); - const node n10_7 = node(3, node::MAX_ID, n10_8.uid(), ptr_uint64(true)); - const node n10_6 = node(3, node::MAX_ID-1, n10_8.uid(), n10_8.uid()); - const node n10_5 = node(3, node::MAX_ID-2, ptr_uint64(true), n10_8.uid()); - const node n10_4 = node(2, node::MAX_ID, n10_6.uid(), n10_7.uid()); - const node n10_3 = node(2, node::MAX_ID-1, n10_5.uid(), n10_6.uid()); - const node n10_2 = node(1, node::MAX_ID, n10_3.uid(), n10_4.uid()); - const node n10_1 = node(0, node::MAX_ID, ptr_uint64(false), n10_2.uid()); + const node n10_8 = node(4, node::max_id, ptr_uint64(false), ptr_uint64(true)); + const node n10_7 = node(3, node::max_id, n10_8.uid(), ptr_uint64(true)); + const node n10_6 = node(3, node::max_id-1, n10_8.uid(), n10_8.uid()); + const node n10_5 = node(3, node::max_id-2, ptr_uint64(true), n10_8.uid()); + const node n10_4 = node(2, node::max_id, n10_6.uid(), n10_7.uid()); + const node n10_3 = node(2, node::max_id-1, n10_5.uid(), n10_6.uid()); + const node n10_2 = node(1, node::max_id, n10_3.uid(), n10_4.uid()); + const node n10_1 = node(0, node::max_id, ptr_uint64(false), n10_2.uid()); - shared_levelized_file bdd_10; + shared_levelized_file bdd_10; { // Garbage collect writer to free write-lock node_writer nw(bdd_10); @@ -359,12 +359,12 @@ go_bandit([]() { // / \ / \ // T F F T */ - shared_levelized_file bdd_11; + shared_levelized_file bdd_11; - node n11_4 = node(6, node::MAX_ID, ptr_uint64(false), ptr_uint64(true)); - node n11_3 = node(6, node::MAX_ID-1, ptr_uint64(true), ptr_uint64(false)); - node n11_2 = node(4, node::MAX_ID, n11_3.uid(), n11_4.uid()); - node n11_1 = node(2, node::MAX_ID, n11_3.uid(), n11_2.uid()); + node n11_4 = node(6, node::max_id, ptr_uint64(false), ptr_uint64(true)); + node n11_3 = node(6, node::max_id-1, ptr_uint64(true), ptr_uint64(false)); + node n11_2 = node(4, node::max_id, n11_3.uid(), n11_4.uid()); + node n11_1 = node(2, node::max_id, n11_3.uid(), n11_2.uid()); { // Garbage collect writer to free write-lock node_writer nw_11(bdd_11); @@ -386,15 +386,15 @@ go_bandit([]() { // / \ // F T */ - const node n12a_7 = node(4, node::MAX_ID, ptr_uint64(false), ptr_uint64(true)); - const node n12a_6 = node(3, node::MAX_ID, ptr_uint64(false), ptr_uint64(true)); - const node n12a_5 = node(3, node::MAX_ID-1, ptr_uint64(true), ptr_uint64(false)); - const node n12a_4 = node(2, node::MAX_ID, n12a_6.uid(), n12a_7.uid()); - const node n12a_3 = node(2, node::MAX_ID-1, n12a_5.uid(), n12a_6.uid()); - const node n12a_2 = node(1, node::MAX_ID, n12a_3.uid(), n12a_4.uid()); - const node n12a_1 = node(0, node::MAX_ID, n12a_3.uid(), n12a_2.uid()); + const node n12a_7 = node(4, node::max_id, ptr_uint64(false), ptr_uint64(true)); + const node n12a_6 = node(3, node::max_id, ptr_uint64(false), ptr_uint64(true)); + const node n12a_5 = node(3, node::max_id-1, ptr_uint64(true), ptr_uint64(false)); + const node n12a_4 = node(2, node::max_id, n12a_6.uid(), n12a_7.uid()); + const node n12a_3 = node(2, node::max_id-1, n12a_5.uid(), n12a_6.uid()); + const node n12a_2 = node(1, node::max_id, n12a_3.uid(), n12a_4.uid()); + const node n12a_1 = node(0, node::max_id, n12a_3.uid(), n12a_2.uid()); - shared_levelized_file bdd_12a; + shared_levelized_file bdd_12a; { // Garbage collect writer to free write-lock node_writer nw(bdd_12a); @@ -417,16 +417,16 @@ go_bandit([]() { // / \ / \ // T F F T */ - const node n12b_8 = node(4, node::MAX_ID, ptr_uint64(false), ptr_uint64(true)); - const node n12b_7 = node(4, node::MAX_ID-1, ptr_uint64(true), ptr_uint64(false)); - const node n12b_6 = node(3, node::MAX_ID, ptr_uint64(false), n12b_8.uid()); - const node n12b_5 = node(3, node::MAX_ID-1, n12b_7.uid(), ptr_uint64(false)); - const node n12b_4 = node(2, node::MAX_ID, n12b_6.uid(), n12b_8.uid()); - const node n12b_3 = node(2, node::MAX_ID-1, n12b_5.uid(), n12b_6.uid()); - const node n12b_2 = node(1, node::MAX_ID, n12b_3.uid(), n12b_4.uid()); - const node n12b_1 = node(0, node::MAX_ID, n12b_3.uid(), n12b_2.uid()); + const node n12b_8 = node(4, node::max_id, ptr_uint64(false), ptr_uint64(true)); + const node n12b_7 = node(4, node::max_id-1, ptr_uint64(true), ptr_uint64(false)); + const node n12b_6 = node(3, node::max_id, ptr_uint64(false), n12b_8.uid()); + const node n12b_5 = node(3, node::max_id-1, n12b_7.uid(), ptr_uint64(false)); + const node n12b_4 = node(2, node::max_id, n12b_6.uid(), n12b_8.uid()); + const node n12b_3 = node(2, node::max_id-1, n12b_5.uid(), n12b_6.uid()); + const node n12b_2 = node(1, node::max_id, n12b_3.uid(), n12b_4.uid()); + const node n12b_1 = node(0, node::max_id, n12b_3.uid(), n12b_2.uid()); - shared_levelized_file bdd_12b; + shared_levelized_file bdd_12b; { // Garbage collect writer to free write-lock node_writer nw(bdd_12b); @@ -470,24 +470,24 @@ go_bandit([]() { */ // This is definitely NOT canonical... it is not worth making. - const node n13_16 = node(7, node::MAX_ID, ptr_uint64(false), ptr_uint64(true)); - const node n13_15 = node(6, node::MAX_ID, ptr_uint64(false), ptr_uint64(true)); - const node n13_14 = node(6, node::MAX_ID-1, ptr_uint64(true), ptr_uint64(false)); - const node n13_13 = node(5, node::MAX_ID, ptr_uint64(false), ptr_uint64(true)); - const node n13_12 = node(5, node::MAX_ID-1, ptr_uint64(true), ptr_uint64(false)); - const node n13_11 = node(4, node::MAX_ID, n13_12.uid(), n13_13.uid()); - const node n13_10 = node(4, node::MAX_ID-1, n13_13.uid(), n13_12.uid()); - const node n13_9 = node(4, node::MAX_ID-2, n13_14.uid(), n13_15.uid()); - const node n13_8 = node(4, node::MAX_ID-3, n13_15.uid(), n13_14.uid()); - const node n13_7 = node(3, node::MAX_ID, n13_10.uid(), n13_11.uid()); - const node n13_6 = node(3, node::MAX_ID-1, ptr_uint64(false), n13_16.uid()); - const node n13_5 = node(2, node::MAX_ID, ptr_uint64(false), n13_16.uid()); - const node n13_4 = node(2, node::MAX_ID-1, n13_8.uid(), n13_9.uid()); - const node n13_3 = node(1, node::MAX_ID, n13_6.uid(), n13_7.uid()); - const node n13_2 = node(1, node::MAX_ID-1, n13_4.uid(), n13_5.uid()); - const node n13_1 = node(0, node::MAX_ID, n13_2.uid(), n13_3.uid()); - - shared_levelized_file bdd_13; + const node n13_16 = node(7, node::max_id, ptr_uint64(false), ptr_uint64(true)); + const node n13_15 = node(6, node::max_id, ptr_uint64(false), ptr_uint64(true)); + const node n13_14 = node(6, node::max_id-1, ptr_uint64(true), ptr_uint64(false)); + const node n13_13 = node(5, node::max_id, ptr_uint64(false), ptr_uint64(true)); + const node n13_12 = node(5, node::max_id-1, ptr_uint64(true), ptr_uint64(false)); + const node n13_11 = node(4, node::max_id, n13_12.uid(), n13_13.uid()); + const node n13_10 = node(4, node::max_id-1, n13_13.uid(), n13_12.uid()); + const node n13_9 = node(4, node::max_id-2, n13_14.uid(), n13_15.uid()); + const node n13_8 = node(4, node::max_id-3, n13_15.uid(), n13_14.uid()); + const node n13_7 = node(3, node::max_id, n13_10.uid(), n13_11.uid()); + const node n13_6 = node(3, node::max_id-1, ptr_uint64(false), n13_16.uid()); + const node n13_5 = node(2, node::max_id, ptr_uint64(false), n13_16.uid()); + const node n13_4 = node(2, node::max_id-1, n13_8.uid(), n13_9.uid()); + const node n13_3 = node(1, node::max_id, n13_6.uid(), n13_7.uid()); + const node n13_2 = node(1, node::max_id-1, n13_4.uid(), n13_5.uid()); + const node n13_1 = node(0, node::max_id, n13_2.uid(), n13_3.uid()); + + shared_levelized_file bdd_13; { // Garbage collect writer to free write-lock node_writer nw(bdd_13); @@ -516,21 +516,21 @@ go_bandit([]() { // / \ / \ // T F F T */ - const node n14_13 = node(8, node::MAX_ID, ptr_uint64(false), ptr_uint64(true)); - const node n14_12 = node(8, node::MAX_ID-1, ptr_uint64(true), ptr_uint64(false)); - const node n14_11 = node(7, node::MAX_ID, ptr_uint64(false), ptr_uint64(true)); - const node n14_10 = node(7, node::MAX_ID-1, ptr_uint64(true), ptr_uint64(false)); - const node n14_9 = node(6, node::MAX_ID, n14_12.uid(), n14_13.uid()); - const node n14_8 = node(5, node::MAX_ID, n14_9.uid(), n14_11.uid()); - const node n14_7 = node(5, node::MAX_ID-1, n14_10.uid(), n14_9.uid()); - const node n14_6 = node(4, node::MAX_ID, n14_8.uid(), ptr_uint64(false)); - const node n14_5 = node(4, node::MAX_ID-1, n14_7.uid(), n14_8.uid()); - const node n14_4 = node(4, node::MAX_ID-2, ptr_uint64(false), n14_7.uid()); - const node n14_3 = node(3, node::MAX_ID, n14_5.uid(), n14_6.uid()); - const node n14_2 = node(3, node::MAX_ID-1, n14_4.uid(), n14_5.uid()); - const node n14_1 = node(2, node::MAX_ID, n14_2.uid(), n14_3.uid()); - - shared_levelized_file bdd_14a; + const node n14_13 = node(8, node::max_id, ptr_uint64(false), ptr_uint64(true)); + const node n14_12 = node(8, node::max_id-1, ptr_uint64(true), ptr_uint64(false)); + const node n14_11 = node(7, node::max_id, ptr_uint64(false), ptr_uint64(true)); + const node n14_10 = node(7, node::max_id-1, ptr_uint64(true), ptr_uint64(false)); + const node n14_9 = node(6, node::max_id, n14_12.uid(), n14_13.uid()); + const node n14_8 = node(5, node::max_id, n14_9.uid(), n14_11.uid()); + const node n14_7 = node(5, node::max_id-1, n14_10.uid(), n14_9.uid()); + const node n14_6 = node(4, node::max_id, n14_8.uid(), ptr_uint64(false)); + const node n14_5 = node(4, node::max_id-1, n14_7.uid(), n14_8.uid()); + const node n14_4 = node(4, node::max_id-2, ptr_uint64(false), n14_7.uid()); + const node n14_3 = node(3, node::max_id, n14_5.uid(), n14_6.uid()); + const node n14_2 = node(3, node::max_id-1, n14_4.uid(), n14_5.uid()); + const node n14_1 = node(2, node::max_id, n14_2.uid(), n14_3.uid()); + + shared_levelized_file bdd_14a; { // Garbage collect writer to free write-lock node_writer nw(bdd_14a); @@ -547,10 +547,10 @@ go_bandit([]() { // | / \ // BDD 14 F T */ - const node n14b_2 = node(1, node::MAX_ID, ptr_uint64(false), ptr_uint64(true)); - const node n14b_1 = node(0, node::MAX_ID, n14_1.uid(), n14b_2.uid()); + const node n14b_2 = node(1, node::max_id, ptr_uint64(false), ptr_uint64(true)); + const node n14b_1 = node(0, node::max_id, n14_1.uid(), n14b_2.uid()); - shared_levelized_file bdd_14b; + shared_levelized_file bdd_14b; { // Garbage collect writer to free write-lock node_writer nw(bdd_14b); @@ -660,55 +660,55 @@ go_bandit([]() { // NOTE: This is not going to be canonical (i.e. ordered) because that would // become too messy. - const node n15_o = node(13, node::MAX_ID, ptr_uint64(false), ptr_uint64(true)); - const node n15_n = node(13, node::MAX_ID-1, ptr_uint64(true), ptr_uint64(false)); + const node n15_o = node(13, node::max_id, ptr_uint64(false), ptr_uint64(true)); + const node n15_n = node(13, node::max_id-1, ptr_uint64(true), ptr_uint64(false)); - const node n15_17 = node(12, node::MAX_ID, ptr_uint64(false), ptr_uint64(true)); - const node n15_16 = node(12, node::MAX_ID-1, ptr_uint64(true), ptr_uint64(false)); + const node n15_17 = node(12, node::max_id, ptr_uint64(false), ptr_uint64(true)); + const node n15_16 = node(12, node::max_id-1, ptr_uint64(true), ptr_uint64(false)); - const node n15_m = node(11, node::MAX_ID, n15_o.uid(), n15_n.uid()); - const node n15_l = node(11, node::MAX_ID-1, n15_n.uid(), n15_o.uid()); - const node n15_15 = node(11, node::MAX_ID-2, n15_17.uid(), n15_16.uid()); - const node n15_14 = node(11, node::MAX_ID-3, n15_16.uid(), n15_17.uid()); + const node n15_m = node(11, node::max_id, n15_o.uid(), n15_n.uid()); + const node n15_l = node(11, node::max_id-1, n15_n.uid(), n15_o.uid()); + const node n15_15 = node(11, node::max_id-2, n15_17.uid(), n15_16.uid()); + const node n15_14 = node(11, node::max_id-3, n15_16.uid(), n15_17.uid()); - const node n15_k = node(10, node::MAX_ID, n15_m.uid(), n15_l.uid()); - const node n15_j = node(10, node::MAX_ID-1, n15_l.uid(), n15_m.uid()); - const node n15_13 = node(10, node::MAX_ID-2, n15_15.uid(), n15_14.uid()); - const node n15_12 = node(10, node::MAX_ID-3, n15_14.uid(), n15_15.uid()); + const node n15_k = node(10, node::max_id, n15_m.uid(), n15_l.uid()); + const node n15_j = node(10, node::max_id-1, n15_l.uid(), n15_m.uid()); + const node n15_13 = node(10, node::max_id-2, n15_15.uid(), n15_14.uid()); + const node n15_12 = node(10, node::max_id-3, n15_14.uid(), n15_15.uid()); - const node n15_i = node(9, node::MAX_ID, n15_k.uid(), n15_j.uid()); - const node n15_h = node(9, node::MAX_ID-1, n15_j.uid(), n15_k.uid()); - const node n15_11 = node(9, node::MAX_ID-2, n15_13.uid(), n15_12.uid()); - const node n15_10 = node(9, node::MAX_ID-3, n15_12.uid(), n15_13.uid()); + const node n15_i = node(9, node::max_id, n15_k.uid(), n15_j.uid()); + const node n15_h = node(9, node::max_id-1, n15_j.uid(), n15_k.uid()); + const node n15_11 = node(9, node::max_id-2, n15_13.uid(), n15_12.uid()); + const node n15_10 = node(9, node::max_id-3, n15_12.uid(), n15_13.uid()); - const node n15_g = node(8, node::MAX_ID, n15_i.uid(), n15_h.uid()); - const node n15_f = node(8, node::MAX_ID-1, n15_h.uid(), n15_i.uid()); - const node n15_9 = node(8, node::MAX_ID-2, n15_11.uid(), n15_10.uid()); - const node n15_8 = node(8, node::MAX_ID-3, n15_10.uid(), n15_11.uid()); + const node n15_g = node(8, node::max_id, n15_i.uid(), n15_h.uid()); + const node n15_f = node(8, node::max_id-1, n15_h.uid(), n15_i.uid()); + const node n15_9 = node(8, node::max_id-2, n15_11.uid(), n15_10.uid()); + const node n15_8 = node(8, node::max_id-3, n15_10.uid(), n15_11.uid()); - const node n15_7 = node(7, node::MAX_ID, n15_8.uid(), n15_9.uid()); + const node n15_7 = node(7, node::max_id, n15_8.uid(), n15_9.uid()); - const node n15_d = node(6, node::MAX_ID, n15_f.uid(), n15_g.uid()); - const node n15_6 = node(6, node::MAX_ID-1, n15_7.uid(), n15_9.uid()); - const node n15_5 = node(6, node::MAX_ID-2, n15_8.uid(), n15_7.uid()); + const node n15_d = node(6, node::max_id, n15_f.uid(), n15_g.uid()); + const node n15_6 = node(6, node::max_id-1, n15_7.uid(), n15_9.uid()); + const node n15_5 = node(6, node::max_id-2, n15_8.uid(), n15_7.uid()); - const node n15_c = node(5, node::MAX_ID, n15_d.uid(), ptr_uint64(false)); - const node n15_b = node(5, node::MAX_ID-1, ptr_uint64(false), n15_d.uid()); - const node n15_4 = node(5, node::MAX_ID-2, n15_5.uid(), n15_6.uid()); + const node n15_c = node(5, node::max_id, n15_d.uid(), ptr_uint64(false)); + const node n15_b = node(5, node::max_id-1, ptr_uint64(false), n15_d.uid()); + const node n15_4 = node(5, node::max_id-2, n15_5.uid(), n15_6.uid()); - const node n15_3 = node(4, node::MAX_ID, n15_4.uid(), ptr_uint64(false)); - const node n15_2 = node(4, node::MAX_ID-1, ptr_uint64(false), n15_4.uid()); + const node n15_3 = node(4, node::max_id, n15_4.uid(), ptr_uint64(false)); + const node n15_2 = node(4, node::max_id-1, ptr_uint64(false), n15_4.uid()); - const node n15_1 = node(3, node::MAX_ID, n15_2.uid(), n15_3.uid()); + const node n15_1 = node(3, node::max_id, n15_2.uid(), n15_3.uid()); - const node n15_a = node(2, node::MAX_ID, n15_b.uid(), n15_c.uid()); + const node n15_a = node(2, node::max_id, n15_b.uid(), n15_c.uid()); - const node n15_r3 = node(1, node::MAX_ID, n15_5.uid(), n15_d.uid()); - const node n15_r2 = node(1, node::MAX_ID-1, n15_1.uid(), n15_a.uid()); + const node n15_r3 = node(1, node::max_id, n15_5.uid(), n15_d.uid()); + const node n15_r2 = node(1, node::max_id-1, n15_1.uid(), n15_a.uid()); - const node n15_r1 = node(0, node::MAX_ID, n15_r2.uid(), n15_r3.uid()); + const node n15_r1 = node(0, node::max_id, n15_r2.uid(), n15_r3.uid()); - shared_levelized_file bdd_15; + shared_levelized_file bdd_15; { // Garbage collect writer to free write-lock node_writer nw(bdd_15); @@ -730,18 +730,18 @@ go_bandit([]() { } //////////////////////////////////////////////////////////////////////////// - describe("bdd_exists(const bdd&, bdd::label_t)", [&]() { + describe("bdd_exists(const bdd&, bdd::label_type)", [&]() { it("should quantify T terminal-only BDD as itself", [&]() { __bdd out = bdd_exists(terminal_T, 42); - AssertThat(out.get>(), Is().EqualTo(terminal_T)); + AssertThat(out.get>(), Is().EqualTo(terminal_T)); AssertThat(out.negate, Is().False()); }); it("should quantify F terminal-only BDD as itself", [&]() { __bdd out = bdd_exists(terminal_F, 21); - AssertThat(out.get>(), Is().EqualTo(terminal_F)); + AssertThat(out.get>(), Is().EqualTo(terminal_F)); AssertThat(out.negate, Is().False()); }); @@ -754,15 +754,15 @@ go_bandit([]() { AssertThat(out_nodes.pull(), Is().EqualTo(node(true))); AssertThat(out_nodes.can_pull(), Is().False()); - AssertThat(out.get>()->levels(), Is().EqualTo(0u)); + AssertThat(out.get>()->levels(), Is().EqualTo(0u)); - AssertThat(out.get>()->max_1level_cut[cut_type::INTERNAL], Is().EqualTo(0u)); - AssertThat(out.get>()->max_1level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(0u)); - AssertThat(out.get>()->max_1level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(1u)); - AssertThat(out.get>()->max_1level_cut[cut_type::ALL], Is().EqualTo(1u)); + AssertThat(out.get>()->max_1level_cut[cut::Internal], Is().EqualTo(0u)); + AssertThat(out.get>()->max_1level_cut[cut::Internal_False], Is().EqualTo(0u)); + AssertThat(out.get>()->max_1level_cut[cut::Internal_True], Is().EqualTo(1u)); + AssertThat(out.get>()->max_1level_cut[cut::All], Is().EqualTo(1u)); - AssertThat(out.get>()->number_of_terminals[false], Is().EqualTo(0u)); - AssertThat(out.get>()->number_of_terminals[true], Is().EqualTo(1u)); + AssertThat(out.get>()->number_of_terminals[false], Is().EqualTo(0u)); + AssertThat(out.get>()->number_of_terminals[true], Is().EqualTo(1u)); }); it("should shortcut quantification of root into T terminal [x2]", [&]() { @@ -774,21 +774,21 @@ go_bandit([]() { AssertThat(out_nodes.pull(), Is().EqualTo(node(true))); AssertThat(out_nodes.can_pull(), Is().False()); - AssertThat(out.get>()->levels(), Is().EqualTo(0u)); + AssertThat(out.get>()->levels(), Is().EqualTo(0u)); - AssertThat(out.get>()->max_1level_cut[cut_type::INTERNAL], Is().EqualTo(0u)); - AssertThat(out.get>()->max_1level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(0u)); - AssertThat(out.get>()->max_1level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(1u)); - AssertThat(out.get>()->max_1level_cut[cut_type::ALL], Is().EqualTo(1u)); + AssertThat(out.get>()->max_1level_cut[cut::Internal], Is().EqualTo(0u)); + AssertThat(out.get>()->max_1level_cut[cut::Internal_False], Is().EqualTo(0u)); + AssertThat(out.get>()->max_1level_cut[cut::Internal_True], Is().EqualTo(1u)); + AssertThat(out.get>()->max_1level_cut[cut::All], Is().EqualTo(1u)); - AssertThat(out.get>()->number_of_terminals[false], Is().EqualTo(0u)); - AssertThat(out.get>()->number_of_terminals[true], Is().EqualTo(1u)); + AssertThat(out.get>()->number_of_terminals[false], Is().EqualTo(0u)); + AssertThat(out.get>()->number_of_terminals[true], Is().EqualTo(1u)); }); it("should shortcut quantification on non-existent label in input [BDD 1]", [&]() { __bdd out = bdd_exists(bdd_1, 42); - AssertThat(out.get>(), Is().EqualTo(bdd_1)); + AssertThat(out.get>(), Is().EqualTo(bdd_1)); AssertThat(out.negate, Is().False()); }); @@ -815,10 +815,10 @@ go_bandit([]() { AssertThat(levels.can_pull(), Is().False()); - AssertThat(out.get<__bdd::shared_arcs_t>()->max_1level_cut, Is().GreaterThanOrEqualTo(0u)); + AssertThat(out.get<__bdd::shared_arc_file_type>()->max_1level_cut, Is().GreaterThanOrEqualTo(0u)); - AssertThat(out.get<__bdd::shared_arcs_t>()->number_of_terminals[false], Is().EqualTo(0u)); - AssertThat(out.get<__bdd::shared_arcs_t>()->number_of_terminals[true], Is().EqualTo(2u)); + AssertThat(out.get<__bdd::shared_arc_file_type>()->number_of_terminals[false], Is().EqualTo(0u)); + AssertThat(out.get<__bdd::shared_arc_file_type>()->number_of_terminals[true], Is().EqualTo(2u)); }); it("should quantify root without terminal arcs [BDD 2]", [&]() { @@ -864,10 +864,10 @@ go_bandit([]() { AssertThat(levels.can_pull(), Is().False()); - AssertThat(out.get<__bdd::shared_arcs_t>()->max_1level_cut, Is().GreaterThanOrEqualTo(2u)); + AssertThat(out.get<__bdd::shared_arc_file_type>()->max_1level_cut, Is().GreaterThanOrEqualTo(2u)); - AssertThat(out.get<__bdd::shared_arcs_t>()->number_of_terminals[false], Is().EqualTo(1u)); - AssertThat(out.get<__bdd::shared_arcs_t>()->number_of_terminals[true], Is().EqualTo(3u)); + AssertThat(out.get<__bdd::shared_arc_file_type>()->number_of_terminals[false], Is().EqualTo(1u)); + AssertThat(out.get<__bdd::shared_arc_file_type>()->number_of_terminals[true], Is().EqualTo(3u)); }); it("should quantify root with F terminal [BDD 5]", [&]() { @@ -913,10 +913,10 @@ go_bandit([]() { AssertThat(levels.can_pull(), Is().False()); - AssertThat(out.get<__bdd::shared_arcs_t>()->max_1level_cut, Is().GreaterThanOrEqualTo(2u)); + AssertThat(out.get<__bdd::shared_arc_file_type>()->max_1level_cut, Is().GreaterThanOrEqualTo(2u)); - AssertThat(out.get<__bdd::shared_arcs_t>()->number_of_terminals[false], Is().EqualTo(2u)); - AssertThat(out.get<__bdd::shared_arcs_t>()->number_of_terminals[true], Is().EqualTo(2u)); + AssertThat(out.get<__bdd::shared_arc_file_type>()->number_of_terminals[false], Is().EqualTo(2u)); + AssertThat(out.get<__bdd::shared_arc_file_type>()->number_of_terminals[true], Is().EqualTo(2u)); // TODO: meta variables... }); @@ -964,10 +964,10 @@ go_bandit([]() { AssertThat(levels.can_pull(), Is().False()); - AssertThat(out.get<__bdd::shared_arcs_t>()->max_1level_cut, Is().GreaterThanOrEqualTo(2u)); + AssertThat(out.get<__bdd::shared_arc_file_type>()->max_1level_cut, Is().GreaterThanOrEqualTo(2u)); - AssertThat(out.get<__bdd::shared_arcs_t>()->number_of_terminals[false], Is().EqualTo(1u)); - AssertThat(out.get<__bdd::shared_arcs_t>()->number_of_terminals[true], Is().EqualTo(3u)); + AssertThat(out.get<__bdd::shared_arc_file_type>()->number_of_terminals[false], Is().EqualTo(1u)); + AssertThat(out.get<__bdd::shared_arc_file_type>()->number_of_terminals[true], Is().EqualTo(3u)); }); it("should output terminal arcs in order, despite the order of resolvement [BDD 2]", [&]() { @@ -1013,10 +1013,10 @@ go_bandit([]() { AssertThat(levels.can_pull(), Is().False()); - AssertThat(out.get<__bdd::shared_arcs_t>()->max_1level_cut, Is().GreaterThanOrEqualTo(2u)); + AssertThat(out.get<__bdd::shared_arc_file_type>()->max_1level_cut, Is().GreaterThanOrEqualTo(2u)); - AssertThat(out.get<__bdd::shared_arcs_t>()->number_of_terminals[false], Is().EqualTo(1u)); - AssertThat(out.get<__bdd::shared_arcs_t>()->number_of_terminals[true], Is().EqualTo(3u)); + AssertThat(out.get<__bdd::shared_arc_file_type>()->number_of_terminals[false], Is().EqualTo(1u)); + AssertThat(out.get<__bdd::shared_arc_file_type>()->number_of_terminals[true], Is().EqualTo(3u)); }); it("should keep nodes as is when skipping quantified level [BDD 3]", [&]() { @@ -1024,7 +1024,7 @@ go_bandit([]() { arc_test_stream arcs(out); - // Note, that node (2,0) reflects (3,NIL) since while n4 < NIL we process this + // Note, that node (2,0) reflects (3,nil) since while n4 < nil we process this // request without forwarding n3 through the secondary priority queue AssertThat(arcs.can_pull_internal(), Is().True()); AssertThat(arcs.pull_internal(), @@ -1064,10 +1064,10 @@ go_bandit([]() { AssertThat(levels.can_pull(), Is().False()); - AssertThat(out.get<__bdd::shared_arcs_t>()->max_1level_cut, Is().GreaterThanOrEqualTo(2u)); + AssertThat(out.get<__bdd::shared_arc_file_type>()->max_1level_cut, Is().GreaterThanOrEqualTo(2u)); - AssertThat(out.get<__bdd::shared_arcs_t>()->number_of_terminals[false], Is().EqualTo(1u)); - AssertThat(out.get<__bdd::shared_arcs_t>()->number_of_terminals[true], Is().EqualTo(3u)); + AssertThat(out.get<__bdd::shared_arc_file_type>()->number_of_terminals[false], Is().EqualTo(1u)); + AssertThat(out.get<__bdd::shared_arc_file_type>()->number_of_terminals[true], Is().EqualTo(3u)); }); it("should output terminal arcs in order, despite the order of resolvement [BDD 3]", [&]() { @@ -1075,7 +1075,7 @@ go_bandit([]() { arc_test_stream arcs(out); - // Note, that node (2,0) reflects (3,NIL) while n4 < NIL since we process this + // Note, that node (2,0) reflects (3,nil) while n4 < nil since we process this // request without forwarding n3 through the secondary priority queue AssertThat(arcs.can_pull_internal(), Is().True()); AssertThat(arcs.pull_internal(), @@ -1107,10 +1107,10 @@ go_bandit([]() { AssertThat(levels.can_pull(), Is().False()); - AssertThat(out.get<__bdd::shared_arcs_t>()->max_1level_cut, Is().GreaterThanOrEqualTo(1u)); + AssertThat(out.get<__bdd::shared_arc_file_type>()->max_1level_cut, Is().GreaterThanOrEqualTo(1u)); - AssertThat(out.get<__bdd::shared_arcs_t>()->number_of_terminals[false], Is().EqualTo(0u)); - AssertThat(out.get<__bdd::shared_arcs_t>()->number_of_terminals[true], Is().EqualTo(3u)); + AssertThat(out.get<__bdd::shared_arc_file_type>()->number_of_terminals[false], Is().EqualTo(0u)); + AssertThat(out.get<__bdd::shared_arc_file_type>()->number_of_terminals[true], Is().EqualTo(3u)); }); it("should resolve terminal-terminal requests in [BDD 5]", [&]() { @@ -1118,7 +1118,7 @@ go_bandit([]() { arc_test_stream arcs(out); - // Note, that node (2,0) reflects (3,NIL) while n4 < NIL since we process this + // Note, that node (2,0) reflects (3,nil) while n4 < nil since we process this // request without forwarding n3 through the secondary priority queue AssertThat(arcs.can_pull_internal(), Is().True()); AssertThat(arcs.pull_internal(), @@ -1150,19 +1150,19 @@ go_bandit([]() { AssertThat(levels.can_pull(), Is().False()); - AssertThat(out.get<__bdd::shared_arcs_t>()->max_1level_cut, Is().GreaterThanOrEqualTo(1u)); + AssertThat(out.get<__bdd::shared_arc_file_type>()->max_1level_cut, Is().GreaterThanOrEqualTo(1u)); - AssertThat(out.get<__bdd::shared_arcs_t>()->number_of_terminals[false], Is().EqualTo(1u)); - AssertThat(out.get<__bdd::shared_arcs_t>()->number_of_terminals[true], Is().EqualTo(2u)); + AssertThat(out.get<__bdd::shared_arc_file_type>()->number_of_terminals[false], Is().EqualTo(1u)); + AssertThat(out.get<__bdd::shared_arc_file_type>()->number_of_terminals[true], Is().EqualTo(2u)); }); it("can shortcut/prune irrelevant subtrees [OR-chain]", [&]() { - shared_levelized_file bdd_chain; + shared_levelized_file bdd_chain; - node n4 = node(3, node::MAX_ID, ptr_uint64(false), ptr_uint64(true)); - node n3 = node(2, node::MAX_ID, n4.uid(), ptr_uint64(true)); - node n2 = node(1, node::MAX_ID, n3.uid(), ptr_uint64(true)); - node n1 = node(0, node::MAX_ID, n2.uid(), ptr_uint64(true)); + node n4 = node(3, node::max_id, ptr_uint64(false), ptr_uint64(true)); + node n3 = node(2, node::max_id, n4.uid(), ptr_uint64(true)); + node n2 = node(1, node::max_id, n3.uid(), ptr_uint64(true)); + node n1 = node(0, node::max_id, n2.uid(), ptr_uint64(true)); { // Garbage collect writer to free write-lock node_writer bdd_chain_w(bdd_chain); @@ -1202,10 +1202,10 @@ go_bandit([]() { AssertThat(levels.can_pull(), Is().False()); - AssertThat(out.get<__bdd::shared_arcs_t>()->max_1level_cut, Is().GreaterThanOrEqualTo(1u)); + AssertThat(out.get<__bdd::shared_arc_file_type>()->max_1level_cut, Is().GreaterThanOrEqualTo(1u)); - AssertThat(out.get<__bdd::shared_arcs_t>()->number_of_terminals[false], Is().EqualTo(0u)); - AssertThat(out.get<__bdd::shared_arcs_t>()->number_of_terminals[true], Is().EqualTo(3u)); + AssertThat(out.get<__bdd::shared_arc_file_type>()->number_of_terminals[false], Is().EqualTo(0u)); + AssertThat(out.get<__bdd::shared_arc_file_type>()->number_of_terminals[true], Is().EqualTo(3u)); }); it("can forward information across a level [BDD 6]", [&]() { @@ -1267,10 +1267,10 @@ go_bandit([]() { AssertThat(levels.can_pull(), Is().False()); - AssertThat(out.get<__bdd::shared_arcs_t>()->max_1level_cut, Is().GreaterThanOrEqualTo(2u)); + AssertThat(out.get<__bdd::shared_arc_file_type>()->max_1level_cut, Is().GreaterThanOrEqualTo(2u)); - AssertThat(out.get<__bdd::shared_arcs_t>()->number_of_terminals[false], Is().EqualTo(1u)); - AssertThat(out.get<__bdd::shared_arcs_t>()->number_of_terminals[true], Is().EqualTo(5u)); + AssertThat(out.get<__bdd::shared_arc_file_type>()->number_of_terminals[false], Is().EqualTo(1u)); + AssertThat(out.get<__bdd::shared_arc_file_type>()->number_of_terminals[true], Is().EqualTo(5u)); }); it("can forward multiple arcs to the same node across a level [BDD 7]", [&]() { @@ -1306,10 +1306,10 @@ go_bandit([]() { AssertThat(levels.can_pull(), Is().False()); - AssertThat(out.get<__bdd::shared_arcs_t>()->max_1level_cut, Is().GreaterThanOrEqualTo(2u)); + AssertThat(out.get<__bdd::shared_arc_file_type>()->max_1level_cut, Is().GreaterThanOrEqualTo(2u)); - AssertThat(out.get<__bdd::shared_arcs_t>()->number_of_terminals[false], Is().EqualTo(0u)); - AssertThat(out.get<__bdd::shared_arcs_t>()->number_of_terminals[true], Is().EqualTo(2u)); + AssertThat(out.get<__bdd::shared_arc_file_type>()->number_of_terminals[false], Is().EqualTo(0u)); + AssertThat(out.get<__bdd::shared_arc_file_type>()->number_of_terminals[true], Is().EqualTo(2u)); }); it("should collapse tuple requests of the same node back into request on a single node [BDD 8a]", [&]() { @@ -1357,10 +1357,10 @@ go_bandit([]() { AssertThat(levels.can_pull(), Is().False()); - AssertThat(out.get<__bdd::shared_arcs_t>()->max_1level_cut, Is().GreaterThanOrEqualTo(2u)); + AssertThat(out.get<__bdd::shared_arc_file_type>()->max_1level_cut, Is().GreaterThanOrEqualTo(2u)); - AssertThat(out.get<__bdd::shared_arcs_t>()->number_of_terminals[false], Is().EqualTo(1u)); - AssertThat(out.get<__bdd::shared_arcs_t>()->number_of_terminals[true], Is().EqualTo(2u)); + AssertThat(out.get<__bdd::shared_arc_file_type>()->number_of_terminals[false], Is().EqualTo(1u)); + AssertThat(out.get<__bdd::shared_arc_file_type>()->number_of_terminals[true], Is().EqualTo(2u)); }); it("should collapse tuple requests of the same node back into request on a single node [BDD 8b]", [&]() { @@ -1408,39 +1408,39 @@ go_bandit([]() { AssertThat(levels.can_pull(), Is().False()); - AssertThat(out.get<__bdd::shared_arcs_t>()->max_1level_cut, Is().GreaterThanOrEqualTo(2u)); + AssertThat(out.get<__bdd::shared_arc_file_type>()->max_1level_cut, Is().GreaterThanOrEqualTo(2u)); - AssertThat(out.get<__bdd::shared_arcs_t>()->number_of_terminals[false], Is().EqualTo(1u)); - AssertThat(out.get<__bdd::shared_arcs_t>()->number_of_terminals[true], Is().EqualTo(2u)); + AssertThat(out.get<__bdd::shared_arc_file_type>()->number_of_terminals[false], Is().EqualTo(1u)); + AssertThat(out.get<__bdd::shared_arc_file_type>()->number_of_terminals[true], Is().EqualTo(2u)); }); }); - describe("bdd_exists(const bdd&, const predicate&)", [&]() { + describe("bdd_exists(const bdd&, const predicate&)", [&]() { it("returns input on always-false predicate BDD 1 [&&]", [&]() { - __bdd out = bdd_exists(bdd_1, [](const bdd::label_t) -> bool { + __bdd out = bdd_exists(bdd_1, [](const bdd::label_type) -> bool { return false; }); - AssertThat(out.get>(), Is().EqualTo(bdd_1)); + AssertThat(out.get>(), Is().EqualTo(bdd_1)); }); - describe("quantify_mode == SINGLETON", [&]() { - quantify_mode = quantify_mode_t::SINGLETON; + describe("quantify_mode == Singleton", [&]() { + quantify_mode = quantify_mode_t::Singleton; it("quantifies odd variables in BDD 4 [&&]", [&]() { - bdd out = bdd_exists(bdd_4, [](const bdd::label_t x) -> bool { + bdd out = bdd_exists(bdd_4, [](const bdd::label_type x) -> bool { return x % 2; }); node_test_stream out_nodes(out); AssertThat(out_nodes.can_pull(), Is().True()); // (3) - AssertThat(out_nodes.pull(), Is().EqualTo(node(2, node::MAX_ID, + AssertThat(out_nodes.pull(), Is().EqualTo(node(2, node::max_id, ptr_uint64(false), ptr_uint64(true)))); AssertThat(out_nodes.can_pull(), Is().True()); // (1) - AssertThat(out_nodes.pull(), Is().EqualTo(node(0, node::MAX_ID, - ptr_uint64(2, ptr_uint64::MAX_ID), + AssertThat(out_nodes.pull(), Is().EqualTo(node(0, node::max_id, + ptr_uint64(2, ptr_uint64::max_id), ptr_uint64(true)))); AssertThat(out_nodes.can_pull(), Is().False()); @@ -1459,20 +1459,20 @@ go_bandit([]() { }); it("quantifies 1, 2 in BDD 4 [&&]", [&]() { - bdd out = bdd_exists(bdd_4, [](const bdd::label_t x) -> bool { + bdd out = bdd_exists(bdd_4, [](const bdd::label_type x) -> bool { return x == 1 || x == 2; }); node_test_stream out_nodes(out); AssertThat(out_nodes.can_pull(), Is().True()); - AssertThat(out_nodes.pull(), Is().EqualTo(node(3, node::MAX_ID, + AssertThat(out_nodes.pull(), Is().EqualTo(node(3, node::max_id, ptr_uint64(false), ptr_uint64(true)))); AssertThat(out_nodes.can_pull(), Is().True()); - AssertThat(out_nodes.pull(), Is().EqualTo(node(0, node::MAX_ID, - ptr_uint64(3, ptr_uint64::MAX_ID), + AssertThat(out_nodes.pull(), Is().EqualTo(node(0, node::max_id, + ptr_uint64(3, ptr_uint64::max_id), ptr_uint64(true)))); AssertThat(out_nodes.can_pull(), Is().False()); @@ -1492,20 +1492,20 @@ go_bandit([]() { it("quantifies even variables in BDD 4 [const &]", [&]() { const bdd in = bdd_4; - const bdd out = bdd_exists(in, [](const bdd::label_t x) -> bool { + const bdd out = bdd_exists(in, [](const bdd::label_type x) -> bool { return !(x % 2); }); node_test_stream out_nodes(out); AssertThat(out_nodes.can_pull(), Is().True()); // (5) - AssertThat(out_nodes.pull(), Is().EqualTo(node(3, node::MAX_ID, + AssertThat(out_nodes.pull(), Is().EqualTo(node(3, node::max_id, ptr_uint64(false), ptr_uint64(true)))); AssertThat(out_nodes.can_pull(), Is().True()); // (2') - AssertThat(out_nodes.pull(), Is().EqualTo(node(1, node::MAX_ID, - ptr_uint64(3, ptr_uint64::MAX_ID), + AssertThat(out_nodes.pull(), Is().EqualTo(node(1, node::max_id, + ptr_uint64(3, ptr_uint64::max_id), ptr_uint64(true)))); AssertThat(out_nodes.can_pull(), Is().False()); @@ -1524,7 +1524,7 @@ go_bandit([]() { }); it("quantifies odd variables in BDD 1 [&&]", [&]() { - bdd out = bdd_exists(bdd_1, [](const bdd::label_t x) -> bool { + bdd out = bdd_exists(bdd_1, [](const bdd::label_type x) -> bool { return x % 2; }); @@ -1545,7 +1545,7 @@ go_bandit([]() { // TODO: top-down dependant? int calls = 0; - const bdd out = bdd_exists(bdd_1, [&calls](const bdd::label_t) -> bool { + const bdd out = bdd_exists(bdd_1, [&calls](const bdd::label_type) -> bool { calls++; return true; }); @@ -1566,7 +1566,7 @@ go_bandit([]() { }); it("quantifies with always-true predicate in BDD 4 [&&]", [&]() { - bdd out = bdd_exists(bdd_4, [](const bdd::label_t) -> bool { + bdd out = bdd_exists(bdd_4, [](const bdd::label_type) -> bool { return true; }); @@ -1582,15 +1582,15 @@ go_bandit([]() { // TODO: meta variables... }); - quantify_mode = quantify_mode_t::AUTO; + quantify_mode = quantify_mode_t::Auto; }); - describe("quantify_mode == PARTIAL", [&]() { - quantify_mode = quantify_mode_t::PARTIAL; + describe("quantify_mode == Partial", [&]() { + quantify_mode = quantify_mode_t::Partial; it("collapses during initial transposition of all variables in BDD 4 [&&]", [&]() { - std::vector call_history; - bdd out = bdd_exists(bdd_4, [&call_history](const bdd::label_t x) -> bool { + std::vector call_history; + bdd out = bdd_exists(bdd_4, [&call_history](const bdd::label_type x) -> bool { call_history.push_back(x); return true; }); @@ -1627,10 +1627,10 @@ go_bandit([]() { }); it("finishes during initial transposition of even variables in BDD 4 [const &]", [&]() { - std::vector call_history; + std::vector call_history; const bdd in = bdd_4; - const bdd out = bdd_exists(in, [&call_history](const bdd::label_t x) -> bool { + const bdd out = bdd_exists(in, [&call_history](const bdd::label_type x) -> bool { call_history.push_back(x); return !(x % 2); }); @@ -1638,13 +1638,13 @@ go_bandit([]() { node_test_stream out_nodes(out); AssertThat(out_nodes.can_pull(), Is().True()); // (5) - AssertThat(out_nodes.pull(), Is().EqualTo(node(3, node::MAX_ID, + AssertThat(out_nodes.pull(), Is().EqualTo(node(3, node::max_id, ptr_uint64(false), ptr_uint64(true)))); AssertThat(out_nodes.can_pull(), Is().True()); // (2') - AssertThat(out_nodes.pull(), Is().EqualTo(node(1, node::MAX_ID, - ptr_uint64(3, ptr_uint64::MAX_ID), + AssertThat(out_nodes.pull(), Is().EqualTo(node(1, node::max_id, + ptr_uint64(3, ptr_uint64::max_id), ptr_uint64(true)))); AssertThat(out_nodes.can_pull(), Is().False()); @@ -1683,8 +1683,8 @@ go_bandit([]() { }); it("collapses during repeated transposition with variables 1 2 variables in BDD 11a [&&]", [&]() { - std::vector call_history; - bdd out = bdd_exists(bdd_12a, [&call_history](const bdd::label_t x) -> bool { + std::vector call_history; + bdd out = bdd_exists(bdd_12a, [&call_history](const bdd::label_type x) -> bool { call_history.push_back(x); return 0 < x && x < 3; }); @@ -1732,8 +1732,8 @@ go_bandit([]() { }); it("finishes during repeated transposition with variables 1 and 2 in BDD 11b [&&]", [&]() { - std::vector call_history; - bdd out = bdd_exists(bdd_12b, [&call_history](const bdd::label_t x) -> bool { + std::vector call_history; + bdd out = bdd_exists(bdd_12b, [&call_history](const bdd::label_type x) -> bool { call_history.push_back(x); return 0 < x && x < 3; }); @@ -1760,29 +1760,29 @@ go_bandit([]() { node_test_stream out_nodes(out); AssertThat(out_nodes.can_pull(), Is().True()); // (8) - AssertThat(out_nodes.pull(), Is().EqualTo(node(4, node::MAX_ID, - node::ptr_t(false), - node::ptr_t(true)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(4, node::max_id, + node::pointer_type(false), + node::pointer_type(true)))); AssertThat(out_nodes.can_pull(), Is().True()); // (7) - AssertThat(out_nodes.pull(), Is().EqualTo(node(4, node::MAX_ID-1, - node::ptr_t(true), - node::ptr_t(false)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(4, node::max_id-1, + node::pointer_type(true), + node::pointer_type(false)))); AssertThat(out_nodes.can_pull(), Is().True()); // (5,6,8) - AssertThat(out_nodes.pull(), Is().EqualTo(node(3, node::MAX_ID, - node::ptr_t(true), - node::ptr_t(4, node::MAX_ID)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(3, node::max_id, + node::pointer_type(true), + node::pointer_type(4, node::max_id)))); AssertThat(out_nodes.can_pull(), Is().True()); // (5,6) - AssertThat(out_nodes.pull(), Is().EqualTo(node(3, node::MAX_ID-1, - node::ptr_t(4, node::MAX_ID-1), - node::ptr_t(4, node::MAX_ID)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(3, node::max_id-1, + node::pointer_type(4, node::max_id-1), + node::pointer_type(4, node::max_id)))); AssertThat(out_nodes.can_pull(), Is().True()); // (1) - AssertThat(out_nodes.pull(), Is().EqualTo(node(0, node::MAX_ID, - node::ptr_t(3, node::MAX_ID-1), - node::ptr_t(3, node::MAX_ID)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(0, node::max_id, + node::pointer_type(3, node::max_id-1), + node::pointer_type(3, node::max_id)))); AssertThat(out_nodes.can_pull(), Is().False()); @@ -1834,8 +1834,8 @@ go_bandit([]() { }); it("finishes during repeated transposition with variables 1 and 2 in BDD 12 [&&]", [&]() { - std::vector call_history; - bdd out = bdd_exists(bdd_13, [&call_history](const bdd::label_t x) -> bool { + std::vector call_history; + bdd out = bdd_exists(bdd_13, [&call_history](const bdd::label_type x) -> bool { call_history.push_back(x); return x < 2; }); @@ -1843,94 +1843,94 @@ go_bandit([]() { node_test_stream out_nodes(out); AssertThat(out_nodes.can_pull(), Is().True()); // (16) - AssertThat(out_nodes.pull(), Is().EqualTo(node(7, node::MAX_ID, - node::ptr_t(false), - node::ptr_t(true)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(7, node::max_id, + node::pointer_type(false), + node::pointer_type(true)))); AssertThat(out_nodes.can_pull(), Is().True()); // (15) - AssertThat(out_nodes.pull(), Is().EqualTo(node(6, node::MAX_ID, - node::ptr_t(false), - node::ptr_t(true)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(6, node::max_id, + node::pointer_type(false), + node::pointer_type(true)))); AssertThat(out_nodes.can_pull(), Is().True()); // (15,16) - AssertThat(out_nodes.pull(), Is().EqualTo(node(6, node::MAX_ID-1, - node::ptr_t(7, node::MAX_ID), - node::ptr_t(true)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(6, node::max_id-1, + node::pointer_type(7, node::max_id), + node::pointer_type(true)))); AssertThat(out_nodes.can_pull(), Is().True()); // (14) - AssertThat(out_nodes.pull(), Is().EqualTo(node(6, node::MAX_ID-2, - node::ptr_t(true), - node::ptr_t(false)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(6, node::max_id-2, + node::pointer_type(true), + node::pointer_type(false)))); AssertThat(out_nodes.can_pull(), Is().True()); // (14,16) - AssertThat(out_nodes.pull(), Is().EqualTo(node(6, node::MAX_ID-3, - node::ptr_t(true), - node::ptr_t(7, node::MAX_ID)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(6, node::max_id-3, + node::pointer_type(true), + node::pointer_type(7, node::max_id)))); AssertThat(out_nodes.can_pull(), Is().True()); // (13,15) - AssertThat(out_nodes.pull(), Is().EqualTo(node(5, node::MAX_ID, - node::ptr_t(6, node::MAX_ID), - node::ptr_t(true)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(5, node::max_id, + node::pointer_type(6, node::max_id), + node::pointer_type(true)))); AssertThat(out_nodes.can_pull(), Is().True()); // (13,15,16) - AssertThat(out_nodes.pull(), Is().EqualTo(node(5, node::MAX_ID-1, - node::ptr_t(6, node::MAX_ID-1), - node::ptr_t(true)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(5, node::max_id-1, + node::pointer_type(6, node::max_id-1), + node::pointer_type(true)))); AssertThat(out_nodes.can_pull(), Is().True()); // (13,14,16) - AssertThat(out_nodes.pull(), Is().EqualTo(node(5, node::MAX_ID-2, - node::ptr_t(6, node::MAX_ID-3), - node::ptr_t(true)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(5, node::max_id-2, + node::pointer_type(6, node::max_id-3), + node::pointer_type(true)))); AssertThat(out_nodes.can_pull(), Is().True()); // (12,15,16) - AssertThat(out_nodes.pull(), Is().EqualTo(node(5, node::MAX_ID-3, - node::ptr_t(true), - node::ptr_t(6, node::MAX_ID-1)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(5, node::max_id-3, + node::pointer_type(true), + node::pointer_type(6, node::max_id-1)))); AssertThat(out_nodes.can_pull(), Is().True()); // (12,14) - AssertThat(out_nodes.pull(), Is().EqualTo(node(5, node::MAX_ID-4, - node::ptr_t(true), - node::ptr_t(6, node::MAX_ID-2)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(5, node::max_id-4, + node::pointer_type(true), + node::pointer_type(6, node::max_id-2)))); AssertThat(out_nodes.can_pull(), Is().True()); // (12,14,16) - AssertThat(out_nodes.pull(), Is().EqualTo(node(5, node::MAX_ID-5, - node::ptr_t(true), - node::ptr_t(6, node::MAX_ID-3)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(5, node::max_id-5, + node::pointer_type(true), + node::pointer_type(6, node::max_id-3)))); AssertThat(out_nodes.can_pull(), Is().True()); // (9,11,16) - AssertThat(out_nodes.pull(), Is().EqualTo(node(4, node::MAX_ID, - node::ptr_t(5, node::MAX_ID-5), - node::ptr_t(5, node::MAX_ID-1)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(4, node::max_id, + node::pointer_type(5, node::max_id-5), + node::pointer_type(5, node::max_id-1)))); AssertThat(out_nodes.can_pull(), Is().True()); // (8,11,16) - AssertThat(out_nodes.pull(), Is().EqualTo(node(4, node::MAX_ID-1, - node::ptr_t(5, node::MAX_ID-3), - node::ptr_t(5, node::MAX_ID-2)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(4, node::max_id-1, + node::pointer_type(5, node::max_id-3), + node::pointer_type(5, node::max_id-2)))); AssertThat(out_nodes.can_pull(), Is().True()); // (9,10,16) - AssertThat(out_nodes.pull(), Is().EqualTo(node(4, node::MAX_ID-2, - node::ptr_t(5, node::MAX_ID-2), - node::ptr_t(5, node::MAX_ID-3)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(4, node::max_id-2, + node::pointer_type(5, node::max_id-2), + node::pointer_type(5, node::max_id-3)))); AssertThat(out_nodes.can_pull(), Is().True()); // (8,10) - AssertThat(out_nodes.pull(), Is().EqualTo(node(4, node::MAX_ID-3, - node::ptr_t(5, node::MAX_ID), - node::ptr_t(5, node::MAX_ID-4)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(4, node::max_id-3, + node::pointer_type(5, node::max_id), + node::pointer_type(5, node::max_id-4)))); AssertThat(out_nodes.can_pull(), Is().True()); // (6,7,9,16) - AssertThat(out_nodes.pull(), Is().EqualTo(node(3, node::MAX_ID, - node::ptr_t(4, node::MAX_ID-2), - node::ptr_t(4, node::MAX_ID)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(3, node::max_id, + node::pointer_type(4, node::max_id-2), + node::pointer_type(4, node::max_id)))); AssertThat(out_nodes.can_pull(), Is().True()); // (6,7,8) - AssertThat(out_nodes.pull(), Is().EqualTo(node(3, node::MAX_ID-1, - node::ptr_t(4, node::MAX_ID-3), - node::ptr_t(4, node::MAX_ID-1)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(3, node::max_id-1, + node::pointer_type(4, node::max_id-3), + node::pointer_type(4, node::max_id-1)))); AssertThat(out_nodes.can_pull(), Is().True()); // (4,5,6,7) - AssertThat(out_nodes.pull(), Is().EqualTo(node(2, node::MAX_ID, - node::ptr_t(3, node::MAX_ID-1), - node::ptr_t(3, node::MAX_ID)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(2, node::max_id, + node::pointer_type(3, node::max_id-1), + node::pointer_type(3, node::max_id)))); AssertThat(out_nodes.can_pull(), Is().False()); @@ -2001,8 +2001,8 @@ go_bandit([]() { }); it("quantifies exploding BDD 15", [&]() { - std::vector call_history; - bdd out = bdd_exists(bdd_15, [&call_history](const bdd::label_t x) -> bool { + std::vector call_history; + bdd out = bdd_exists(bdd_15, [&call_history](const bdd::label_type x) -> bool { call_history.push_back(x); return x < 2; }); @@ -2010,157 +2010,157 @@ go_bandit([]() { node_test_stream out_nodes(out); AssertThat(out_nodes.can_pull(), Is().True()); // (o) - AssertThat(out_nodes.pull(), Is().EqualTo(node(13, node::MAX_ID, - node::ptr_t(false), - node::ptr_t(true)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(13, node::max_id, + node::pointer_type(false), + node::pointer_type(true)))); AssertThat(out_nodes.can_pull(), Is().True()); // (n) - AssertThat(out_nodes.pull(), Is().EqualTo(node(13, node::MAX_ID-1, - node::ptr_t(true), - node::ptr_t(false)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(13, node::max_id-1, + node::pointer_type(true), + node::pointer_type(false)))); AssertThat(out_nodes.can_pull(), Is().True()); // (17,o) - AssertThat(out_nodes.pull(), Is().EqualTo(node(12, node::MAX_ID, - node::ptr_t(13, node::MAX_ID), - node::ptr_t(true)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(12, node::max_id, + node::pointer_type(13, node::max_id), + node::pointer_type(true)))); AssertThat(out_nodes.can_pull(), Is().True()); // (17,n) - AssertThat(out_nodes.pull(), Is().EqualTo(node(12, node::MAX_ID-1, - node::ptr_t(13, node::MAX_ID-1), - node::ptr_t(true)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(12, node::max_id-1, + node::pointer_type(13, node::max_id-1), + node::pointer_type(true)))); AssertThat(out_nodes.can_pull(), Is().True()); // (16,o) - AssertThat(out_nodes.pull(), Is().EqualTo(node(12, node::MAX_ID-2, - node::ptr_t(true), - node::ptr_t(13, node::MAX_ID)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(12, node::max_id-2, + node::pointer_type(true), + node::pointer_type(13, node::max_id)))); AssertThat(out_nodes.can_pull(), Is().True()); // (16,n) - AssertThat(out_nodes.pull(), Is().EqualTo(node(12, node::MAX_ID-3, - node::ptr_t(true), - node::ptr_t(13, node::MAX_ID-1)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(12, node::max_id-3, + node::pointer_type(true), + node::pointer_type(13, node::max_id-1)))); AssertThat(out_nodes.can_pull(), Is().True()); // (14,l) - AssertThat(out_nodes.pull(), Is().EqualTo(node(11, node::MAX_ID, - node::ptr_t(12, node::MAX_ID-3), - node::ptr_t(12, node::MAX_ID)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(11, node::max_id, + node::pointer_type(12, node::max_id-3), + node::pointer_type(12, node::max_id)))); AssertThat(out_nodes.can_pull(), Is().True()); // (14,m) - AssertThat(out_nodes.pull(), Is().EqualTo(node(11, node::MAX_ID-1, - node::ptr_t(12, node::MAX_ID-2), - node::ptr_t(12, node::MAX_ID-1)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(11, node::max_id-1, + node::pointer_type(12, node::max_id-2), + node::pointer_type(12, node::max_id-1)))); AssertThat(out_nodes.can_pull(), Is().True()); // (15,l) - AssertThat(out_nodes.pull(), Is().EqualTo(node(11, node::MAX_ID-2, - node::ptr_t(12, node::MAX_ID-1), - node::ptr_t(12, node::MAX_ID-2)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(11, node::max_id-2, + node::pointer_type(12, node::max_id-1), + node::pointer_type(12, node::max_id-2)))); AssertThat(out_nodes.can_pull(), Is().True()); // (15,m) - AssertThat(out_nodes.pull(), Is().EqualTo(node(11, node::MAX_ID-3, - node::ptr_t(12, node::MAX_ID), - node::ptr_t(12, node::MAX_ID-3)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(11, node::max_id-3, + node::pointer_type(12, node::max_id), + node::pointer_type(12, node::max_id-3)))); AssertThat(out_nodes.can_pull(), Is().True()); // (13,k) - AssertThat(out_nodes.pull(), Is().EqualTo(node(10, node::MAX_ID, - node::ptr_t(11, node::MAX_ID-3), - node::ptr_t(11, node::MAX_ID)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(10, node::max_id, + node::pointer_type(11, node::max_id-3), + node::pointer_type(11, node::max_id)))); AssertThat(out_nodes.can_pull(), Is().True()); // (13,j) - AssertThat(out_nodes.pull(), Is().EqualTo(node(10, node::MAX_ID-1, - node::ptr_t(11, node::MAX_ID-2), - node::ptr_t(11, node::MAX_ID-1)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(10, node::max_id-1, + node::pointer_type(11, node::max_id-2), + node::pointer_type(11, node::max_id-1)))); AssertThat(out_nodes.can_pull(), Is().True()); // (12,k) - AssertThat(out_nodes.pull(), Is().EqualTo(node(10, node::MAX_ID-2, - node::ptr_t(11, node::MAX_ID-1), - node::ptr_t(11, node::MAX_ID-2)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(10, node::max_id-2, + node::pointer_type(11, node::max_id-1), + node::pointer_type(11, node::max_id-2)))); AssertThat(out_nodes.can_pull(), Is().True()); // (12,j) - AssertThat(out_nodes.pull(), Is().EqualTo(node(10, node::MAX_ID-3, - node::ptr_t(11, node::MAX_ID), - node::ptr_t(11, node::MAX_ID-3)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(10, node::max_id-3, + node::pointer_type(11, node::max_id), + node::pointer_type(11, node::max_id-3)))); AssertThat(out_nodes.can_pull(), Is().True()); // (10,h) - AssertThat(out_nodes.pull(), Is().EqualTo(node(9, node::MAX_ID, - node::ptr_t(10, node::MAX_ID-3), - node::ptr_t(10, node::MAX_ID)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(9, node::max_id, + node::pointer_type(10, node::max_id-3), + node::pointer_type(10, node::max_id)))); AssertThat(out_nodes.can_pull(), Is().True()); // (10,i) - AssertThat(out_nodes.pull(), Is().EqualTo(node(9, node::MAX_ID-1, - node::ptr_t(10, node::MAX_ID-2), - node::ptr_t(10, node::MAX_ID-1)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(9, node::max_id-1, + node::pointer_type(10, node::max_id-2), + node::pointer_type(10, node::max_id-1)))); AssertThat(out_nodes.can_pull(), Is().True()); // (11,h) - AssertThat(out_nodes.pull(), Is().EqualTo(node(9, node::MAX_ID-2, - node::ptr_t(10, node::MAX_ID-1), - node::ptr_t(10, node::MAX_ID-2)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(9, node::max_id-2, + node::pointer_type(10, node::max_id-1), + node::pointer_type(10, node::max_id-2)))); AssertThat(out_nodes.can_pull(), Is().True()); // (11,i) - AssertThat(out_nodes.pull(), Is().EqualTo(node(9, node::MAX_ID-3, - node::ptr_t(10, node::MAX_ID), - node::ptr_t(10, node::MAX_ID-3)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(9, node::max_id-3, + node::pointer_type(10, node::max_id), + node::pointer_type(10, node::max_id-3)))); AssertThat(out_nodes.can_pull(), Is().True()); // (9,g) - AssertThat(out_nodes.pull(), Is().EqualTo(node(8, node::MAX_ID, - node::ptr_t(9, node::MAX_ID-3), - node::ptr_t(9, node::MAX_ID)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(8, node::max_id, + node::pointer_type(9, node::max_id-3), + node::pointer_type(9, node::max_id)))); AssertThat(out_nodes.can_pull(), Is().True()); // (8,g) - AssertThat(out_nodes.pull(), Is().EqualTo(node(8, node::MAX_ID-1, - node::ptr_t(9, node::MAX_ID-1), - node::ptr_t(9, node::MAX_ID-2)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(8, node::max_id-1, + node::pointer_type(9, node::max_id-1), + node::pointer_type(9, node::max_id-2)))); AssertThat(out_nodes.can_pull(), Is().True()); // (8,f) - AssertThat(out_nodes.pull(), Is().EqualTo(node(8, node::MAX_ID-2, - node::ptr_t(9, node::MAX_ID), - node::ptr_t(9, node::MAX_ID-3)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(8, node::max_id-2, + node::pointer_type(9, node::max_id), + node::pointer_type(9, node::max_id-3)))); // NOTE: (9,f) because the pair (7,f) is is merged with (8) which // prunes that entire subtree away. AssertThat(out_nodes.can_pull(), Is().True()); // (7,8,f) - AssertThat(out_nodes.pull(), Is().EqualTo(node(7, node::MAX_ID, - node::ptr_t(8, node::MAX_ID-2), - node::ptr_t(true)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(7, node::max_id, + node::pointer_type(8, node::max_id-2), + node::pointer_type(true)))); AssertThat(out_nodes.can_pull(), Is().True()); // (7,g,9) - AssertThat(out_nodes.pull(), Is().EqualTo(node(7, node::MAX_ID-1, - node::ptr_t(true), - node::ptr_t(8, node::MAX_ID)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(7, node::max_id-1, + node::pointer_type(true), + node::pointer_type(8, node::max_id)))); AssertThat(out_nodes.can_pull(), Is().True()); // (7,g) - AssertThat(out_nodes.pull(), Is().EqualTo(node(7, node::MAX_ID-2, - node::ptr_t(8, node::MAX_ID-1), - node::ptr_t(8, node::MAX_ID)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(7, node::max_id-2, + node::pointer_type(8, node::max_id-1), + node::pointer_type(8, node::max_id)))); AssertThat(out_nodes.can_pull(), Is().True()); // (6,5,d) - AssertThat(out_nodes.pull(), Is().EqualTo(node(6, node::MAX_ID, - node::ptr_t(7, node::MAX_ID), - node::ptr_t(7, node::MAX_ID-1)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(6, node::max_id, + node::pointer_type(7, node::max_id), + node::pointer_type(7, node::max_id-1)))); AssertThat(out_nodes.can_pull(), Is().True()); // (5,d) - AssertThat(out_nodes.pull(), Is().EqualTo(node(6, node::MAX_ID-1, - node::ptr_t(8, node::MAX_ID-2), - node::ptr_t(7, node::MAX_ID-2)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(6, node::max_id-1, + node::pointer_type(8, node::max_id-2), + node::pointer_type(7, node::max_id-2)))); AssertThat(out_nodes.can_pull(), Is().True()); // (4,5,d) - AssertThat(out_nodes.pull(), Is().EqualTo(node(5, node::MAX_ID, - node::ptr_t(6, node::MAX_ID-1), - node::ptr_t(6, node::MAX_ID)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(5, node::max_id, + node::pointer_type(6, node::max_id-1), + node::pointer_type(6, node::max_id)))); AssertThat(out_nodes.can_pull(), Is().True()); // (3,5,d) - AssertThat(out_nodes.pull(), Is().EqualTo(node(4, node::MAX_ID, - node::ptr_t(5, node::MAX_ID), - node::ptr_t(6, node::MAX_ID-1)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(4, node::max_id, + node::pointer_type(5, node::max_id), + node::pointer_type(6, node::max_id-1)))); AssertThat(out_nodes.can_pull(), Is().True()); // (2,5,d) - AssertThat(out_nodes.pull(), Is().EqualTo(node(4, node::MAX_ID-1, - node::ptr_t(6, node::MAX_ID-1), - node::ptr_t(5, node::MAX_ID)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(4, node::max_id-1, + node::pointer_type(6, node::max_id-1), + node::pointer_type(5, node::max_id)))); AssertThat(out_nodes.can_pull(), Is().True()); // (1,5,d) - AssertThat(out_nodes.pull(), Is().EqualTo(node(3, node::MAX_ID, - node::ptr_t(4, node::MAX_ID-1), - node::ptr_t(4, node::MAX_ID)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(3, node::max_id, + node::pointer_type(4, node::max_id-1), + node::pointer_type(4, node::max_id)))); // NOTE: The root (1,a,5,d) has x2 suppressed as the choice at (a) // only is relevant for (b) and (c), not for (d). @@ -2266,16 +2266,16 @@ go_bandit([]() { AssertThat(call_history.at(41), Is().EqualTo(13u)); }); - quantify_mode = quantify_mode_t::AUTO; + quantify_mode = quantify_mode_t::Auto; }); - describe("quantify_mode == NESTED", [&]() { - quantify_mode = quantify_mode_t::NESTED; + describe("quantify_mode == Nested", [&]() { + quantify_mode = quantify_mode_t::Nested; it("quantifies odd variables in BDD 4", [&]() { - std::vector call_history; + std::vector call_history; - bdd out = bdd_exists(bdd_4, [&call_history](const bdd::label_t x) -> bool { + bdd out = bdd_exists(bdd_4, [&call_history](const bdd::label_type x) -> bool { call_history.push_back(x); return x % 2; }); @@ -2283,13 +2283,13 @@ go_bandit([]() { node_test_stream out_nodes(out); AssertThat(out_nodes.can_pull(), Is().True()); // (3) - AssertThat(out_nodes.pull(), Is().EqualTo(node(2, node::MAX_ID, + AssertThat(out_nodes.pull(), Is().EqualTo(node(2, node::max_id, ptr_uint64(false), ptr_uint64(true)))); AssertThat(out_nodes.can_pull(), Is().True()); // (1) - AssertThat(out_nodes.pull(), Is().EqualTo(node(0, node::MAX_ID, - ptr_uint64(2, ptr_uint64::MAX_ID), + AssertThat(out_nodes.pull(), Is().EqualTo(node(0, node::max_id, + ptr_uint64(2, ptr_uint64::max_id), ptr_uint64(true)))); AssertThat(out_nodes.can_pull(), Is().False()); @@ -2324,7 +2324,7 @@ go_bandit([]() { }); it("quantifies odd variables in BDD 1", [&]() { - bdd out = bdd_exists(bdd_1, [](const bdd::label_t x) -> bool { + bdd out = bdd_exists(bdd_1, [](const bdd::label_type x) -> bool { return x % 2; }); @@ -2343,7 +2343,7 @@ go_bandit([]() { }); it("quantifies with always-true predicate in BDD 4 [&&]", [&]() { - bdd out = bdd_exists(bdd_4, [](const bdd::label_t) -> bool { + bdd out = bdd_exists(bdd_4, [](const bdd::label_type) -> bool { return true; }); @@ -2360,26 +2360,26 @@ go_bandit([]() { }); it("bails out on a level that only shortcuts", [&bdd_9T]() { - bdd out = bdd_exists(bdd_9T, [](const bdd::label_t x) -> bool { + bdd out = bdd_exists(bdd_9T, [](const bdd::label_type x) -> bool { return !(x % 2); }); node_test_stream out_nodes(out); AssertThat(out_nodes.can_pull(), Is().True()); // (7') - AssertThat(out_nodes.pull(), Is().EqualTo(node(5, node::MAX_ID, + AssertThat(out_nodes.pull(), Is().EqualTo(node(5, node::max_id, ptr_uint64(false), ptr_uint64(true)))); AssertThat(out_nodes.can_pull(), Is().True()); // (5') - AssertThat(out_nodes.pull(), Is().EqualTo(node(3, node::MAX_ID, - ptr_uint64(5, node::MAX_ID), + AssertThat(out_nodes.pull(), Is().EqualTo(node(3, node::max_id, + ptr_uint64(5, node::max_id), ptr_uint64(true)))); AssertThat(out_nodes.can_pull(), Is().True()); // (1') - AssertThat(out_nodes.pull(), Is().EqualTo(node(1, node::MAX_ID, + AssertThat(out_nodes.pull(), Is().EqualTo(node(1, node::max_id, ptr_uint64(true), - ptr_uint64(3, node::MAX_ID)))); + ptr_uint64(3, node::max_id)))); AssertThat(out_nodes.can_pull(), Is().False()); @@ -2400,20 +2400,20 @@ go_bandit([]() { }); it("bails out on a level that only is irrelevant", [&bdd_9F]() { - bdd out = bdd_exists(bdd_9F, [](const bdd::label_t x) -> bool { + bdd out = bdd_exists(bdd_9F, [](const bdd::label_type x) -> bool { return !(x % 2); }); node_test_stream out_nodes(out); AssertThat(out_nodes.can_pull(), Is().True()); // (7') - AssertThat(out_nodes.pull(), Is().EqualTo(node(5, node::MAX_ID, + AssertThat(out_nodes.pull(), Is().EqualTo(node(5, node::max_id, ptr_uint64(false), ptr_uint64(true)))); AssertThat(out_nodes.can_pull(), Is().True()); // (5') - AssertThat(out_nodes.pull(), Is().EqualTo(node(3, node::MAX_ID, - ptr_uint64(5, node::MAX_ID), + AssertThat(out_nodes.pull(), Is().EqualTo(node(3, node::max_id, + ptr_uint64(5, node::max_id), ptr_uint64(true)))); AssertThat(out_nodes.can_pull(), Is().False()); @@ -2432,7 +2432,7 @@ go_bandit([]() { }); it("bails out on a level that both shortcuts and is irrelevant", [&bdd_6_x4T]() { - bdd out = bdd_exists(bdd_6_x4T, [](const bdd::label_t x) -> bool { + bdd out = bdd_exists(bdd_6_x4T, [](const bdd::label_type x) -> bool { return x == 4 || x == 2 || x == 1; }); @@ -2452,8 +2452,8 @@ go_bandit([]() { }); it("kills intermediate dead partial solution", [&bdd_10]() { - std::vector call_history; - bdd out = bdd_exists(bdd_10, [&call_history](const bdd::label_t x) -> bool { + std::vector call_history; + bdd out = bdd_exists(bdd_10, [&call_history](const bdd::label_type x) -> bool { call_history.push_back(x); return x == 3 || x == 2; }); @@ -2461,7 +2461,7 @@ go_bandit([]() { node_test_stream out_nodes(out); AssertThat(out_nodes.can_pull(), Is().True()); // (1) - AssertThat(out_nodes.pull(), Is().EqualTo(node(0, node::MAX_ID, + AssertThat(out_nodes.pull(), Is().EqualTo(node(0, node::max_id, ptr_uint64(false), ptr_uint64(true)))); @@ -2496,7 +2496,7 @@ go_bandit([]() { }); it("kills intermediate dead partial solutions multiple times", [&]() { - bdd::label_t var = 7; + bdd::label_type var = 7; /* expected // @@ -2511,8 +2511,8 @@ go_bandit([]() { // | // T */ - bdd out = bdd_exists(bdd_6, [&var]() -> bdd::label_t { - const bdd::label_t ret = var; + bdd out = bdd_exists(bdd_6, [&var]() -> bdd::label_type { + const bdd::label_type ret = var; var -= 2; return ret; }); @@ -2532,162 +2532,162 @@ go_bandit([]() { }); it("quantifies exploding BDD 15", [&]() { - bdd out = bdd_exists(bdd_15, [](const bdd::label_t x) -> bool { return x < 2; }); + bdd out = bdd_exists(bdd_15, [](const bdd::label_type x) -> bool { return x < 2; }); node_test_stream out_nodes(out); AssertThat(out_nodes.can_pull(), Is().True()); // (o) - AssertThat(out_nodes.pull(), Is().EqualTo(node(13, node::MAX_ID, - node::ptr_t(false), - node::ptr_t(true)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(13, node::max_id, + node::pointer_type(false), + node::pointer_type(true)))); AssertThat(out_nodes.can_pull(), Is().True()); // (n) - AssertThat(out_nodes.pull(), Is().EqualTo(node(13, node::MAX_ID-1, - node::ptr_t(true), - node::ptr_t(false)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(13, node::max_id-1, + node::pointer_type(true), + node::pointer_type(false)))); AssertThat(out_nodes.can_pull(), Is().True()); // (17,o) - AssertThat(out_nodes.pull(), Is().EqualTo(node(12, node::MAX_ID, - node::ptr_t(13, node::MAX_ID), - node::ptr_t(true)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(12, node::max_id, + node::pointer_type(13, node::max_id), + node::pointer_type(true)))); AssertThat(out_nodes.can_pull(), Is().True()); // (17,n) - AssertThat(out_nodes.pull(), Is().EqualTo(node(12, node::MAX_ID-1, - node::ptr_t(13, node::MAX_ID-1), - node::ptr_t(true)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(12, node::max_id-1, + node::pointer_type(13, node::max_id-1), + node::pointer_type(true)))); AssertThat(out_nodes.can_pull(), Is().True()); // (16,o) - AssertThat(out_nodes.pull(), Is().EqualTo(node(12, node::MAX_ID-2, - node::ptr_t(true), - node::ptr_t(13, node::MAX_ID)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(12, node::max_id-2, + node::pointer_type(true), + node::pointer_type(13, node::max_id)))); AssertThat(out_nodes.can_pull(), Is().True()); // (16,n) - AssertThat(out_nodes.pull(), Is().EqualTo(node(12, node::MAX_ID-3, - node::ptr_t(true), - node::ptr_t(13, node::MAX_ID-1)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(12, node::max_id-3, + node::pointer_type(true), + node::pointer_type(13, node::max_id-1)))); AssertThat(out_nodes.can_pull(), Is().True()); // (14,l) - AssertThat(out_nodes.pull(), Is().EqualTo(node(11, node::MAX_ID, - node::ptr_t(12, node::MAX_ID-3), - node::ptr_t(12, node::MAX_ID)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(11, node::max_id, + node::pointer_type(12, node::max_id-3), + node::pointer_type(12, node::max_id)))); AssertThat(out_nodes.can_pull(), Is().True()); // (14,m) - AssertThat(out_nodes.pull(), Is().EqualTo(node(11, node::MAX_ID-1, - node::ptr_t(12, node::MAX_ID-2), - node::ptr_t(12, node::MAX_ID-1)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(11, node::max_id-1, + node::pointer_type(12, node::max_id-2), + node::pointer_type(12, node::max_id-1)))); AssertThat(out_nodes.can_pull(), Is().True()); // (15,l) - AssertThat(out_nodes.pull(), Is().EqualTo(node(11, node::MAX_ID-2, - node::ptr_t(12, node::MAX_ID-1), - node::ptr_t(12, node::MAX_ID-2)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(11, node::max_id-2, + node::pointer_type(12, node::max_id-1), + node::pointer_type(12, node::max_id-2)))); AssertThat(out_nodes.can_pull(), Is().True()); // (15,m) - AssertThat(out_nodes.pull(), Is().EqualTo(node(11, node::MAX_ID-3, - node::ptr_t(12, node::MAX_ID), - node::ptr_t(12, node::MAX_ID-3)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(11, node::max_id-3, + node::pointer_type(12, node::max_id), + node::pointer_type(12, node::max_id-3)))); AssertThat(out_nodes.can_pull(), Is().True()); // (13,k) - AssertThat(out_nodes.pull(), Is().EqualTo(node(10, node::MAX_ID, - node::ptr_t(11, node::MAX_ID-3), - node::ptr_t(11, node::MAX_ID)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(10, node::max_id, + node::pointer_type(11, node::max_id-3), + node::pointer_type(11, node::max_id)))); AssertThat(out_nodes.can_pull(), Is().True()); // (13,j) - AssertThat(out_nodes.pull(), Is().EqualTo(node(10, node::MAX_ID-1, - node::ptr_t(11, node::MAX_ID-2), - node::ptr_t(11, node::MAX_ID-1)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(10, node::max_id-1, + node::pointer_type(11, node::max_id-2), + node::pointer_type(11, node::max_id-1)))); AssertThat(out_nodes.can_pull(), Is().True()); // (12,k) - AssertThat(out_nodes.pull(), Is().EqualTo(node(10, node::MAX_ID-2, - node::ptr_t(11, node::MAX_ID-1), - node::ptr_t(11, node::MAX_ID-2)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(10, node::max_id-2, + node::pointer_type(11, node::max_id-1), + node::pointer_type(11, node::max_id-2)))); AssertThat(out_nodes.can_pull(), Is().True()); // (12,j) - AssertThat(out_nodes.pull(), Is().EqualTo(node(10, node::MAX_ID-3, - node::ptr_t(11, node::MAX_ID), - node::ptr_t(11, node::MAX_ID-3)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(10, node::max_id-3, + node::pointer_type(11, node::max_id), + node::pointer_type(11, node::max_id-3)))); AssertThat(out_nodes.can_pull(), Is().True()); // (10,h) - AssertThat(out_nodes.pull(), Is().EqualTo(node(9, node::MAX_ID, - node::ptr_t(10, node::MAX_ID-3), - node::ptr_t(10, node::MAX_ID)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(9, node::max_id, + node::pointer_type(10, node::max_id-3), + node::pointer_type(10, node::max_id)))); AssertThat(out_nodes.can_pull(), Is().True()); // (10,i) - AssertThat(out_nodes.pull(), Is().EqualTo(node(9, node::MAX_ID-1, - node::ptr_t(10, node::MAX_ID-2), - node::ptr_t(10, node::MAX_ID-1)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(9, node::max_id-1, + node::pointer_type(10, node::max_id-2), + node::pointer_type(10, node::max_id-1)))); AssertThat(out_nodes.can_pull(), Is().True()); // (11,h) - AssertThat(out_nodes.pull(), Is().EqualTo(node(9, node::MAX_ID-2, - node::ptr_t(10, node::MAX_ID-1), - node::ptr_t(10, node::MAX_ID-2)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(9, node::max_id-2, + node::pointer_type(10, node::max_id-1), + node::pointer_type(10, node::max_id-2)))); AssertThat(out_nodes.can_pull(), Is().True()); // (11,i) - AssertThat(out_nodes.pull(), Is().EqualTo(node(9, node::MAX_ID-3, - node::ptr_t(10, node::MAX_ID), - node::ptr_t(10, node::MAX_ID-3)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(9, node::max_id-3, + node::pointer_type(10, node::max_id), + node::pointer_type(10, node::max_id-3)))); AssertThat(out_nodes.can_pull(), Is().True()); // (9,g) - AssertThat(out_nodes.pull(), Is().EqualTo(node(8, node::MAX_ID, - node::ptr_t(9, node::MAX_ID-3), - node::ptr_t(9, node::MAX_ID)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(8, node::max_id, + node::pointer_type(9, node::max_id-3), + node::pointer_type(9, node::max_id)))); AssertThat(out_nodes.can_pull(), Is().True()); // (8,g) - AssertThat(out_nodes.pull(), Is().EqualTo(node(8, node::MAX_ID-1, - node::ptr_t(9, node::MAX_ID-1), - node::ptr_t(9, node::MAX_ID-2)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(8, node::max_id-1, + node::pointer_type(9, node::max_id-1), + node::pointer_type(9, node::max_id-2)))); AssertThat(out_nodes.can_pull(), Is().True()); // (8,f) - AssertThat(out_nodes.pull(), Is().EqualTo(node(8, node::MAX_ID-2, - node::ptr_t(9, node::MAX_ID), - node::ptr_t(9, node::MAX_ID-3)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(8, node::max_id-2, + node::pointer_type(9, node::max_id), + node::pointer_type(9, node::max_id-3)))); // NOTE: (9,f) because the pair (7,f) is is merged with (8) which // prunes that entire subtree away. AssertThat(out_nodes.can_pull(), Is().True()); // (7,8,f) - AssertThat(out_nodes.pull(), Is().EqualTo(node(7, node::MAX_ID, - node::ptr_t(8, node::MAX_ID-2), - node::ptr_t(true)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(7, node::max_id, + node::pointer_type(8, node::max_id-2), + node::pointer_type(true)))); AssertThat(out_nodes.can_pull(), Is().True()); // (7,g,9) - AssertThat(out_nodes.pull(), Is().EqualTo(node(7, node::MAX_ID-1, - node::ptr_t(true), - node::ptr_t(8, node::MAX_ID)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(7, node::max_id-1, + node::pointer_type(true), + node::pointer_type(8, node::max_id)))); AssertThat(out_nodes.can_pull(), Is().True()); // (7,g) - AssertThat(out_nodes.pull(), Is().EqualTo(node(7, node::MAX_ID-2, - node::ptr_t(8, node::MAX_ID-1), - node::ptr_t(8, node::MAX_ID)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(7, node::max_id-2, + node::pointer_type(8, node::max_id-1), + node::pointer_type(8, node::max_id)))); AssertThat(out_nodes.can_pull(), Is().True()); // (6,5,d) - AssertThat(out_nodes.pull(), Is().EqualTo(node(6, node::MAX_ID, - node::ptr_t(7, node::MAX_ID), - node::ptr_t(7, node::MAX_ID-1)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(6, node::max_id, + node::pointer_type(7, node::max_id), + node::pointer_type(7, node::max_id-1)))); AssertThat(out_nodes.can_pull(), Is().True()); // (5,d) - AssertThat(out_nodes.pull(), Is().EqualTo(node(6, node::MAX_ID-1, - node::ptr_t(8, node::MAX_ID-2), - node::ptr_t(7, node::MAX_ID-2)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(6, node::max_id-1, + node::pointer_type(8, node::max_id-2), + node::pointer_type(7, node::max_id-2)))); AssertThat(out_nodes.can_pull(), Is().True()); // (4,5,d) - AssertThat(out_nodes.pull(), Is().EqualTo(node(5, node::MAX_ID, - node::ptr_t(6, node::MAX_ID-1), - node::ptr_t(6, node::MAX_ID)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(5, node::max_id, + node::pointer_type(6, node::max_id-1), + node::pointer_type(6, node::max_id)))); AssertThat(out_nodes.can_pull(), Is().True()); // (3,5,d) - AssertThat(out_nodes.pull(), Is().EqualTo(node(4, node::MAX_ID, - node::ptr_t(5, node::MAX_ID), - node::ptr_t(6, node::MAX_ID-1)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(4, node::max_id, + node::pointer_type(5, node::max_id), + node::pointer_type(6, node::max_id-1)))); AssertThat(out_nodes.can_pull(), Is().True()); // (2,5,d) - AssertThat(out_nodes.pull(), Is().EqualTo(node(4, node::MAX_ID-1, - node::ptr_t(6, node::MAX_ID-1), - node::ptr_t(5, node::MAX_ID)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(4, node::max_id-1, + node::pointer_type(6, node::max_id-1), + node::pointer_type(5, node::max_id)))); AssertThat(out_nodes.can_pull(), Is().True()); // (1,5,d) - AssertThat(out_nodes.pull(), Is().EqualTo(node(3, node::MAX_ID, - node::ptr_t(4, node::MAX_ID-1), - node::ptr_t(4, node::MAX_ID)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(3, node::max_id, + node::pointer_type(4, node::max_id-1), + node::pointer_type(4, node::max_id)))); // NOTE: The root (1,a,5,d) has x2 suppressed as the choice at (a) // only is relevant for (b) and (c), not for (d). @@ -2736,15 +2736,15 @@ go_bandit([]() { // TODO: meta variables... }); - quantify_mode = quantify_mode_t::AUTO; + quantify_mode = quantify_mode_t::Auto; }); - describe("quantify_mode == AUTO", [&]() { - quantify_mode = quantify_mode_t::AUTO; + describe("quantify_mode == Auto", [&]() { + quantify_mode = quantify_mode_t::Auto; it("collapses during initial transposition of all variables in BDD 4 [&&]", [&]() { - std::vector call_history; - bdd out = bdd_exists(bdd_4, [&call_history](const bdd::label_t x) -> bool { + std::vector call_history; + bdd out = bdd_exists(bdd_4, [&call_history](const bdd::label_type x) -> bool { call_history.push_back(x); return true; }); @@ -2785,10 +2785,10 @@ go_bandit([]() { }); it("finishes during initial transposition of even variables in BDD 4 [const &]", [&]() { - std::vector call_history; + std::vector call_history; const bdd in = bdd_4; - const bdd out = bdd_exists(in, [&call_history](const bdd::label_t x) -> bool { + const bdd out = bdd_exists(in, [&call_history](const bdd::label_type x) -> bool { call_history.push_back(x); return !(x % 2); }); @@ -2796,13 +2796,13 @@ go_bandit([]() { node_test_stream out_nodes(out); AssertThat(out_nodes.can_pull(), Is().True()); // (5) - AssertThat(out_nodes.pull(), Is().EqualTo(node(3, node::MAX_ID, + AssertThat(out_nodes.pull(), Is().EqualTo(node(3, node::max_id, ptr_uint64(false), ptr_uint64(true)))); AssertThat(out_nodes.can_pull(), Is().True()); // (2') - AssertThat(out_nodes.pull(), Is().EqualTo(node(1, node::MAX_ID, - ptr_uint64(3, ptr_uint64::MAX_ID), + AssertThat(out_nodes.pull(), Is().EqualTo(node(1, node::max_id, + ptr_uint64(3, ptr_uint64::max_id), ptr_uint64(true)))); AssertThat(out_nodes.can_pull(), Is().False()); @@ -2846,8 +2846,8 @@ go_bandit([]() { }); it("collapses during repeated transposition with variables 1 2 variables in BDD 11a [&&]", [&]() { - std::vector call_history; - bdd out = bdd_exists(bdd_12a, [&call_history](const bdd::label_t x) -> bool { + std::vector call_history; + bdd out = bdd_exists(bdd_12a, [&call_history](const bdd::label_type x) -> bool { call_history.push_back(x); return 0 < x && x < 3; }); @@ -2901,8 +2901,8 @@ go_bandit([]() { }); it("finishes during repeated transposition with variables 1 and 2 in BDD 11b [&&]", [&]() { - std::vector call_history; - bdd out = bdd_exists(bdd_12b, [&call_history](const bdd::label_t x) -> bool { + std::vector call_history; + bdd out = bdd_exists(bdd_12b, [&call_history](const bdd::label_type x) -> bool { call_history.push_back(x); return 0 < x && x < 3; }); @@ -2929,29 +2929,29 @@ go_bandit([]() { node_test_stream out_nodes(out); AssertThat(out_nodes.can_pull(), Is().True()); // (8) - AssertThat(out_nodes.pull(), Is().EqualTo(node(4, node::MAX_ID, - node::ptr_t(false), - node::ptr_t(true)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(4, node::max_id, + node::pointer_type(false), + node::pointer_type(true)))); AssertThat(out_nodes.can_pull(), Is().True()); // (7) - AssertThat(out_nodes.pull(), Is().EqualTo(node(4, node::MAX_ID-1, - node::ptr_t(true), - node::ptr_t(false)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(4, node::max_id-1, + node::pointer_type(true), + node::pointer_type(false)))); AssertThat(out_nodes.can_pull(), Is().True()); // (5,6,8) - AssertThat(out_nodes.pull(), Is().EqualTo(node(3, node::MAX_ID, - node::ptr_t(true), - node::ptr_t(4, node::MAX_ID)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(3, node::max_id, + node::pointer_type(true), + node::pointer_type(4, node::max_id)))); AssertThat(out_nodes.can_pull(), Is().True()); // (5,6) - AssertThat(out_nodes.pull(), Is().EqualTo(node(3, node::MAX_ID-1, - node::ptr_t(4, node::MAX_ID-1), - node::ptr_t(4, node::MAX_ID)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(3, node::max_id-1, + node::pointer_type(4, node::max_id-1), + node::pointer_type(4, node::max_id)))); AssertThat(out_nodes.can_pull(), Is().True()); // (1) - AssertThat(out_nodes.pull(), Is().EqualTo(node(0, node::MAX_ID, - node::ptr_t(3, node::MAX_ID-1), - node::ptr_t(3, node::MAX_ID)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(0, node::max_id, + node::pointer_type(3, node::max_id-1), + node::pointer_type(3, node::max_id)))); AssertThat(out_nodes.can_pull(), Is().False()); @@ -3010,8 +3010,8 @@ go_bandit([]() { }); it("finishes during repeated transposition with variables 1 and 2 in BDD 12 [&&]", [&]() { - std::vector call_history; - bdd out = bdd_exists(bdd_13, [&call_history](const bdd::label_t x) -> bool { + std::vector call_history; + bdd out = bdd_exists(bdd_13, [&call_history](const bdd::label_type x) -> bool { call_history.push_back(x); return x < 2; }); @@ -3019,94 +3019,94 @@ go_bandit([]() { node_test_stream out_nodes(out); AssertThat(out_nodes.can_pull(), Is().True()); // (16) - AssertThat(out_nodes.pull(), Is().EqualTo(node(7, node::MAX_ID, - node::ptr_t(false), - node::ptr_t(true)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(7, node::max_id, + node::pointer_type(false), + node::pointer_type(true)))); AssertThat(out_nodes.can_pull(), Is().True()); // (15) - AssertThat(out_nodes.pull(), Is().EqualTo(node(6, node::MAX_ID, - node::ptr_t(false), - node::ptr_t(true)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(6, node::max_id, + node::pointer_type(false), + node::pointer_type(true)))); AssertThat(out_nodes.can_pull(), Is().True()); // (15,16) - AssertThat(out_nodes.pull(), Is().EqualTo(node(6, node::MAX_ID-1, - node::ptr_t(7, node::MAX_ID), - node::ptr_t(true)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(6, node::max_id-1, + node::pointer_type(7, node::max_id), + node::pointer_type(true)))); AssertThat(out_nodes.can_pull(), Is().True()); // (14) - AssertThat(out_nodes.pull(), Is().EqualTo(node(6, node::MAX_ID-2, - node::ptr_t(true), - node::ptr_t(false)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(6, node::max_id-2, + node::pointer_type(true), + node::pointer_type(false)))); AssertThat(out_nodes.can_pull(), Is().True()); // (14,16) - AssertThat(out_nodes.pull(), Is().EqualTo(node(6, node::MAX_ID-3, - node::ptr_t(true), - node::ptr_t(7, node::MAX_ID)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(6, node::max_id-3, + node::pointer_type(true), + node::pointer_type(7, node::max_id)))); AssertThat(out_nodes.can_pull(), Is().True()); // (13,15) - AssertThat(out_nodes.pull(), Is().EqualTo(node(5, node::MAX_ID, - node::ptr_t(6, node::MAX_ID), - node::ptr_t(true)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(5, node::max_id, + node::pointer_type(6, node::max_id), + node::pointer_type(true)))); AssertThat(out_nodes.can_pull(), Is().True()); // (13,15,16) - AssertThat(out_nodes.pull(), Is().EqualTo(node(5, node::MAX_ID-1, - node::ptr_t(6, node::MAX_ID-1), - node::ptr_t(true)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(5, node::max_id-1, + node::pointer_type(6, node::max_id-1), + node::pointer_type(true)))); AssertThat(out_nodes.can_pull(), Is().True()); // (13,14,16) - AssertThat(out_nodes.pull(), Is().EqualTo(node(5, node::MAX_ID-2, - node::ptr_t(6, node::MAX_ID-3), - node::ptr_t(true)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(5, node::max_id-2, + node::pointer_type(6, node::max_id-3), + node::pointer_type(true)))); AssertThat(out_nodes.can_pull(), Is().True()); // (12,15,16) - AssertThat(out_nodes.pull(), Is().EqualTo(node(5, node::MAX_ID-3, - node::ptr_t(true), - node::ptr_t(6, node::MAX_ID-1)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(5, node::max_id-3, + node::pointer_type(true), + node::pointer_type(6, node::max_id-1)))); AssertThat(out_nodes.can_pull(), Is().True()); // (12,14) - AssertThat(out_nodes.pull(), Is().EqualTo(node(5, node::MAX_ID-4, - node::ptr_t(true), - node::ptr_t(6, node::MAX_ID-2)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(5, node::max_id-4, + node::pointer_type(true), + node::pointer_type(6, node::max_id-2)))); AssertThat(out_nodes.can_pull(), Is().True()); // (12,14,16) - AssertThat(out_nodes.pull(), Is().EqualTo(node(5, node::MAX_ID-5, - node::ptr_t(true), - node::ptr_t(6, node::MAX_ID-3)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(5, node::max_id-5, + node::pointer_type(true), + node::pointer_type(6, node::max_id-3)))); AssertThat(out_nodes.can_pull(), Is().True()); // (9,11,16) - AssertThat(out_nodes.pull(), Is().EqualTo(node(4, node::MAX_ID, - node::ptr_t(5, node::MAX_ID-5), - node::ptr_t(5, node::MAX_ID-1)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(4, node::max_id, + node::pointer_type(5, node::max_id-5), + node::pointer_type(5, node::max_id-1)))); AssertThat(out_nodes.can_pull(), Is().True()); // (8,11,16) - AssertThat(out_nodes.pull(), Is().EqualTo(node(4, node::MAX_ID-1, - node::ptr_t(5, node::MAX_ID-3), - node::ptr_t(5, node::MAX_ID-2)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(4, node::max_id-1, + node::pointer_type(5, node::max_id-3), + node::pointer_type(5, node::max_id-2)))); AssertThat(out_nodes.can_pull(), Is().True()); // (9,10,16) - AssertThat(out_nodes.pull(), Is().EqualTo(node(4, node::MAX_ID-2, - node::ptr_t(5, node::MAX_ID-2), - node::ptr_t(5, node::MAX_ID-3)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(4, node::max_id-2, + node::pointer_type(5, node::max_id-2), + node::pointer_type(5, node::max_id-3)))); AssertThat(out_nodes.can_pull(), Is().True()); // (8,10) - AssertThat(out_nodes.pull(), Is().EqualTo(node(4, node::MAX_ID-3, - node::ptr_t(5, node::MAX_ID), - node::ptr_t(5, node::MAX_ID-4)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(4, node::max_id-3, + node::pointer_type(5, node::max_id), + node::pointer_type(5, node::max_id-4)))); AssertThat(out_nodes.can_pull(), Is().True()); // (6,7,9,16) - AssertThat(out_nodes.pull(), Is().EqualTo(node(3, node::MAX_ID, - node::ptr_t(4, node::MAX_ID-2), - node::ptr_t(4, node::MAX_ID)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(3, node::max_id, + node::pointer_type(4, node::max_id-2), + node::pointer_type(4, node::max_id)))); AssertThat(out_nodes.can_pull(), Is().True()); // (6,7,8) - AssertThat(out_nodes.pull(), Is().EqualTo(node(3, node::MAX_ID-1, - node::ptr_t(4, node::MAX_ID-3), - node::ptr_t(4, node::MAX_ID-1)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(3, node::max_id-1, + node::pointer_type(4, node::max_id-3), + node::pointer_type(4, node::max_id-1)))); AssertThat(out_nodes.can_pull(), Is().True()); // (4,5,6,7) - AssertThat(out_nodes.pull(), Is().EqualTo(node(2, node::MAX_ID, - node::ptr_t(3, node::MAX_ID-1), - node::ptr_t(3, node::MAX_ID)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(2, node::max_id, + node::pointer_type(3, node::max_id-1), + node::pointer_type(3, node::max_id)))); AssertThat(out_nodes.can_pull(), Is().False()); @@ -3184,8 +3184,8 @@ go_bandit([]() { }); it("finishes early during repeated transposition [&&]", [&]() { - std::vector call_history; - bdd out = bdd_exists(bdd_10, [&call_history](const bdd::label_t x) -> bool { + std::vector call_history; + bdd out = bdd_exists(bdd_10, [&call_history](const bdd::label_type x) -> bool { call_history.push_back(x); return 1 < x; }); @@ -3193,9 +3193,9 @@ go_bandit([]() { node_test_stream out_nodes(out); AssertThat(out_nodes.can_pull(), Is().True()); // (1) - AssertThat(out_nodes.pull(), Is().EqualTo(node(0, node::MAX_ID, - node::ptr_t(false), - node::ptr_t(true)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(0, node::max_id, + node::pointer_type(false), + node::pointer_type(true)))); AssertThat(out_nodes.can_pull(), Is().False()); @@ -3238,8 +3238,8 @@ go_bandit([]() { }); it("switches to nested sweeping when the transposition explodes with BDD 15 [&&]", [&]() { - std::vector call_history; - bdd out = bdd_exists(bdd_15, [&call_history](const bdd::label_t x) -> bool { + std::vector call_history; + bdd out = bdd_exists(bdd_15, [&call_history](const bdd::label_type x) -> bool { call_history.push_back(x); return x < 2; }); @@ -3247,157 +3247,157 @@ go_bandit([]() { node_test_stream out_nodes(out); AssertThat(out_nodes.can_pull(), Is().True()); // (o) - AssertThat(out_nodes.pull(), Is().EqualTo(node(13, node::MAX_ID, - node::ptr_t(false), - node::ptr_t(true)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(13, node::max_id, + node::pointer_type(false), + node::pointer_type(true)))); AssertThat(out_nodes.can_pull(), Is().True()); // (n) - AssertThat(out_nodes.pull(), Is().EqualTo(node(13, node::MAX_ID-1, - node::ptr_t(true), - node::ptr_t(false)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(13, node::max_id-1, + node::pointer_type(true), + node::pointer_type(false)))); AssertThat(out_nodes.can_pull(), Is().True()); // (17,o) - AssertThat(out_nodes.pull(), Is().EqualTo(node(12, node::MAX_ID, - node::ptr_t(13, node::MAX_ID), - node::ptr_t(true)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(12, node::max_id, + node::pointer_type(13, node::max_id), + node::pointer_type(true)))); AssertThat(out_nodes.can_pull(), Is().True()); // (17,n) - AssertThat(out_nodes.pull(), Is().EqualTo(node(12, node::MAX_ID-1, - node::ptr_t(13, node::MAX_ID-1), - node::ptr_t(true)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(12, node::max_id-1, + node::pointer_type(13, node::max_id-1), + node::pointer_type(true)))); AssertThat(out_nodes.can_pull(), Is().True()); // (16,o) - AssertThat(out_nodes.pull(), Is().EqualTo(node(12, node::MAX_ID-2, - node::ptr_t(true), - node::ptr_t(13, node::MAX_ID)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(12, node::max_id-2, + node::pointer_type(true), + node::pointer_type(13, node::max_id)))); AssertThat(out_nodes.can_pull(), Is().True()); // (16,n) - AssertThat(out_nodes.pull(), Is().EqualTo(node(12, node::MAX_ID-3, - node::ptr_t(true), - node::ptr_t(13, node::MAX_ID-1)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(12, node::max_id-3, + node::pointer_type(true), + node::pointer_type(13, node::max_id-1)))); AssertThat(out_nodes.can_pull(), Is().True()); // (14,l) - AssertThat(out_nodes.pull(), Is().EqualTo(node(11, node::MAX_ID, - node::ptr_t(12, node::MAX_ID-3), - node::ptr_t(12, node::MAX_ID)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(11, node::max_id, + node::pointer_type(12, node::max_id-3), + node::pointer_type(12, node::max_id)))); AssertThat(out_nodes.can_pull(), Is().True()); // (14,m) - AssertThat(out_nodes.pull(), Is().EqualTo(node(11, node::MAX_ID-1, - node::ptr_t(12, node::MAX_ID-2), - node::ptr_t(12, node::MAX_ID-1)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(11, node::max_id-1, + node::pointer_type(12, node::max_id-2), + node::pointer_type(12, node::max_id-1)))); AssertThat(out_nodes.can_pull(), Is().True()); // (15,l) - AssertThat(out_nodes.pull(), Is().EqualTo(node(11, node::MAX_ID-2, - node::ptr_t(12, node::MAX_ID-1), - node::ptr_t(12, node::MAX_ID-2)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(11, node::max_id-2, + node::pointer_type(12, node::max_id-1), + node::pointer_type(12, node::max_id-2)))); AssertThat(out_nodes.can_pull(), Is().True()); // (15,m) - AssertThat(out_nodes.pull(), Is().EqualTo(node(11, node::MAX_ID-3, - node::ptr_t(12, node::MAX_ID), - node::ptr_t(12, node::MAX_ID-3)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(11, node::max_id-3, + node::pointer_type(12, node::max_id), + node::pointer_type(12, node::max_id-3)))); AssertThat(out_nodes.can_pull(), Is().True()); // (13,k) - AssertThat(out_nodes.pull(), Is().EqualTo(node(10, node::MAX_ID, - node::ptr_t(11, node::MAX_ID-3), - node::ptr_t(11, node::MAX_ID)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(10, node::max_id, + node::pointer_type(11, node::max_id-3), + node::pointer_type(11, node::max_id)))); AssertThat(out_nodes.can_pull(), Is().True()); // (13,j) - AssertThat(out_nodes.pull(), Is().EqualTo(node(10, node::MAX_ID-1, - node::ptr_t(11, node::MAX_ID-2), - node::ptr_t(11, node::MAX_ID-1)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(10, node::max_id-1, + node::pointer_type(11, node::max_id-2), + node::pointer_type(11, node::max_id-1)))); AssertThat(out_nodes.can_pull(), Is().True()); // (12,k) - AssertThat(out_nodes.pull(), Is().EqualTo(node(10, node::MAX_ID-2, - node::ptr_t(11, node::MAX_ID-1), - node::ptr_t(11, node::MAX_ID-2)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(10, node::max_id-2, + node::pointer_type(11, node::max_id-1), + node::pointer_type(11, node::max_id-2)))); AssertThat(out_nodes.can_pull(), Is().True()); // (12,j) - AssertThat(out_nodes.pull(), Is().EqualTo(node(10, node::MAX_ID-3, - node::ptr_t(11, node::MAX_ID), - node::ptr_t(11, node::MAX_ID-3)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(10, node::max_id-3, + node::pointer_type(11, node::max_id), + node::pointer_type(11, node::max_id-3)))); AssertThat(out_nodes.can_pull(), Is().True()); // (10,h) - AssertThat(out_nodes.pull(), Is().EqualTo(node(9, node::MAX_ID, - node::ptr_t(10, node::MAX_ID-3), - node::ptr_t(10, node::MAX_ID)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(9, node::max_id, + node::pointer_type(10, node::max_id-3), + node::pointer_type(10, node::max_id)))); AssertThat(out_nodes.can_pull(), Is().True()); // (10,i) - AssertThat(out_nodes.pull(), Is().EqualTo(node(9, node::MAX_ID-1, - node::ptr_t(10, node::MAX_ID-2), - node::ptr_t(10, node::MAX_ID-1)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(9, node::max_id-1, + node::pointer_type(10, node::max_id-2), + node::pointer_type(10, node::max_id-1)))); AssertThat(out_nodes.can_pull(), Is().True()); // (11,h) - AssertThat(out_nodes.pull(), Is().EqualTo(node(9, node::MAX_ID-2, - node::ptr_t(10, node::MAX_ID-1), - node::ptr_t(10, node::MAX_ID-2)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(9, node::max_id-2, + node::pointer_type(10, node::max_id-1), + node::pointer_type(10, node::max_id-2)))); AssertThat(out_nodes.can_pull(), Is().True()); // (11,i) - AssertThat(out_nodes.pull(), Is().EqualTo(node(9, node::MAX_ID-3, - node::ptr_t(10, node::MAX_ID), - node::ptr_t(10, node::MAX_ID-3)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(9, node::max_id-3, + node::pointer_type(10, node::max_id), + node::pointer_type(10, node::max_id-3)))); AssertThat(out_nodes.can_pull(), Is().True()); // (9,g) - AssertThat(out_nodes.pull(), Is().EqualTo(node(8, node::MAX_ID, - node::ptr_t(9, node::MAX_ID-3), - node::ptr_t(9, node::MAX_ID)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(8, node::max_id, + node::pointer_type(9, node::max_id-3), + node::pointer_type(9, node::max_id)))); AssertThat(out_nodes.can_pull(), Is().True()); // (8,g) - AssertThat(out_nodes.pull(), Is().EqualTo(node(8, node::MAX_ID-1, - node::ptr_t(9, node::MAX_ID-1), - node::ptr_t(9, node::MAX_ID-2)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(8, node::max_id-1, + node::pointer_type(9, node::max_id-1), + node::pointer_type(9, node::max_id-2)))); AssertThat(out_nodes.can_pull(), Is().True()); // (8,f) - AssertThat(out_nodes.pull(), Is().EqualTo(node(8, node::MAX_ID-2, - node::ptr_t(9, node::MAX_ID), - node::ptr_t(9, node::MAX_ID-3)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(8, node::max_id-2, + node::pointer_type(9, node::max_id), + node::pointer_type(9, node::max_id-3)))); // NOTE: (9,f) because the pair (7,f) is is merged with (8) which // prunes that entire subtree away. AssertThat(out_nodes.can_pull(), Is().True()); // (7,8,f) - AssertThat(out_nodes.pull(), Is().EqualTo(node(7, node::MAX_ID, - node::ptr_t(8, node::MAX_ID-2), - node::ptr_t(true)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(7, node::max_id, + node::pointer_type(8, node::max_id-2), + node::pointer_type(true)))); AssertThat(out_nodes.can_pull(), Is().True()); // (7,g,9) - AssertThat(out_nodes.pull(), Is().EqualTo(node(7, node::MAX_ID-1, - node::ptr_t(true), - node::ptr_t(8, node::MAX_ID)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(7, node::max_id-1, + node::pointer_type(true), + node::pointer_type(8, node::max_id)))); AssertThat(out_nodes.can_pull(), Is().True()); // (7,g) - AssertThat(out_nodes.pull(), Is().EqualTo(node(7, node::MAX_ID-2, - node::ptr_t(8, node::MAX_ID-1), - node::ptr_t(8, node::MAX_ID)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(7, node::max_id-2, + node::pointer_type(8, node::max_id-1), + node::pointer_type(8, node::max_id)))); AssertThat(out_nodes.can_pull(), Is().True()); // (6,5,d) - AssertThat(out_nodes.pull(), Is().EqualTo(node(6, node::MAX_ID, - node::ptr_t(7, node::MAX_ID), - node::ptr_t(7, node::MAX_ID-1)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(6, node::max_id, + node::pointer_type(7, node::max_id), + node::pointer_type(7, node::max_id-1)))); AssertThat(out_nodes.can_pull(), Is().True()); // (5,d) - AssertThat(out_nodes.pull(), Is().EqualTo(node(6, node::MAX_ID-1, - node::ptr_t(8, node::MAX_ID-2), - node::ptr_t(7, node::MAX_ID-2)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(6, node::max_id-1, + node::pointer_type(8, node::max_id-2), + node::pointer_type(7, node::max_id-2)))); AssertThat(out_nodes.can_pull(), Is().True()); // (4,5,d) - AssertThat(out_nodes.pull(), Is().EqualTo(node(5, node::MAX_ID, - node::ptr_t(6, node::MAX_ID-1), - node::ptr_t(6, node::MAX_ID)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(5, node::max_id, + node::pointer_type(6, node::max_id-1), + node::pointer_type(6, node::max_id)))); AssertThat(out_nodes.can_pull(), Is().True()); // (3,5,d) - AssertThat(out_nodes.pull(), Is().EqualTo(node(4, node::MAX_ID, - node::ptr_t(5, node::MAX_ID), - node::ptr_t(6, node::MAX_ID-1)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(4, node::max_id, + node::pointer_type(5, node::max_id), + node::pointer_type(6, node::max_id-1)))); AssertThat(out_nodes.can_pull(), Is().True()); // (2,5,d) - AssertThat(out_nodes.pull(), Is().EqualTo(node(4, node::MAX_ID-1, - node::ptr_t(6, node::MAX_ID-1), - node::ptr_t(5, node::MAX_ID)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(4, node::max_id-1, + node::pointer_type(6, node::max_id-1), + node::pointer_type(5, node::max_id)))); AssertThat(out_nodes.can_pull(), Is().True()); // (1,5,d) - AssertThat(out_nodes.pull(), Is().EqualTo(node(3, node::MAX_ID, - node::ptr_t(4, node::MAX_ID-1), - node::ptr_t(4, node::MAX_ID)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(3, node::max_id, + node::pointer_type(4, node::max_id-1), + node::pointer_type(4, node::max_id)))); // NOTE: The root (1,a,5,d) has x2 suppressed as the choice at (a) // only is relevant for (b) and (c), not for (d). @@ -3517,8 +3517,8 @@ go_bandit([]() { }); it("transposes with a single partial quantification if all variables are deep [&&]", [&]() { - std::vector call_history; - bdd out = bdd_exists(bdd_14a, [&call_history](const bdd::label_t x) -> bool { + std::vector call_history; + bdd out = bdd_exists(bdd_14a, [&call_history](const bdd::label_type x) -> bool { call_history.push_back(x); return x == 5 || x == 6; }); @@ -3526,29 +3526,29 @@ go_bandit([]() { node_test_stream out_nodes(out); AssertThat(out_nodes.can_pull(), Is().True()); // (4) - AssertThat(out_nodes.pull(), Is().EqualTo(node(4, node::MAX_ID, - node::ptr_t(false), - node::ptr_t(true)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(4, node::max_id, + node::pointer_type(false), + node::pointer_type(true)))); AssertThat(out_nodes.can_pull(), Is().True()); // (6) - AssertThat(out_nodes.pull(), Is().EqualTo(node(4, node::MAX_ID-1, - node::ptr_t(true), - node::ptr_t(false)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(4, node::max_id-1, + node::pointer_type(true), + node::pointer_type(false)))); AssertThat(out_nodes.can_pull(), Is().True()); // (2) - AssertThat(out_nodes.pull(), Is().EqualTo(node(3, node::MAX_ID, - node::ptr_t(4, node::MAX_ID), - node::ptr_t(true)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(3, node::max_id, + node::pointer_type(4, node::max_id), + node::pointer_type(true)))); AssertThat(out_nodes.can_pull(), Is().True()); // (3) - AssertThat(out_nodes.pull(), Is().EqualTo(node(3, node::MAX_ID-1, - node::ptr_t(true), - node::ptr_t(4, node::MAX_ID-1)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(3, node::max_id-1, + node::pointer_type(true), + node::pointer_type(4, node::max_id-1)))); AssertThat(out_nodes.can_pull(), Is().True()); // (1) - AssertThat(out_nodes.pull(), Is().EqualTo(node(2, node::MAX_ID, - node::ptr_t(3, node::MAX_ID), - node::ptr_t(3, node::MAX_ID-1)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(2, node::max_id, + node::pointer_type(3, node::max_id), + node::pointer_type(3, node::max_id-1)))); AssertThat(out_nodes.can_pull(), Is().False()); @@ -3606,8 +3606,8 @@ go_bandit([]() { }); it("switches to nested sweeping if the only variables left are deep [&&]", [&]() { - std::vector call_history; - bdd out = bdd_exists(bdd_14b, [&call_history](const bdd::label_t x) -> bool { + std::vector call_history; + bdd out = bdd_exists(bdd_14b, [&call_history](const bdd::label_type x) -> bool { call_history.push_back(x); return x == 1 || x == 5 || x == 6; }); @@ -3615,34 +3615,34 @@ go_bandit([]() { node_test_stream out_nodes(out); AssertThat(out_nodes.can_pull(), Is().True()); // (4) - AssertThat(out_nodes.pull(), Is().EqualTo(node(4, node::MAX_ID, - node::ptr_t(false), - node::ptr_t(true)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(4, node::max_id, + node::pointer_type(false), + node::pointer_type(true)))); AssertThat(out_nodes.can_pull(), Is().True()); // (6) - AssertThat(out_nodes.pull(), Is().EqualTo(node(4, node::MAX_ID-1, - node::ptr_t(true), - node::ptr_t(false)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(4, node::max_id-1, + node::pointer_type(true), + node::pointer_type(false)))); AssertThat(out_nodes.can_pull(), Is().True()); // (2) - AssertThat(out_nodes.pull(), Is().EqualTo(node(3, node::MAX_ID, - node::ptr_t(4, node::MAX_ID), - node::ptr_t(true)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(3, node::max_id, + node::pointer_type(4, node::max_id), + node::pointer_type(true)))); AssertThat(out_nodes.can_pull(), Is().True()); // (3) - AssertThat(out_nodes.pull(), Is().EqualTo(node(3, node::MAX_ID-1, - node::ptr_t(true), - node::ptr_t(4, node::MAX_ID-1)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(3, node::max_id-1, + node::pointer_type(true), + node::pointer_type(4, node::max_id-1)))); AssertThat(out_nodes.can_pull(), Is().True()); // (1) - AssertThat(out_nodes.pull(), Is().EqualTo(node(2, node::MAX_ID, - node::ptr_t(3, node::MAX_ID), - node::ptr_t(3, node::MAX_ID-1)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(2, node::max_id, + node::pointer_type(3, node::max_id), + node::pointer_type(3, node::max_id-1)))); AssertThat(out_nodes.can_pull(), Is().True()); // (1*) - AssertThat(out_nodes.pull(), Is().EqualTo(node(0, node::MAX_ID, - node::ptr_t(2, node::MAX_ID), - node::ptr_t(true)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(0, node::max_id, + node::pointer_type(2, node::max_id), + node::pointer_type(true)))); AssertThat(out_nodes.can_pull(), Is().False()); @@ -3707,24 +3707,24 @@ go_bandit([]() { AssertThat(call_history.at(24), Is().EqualTo(0u)); }); - quantify_mode = quantify_mode_t::AUTO; + quantify_mode = quantify_mode_t::Auto; }); }); - describe("bdd_exists(const bdd&, const generator&)", [&]() { + describe("bdd_exists(const bdd&, const generator&)", [&]() { it("returns input on -1 generator BDD 1 [&&]", [&]() { - __bdd out = bdd_exists(bdd_1, []() -> bdd::label_t { return -1; }); - AssertThat(out.get>(), Is().EqualTo(bdd_1)); + __bdd out = bdd_exists(bdd_1, []() -> bdd::label_type { return -1; }); + AssertThat(out.get>(), Is().EqualTo(bdd_1)); }); - describe("quantify_mode == SINGLETON", [&]() { - quantify_mode = quantify_mode_t::SINGLETON; + describe("quantify_mode == Singleton", [&]() { + quantify_mode = quantify_mode_t::Singleton; it("quantifies 3, 1, -1 in BDD 4 [&&]", [&]() { - bdd::label_t var = 3; + bdd::label_type var = 3; - bdd out = bdd_exists(bdd_4, [&var]() -> bdd::label_t { - const bdd::label_t ret = var; + bdd out = bdd_exists(bdd_4, [&var]() -> bdd::label_type { + const bdd::label_type ret = var; var -= 2; return ret; }); @@ -3732,13 +3732,13 @@ go_bandit([]() { node_test_stream out_nodes(out); AssertThat(out_nodes.can_pull(), Is().True()); // (3) - AssertThat(out_nodes.pull(), Is().EqualTo(node(2, node::MAX_ID, + AssertThat(out_nodes.pull(), Is().EqualTo(node(2, node::max_id, ptr_uint64(false), ptr_uint64(true)))); AssertThat(out_nodes.can_pull(), Is().True()); // (1) - AssertThat(out_nodes.pull(), Is().EqualTo(node(0, node::MAX_ID, - ptr_uint64(2, ptr_uint64::MAX_ID), + AssertThat(out_nodes.pull(), Is().EqualTo(node(0, node::max_id, + ptr_uint64(2, ptr_uint64::max_id), ptr_uint64(true)))); AssertThat(out_nodes.can_pull(), Is().False()); @@ -3757,10 +3757,10 @@ go_bandit([]() { it("quantifies 2, 0, -2 in BDD 4 [const &]", [&]() { const bdd in = bdd_4; - bdd::label_t var = 2; + bdd::label_type var = 2; - bdd out = bdd_exists(in, [&var]() -> bdd::label_t { - const bdd::label_t ret = var; + bdd out = bdd_exists(in, [&var]() -> bdd::label_type { + const bdd::label_type ret = var; var -= 2; return ret; }); @@ -3768,13 +3768,13 @@ go_bandit([]() { node_test_stream out_nodes(out); AssertThat(out_nodes.can_pull(), Is().True()); // (5) - AssertThat(out_nodes.pull(), Is().EqualTo(node(3, node::MAX_ID, + AssertThat(out_nodes.pull(), Is().EqualTo(node(3, node::max_id, ptr_uint64(false), ptr_uint64(true)))); AssertThat(out_nodes.can_pull(), Is().True()); // (2') - AssertThat(out_nodes.pull(), Is().EqualTo(node(1, node::MAX_ID, - ptr_uint64(3, ptr_uint64::MAX_ID), + AssertThat(out_nodes.pull(), Is().EqualTo(node(1, node::max_id, + ptr_uint64(3, ptr_uint64::max_id), ptr_uint64(true)))); AssertThat(out_nodes.can_pull(), Is().False()); @@ -3791,10 +3791,10 @@ go_bandit([]() { }); it("quantifies 1, -1 variables in BDD 1 [&&]", [&]() { - bdd::label_t var = 1; + bdd::label_type var = 1; - bdd out = bdd_exists(bdd_1, [&var]() -> bdd::label_t { - const bdd::label_t ret = var; + bdd out = bdd_exists(bdd_1, [&var]() -> bdd::label_type { + const bdd::label_type ret = var; var -= 2; return ret; }); @@ -3814,7 +3814,7 @@ go_bandit([]() { it("terminates early when quantifying to a terminal in BDD 3 [&&]", [&]() { int calls = 0; - const bdd out = bdd_exists(bdd_3, [&calls]() -> bdd::label_t { + const bdd out = bdd_exists(bdd_3, [&calls]() -> bdd::label_type { return 2 - 2*(calls++); }); @@ -3833,17 +3833,17 @@ go_bandit([]() { AssertThat(out_meta.can_pull(), Is().False()); }); - quantify_mode = quantify_mode_t::AUTO; + quantify_mode = quantify_mode_t::Auto; }); - describe("quantify_mode == NESTED", [&]() { - quantify_mode = quantify_mode_t::NESTED; + describe("quantify_mode == Nested", [&]() { + quantify_mode = quantify_mode_t::Nested; it("quantifies 3, 1, -1 in BDD 4 [&&]", [&]() { - bdd::label_t var = 3; + bdd::label_type var = 3; - bdd out = bdd_exists(bdd_4, [&var]() -> bdd::label_t { - const bdd::label_t ret = var; + bdd out = bdd_exists(bdd_4, [&var]() -> bdd::label_type { + const bdd::label_type ret = var; var -= 2; return ret; }); @@ -3851,13 +3851,13 @@ go_bandit([]() { node_test_stream out_nodes(out); AssertThat(out_nodes.can_pull(), Is().True()); // (3) - AssertThat(out_nodes.pull(), Is().EqualTo(node(2, node::MAX_ID, + AssertThat(out_nodes.pull(), Is().EqualTo(node(2, node::max_id, ptr_uint64(false), ptr_uint64(true)))); AssertThat(out_nodes.can_pull(), Is().True()); // (1) - AssertThat(out_nodes.pull(), Is().EqualTo(node(0, node::MAX_ID, - ptr_uint64(2, ptr_uint64::MAX_ID), + AssertThat(out_nodes.pull(), Is().EqualTo(node(0, node::max_id, + ptr_uint64(2, ptr_uint64::max_id), ptr_uint64(true)))); AssertThat(out_nodes.can_pull(), Is().False()); @@ -3874,10 +3874,10 @@ go_bandit([]() { }); it("quantifies 1, -1 variables in BDD 1 [&&]", [&]() { - bdd::label_t var = 1; + bdd::label_type var = 1; - bdd out = bdd_exists(bdd_1, [&var]() -> bdd::label_t { - const bdd::label_t ret = var; + bdd out = bdd_exists(bdd_1, [&var]() -> bdd::label_type { + const bdd::label_type ret = var; var -= 2; return ret; }); @@ -3895,9 +3895,9 @@ go_bandit([]() { }); it("bails out on a level that only shortcuts", [&bdd_9T]() { - bdd::label_t var = 6; - bdd out = bdd_exists(bdd_9T, [&var]() -> bdd::label_t { - const bdd::label_t res = var; + bdd::label_type var = 6; + bdd out = bdd_exists(bdd_9T, [&var]() -> bdd::label_type { + const bdd::label_type res = var; var -= 2; return res; }); @@ -3905,19 +3905,19 @@ go_bandit([]() { node_test_stream out_nodes(out); AssertThat(out_nodes.can_pull(), Is().True()); // (7') - AssertThat(out_nodes.pull(), Is().EqualTo(node(5, node::MAX_ID, + AssertThat(out_nodes.pull(), Is().EqualTo(node(5, node::max_id, ptr_uint64(false), ptr_uint64(true)))); AssertThat(out_nodes.can_pull(), Is().True()); // (5') - AssertThat(out_nodes.pull(), Is().EqualTo(node(3, node::MAX_ID, - ptr_uint64(5, node::MAX_ID), + AssertThat(out_nodes.pull(), Is().EqualTo(node(3, node::max_id, + ptr_uint64(5, node::max_id), ptr_uint64(true)))); AssertThat(out_nodes.can_pull(), Is().True()); // (1') - AssertThat(out_nodes.pull(), Is().EqualTo(node(1, node::MAX_ID, + AssertThat(out_nodes.pull(), Is().EqualTo(node(1, node::max_id, ptr_uint64(true), - ptr_uint64(3, node::MAX_ID)))); + ptr_uint64(3, node::max_id)))); AssertThat(out_nodes.can_pull(), Is().False()); @@ -3938,9 +3938,9 @@ go_bandit([]() { }); it("bails out on a level that only is irrelevant", [&bdd_9F]() { - bdd::label_t var = 6; - bdd out = bdd_exists(bdd_9F, [&var]() -> bdd::label_t { - const bdd::label_t res = var; + bdd::label_type var = 6; + bdd out = bdd_exists(bdd_9F, [&var]() -> bdd::label_type { + const bdd::label_type res = var; var -= 2; return res; }); @@ -3948,13 +3948,13 @@ go_bandit([]() { node_test_stream out_nodes(out); AssertThat(out_nodes.can_pull(), Is().True()); // (7') - AssertThat(out_nodes.pull(), Is().EqualTo(node(5, node::MAX_ID, + AssertThat(out_nodes.pull(), Is().EqualTo(node(5, node::max_id, ptr_uint64(false), ptr_uint64(true)))); AssertThat(out_nodes.can_pull(), Is().True()); // (5') - AssertThat(out_nodes.pull(), Is().EqualTo(node(3, node::MAX_ID, - ptr_uint64(5, node::MAX_ID), + AssertThat(out_nodes.pull(), Is().EqualTo(node(3, node::max_id, + ptr_uint64(5, node::max_id), ptr_uint64(true)))); AssertThat(out_nodes.can_pull(), Is().False()); @@ -3973,9 +3973,9 @@ go_bandit([]() { }); it("bails out on a level that both shortcuts and is irrelevant", [&bdd_6_x4T]() { - bdd::label_t var = 4; - bdd out = bdd_exists(bdd_6_x4T, [&var]() -> bdd::label_t { - const bdd::label_t res = var; + bdd::label_type var = 4; + bdd out = bdd_exists(bdd_6_x4T, [&var]() -> bdd::label_type { + const bdd::label_type res = var; switch (var) { case 4: { var = 2; break; } // <-- 4: transposing case 2: { var = 1; break; } // <-- 2: shortuctting / irrelevant @@ -4000,9 +4000,9 @@ go_bandit([]() { }); it("kills intermediate dead partial solution", [&bdd_10]() { - bdd::label_t var = 3; - bdd out = bdd_exists(bdd_10, [&var]() -> bdd::label_t { - const bdd::label_t res = var; + bdd::label_type var = 3; + bdd out = bdd_exists(bdd_10, [&var]() -> bdd::label_type { + const bdd::label_type res = var; if (2 < var) { var -= 1; } else { var = -1; } return res; @@ -4011,7 +4011,7 @@ go_bandit([]() { node_test_stream out_nodes(out); AssertThat(out_nodes.can_pull(), Is().True()); // (1) - AssertThat(out_nodes.pull(), Is().EqualTo(node(0, node::MAX_ID, + AssertThat(out_nodes.pull(), Is().EqualTo(node(0, node::max_id, ptr_uint64(false), ptr_uint64(true)))); @@ -4028,7 +4028,7 @@ go_bandit([]() { }); it("kills intermediate dead partial solutions multiple times", [&]() { - bdd::label_t var = 7; + bdd::label_type var = 7; /* expected // @@ -4043,8 +4043,8 @@ go_bandit([]() { // | // T */ - bdd out = bdd_exists(bdd_6, [&var]() -> bdd::label_t { - const bdd::label_t ret = var; + bdd out = bdd_exists(bdd_6, [&var]() -> bdd::label_type { + const bdd::label_type ret = var; var -= 2; return ret; }); @@ -4063,47 +4063,47 @@ go_bandit([]() { // TODO: meta variables }); - quantify_mode = quantify_mode_t::AUTO; + quantify_mode = quantify_mode_t::Auto; }); }); describe("bdd_exists(const bdd&, IT begin, IT end)", [&]() { it("returns original file for [].begin() in BDD 1 [&]", [&]() { - const std::vector vars = { }; + const std::vector vars = { }; const bdd out = bdd_exists(bdd_1, vars.begin(), vars.end()); AssertThat(out.file_ptr(), Is().EqualTo(bdd_1)); }); it("returns original file for [3, 5].rbegin() in BDD 11 [&]", [&]() { - const std::vector vars = { 3,5 }; + const std::vector vars = { 3,5 }; const bdd out = bdd_exists(bdd_11, vars.rbegin(), vars.rend()); AssertThat(out.file_ptr(), Is().EqualTo(bdd_11)); }); it("returns original file for [0, 3].rbegin() in BDD 11 [&]", [&]() { - const std::vector vars = { 0,3 }; + const std::vector vars = { 0,3 }; const bdd out = bdd_exists(bdd_11, vars.rbegin(), vars.rend()); AssertThat(out.file_ptr(), Is().EqualTo(bdd_11)); }); it("quantifies [1, 3].rbegin() in BDD 4 [&&]", [&]() { - std::vector vars = { 1 , 3 }; + std::vector vars = { 1 , 3 }; bdd out = bdd_exists(bdd_4, vars.rbegin(), vars.rend()); node_test_stream out_nodes(out); AssertThat(out_nodes.can_pull(), Is().True()); // (3) - AssertThat(out_nodes.pull(), Is().EqualTo(node(2, node::MAX_ID, + AssertThat(out_nodes.pull(), Is().EqualTo(node(2, node::max_id, ptr_uint64(false), ptr_uint64(true)))); AssertThat(out_nodes.can_pull(), Is().True()); // (1) - AssertThat(out_nodes.pull(), Is().EqualTo(node(0, node::MAX_ID, - ptr_uint64(2, ptr_uint64::MAX_ID), + AssertThat(out_nodes.pull(), Is().EqualTo(node(0, node::max_id, + ptr_uint64(2, ptr_uint64::max_id), ptr_uint64(true)))); AssertThat(out_nodes.can_pull(), Is().False()); @@ -4121,20 +4121,20 @@ go_bandit([]() { it("quantifies [2, 0].begin() in BDD 4 [const &]", [&]() { const bdd in = bdd_4; - const std::vector vars = { 2, 0 }; + const std::vector vars = { 2, 0 }; bdd out = bdd_exists(in, vars.begin(), vars.end()); node_test_stream out_nodes(out); AssertThat(out_nodes.can_pull(), Is().True()); // (5) - AssertThat(out_nodes.pull(), Is().EqualTo(node(3, node::MAX_ID, + AssertThat(out_nodes.pull(), Is().EqualTo(node(3, node::max_id, ptr_uint64(false), ptr_uint64(true)))); AssertThat(out_nodes.can_pull(), Is().True()); // (2') - AssertThat(out_nodes.pull(), Is().EqualTo(node(1, node::MAX_ID, - ptr_uint64(3, ptr_uint64::MAX_ID), + AssertThat(out_nodes.pull(), Is().EqualTo(node(1, node::max_id, + ptr_uint64(3, ptr_uint64::max_id), ptr_uint64(true)))); AssertThat(out_nodes.can_pull(), Is().False()); @@ -4152,20 +4152,20 @@ go_bandit([]() { it("quantifies [4, 2, 0].begin() in BDD 4 [const &]", [&]() { const bdd in = bdd_4; - const std::vector vars = { 4, 2, 0 }; + const std::vector vars = { 4, 2, 0 }; bdd out = bdd_exists(in, vars.begin(), vars.end()); node_test_stream out_nodes(out); AssertThat(out_nodes.can_pull(), Is().True()); // (5) - AssertThat(out_nodes.pull(), Is().EqualTo(node(3, node::MAX_ID, + AssertThat(out_nodes.pull(), Is().EqualTo(node(3, node::max_id, ptr_uint64(false), ptr_uint64(true)))); AssertThat(out_nodes.can_pull(), Is().True()); // (2') - AssertThat(out_nodes.pull(), Is().EqualTo(node(1, node::MAX_ID, - ptr_uint64(3, ptr_uint64::MAX_ID), + AssertThat(out_nodes.pull(), Is().EqualTo(node(1, node::max_id, + ptr_uint64(3, ptr_uint64::max_id), ptr_uint64(true)))); AssertThat(out_nodes.can_pull(), Is().False()); @@ -4185,18 +4185,18 @@ go_bandit([]() { //////////////////////////////////////////////////////////////////////////// // We will not test the Forall operator as much, since it is the same // underlying algorithm, but just with the AND operator. - describe("bdd_forall(const bdd&, bdd::label_t)", [&]() { + describe("bdd_forall(const bdd&, bdd::label_type)", [&]() { it("quantifies T terminal-only BDD as itself", [&]() { __bdd out = bdd_forall(terminal_T, 42); - AssertThat(out.get>(), Is().EqualTo(terminal_T)); + AssertThat(out.get>(), Is().EqualTo(terminal_T)); AssertThat(out.negate, Is().False()); }); it("quantifies F terminal-only BDD as itself", [&]() { __bdd out = bdd_forall(terminal_F, 21); - AssertThat(out.get>(), Is().EqualTo(terminal_F)); + AssertThat(out.get>(), Is().EqualTo(terminal_F)); AssertThat(out.negate, Is().False()); }); @@ -4224,10 +4224,10 @@ go_bandit([]() { AssertThat(levels.can_pull(), Is().False()); - AssertThat(out.get<__bdd::shared_arcs_t>()->max_1level_cut, Is().GreaterThanOrEqualTo(0u)); + AssertThat(out.get<__bdd::shared_arc_file_type>()->max_1level_cut, Is().GreaterThanOrEqualTo(0u)); - AssertThat(out.get<__bdd::shared_arcs_t>()->number_of_terminals[false], Is().EqualTo(1u)); - AssertThat(out.get<__bdd::shared_arcs_t>()->number_of_terminals[true], Is().EqualTo(1u)); + AssertThat(out.get<__bdd::shared_arc_file_type>()->number_of_terminals[false], Is().EqualTo(1u)); + AssertThat(out.get<__bdd::shared_arc_file_type>()->number_of_terminals[true], Is().EqualTo(1u)); }); it("quantifies root of [BDD 3]", [&]() { @@ -4273,10 +4273,10 @@ go_bandit([]() { AssertThat(levels.can_pull(), Is().False()); - AssertThat(out.get<__bdd::shared_arcs_t>()->max_1level_cut, Is().GreaterThanOrEqualTo(2u)); + AssertThat(out.get<__bdd::shared_arc_file_type>()->max_1level_cut, Is().GreaterThanOrEqualTo(2u)); - AssertThat(out.get<__bdd::shared_arcs_t>()->number_of_terminals[false], Is().EqualTo(3u)); - AssertThat(out.get<__bdd::shared_arcs_t>()->number_of_terminals[true], Is().EqualTo(1u)); + AssertThat(out.get<__bdd::shared_arc_file_type>()->number_of_terminals[false], Is().EqualTo(3u)); + AssertThat(out.get<__bdd::shared_arc_file_type>()->number_of_terminals[true], Is().EqualTo(1u)); }); it("should prune shortcuttable requests [BDD 4]", [&]() { @@ -4325,10 +4325,10 @@ go_bandit([]() { AssertThat(levels.can_pull(), Is().False()); - AssertThat(out.get<__bdd::shared_arcs_t>()->max_1level_cut, Is().GreaterThanOrEqualTo(1u)); + AssertThat(out.get<__bdd::shared_arc_file_type>()->max_1level_cut, Is().GreaterThanOrEqualTo(1u)); - AssertThat(out.get<__bdd::shared_arcs_t>()->number_of_terminals[false], Is().EqualTo(3u)); - AssertThat(out.get<__bdd::shared_arcs_t>()->number_of_terminals[true], Is().EqualTo(1u)); + AssertThat(out.get<__bdd::shared_arc_file_type>()->number_of_terminals[false], Is().EqualTo(3u)); + AssertThat(out.get<__bdd::shared_arc_file_type>()->number_of_terminals[true], Is().EqualTo(1u)); }); it("can forward information across a level [BDD 6]", [&]() { @@ -4390,10 +4390,10 @@ go_bandit([]() { AssertThat(levels.can_pull(), Is().False()); - AssertThat(out.get<__bdd::shared_arcs_t>()->max_1level_cut, Is().GreaterThanOrEqualTo(2u)); + AssertThat(out.get<__bdd::shared_arc_file_type>()->max_1level_cut, Is().GreaterThanOrEqualTo(2u)); - AssertThat(out.get<__bdd::shared_arcs_t>()->number_of_terminals[false], Is().EqualTo(5u)); - AssertThat(out.get<__bdd::shared_arcs_t>()->number_of_terminals[true], Is().EqualTo(1u)); + AssertThat(out.get<__bdd::shared_arc_file_type>()->number_of_terminals[false], Is().EqualTo(5u)); + AssertThat(out.get<__bdd::shared_arc_file_type>()->number_of_terminals[true], Is().EqualTo(1u)); }); it("should collapse tuple requests of the same node back into request on a single node [BDD 8a]", [&]() { @@ -4441,35 +4441,35 @@ go_bandit([]() { AssertThat(levels.can_pull(), Is().False()); - AssertThat(out.get<__bdd::shared_arcs_t>()->max_1level_cut, Is().GreaterThanOrEqualTo(2u)); + AssertThat(out.get<__bdd::shared_arc_file_type>()->max_1level_cut, Is().GreaterThanOrEqualTo(2u)); - AssertThat(out.get<__bdd::shared_arcs_t>()->number_of_terminals[false], Is().EqualTo(2u)); - AssertThat(out.get<__bdd::shared_arcs_t>()->number_of_terminals[true], Is().EqualTo(1u)); + AssertThat(out.get<__bdd::shared_arc_file_type>()->number_of_terminals[false], Is().EqualTo(2u)); + AssertThat(out.get<__bdd::shared_arc_file_type>()->number_of_terminals[true], Is().EqualTo(1u)); }); }); - describe("bdd_forall(const bdd&, const predicate&)", [&]() { + describe("bdd_forall(const bdd&, const predicate&)", [&]() { it("returns input on always-false predicate BDD 1 [&&]", [&]() { - __bdd out = bdd_forall(bdd_1, [](const bdd::label_t) -> bool { + __bdd out = bdd_forall(bdd_1, [](const bdd::label_type) -> bool { return false; }); - AssertThat(out.get>(), Is().EqualTo(bdd_1)); + AssertThat(out.get>(), Is().EqualTo(bdd_1)); }); - describe("quantify_mode == SINGLETON", [&]() { - quantify_mode = quantify_mode_t::SINGLETON; + describe("quantify_mode == Singleton", [&]() { + quantify_mode = quantify_mode_t::Singleton; it("quantifies even variables in BDD 1 [const &]", [&]() { const bdd in = bdd_1; - const bdd out = bdd_forall(in, [](const bdd::label_t x) -> bool { + const bdd out = bdd_forall(in, [](const bdd::label_type x) -> bool { return !(x % 2); }); node_test_stream out_nodes(out); AssertThat(out_nodes.can_pull(), Is().True()); // (1') - AssertThat(out_nodes.pull(), Is().EqualTo(node(1, node::MAX_ID, + AssertThat(out_nodes.pull(), Is().EqualTo(node(1, node::max_id, ptr_uint64(false), ptr_uint64(true)))); @@ -4486,14 +4486,14 @@ go_bandit([]() { }); it("quantifies odd variables in BDD 1 [&&]", [&]() { - const bdd out = bdd_forall(bdd_1, [](const bdd::label_t x) -> bool { + const bdd out = bdd_forall(bdd_1, [](const bdd::label_type x) -> bool { return x % 2; }); node_test_stream out_nodes(out); AssertThat(out_nodes.can_pull(), Is().True()); // (1') - AssertThat(out_nodes.pull(), Is().EqualTo(node(0, node::MAX_ID, + AssertThat(out_nodes.pull(), Is().EqualTo(node(0, node::max_id, ptr_uint64(true), ptr_uint64(false)))); @@ -4510,7 +4510,7 @@ go_bandit([]() { }); it("quantifies <= 2 variables in BDD 4 [&&]", [&]() { - const bdd out = bdd_forall(bdd_4, [](const bdd::label_t x) -> bool { + const bdd out = bdd_forall(bdd_4, [](const bdd::label_type x) -> bool { return x <= 2; }); @@ -4531,7 +4531,7 @@ go_bandit([]() { // TODO: top-down dependant? int calls = 0; - const bdd out = bdd_forall(bdd_5, [&calls](const bdd::label_t) -> bool { + const bdd out = bdd_forall(bdd_5, [&calls](const bdd::label_type) -> bool { calls++; return true; }); @@ -4551,29 +4551,29 @@ go_bandit([]() { // TODO: meta variables... }); - quantify_mode = quantify_mode_t::AUTO; + quantify_mode = quantify_mode_t::Auto; }); - describe("quantify_mode == PARTIAL", [&]() { - quantify_mode = quantify_mode_t::PARTIAL; + describe("quantify_mode == Partial", [&]() { + quantify_mode = quantify_mode_t::Partial; // TODO - quantify_mode = quantify_mode_t::AUTO; + quantify_mode = quantify_mode_t::Auto; }); - describe("quantify_mode == NESTED", [&]() { - quantify_mode = quantify_mode_t::NESTED; + describe("quantify_mode == Nested", [&]() { + quantify_mode = quantify_mode_t::Nested; it("quantifies even variables in BDD 1", [&]() { - const bdd out = bdd_forall(bdd_1, [](const bdd::label_t x) -> bool { + const bdd out = bdd_forall(bdd_1, [](const bdd::label_type x) -> bool { return !(x % 2); }); node_test_stream out_nodes(out); AssertThat(out_nodes.can_pull(), Is().True()); // (1') - AssertThat(out_nodes.pull(), Is().EqualTo(node(1, node::MAX_ID, + AssertThat(out_nodes.pull(), Is().EqualTo(node(1, node::max_id, ptr_uint64(false), ptr_uint64(true)))); @@ -4588,26 +4588,26 @@ go_bandit([]() { }); it("bails out on a level that only shortcuts", [&bdd_9T]() { - bdd out = bdd_forall(bdd_not(bdd_9T), [](const bdd::label_t x) -> bool { + bdd out = bdd_forall(bdd_not(bdd_9T), [](const bdd::label_type x) -> bool { return !(x % 2); }); node_test_stream out_nodes(out); AssertThat(out_nodes.can_pull(), Is().True()); // (7') - AssertThat(out_nodes.pull(), Is().EqualTo(node(5, node::MAX_ID, + AssertThat(out_nodes.pull(), Is().EqualTo(node(5, node::max_id, ptr_uint64(true), ptr_uint64(false)))); AssertThat(out_nodes.can_pull(), Is().True()); // (5') - AssertThat(out_nodes.pull(), Is().EqualTo(node(3, node::MAX_ID, - ptr_uint64(5, node::MAX_ID), + AssertThat(out_nodes.pull(), Is().EqualTo(node(3, node::max_id, + ptr_uint64(5, node::max_id), ptr_uint64(false)))); AssertThat(out_nodes.can_pull(), Is().True()); // (1') - AssertThat(out_nodes.pull(), Is().EqualTo(node(1, node::MAX_ID, + AssertThat(out_nodes.pull(), Is().EqualTo(node(1, node::max_id, ptr_uint64(false), - ptr_uint64(3, node::MAX_ID)))); + ptr_uint64(3, node::max_id)))); AssertThat(out_nodes.can_pull(), Is().False()); @@ -4628,20 +4628,20 @@ go_bandit([]() { }); it("bails out on a level that only is irrelevant", [&bdd_9F]() { - bdd out = bdd_forall(bdd_not(bdd_9F), [](const bdd::label_t x) -> bool { + bdd out = bdd_forall(bdd_not(bdd_9F), [](const bdd::label_type x) -> bool { return !(x % 2); }); node_test_stream out_nodes(out); AssertThat(out_nodes.can_pull(), Is().True()); // (7') - AssertThat(out_nodes.pull(), Is().EqualTo(node(5, node::MAX_ID, + AssertThat(out_nodes.pull(), Is().EqualTo(node(5, node::max_id, ptr_uint64(true), ptr_uint64(false)))); AssertThat(out_nodes.can_pull(), Is().True()); // (5') - AssertThat(out_nodes.pull(), Is().EqualTo(node(3, node::MAX_ID, - ptr_uint64(5, node::MAX_ID), + AssertThat(out_nodes.pull(), Is().EqualTo(node(3, node::max_id, + ptr_uint64(5, node::max_id), ptr_uint64(false)))); AssertThat(out_nodes.can_pull(), Is().False()); @@ -4659,21 +4659,21 @@ go_bandit([]() { // TODO: meta variables }); - quantify_mode = quantify_mode_t::AUTO; + quantify_mode = quantify_mode_t::Auto; }); - describe("quantify_mode == AUTO", [&]() { - quantify_mode = quantify_mode_t::AUTO; + describe("quantify_mode == Auto", [&]() { + quantify_mode = quantify_mode_t::Auto; it("quantifies odd variables in BDD 1", [&]() { - const bdd out = bdd_forall(bdd_1, [](const bdd::label_t x) -> bool { + const bdd out = bdd_forall(bdd_1, [](const bdd::label_type x) -> bool { return x % 2; }); node_test_stream out_nodes(out); AssertThat(out_nodes.can_pull(), Is().True()); // (1') - AssertThat(out_nodes.pull(), Is().EqualTo(node(0, node::MAX_ID, + AssertThat(out_nodes.pull(), Is().EqualTo(node(0, node::max_id, ptr_uint64(true), ptr_uint64(false)))); @@ -4687,26 +4687,26 @@ go_bandit([]() { AssertThat(out_meta.can_pull(), Is().False()); }); - quantify_mode = quantify_mode_t::AUTO; + quantify_mode = quantify_mode_t::Auto; }); }); - describe("bdd_forall(const bdd&, const generator&)", [&]() { + describe("bdd_forall(const bdd&, const generator&)", [&]() { it("returns input on -1 geneator in BDD 1 [&&]", [&]() { - __bdd out = bdd_forall(bdd_1, []() -> bdd::label_t { return -1; }); - AssertThat(out.get>(), Is().EqualTo(bdd_1)); + __bdd out = bdd_forall(bdd_1, []() -> bdd::label_type { return -1; }); + AssertThat(out.get>(), Is().EqualTo(bdd_1)); }); - describe("quantify_mode == SINGLETON", [&]() { - quantify_mode = quantify_mode_t::SINGLETON; + describe("quantify_mode == Singleton", [&]() { + quantify_mode = quantify_mode_t::Singleton; it("quantifies 0, -2 in BDD 1 [const &]", [&]() { const bdd in = bdd_1; - bdd::label_t var = 0; + bdd::label_type var = 0; - const bdd out = bdd_forall(in, [&var]() -> bdd::label_t { - const bdd::label_t ret = var; + const bdd out = bdd_forall(in, [&var]() -> bdd::label_type { + const bdd::label_type ret = var; var -= 2; return ret; }); @@ -4714,7 +4714,7 @@ go_bandit([]() { node_test_stream out_nodes(out); AssertThat(out_nodes.can_pull(), Is().True()); // (1') - AssertThat(out_nodes.pull(), Is().EqualTo(node(1, node::MAX_ID, + AssertThat(out_nodes.pull(), Is().EqualTo(node(1, node::max_id, ptr_uint64(false), ptr_uint64(true)))); @@ -4729,10 +4729,10 @@ go_bandit([]() { }); it("quantifies 1, -1 in BDD 1 [&&]", [&]() { - bdd::label_t var = 1; + bdd::label_type var = 1; - const bdd out = bdd_forall(bdd_1, [&var]() -> bdd::label_t { - const bdd::label_t ret = var; + const bdd out = bdd_forall(bdd_1, [&var]() -> bdd::label_type { + const bdd::label_type ret = var; var -= 2; return ret; }); @@ -4740,7 +4740,7 @@ go_bandit([]() { node_test_stream out_nodes(out); AssertThat(out_nodes.can_pull(), Is().True()); // (1') - AssertThat(out_nodes.pull(), Is().EqualTo(node(0, node::MAX_ID, + AssertThat(out_nodes.pull(), Is().EqualTo(node(0, node::max_id, ptr_uint64(true), ptr_uint64(false)))); @@ -4757,7 +4757,7 @@ go_bandit([]() { it("terminates early when quantifying to a terminal in BDD 3 [&&]", [&]() { int calls = 0; - const bdd out = bdd_forall(bdd_3, [&calls]() -> bdd::label_t { + const bdd out = bdd_forall(bdd_3, [&calls]() -> bdd::label_type { return 2 - 2*(calls++); }); @@ -4776,17 +4776,17 @@ go_bandit([]() { AssertThat(out_meta.can_pull(), Is().False()); }); - quantify_mode = quantify_mode_t::AUTO; + quantify_mode = quantify_mode_t::Auto; }); - describe("quantify_mode == NESTED", [&]() { - quantify_mode = quantify_mode_t::NESTED; + describe("quantify_mode == Nested", [&]() { + quantify_mode = quantify_mode_t::Nested; it("quantifies 0, -2 in BDD 1", [&]() { - bdd::label_t var = 0; + bdd::label_type var = 0; - const bdd out = bdd_forall(bdd_1, [&var]() -> bdd::label_t { - const bdd::label_t ret = var; + const bdd out = bdd_forall(bdd_1, [&var]() -> bdd::label_type { + const bdd::label_type ret = var; var -= 2; return ret; }); @@ -4794,7 +4794,7 @@ go_bandit([]() { node_test_stream out_nodes(out); AssertThat(out_nodes.can_pull(), Is().True()); // (1') - AssertThat(out_nodes.pull(), Is().EqualTo(node(1, node::MAX_ID, + AssertThat(out_nodes.pull(), Is().EqualTo(node(1, node::max_id, ptr_uint64(false), ptr_uint64(true)))); @@ -4809,10 +4809,10 @@ go_bandit([]() { }); it("quantifies 1, -1 in BDD 1", [&]() { - bdd::label_t var = 1; + bdd::label_type var = 1; - const bdd out = bdd_forall(bdd_1, [&var]() -> bdd::label_t { - const bdd::label_t ret = var; + const bdd out = bdd_forall(bdd_1, [&var]() -> bdd::label_type { + const bdd::label_type ret = var; var -= 2; return ret; }); @@ -4820,7 +4820,7 @@ go_bandit([]() { node_test_stream out_nodes(out); AssertThat(out_nodes.can_pull(), Is().True()); // (1') - AssertThat(out_nodes.pull(), Is().EqualTo(node(0, node::MAX_ID, + AssertThat(out_nodes.pull(), Is().EqualTo(node(0, node::max_id, ptr_uint64(true), ptr_uint64(false)))); @@ -4835,9 +4835,9 @@ go_bandit([]() { }); it("bails out on a level that only shortcuts", [&bdd_9T]() { - bdd::label_t var = 6; - bdd out = bdd_forall(bdd_not(bdd_9T), [&var]() -> bdd::label_t { - const bdd::label_t res = var; + bdd::label_type var = 6; + bdd out = bdd_forall(bdd_not(bdd_9T), [&var]() -> bdd::label_type { + const bdd::label_type res = var; var -= 2; return res; }); @@ -4845,19 +4845,19 @@ go_bandit([]() { node_test_stream out_nodes(out); AssertThat(out_nodes.can_pull(), Is().True()); // (7') - AssertThat(out_nodes.pull(), Is().EqualTo(node(5, node::MAX_ID, + AssertThat(out_nodes.pull(), Is().EqualTo(node(5, node::max_id, ptr_uint64(true), ptr_uint64(false)))); AssertThat(out_nodes.can_pull(), Is().True()); // (5') - AssertThat(out_nodes.pull(), Is().EqualTo(node(3, node::MAX_ID, - ptr_uint64(5, node::MAX_ID), + AssertThat(out_nodes.pull(), Is().EqualTo(node(3, node::max_id, + ptr_uint64(5, node::max_id), ptr_uint64(false)))); AssertThat(out_nodes.can_pull(), Is().True()); // (1') - AssertThat(out_nodes.pull(), Is().EqualTo(node(1, node::MAX_ID, + AssertThat(out_nodes.pull(), Is().EqualTo(node(1, node::max_id, ptr_uint64(false), - ptr_uint64(3, node::MAX_ID)))); + ptr_uint64(3, node::max_id)))); AssertThat(out_nodes.can_pull(), Is().False()); @@ -4878,9 +4878,9 @@ go_bandit([]() { }); it("bails out on a level that only is irrelevant", [&bdd_9F]() { - bdd::label_t var = 6; - bdd out = bdd_forall(bdd_not(bdd_9F), [&var]() -> bdd::label_t { - const bdd::label_t res = var; + bdd::label_type var = 6; + bdd out = bdd_forall(bdd_not(bdd_9F), [&var]() -> bdd::label_type { + const bdd::label_type res = var; var -= 2; return res; }); @@ -4888,13 +4888,13 @@ go_bandit([]() { node_test_stream out_nodes(out); AssertThat(out_nodes.can_pull(), Is().True()); // (7') - AssertThat(out_nodes.pull(), Is().EqualTo(node(5, node::MAX_ID, + AssertThat(out_nodes.pull(), Is().EqualTo(node(5, node::max_id, ptr_uint64(true), ptr_uint64(false)))); AssertThat(out_nodes.can_pull(), Is().True()); // (5') - AssertThat(out_nodes.pull(), Is().EqualTo(node(3, node::MAX_ID, - ptr_uint64(5, node::MAX_ID), + AssertThat(out_nodes.pull(), Is().EqualTo(node(3, node::max_id, + ptr_uint64(5, node::max_id), ptr_uint64(false)))); AssertThat(out_nodes.can_pull(), Is().False()); @@ -4912,21 +4912,21 @@ go_bandit([]() { // TODO: meta variables }); - quantify_mode = quantify_mode_t::AUTO; + quantify_mode = quantify_mode_t::Auto; }); }); describe("bdd_forall(const bdd&, IT begin, IT end)", [&]() { it("quantifies [0].rbegin() in BDD 1 [const &]", [&]() { const bdd in = bdd_1; - const std::vector vars = { 0 }; + const std::vector vars = { 0 }; const bdd out = bdd_forall(in, vars.rbegin(), vars.rend()); node_test_stream out_nodes(out); AssertThat(out_nodes.can_pull(), Is().True()); // (1') - AssertThat(out_nodes.pull(), Is().EqualTo(node(1, node::MAX_ID, + AssertThat(out_nodes.pull(), Is().EqualTo(node(1, node::max_id, ptr_uint64(false), ptr_uint64(true)))); @@ -4941,13 +4941,13 @@ go_bandit([]() { }); it("quantifies [1].begin() in BDD 1 [&&]", [&]() { - const std::vector vars = { 1 }; + const std::vector vars = { 1 }; const bdd out = bdd_forall(bdd_1, vars.begin(), vars.end()); node_test_stream out_nodes(out); AssertThat(out_nodes.can_pull(), Is().True()); // (1') - AssertThat(out_nodes.pull(), Is().EqualTo(node(0, node::MAX_ID, + AssertThat(out_nodes.pull(), Is().EqualTo(node(0, node::max_id, ptr_uint64(true), ptr_uint64(false)))); diff --git a/test/adiar/bdd/test_restrict.cpp b/test/adiar/bdd/test_restrict.cpp index 2fdd34e69..21f9bad6f 100644 --- a/test/adiar/bdd/test_restrict.cpp +++ b/test/adiar/bdd/test_restrict.cpp @@ -23,7 +23,7 @@ go_bandit([]() { node n2 = node(1,0, n3.uid(), n4.uid()); node n1 = node(0,0, n3.uid(), n2.uid()); - shared_levelized_file bdd; + shared_levelized_file bdd; { // Garbage collect writer to free write-lock node_writer bdd_w(bdd); @@ -43,11 +43,11 @@ go_bandit([]() { // F T */ - adiar::shared_file> ass; + adiar::shared_file> ass; { // Garbage collect writer to free write-lock - adiar::file_writer> aw(ass); - aw << map_pair(2, true); + adiar::file_writer> aw(ass); + aw << map_pair(2, true); } __bdd out = bdd_restrict(bdd, ass); @@ -87,10 +87,10 @@ go_bandit([]() { AssertThat(meta_arcs.can_pull(), Is().False()); - AssertThat(out.get<__bdd::shared_arcs_t>()->max_1level_cut, Is().GreaterThanOrEqualTo(1u)); + AssertThat(out.get<__bdd::shared_arc_file_type>()->max_1level_cut, Is().GreaterThanOrEqualTo(1u)); - AssertThat(out.get<__bdd::shared_arcs_t>()->number_of_terminals[false], Is().EqualTo(1u)); - AssertThat(out.get<__bdd::shared_arcs_t>()->number_of_terminals[true], Is().EqualTo(3u)); + AssertThat(out.get<__bdd::shared_arc_file_type>()->number_of_terminals[false], Is().EqualTo(1u)); + AssertThat(out.get<__bdd::shared_arc_file_type>()->number_of_terminals[true], Is().EqualTo(3u)); }); it("should bridge levels [2]. Assignment: (_,F,_,_)", [&]() { @@ -104,11 +104,11 @@ go_bandit([]() { // F T */ - adiar::shared_file> ass; + adiar::shared_file> ass; { // Garbage collect writer to free write-lock - adiar::file_writer> aw(ass); - aw << map_pair(1, false); + adiar::file_writer> aw(ass); + aw << map_pair(1, false); } __bdd out = bdd_restrict(bdd, ass); @@ -139,10 +139,10 @@ go_bandit([]() { AssertThat(meta_arcs.can_pull(), Is().False()); - AssertThat(out.get<__bdd::shared_arcs_t>()->max_1level_cut, Is().GreaterThanOrEqualTo(2u)); + AssertThat(out.get<__bdd::shared_arc_file_type>()->max_1level_cut, Is().GreaterThanOrEqualTo(2u)); - AssertThat(out.get<__bdd::shared_arcs_t>()->number_of_terminals[false], Is().EqualTo(1u)); - AssertThat(out.get<__bdd::shared_arcs_t>()->number_of_terminals[true], Is().EqualTo(1u)); + AssertThat(out.get<__bdd::shared_arc_file_type>()->number_of_terminals[false], Is().EqualTo(1u)); + AssertThat(out.get<__bdd::shared_arc_file_type>()->number_of_terminals[true], Is().EqualTo(1u)); }); it("should bridge levels [3]. Assignment: (_,T,_,_)", [&]() { @@ -158,11 +158,11 @@ go_bandit([]() { // F T */ - adiar::shared_file> ass; + adiar::shared_file> ass; { // Garbage collect writer to free write-lock - adiar::file_writer> aw(ass); - aw << map_pair(1, true); + adiar::file_writer> aw(ass); + aw << map_pair(1, true); } __bdd out = bdd_restrict(bdd, ass); @@ -208,10 +208,10 @@ go_bandit([]() { AssertThat(meta_arcs.can_pull(), Is().False()); - AssertThat(out.get<__bdd::shared_arcs_t>()->max_1level_cut, Is().GreaterThanOrEqualTo(2u)); + AssertThat(out.get<__bdd::shared_arc_file_type>()->max_1level_cut, Is().GreaterThanOrEqualTo(2u)); - AssertThat(out.get<__bdd::shared_arcs_t>()->number_of_terminals[false], Is().EqualTo(2u)); - AssertThat(out.get<__bdd::shared_arcs_t>()->number_of_terminals[true], Is().EqualTo(3u)); + AssertThat(out.get<__bdd::shared_arc_file_type>()->number_of_terminals[false], Is().EqualTo(2u)); + AssertThat(out.get<__bdd::shared_arc_file_type>()->number_of_terminals[true], Is().EqualTo(3u)); }); it("should remove root. Assignment: (T,_,_,F)", [&]() { @@ -224,12 +224,12 @@ go_bandit([]() { // F T T F */ - adiar::shared_file> ass; + adiar::shared_file> ass; { // Garbage collect writer to free write-lock - adiar::file_writer> aw(ass); - aw << map_pair(0, true) - << map_pair(3, false); + adiar::file_writer> aw(ass); + aw << map_pair(0, true) + << map_pair(3, false); } __bdd out = bdd_restrict(bdd, ass); @@ -266,10 +266,10 @@ go_bandit([]() { AssertThat(meta_arcs.can_pull(), Is().False()); - AssertThat(out.get<__bdd::shared_arcs_t>()->max_1level_cut, Is().GreaterThanOrEqualTo(2u)); + AssertThat(out.get<__bdd::shared_arc_file_type>()->max_1level_cut, Is().GreaterThanOrEqualTo(2u)); - AssertThat(out.get<__bdd::shared_arcs_t>()->number_of_terminals[false], Is().EqualTo(2u)); - AssertThat(out.get<__bdd::shared_arcs_t>()->number_of_terminals[true], Is().EqualTo(2u)); + AssertThat(out.get<__bdd::shared_arc_file_type>()->number_of_terminals[false], Is().EqualTo(2u)); + AssertThat(out.get<__bdd::shared_arc_file_type>()->number_of_terminals[true], Is().EqualTo(2u)); }); it("should ignore skipped variables. Assignment: (F,T,_,F)", [&]() { @@ -279,13 +279,13 @@ go_bandit([]() { // F T */ - adiar::shared_file> ass; + adiar::shared_file> ass; { // Garbage collect writer to free write-lock - adiar::file_writer> aw(ass); - aw << map_pair(0, false) - << map_pair(1, true) - << map_pair(3, false); + adiar::file_writer> aw(ass); + aw << map_pair(0, false) + << map_pair(1, true) + << map_pair(3, false); } __bdd out = bdd_restrict(bdd, ass); @@ -307,19 +307,19 @@ go_bandit([]() { AssertThat(meta_arcs.can_pull(), Is().False()); - AssertThat(out.get<__bdd::shared_arcs_t>()->max_1level_cut, Is().GreaterThanOrEqualTo(0u)); + AssertThat(out.get<__bdd::shared_arc_file_type>()->max_1level_cut, Is().GreaterThanOrEqualTo(0u)); - AssertThat(out.get<__bdd::shared_arcs_t>()->number_of_terminals[false], Is().EqualTo(1u)); - AssertThat(out.get<__bdd::shared_arcs_t>()->number_of_terminals[true], Is().EqualTo(1u)); + AssertThat(out.get<__bdd::shared_arc_file_type>()->number_of_terminals[false], Is().EqualTo(1u)); + AssertThat(out.get<__bdd::shared_arc_file_type>()->number_of_terminals[true], Is().EqualTo(1u)); }); it("should return F terminal. Assignment: (F,_,F,_)", [&]() { - adiar::shared_file> ass; + adiar::shared_file> ass; { // Garbage collect writer to free write-lock - adiar::file_writer> aw(ass); - aw << map_pair(0, false) - << map_pair(2, false); + adiar::file_writer> aw(ass); + aw << map_pair(0, false) + << map_pair(2, false); } __bdd out = bdd_restrict(bdd, ass); @@ -333,23 +333,23 @@ go_bandit([]() { level_info_test_stream meta_arcs(out); AssertThat(meta_arcs.can_pull(), Is().False()); - AssertThat(out.get>()->max_1level_cut[cut_type::INTERNAL], Is().EqualTo(0u)); - AssertThat(out.get>()->max_1level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(1u)); - AssertThat(out.get>()->max_1level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(0u)); - AssertThat(out.get>()->max_1level_cut[cut_type::ALL], Is().EqualTo(1u)); + AssertThat(out.get>()->max_1level_cut[cut::Internal], Is().EqualTo(0u)); + AssertThat(out.get>()->max_1level_cut[cut::Internal_False], Is().EqualTo(1u)); + AssertThat(out.get>()->max_1level_cut[cut::Internal_True], Is().EqualTo(0u)); + AssertThat(out.get>()->max_1level_cut[cut::All], Is().EqualTo(1u)); - AssertThat(out.get>()->number_of_terminals[false], Is().EqualTo(1u)); - AssertThat(out.get>()->number_of_terminals[true], Is().EqualTo(0u)); + AssertThat(out.get>()->number_of_terminals[false], Is().EqualTo(1u)); + AssertThat(out.get>()->number_of_terminals[true], Is().EqualTo(0u)); }); it("should return T terminal. Assignment: (T,T,F,_)", [&]() { - adiar::shared_file> ass; + adiar::shared_file> ass; { // Garbage collect writer to free write-lock - adiar::file_writer> aw(ass); - aw << map_pair(0, true) - << map_pair(1, true) - << map_pair(2, false); + adiar::file_writer> aw(ass); + aw << map_pair(0, true) + << map_pair(1, true) + << map_pair(2, false); } __bdd out = bdd_restrict(bdd, ass); @@ -363,83 +363,83 @@ go_bandit([]() { level_info_test_stream meta_arcs(out); AssertThat(meta_arcs.can_pull(), Is().False()); - AssertThat(out.get>()->max_1level_cut[cut_type::INTERNAL], Is().EqualTo(0u)); - AssertThat(out.get>()->max_1level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(0u)); - AssertThat(out.get>()->max_1level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(1u)); - AssertThat(out.get>()->max_1level_cut[cut_type::ALL], Is().EqualTo(1u)); + AssertThat(out.get>()->max_1level_cut[cut::Internal], Is().EqualTo(0u)); + AssertThat(out.get>()->max_1level_cut[cut::Internal_False], Is().EqualTo(0u)); + AssertThat(out.get>()->max_1level_cut[cut::Internal_True], Is().EqualTo(1u)); + AssertThat(out.get>()->max_1level_cut[cut::All], Is().EqualTo(1u)); - AssertThat(out.get>()->number_of_terminals[false], Is().EqualTo(0u)); - AssertThat(out.get>()->number_of_terminals[true], Is().EqualTo(1u)); + AssertThat(out.get>()->number_of_terminals[false], Is().EqualTo(0u)); + AssertThat(out.get>()->number_of_terminals[true], Is().EqualTo(1u)); }); it("should return input unchanged when given a T terminal", [&]() { - shared_levelized_file T_file; + shared_levelized_file T_file; { // Garbage collect writer to free write-lock node_writer Tw(T_file); Tw << node(true); } - adiar::shared_file> ass; + adiar::shared_file> ass; { // Garbage collect writer to free write-lock - adiar::file_writer> aw(ass); - aw << map_pair(0, true) - << map_pair(2, true) - << map_pair(42, false); + adiar::file_writer> aw(ass); + aw << map_pair(0, true) + << map_pair(2, true) + << map_pair(42, false); } __bdd out = bdd_restrict(T_file, ass); - AssertThat(out.get>(), Is().EqualTo(T_file)); + AssertThat(out.get>(), Is().EqualTo(T_file)); AssertThat(out.negate, Is().False()); }); it("should return input unchanged when given a F terminal", [&]() { - shared_levelized_file F_file; + shared_levelized_file F_file; { // Garbage collect writer to free write-lock node_writer Fw(F_file); Fw << node(false); } - adiar::shared_file> ass; + adiar::shared_file> ass; { // Garbage collect writer to free write-lock - adiar::file_writer> aw(ass); - aw << map_pair(2, true) - << map_pair(21, true) - << map_pair(28, false); + adiar::file_writer> aw(ass); + aw << map_pair(2, true) + << map_pair(21, true) + << map_pair(28, false); } __bdd out = bdd_restrict(F_file, ass); - AssertThat(out.get>(), Is().EqualTo(F_file)); + AssertThat(out.get>(), Is().EqualTo(F_file)); AssertThat(out.negate, Is().False()); }); it("should return input unchanged when given an empty assignment", [&]() { - adiar::shared_file> ass; + adiar::shared_file> ass; __bdd out = bdd_restrict(bdd, ass); - AssertThat(out.get>(), Is().EqualTo(bdd)); + AssertThat(out.get>(), Is().EqualTo(bdd)); AssertThat(out.negate, Is().False()); }); it("should return input unchanged when assignment that is disjoint of its live variables", [&]() { - adiar::shared_file> ass; + adiar::shared_file> ass; { // Garbage collect writer to free write-lock - adiar::file_writer> aw(ass); - aw << map_pair(5, false) - << map_pair(6, true) - << map_pair(7, true) + adiar::file_writer> aw(ass); + aw << map_pair(5, false) + << map_pair(6, true) + << map_pair(7, true) ; } __bdd out = bdd_restrict(bdd, ass); - AssertThat(out.get>(), Is().EqualTo(bdd)); + AssertThat(out.get>(), Is().EqualTo(bdd)); AssertThat(out.negate, Is().False()); }); @@ -456,7 +456,7 @@ go_bandit([]() { ptr_uint64 terminal_T = ptr_uint64(true); ptr_uint64 terminal_F = ptr_uint64(false); - shared_levelized_file node_input; + shared_levelized_file node_input; node n4 = node(2,0, terminal_T, terminal_F); node n3 = node(1,1, terminal_T, terminal_F); @@ -468,11 +468,11 @@ go_bandit([]() { inw << n4 << n3 << n2 << n1; } - adiar::shared_file> ass; + adiar::shared_file> ass; { // Garbage collect writer to free write-lock - adiar::file_writer> aw(ass); - aw << map_pair(2, true); + adiar::file_writer> aw(ass); + aw << map_pair(2, true); } __bdd out = bdd_restrict(node_input, ass); @@ -511,10 +511,10 @@ go_bandit([]() { AssertThat(meta_arcs.can_pull(), Is().False()); - AssertThat(out.get<__bdd::shared_arcs_t>()->max_1level_cut, Is().GreaterThanOrEqualTo(2u)); + AssertThat(out.get<__bdd::shared_arc_file_type>()->max_1level_cut, Is().GreaterThanOrEqualTo(2u)); - AssertThat(out.get<__bdd::shared_arcs_t>()->number_of_terminals[false], Is().EqualTo(3u)); - AssertThat(out.get<__bdd::shared_arcs_t>()->number_of_terminals[true], Is().EqualTo(1u)); + AssertThat(out.get<__bdd::shared_arc_file_type>()->number_of_terminals[false], Is().EqualTo(3u)); + AssertThat(out.get<__bdd::shared_arc_file_type>()->number_of_terminals[true], Is().EqualTo(1u)); }); it("should have terminal arcs restricted to a terminal sorted [2]", []() { @@ -530,7 +530,7 @@ go_bandit([]() { ptr_uint64 terminal_T = ptr_uint64(true); ptr_uint64 terminal_F = ptr_uint64(false); - shared_levelized_file node_input; + shared_levelized_file node_input; node n5 = node(2,1, terminal_F, terminal_T); node n4 = node(2,0, terminal_T, terminal_F); @@ -543,11 +543,11 @@ go_bandit([]() { inw << n5 << n4 << n3 << n2 << n1; } - adiar::shared_file> ass; + adiar::shared_file> ass; { // Garbage collect writer to free write-lock - adiar::file_writer> aw(ass); - aw << map_pair(2, true); + adiar::file_writer> aw(ass); + aw << map_pair(2, true); } __bdd out = bdd_restrict(node_input, ass); @@ -586,10 +586,10 @@ go_bandit([]() { AssertThat(meta_arcs.can_pull(), Is().False()); - AssertThat(out.get<__bdd::shared_arcs_t>()->max_1level_cut, Is().GreaterThanOrEqualTo(2u)); + AssertThat(out.get<__bdd::shared_arc_file_type>()->max_1level_cut, Is().GreaterThanOrEqualTo(2u)); - AssertThat(out.get<__bdd::shared_arcs_t>()->number_of_terminals[false], Is().EqualTo(3u)); - AssertThat(out.get<__bdd::shared_arcs_t>()->number_of_terminals[true], Is().EqualTo(1u)); + AssertThat(out.get<__bdd::shared_arc_file_type>()->number_of_terminals[false], Is().EqualTo(3u)); + AssertThat(out.get<__bdd::shared_arc_file_type>()->number_of_terminals[true], Is().EqualTo(1u)); }); it("should skip 'dead' nodes", [&]() { @@ -607,7 +607,7 @@ go_bandit([]() { // Here, node 4 and 6 are going to be dead, when x1 -> T. */ - shared_levelized_file dead_bdd; + shared_levelized_file dead_bdd; node n9 = node(3,1, terminal_T, terminal_F); node n8 = node(3,0, terminal_F, terminal_T); @@ -624,11 +624,11 @@ go_bandit([]() { dead_w << n9 << n8 << n7 << n6 << n5 << n4 << n3 << n2 << n1; } - adiar::shared_file> ass; + adiar::shared_file> ass; { // Garbage collect writer to free write-lock - adiar::file_writer> aw(ass); - aw << map_pair(1, true); + adiar::file_writer> aw(ass); + aw << map_pair(1, true); } __bdd out = bdd_restrict(dead_bdd, ass); @@ -682,28 +682,28 @@ go_bandit([]() { AssertThat(meta_arcs.can_pull(), Is().False()); - AssertThat(out.get<__bdd::shared_arcs_t>()->max_1level_cut, Is().GreaterThanOrEqualTo(2u)); + AssertThat(out.get<__bdd::shared_arc_file_type>()->max_1level_cut, Is().GreaterThanOrEqualTo(2u)); - AssertThat(out.get<__bdd::shared_arcs_t>()->number_of_terminals[false], Is().EqualTo(3u)); - AssertThat(out.get<__bdd::shared_arcs_t>()->number_of_terminals[true], Is().EqualTo(3u)); + AssertThat(out.get<__bdd::shared_arc_file_type>()->number_of_terminals[false], Is().EqualTo(3u)); + AssertThat(out.get<__bdd::shared_arc_file_type>()->number_of_terminals[true], Is().EqualTo(3u)); }); it("should return terminal-child of restricted root [assignment = T]", [&]() { - shared_levelized_file terminal_child_of_root_bdd; + shared_levelized_file terminal_child_of_root_bdd; - node n2 = node(2, node::MAX_ID, terminal_T, terminal_T); - node n1 = node(1, node::MAX_ID, n2.uid(), terminal_F); + node n2 = node(2, node::max_id, terminal_T, terminal_T); + node n1 = node(1, node::max_id, n2.uid(), terminal_F); { // Garbage collect writer to free write-lock node_writer dead_w(terminal_child_of_root_bdd); dead_w << n2 << n1; } - adiar::shared_file> ass; + adiar::shared_file> ass; { // Garbage collect writer to free write-lock - adiar::file_writer> aw(ass); - aw << map_pair(1, true); + adiar::file_writer> aw(ass); + aw << map_pair(1, true); } __bdd out = bdd_restrict(terminal_child_of_root_bdd, ass); @@ -717,31 +717,31 @@ go_bandit([]() { level_info_test_stream meta_arcs(out); AssertThat(meta_arcs.can_pull(), Is().False()); - AssertThat(out.get>()->max_1level_cut[cut_type::INTERNAL], Is().EqualTo(0u)); - AssertThat(out.get>()->max_1level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(1u)); - AssertThat(out.get>()->max_1level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(0u)); - AssertThat(out.get>()->max_1level_cut[cut_type::ALL], Is().EqualTo(1u)); + AssertThat(out.get>()->max_1level_cut[cut::Internal], Is().EqualTo(0u)); + AssertThat(out.get>()->max_1level_cut[cut::Internal_False], Is().EqualTo(1u)); + AssertThat(out.get>()->max_1level_cut[cut::Internal_True], Is().EqualTo(0u)); + AssertThat(out.get>()->max_1level_cut[cut::All], Is().EqualTo(1u)); - AssertThat(out.get>()->number_of_terminals[false], Is().EqualTo(1u)); - AssertThat(out.get>()->number_of_terminals[true], Is().EqualTo(0u)); + AssertThat(out.get>()->number_of_terminals[false], Is().EqualTo(1u)); + AssertThat(out.get>()->number_of_terminals[true], Is().EqualTo(0u)); }); it("should return terminal-child of restricted root [assignment = F]", [&]() { - shared_levelized_file terminal_child_of_root_bdd; + shared_levelized_file terminal_child_of_root_bdd; - node n2 = node(2, node::MAX_ID, terminal_T, terminal_T); - node n1 = node(0, node::MAX_ID, terminal_T, n2.uid()); + node n2 = node(2, node::max_id, terminal_T, terminal_T); + node n1 = node(0, node::max_id, terminal_T, n2.uid()); { // Garbage collect writer to free write-lock node_writer dead_w(terminal_child_of_root_bdd); dead_w << n2 << n1; } - adiar::shared_file> ass; + adiar::shared_file> ass; { // Garbage collect writer to free write-lock - adiar::file_writer> aw(ass); - aw << map_pair(0, false); + adiar::file_writer> aw(ass); + aw << map_pair(0, false); } __bdd out = bdd_restrict(terminal_child_of_root_bdd, ass); @@ -755,13 +755,13 @@ go_bandit([]() { level_info_test_stream meta_arcs(out); AssertThat(meta_arcs.can_pull(), Is().False()); - AssertThat(out.get>()->max_1level_cut[cut_type::INTERNAL], Is().EqualTo(0u)); - AssertThat(out.get>()->max_1level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(0u)); - AssertThat(out.get>()->max_1level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(1u)); - AssertThat(out.get>()->max_1level_cut[cut_type::ALL], Is().EqualTo(1u)); + AssertThat(out.get>()->max_1level_cut[cut::Internal], Is().EqualTo(0u)); + AssertThat(out.get>()->max_1level_cut[cut::Internal_False], Is().EqualTo(0u)); + AssertThat(out.get>()->max_1level_cut[cut::Internal_True], Is().EqualTo(1u)); + AssertThat(out.get>()->max_1level_cut[cut::All], Is().EqualTo(1u)); - AssertThat(out.get>()->number_of_terminals[false], Is().EqualTo(0u)); - AssertThat(out.get>()->number_of_terminals[true], Is().EqualTo(1u)); + AssertThat(out.get>()->number_of_terminals[false], Is().EqualTo(0u)); + AssertThat(out.get>()->number_of_terminals[true], Is().EqualTo(1u)); }); }); }); diff --git a/test/adiar/internal/algorithms/test_convert.cpp b/test/adiar/internal/algorithms/test_convert.cpp index 33c3d2665..1b53e3c25 100644 --- a/test/adiar/internal/algorithms/test_convert.cpp +++ b/test/adiar/internal/algorithms/test_convert.cpp @@ -10,13 +10,13 @@ go_bandit([]() { const std::vector dom_0123 = { 0, 1, 2, 3}; const std::vector dom_024 = { 0, 2, 4 }; - shared_levelized_file nf_F; + shared_levelized_file nf_F; { node_writer w(nf_F); w << node(false); } - shared_levelized_file nf_T; + shared_levelized_file nf_T; { node_writer w(nf_T); w << node(true); @@ -25,22 +25,22 @@ go_bandit([]() { const ptr_uint64 terminal_F = ptr_uint64(false); const ptr_uint64 terminal_T = ptr_uint64(true); - shared_levelized_file nf_x0; + shared_levelized_file nf_x0; { node_writer nw(nf_x0); - nw << node(0, node::MAX_ID, terminal_F, terminal_T); + nw << node(0, node::max_id, terminal_F, terminal_T); } - shared_levelized_file nf_x1; + shared_levelized_file nf_x1; { node_writer nw(nf_x1); - nw << node(1, node::MAX_ID, terminal_F, terminal_T); + nw << node(1, node::max_id, terminal_F, terminal_T); } - shared_levelized_file nf_x2; + shared_levelized_file nf_x2; { node_writer nw(nf_x2); - nw << node(2, node::MAX_ID, terminal_F, terminal_T); + nw << node(2, node::max_id, terminal_F, terminal_T); } zdd zdd_F(nf_F); @@ -50,33 +50,33 @@ go_bandit([]() { zdd zdd_x1(nf_x1); zdd zdd_x2(nf_x2); - shared_levelized_file nf_x0_null; + shared_levelized_file nf_x0_null; { node_writer nw(nf_x0_null); - nw << node(0, node::MAX_ID, terminal_T, terminal_T); + nw << node(0, node::max_id, terminal_T, terminal_T); } zdd zdd_x0_null(nf_x0_null); - shared_levelized_file nf_x1_null; + shared_levelized_file nf_x1_null; { node_writer nw(nf_x1_null); - nw << node(1, node::MAX_ID, terminal_T, terminal_T); + nw << node(1, node::max_id, terminal_T, terminal_T); } zdd zdd_x1_null(nf_x1_null); - shared_levelized_file nf_x2_null; + shared_levelized_file nf_x2_null; { node_writer nw(nf_x2_null); - nw << node(2, node::MAX_ID, terminal_T, terminal_T); + nw << node(2, node::max_id, terminal_T, terminal_T); } zdd zdd_x2_null(nf_x2_null); // Fig. 5 from Minato: "Zero-suppressed BDDs and their applications". This // is the ZDD version of Fig. 3 in the same paper. - shared_levelized_file nf_minato_fig5; + shared_levelized_file nf_minato_fig5; { - const node n2 = node(1, node::MAX_ID, terminal_F, terminal_T); - const node n1 = node(0, node::MAX_ID, n2.uid(), terminal_T); + const node n2 = node(1, node::max_id, terminal_F, terminal_T); + const node n1 = node(0, node::max_id, n2.uid(), terminal_T); node_writer nw(nf_minato_fig5); nw << n2 << n1; @@ -142,18 +142,18 @@ go_bandit([]() { node_test_stream out_nodes(out); AssertThat(out_nodes.can_pull(), Is().True()); - AssertThat(out_nodes.pull(), Is().EqualTo(node(2, node::MAX_ID, + AssertThat(out_nodes.pull(), Is().EqualTo(node(2, node::max_id, terminal_T, terminal_F))); AssertThat(out_nodes.can_pull(), Is().True()); - AssertThat(out_nodes.pull(), Is().EqualTo(node(1, node::MAX_ID, - ptr_uint64(2, ptr_uint64::MAX_ID), + AssertThat(out_nodes.pull(), Is().EqualTo(node(1, node::max_id, + ptr_uint64(2, ptr_uint64::max_id), terminal_F))); AssertThat(out_nodes.can_pull(), Is().True()); - AssertThat(out_nodes.pull(), Is().EqualTo(node(0, node::MAX_ID, - ptr_uint64(1, ptr_uint64::MAX_ID), + AssertThat(out_nodes.pull(), Is().EqualTo(node(0, node::max_id, + ptr_uint64(1, ptr_uint64::max_id), terminal_F))); AssertThat(out_nodes.can_pull(), Is().False()); @@ -365,11 +365,11 @@ go_bandit([]() { }); it("collapses to T terminal on pow(dom) with dom = { 0,1,2 }", [&]() { - shared_levelized_file nf_pow_dom; + shared_levelized_file nf_pow_dom; { - const node n2 = node(2, node::MAX_ID, terminal_T, terminal_T); - const node n1 = node(1, node::MAX_ID, n2.uid(), n2.uid()); - const node n0 = node(0, node::MAX_ID, n1.uid(), n1.uid()); + const node n2 = node(2, node::max_id, terminal_T, terminal_T); + const node n1 = node(1, node::max_id, n2.uid(), n2.uid()); + const node n0 = node(0, node::max_id, n1.uid(), n1.uid()); node_writer nw(nf_pow_dom); nw << n2 << n1 << n0; @@ -390,11 +390,11 @@ go_bandit([]() { }); it("collapses to T terminal on pow(dom) with dom = { 0,2,4 }", [&]() { - shared_levelized_file nf_pow_dom; + shared_levelized_file nf_pow_dom; { - const node n2 = node(4, node::MAX_ID, terminal_T, terminal_T); - const node n1 = node(2, node::MAX_ID, n2.uid(), n2.uid()); - const node n0 = node(0, node::MAX_ID, n1.uid(), n1.uid()); + const node n2 = node(4, node::max_id, terminal_T, terminal_T); + const node n1 = node(2, node::max_id, n2.uid(), n2.uid()); + const node n0 = node(0, node::max_id, n1.uid(), n1.uid()); node_writer nw(nf_pow_dom); nw << n2 << n1 << n0; @@ -425,12 +425,12 @@ go_bandit([]() { // F T */ - shared_levelized_file nf; + shared_levelized_file nf; { - const node n4 = node(2, node::MAX_ID, terminal_F, terminal_T); - const node n3 = node(1, node::MAX_ID, n4.uid(), n4.uid()); - const node n2 = node(1, node::MAX_ID-1, terminal_F, n4.uid()); - const node n1 = node(0, node::MAX_ID, n2.uid(), n3.uid()); + const node n4 = node(2, node::max_id, terminal_F, terminal_T); + const node n3 = node(1, node::max_id, n4.uid(), n4.uid()); + const node n2 = node(1, node::max_id-1, terminal_F, n4.uid()); + const node n1 = node(0, node::max_id, n2.uid(), n3.uid()); node_writer nw(nf); nw << n4 << n3 << n2 << n1; @@ -591,11 +591,11 @@ go_bandit([]() { }); it("converts [Minato] Fig. 11 (dom = { 0,1,2,3 })", [&]() { - shared_levelized_file nf; + shared_levelized_file nf; { - const node n3 = node(3, node::MAX_ID, terminal_T, terminal_T); - const node n2 = node(2, node::MAX_ID, n3.uid(), n3.uid()); - const node n1 = node(1, node::MAX_ID, n2.uid(), terminal_T); + const node n3 = node(3, node::max_id, terminal_T, terminal_T); + const node n2 = node(2, node::max_id, n3.uid(), n3.uid()); + const node n1 = node(1, node::max_id, n2.uid(), terminal_T); node_writer nw(nf); nw << n3 << n2 << n1; @@ -651,11 +651,11 @@ go_bandit([]() { }); it("converts [Minato] Fig. 15 (dom = { 0,1,2 })", [&]() { - shared_levelized_file nf; + shared_levelized_file nf; { - const node n3 = node(2, node::MAX_ID, terminal_F, terminal_T); - const node n2 = node(1, node::MAX_ID, n3.uid(), terminal_T); - const node n1 = node(0, node::MAX_ID, n3.uid(), n2.uid()); + const node n3 = node(2, node::max_id, terminal_F, terminal_T); + const node n2 = node(1, node::max_id, n3.uid(), terminal_T); + const node n1 = node(0, node::max_id, n3.uid(), n2.uid()); node_writer nw(nf); nw << n3 << n2 << n1; @@ -715,7 +715,7 @@ go_bandit([]() { // Other large cases it("converts { Ø, { 0,1 }, { 0,2 }, { 1,2 } } with dom = { 0,1,2 } only adding true-chain", [&]() { - shared_levelized_file nf_in; + shared_levelized_file nf_in; // In dom = { 0,1,2 } /* // _1_ ---- x0 @@ -727,10 +727,10 @@ go_bandit([]() { // F T */ { - const node n4 = node(2, node::MAX_ID, terminal_F, terminal_T); - const node n3 = node(1, node::MAX_ID, n4.uid(), terminal_T); - const node n2 = node(1, node::MAX_ID-1, terminal_T, n4.uid()); - const node n1 = node(0, node::MAX_ID, n2.uid(), n3.uid()); + const node n4 = node(2, node::max_id, terminal_F, terminal_T); + const node n3 = node(1, node::max_id, n4.uid(), terminal_T); + const node n2 = node(1, node::max_id-1, terminal_T, n4.uid()); + const node n1 = node(0, node::max_id, n2.uid(), n3.uid()); node_writer nw(nf_in); nw << n4 << n3 << n2 << n1; @@ -793,7 +793,7 @@ go_bandit([]() { it("bridges over root and others, and creates pre and post chains", [&]() { std::vector dom = { 0, 1, 2, 3, 4, 5, 6 }; - shared_levelized_file in; + shared_levelized_file in; /* // ---- x0 // @@ -812,13 +812,13 @@ go_bandit([]() { // T T */ { - const node n7 = node(6, node::MAX_ID, terminal_T, terminal_T); - const node n6 = node(5, node::MAX_ID, n7.uid(), n7.uid()); - const node n5 = node(5, node::MAX_ID-1, terminal_F, n7.uid()); - const node n4 = node(4, node::MAX_ID, n6.uid(), terminal_T); - const node n3 = node(4, node::MAX_ID-1, n5.uid(), n6.uid()); - const node n2 = node(3, node::MAX_ID, n3.uid(), n4.uid()); - const node n1 = node(1, node::MAX_ID, n2.uid(), n2.uid()); + const node n7 = node(6, node::max_id, terminal_T, terminal_T); + const node n6 = node(5, node::max_id, n7.uid(), n7.uid()); + const node n5 = node(5, node::max_id-1, terminal_F, n7.uid()); + const node n4 = node(4, node::max_id, n6.uid(), terminal_T); + const node n3 = node(4, node::max_id-1, n5.uid(), n6.uid()); + const node n2 = node(3, node::max_id, n3.uid(), n4.uid()); + const node n1 = node(1, node::max_id, n2.uid(), n2.uid()); node_writer w(in); w << n7 << n6 << n5 << n4 << n3 << n2 << n1; @@ -923,25 +923,25 @@ go_bandit([]() { describe("bdd_from(const zdd&)", [&]() { it("returns check-false chain to T terminal on { Ø } with set dom = { 0,1,2 }", [&]() { - adiar_set_domain(dom_012.begin(), dom_012.end()); + domain_set(dom_012.begin(), dom_012.end()); __bdd out = bdd_from(zdd_T); node_test_stream out_nodes(out); AssertThat(out_nodes.can_pull(), Is().True()); - AssertThat(out_nodes.pull(), Is().EqualTo(node(2, node::MAX_ID, + AssertThat(out_nodes.pull(), Is().EqualTo(node(2, node::max_id, terminal_T, terminal_F))); AssertThat(out_nodes.can_pull(), Is().True()); - AssertThat(out_nodes.pull(), Is().EqualTo(node(1, node::MAX_ID, - ptr_uint64(2, ptr_uint64::MAX_ID), + AssertThat(out_nodes.pull(), Is().EqualTo(node(1, node::max_id, + ptr_uint64(2, ptr_uint64::max_id), terminal_F))); AssertThat(out_nodes.can_pull(), Is().True()); - AssertThat(out_nodes.pull(), Is().EqualTo(node(0, node::MAX_ID, - ptr_uint64(1, ptr_uint64::MAX_ID), + AssertThat(out_nodes.pull(), Is().EqualTo(node(0, node::max_id, + ptr_uint64(1, ptr_uint64::max_id), terminal_F))); AssertThat(out_nodes.can_pull(), Is().False()); @@ -961,7 +961,7 @@ go_bandit([]() { }); it("kills root and bridges over it on { Ø, { 2 } } with set dom = { 0,2,4 }", [&]() { - adiar_set_domain(dom_024.begin(), dom_024.end()); + domain_set(dom_024.begin(), dom_024.end()); __bdd out = bdd_from(zdd_x2_null); @@ -1048,19 +1048,19 @@ go_bandit([]() { node_test_stream out_nodes(out); AssertThat(out_nodes.can_pull(), Is().True()); - AssertThat(out_nodes.pull(), Is().EqualTo(node(2, node::MAX_ID, + AssertThat(out_nodes.pull(), Is().EqualTo(node(2, node::max_id, terminal_T, terminal_T))); AssertThat(out_nodes.can_pull(), Is().True()); - AssertThat(out_nodes.pull(), Is().EqualTo(node(1, node::MAX_ID, - ptr_uint64(2, ptr_uint64::MAX_ID), - ptr_uint64(2, ptr_uint64::MAX_ID)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(1, node::max_id, + ptr_uint64(2, ptr_uint64::max_id), + ptr_uint64(2, ptr_uint64::max_id)))); AssertThat(out_nodes.can_pull(), Is().True()); - AssertThat(out_nodes.pull(), Is().EqualTo(node(0, node::MAX_ID, - ptr_uint64(1, ptr_uint64::MAX_ID), - ptr_uint64(1, ptr_uint64::MAX_ID)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(0, node::max_id, + ptr_uint64(1, ptr_uint64::max_id), + ptr_uint64(1, ptr_uint64::max_id)))); AssertThat(out_nodes.can_pull(), Is().False()); @@ -1161,10 +1161,10 @@ go_bandit([]() { }); it("kills and bridges root on ~x1 with dom = { 0,1,2 }", [&]() { - shared_levelized_file nf; + shared_levelized_file nf; { node_writer nw(nf); - nw << node(1, node::MAX_ID, terminal_T, terminal_F); + nw << node(1, node::max_id, terminal_T, terminal_F); } bdd in(nf); @@ -1200,10 +1200,10 @@ go_bandit([]() { }); it("kills root into { Ø } on ~x0 into with dom = { 0 }", [&]() { - shared_levelized_file nf; + shared_levelized_file nf; { node_writer nw(nf); - nw << node(0, node::MAX_ID, terminal_T, terminal_F); + nw << node(0, node::max_id, terminal_T, terminal_F); } bdd in(nf); @@ -1221,11 +1221,11 @@ go_bandit([]() { }); it("collapses false-chain into { Ø } on with dom = { 0,2,4 }", [&]() { - shared_levelized_file nf; + shared_levelized_file nf; { - const node n3 = node(4, node::MAX_ID, terminal_T, terminal_F); - const node n2 = node(2, node::MAX_ID, n3.uid(), terminal_F); - const node n1 = node(0, node::MAX_ID, n2.uid(), terminal_F); + const node n3 = node(4, node::max_id, terminal_T, terminal_F); + const node n2 = node(2, node::max_id, n3.uid(), terminal_F); + const node n1 = node(0, node::max_id, n2.uid(), terminal_F); node_writer nw(nf); nw << n3 << n2 << n1; @@ -1247,12 +1247,12 @@ go_bandit([]() { // Minato examples it("converts [Minato] Fig. 3 into Fig. 5 with dom = { 0,1,2 } ", [&]() { - shared_levelized_file nf; + shared_levelized_file nf; { - const node n4 = node(2, node::MAX_ID, terminal_T, terminal_F); - const node n3 = node(1, node::MAX_ID, n4.uid(), terminal_F); - const node n2 = node(1, node::MAX_ID-1, terminal_F, n4.uid()); - const node n1 = node(0, node::MAX_ID, n2.uid(), n3.uid()); + const node n4 = node(2, node::max_id, terminal_T, terminal_F); + const node n3 = node(1, node::max_id, n4.uid(), terminal_F); + const node n2 = node(1, node::max_id-1, terminal_F, n4.uid()); + const node n1 = node(0, node::max_id, n2.uid(), n3.uid()); node_writer nw(nf); nw << n4 << n3 << n2 << n1; @@ -1291,13 +1291,13 @@ go_bandit([]() { }); it("converts [Minato] Fig. 3 into Fig. 5 with dom = { 0,1,2,3 } ", [&]() { - shared_levelized_file nf; + shared_levelized_file nf; { - const node n5 = node(3, node::MAX_ID, terminal_T, terminal_F); - const node n4 = node(2, node::MAX_ID, n5.uid(), terminal_F); - const node n3 = node(1, node::MAX_ID, n4.uid(), terminal_F); - const node n2 = node(1, node::MAX_ID-1, terminal_F, n4.uid()); - const node n1 = node(0, node::MAX_ID, n2.uid(), n3.uid()); + const node n5 = node(3, node::max_id, terminal_T, terminal_F); + const node n4 = node(2, node::max_id, n5.uid(), terminal_F); + const node n3 = node(1, node::max_id, n4.uid(), terminal_F); + const node n2 = node(1, node::max_id-1, terminal_F, n4.uid()); + const node n1 = node(0, node::max_id, n2.uid(), n3.uid()); node_writer nw(nf); nw << n5 << n4 << n3 << n2 << n1; @@ -1336,12 +1336,12 @@ go_bandit([]() { }); it("converts [Minato] Fig. 11 with dom = { 0,1,2,3 } ", [&]() { - shared_levelized_file nf; + shared_levelized_file nf; { - const node n4 = node(3, node::MAX_ID, terminal_T, terminal_F); - const node n3 = node(2, node::MAX_ID, n4.uid(), terminal_F); - const node n2 = node(1, node::MAX_ID-1, terminal_T, n3.uid()); - const node n1 = node(0, node::MAX_ID, n2.uid(), terminal_F); + const node n4 = node(3, node::max_id, terminal_T, terminal_F); + const node n3 = node(2, node::max_id, n4.uid(), terminal_F); + const node n2 = node(1, node::max_id-1, terminal_T, n3.uid()); + const node n1 = node(0, node::max_id, n2.uid(), terminal_F); node_writer nw(nf); nw << n4 << n3 << n2 << n1; @@ -1389,13 +1389,13 @@ go_bandit([]() { }); it("converts [Minato] Fig. 15 with dom = { 0,1,2 } ", [&]() { - shared_levelized_file nf; + shared_levelized_file nf; { - const node n5 = node(2, node::MAX_ID, terminal_F, terminal_T); - const node n4 = node(2, node::MAX_ID-1, terminal_T, terminal_F); - const node n3 = node(1, node::MAX_ID, n5.uid(), terminal_F); - const node n2 = node(1, node::MAX_ID-1, n5.uid(), n4.uid()); - const node n1 = node(0, node::MAX_ID, n3.uid(), n2.uid()); + const node n5 = node(2, node::max_id, terminal_F, terminal_T); + const node n4 = node(2, node::max_id-1, terminal_T, terminal_F); + const node n3 = node(1, node::max_id, n5.uid(), terminal_F); + const node n2 = node(1, node::max_id-1, n5.uid(), n4.uid()); + const node n1 = node(0, node::max_id, n3.uid(), n2.uid()); node_writer nw(nf); nw << n5 << n4 << n3 << n2 << n1; @@ -1445,26 +1445,26 @@ go_bandit([]() { describe("zdd_from(const bdd&)", [&]() { it("returns pow(dom) on T terminal with set dom = { 0,1,2 }", [&]() { - adiar_set_domain(dom_012.begin(), dom_012.end()); + domain_set(dom_012.begin(), dom_012.end()); __zdd out = zdd_from(bdd_T); node_test_stream out_nodes(out); AssertThat(out_nodes.can_pull(), Is().True()); - AssertThat(out_nodes.pull(), Is().EqualTo(node(2, node::MAX_ID, + AssertThat(out_nodes.pull(), Is().EqualTo(node(2, node::max_id, terminal_T, terminal_T))); AssertThat(out_nodes.can_pull(), Is().True()); - AssertThat(out_nodes.pull(), Is().EqualTo(node(1, node::MAX_ID, - ptr_uint64(2, ptr_uint64::MAX_ID), - ptr_uint64(2, ptr_uint64::MAX_ID)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(1, node::max_id, + ptr_uint64(2, ptr_uint64::max_id), + ptr_uint64(2, ptr_uint64::max_id)))); AssertThat(out_nodes.can_pull(), Is().True()); - AssertThat(out_nodes.pull(), Is().EqualTo(node(0, node::MAX_ID, - ptr_uint64(1, ptr_uint64::MAX_ID), - ptr_uint64(1, ptr_uint64::MAX_ID)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(0, node::max_id, + ptr_uint64(1, ptr_uint64::max_id), + ptr_uint64(1, ptr_uint64::max_id)))); AssertThat(out_nodes.can_pull(), Is().False()); @@ -1483,18 +1483,18 @@ go_bandit([]() { }); it("collapses false-chain into { Ø } on with set dom = { 0,2,4 }", [&]() { - shared_levelized_file nf; + shared_levelized_file nf; { - const node n3 = node(4, node::MAX_ID, terminal_T, terminal_F); - const node n2 = node(2, node::MAX_ID, n3.uid(), terminal_F); - const node n1 = node(0, node::MAX_ID, n2.uid(), terminal_F); + const node n3 = node(4, node::max_id, terminal_T, terminal_F); + const node n2 = node(2, node::max_id, n3.uid(), terminal_F); + const node n1 = node(0, node::max_id, n2.uid(), terminal_F); node_writer nw(nf); nw << n3 << n2 << n1; } bdd in(nf); - adiar_set_domain(dom_024.begin(), dom_024.end()); + domain_set(dom_024.begin(), dom_024.end()); __zdd out = zdd_from(in); diff --git a/test/adiar/internal/algorithms/test_isomorphism.cpp b/test/adiar/internal/algorithms/test_isomorphism.cpp index 5c962b82a..aa633c3c6 100644 --- a/test/adiar/internal/algorithms/test_isomorphism.cpp +++ b/test/adiar/internal/algorithms/test_isomorphism.cpp @@ -5,7 +5,7 @@ go_bandit([]() { describe("adiar/internal/algoritms/pred.h", []() { describe("is_isomorphic", []() { describe("Trivial cases", []() { - shared_levelized_file + shared_levelized_file terminal_F, x21, x42, x21_and_x22, x21_and_x22_and_x42, x21_and_x42, x21_xor_x42; { // Garbage collect writers to free write-lock @@ -94,7 +94,7 @@ go_bandit([]() { // and x3 (i.e. the same number of nodes and levels). One with 3 // nodes for x2 and one node for x3 and one with 2 nodes for x2 and x3. - shared_levelized_file seven_a, seven_b; + shared_levelized_file seven_a, seven_b; { // Garbage collect writers to free write-lock node_writer w_seven_a(seven_a); @@ -126,7 +126,7 @@ go_bandit([]() { ////////////////////// // Sink-only cases - shared_levelized_file F_a, F_b, T_a; + shared_levelized_file F_a, F_b, T_a; { // Garbage collect writers to free write-lock node_writer nw_F_a(F_a); @@ -146,17 +146,17 @@ go_bandit([]() { / \ F T */ - shared_levelized_file x42_a, x42_b, not_x42; + shared_levelized_file x42_a, x42_b, not_x42; { // Garbage collect writers to free write-lock node_writer wa(x42_a); - wa << node(42, node::MAX_ID, ptr_uint64(false), ptr_uint64(true)); + wa << node(42, node::max_id, ptr_uint64(false), ptr_uint64(true)); node_writer wb(x42_b); - wb << node(42, node::MAX_ID, ptr_uint64(false), ptr_uint64(true)); + wb << node(42, node::max_id, ptr_uint64(false), ptr_uint64(true)); node_writer wn(not_x42); - wn << node(42, node::MAX_ID, ptr_uint64(true), ptr_uint64(false)); + wn << node(42, node::max_id, ptr_uint64(true), ptr_uint64(false)); } /* @@ -164,14 +164,14 @@ go_bandit([]() { / \ / \ T T F F */ - shared_levelized_file x69_T, x69_F; + shared_levelized_file x69_T, x69_F; { // Garbage collect writers to free write-lock node_writer wT(x69_T); - wT << node(69, node::MAX_ID, ptr_uint64(true), ptr_uint64(true)); + wT << node(69, node::max_id, ptr_uint64(true), ptr_uint64(true)); node_writer wF(x69_F); - wF << node(69, node::MAX_ID, ptr_uint64(false), ptr_uint64(false)); + wF << node(69, node::max_id, ptr_uint64(false), ptr_uint64(false)); } @@ -188,37 +188,37 @@ go_bandit([]() { F T */ { node_writer w(bdd_1); - w << node(2, node::MAX_ID, ptr_uint64(false), ptr_uint64(true)) - << node(1, node::MAX_ID, ptr_uint64(2, ptr_uint64::MAX_ID), ptr_uint64(false)) - << node(1, node::MAX_ID-1, ptr_uint64(true), ptr_uint64(2, ptr_uint64::MAX_ID)) - << node(0, node::MAX_ID, ptr_uint64(1, ptr_uint64::MAX_ID-1), ptr_uint64(1, ptr_uint64::MAX_ID)); + w << node(2, node::max_id, ptr_uint64(false), ptr_uint64(true)) + << node(1, node::max_id, ptr_uint64(2, ptr_uint64::max_id), ptr_uint64(false)) + << node(1, node::max_id-1, ptr_uint64(true), ptr_uint64(2, ptr_uint64::max_id)) + << node(0, node::max_id, ptr_uint64(1, ptr_uint64::max_id-1), ptr_uint64(1, ptr_uint64::max_id)); } shared_levelized_file bdd_1n; /* bdd_1 negated */ { node_writer w(bdd_1n); - w << node(2, node::MAX_ID, ptr_uint64(true), ptr_uint64(false)) - << node(1, node::MAX_ID, ptr_uint64(2, ptr_uint64::MAX_ID), ptr_uint64(true)) - << node(1, node::MAX_ID-1, ptr_uint64(false), ptr_uint64(2, ptr_uint64::MAX_ID)) - << node(0, node::MAX_ID, ptr_uint64(1, ptr_uint64::MAX_ID-1), ptr_uint64(1, ptr_uint64::MAX_ID)); + w << node(2, node::max_id, ptr_uint64(true), ptr_uint64(false)) + << node(1, node::max_id, ptr_uint64(2, ptr_uint64::max_id), ptr_uint64(true)) + << node(1, node::max_id-1, ptr_uint64(false), ptr_uint64(2, ptr_uint64::max_id)) + << node(0, node::max_id, ptr_uint64(1, ptr_uint64::max_id-1), ptr_uint64(1, ptr_uint64::max_id)); } // bdd_1 with child of (2) and low child of (4) flipped in truth value shared_levelized_file bdd_1_low_leaf; { node_writer w(bdd_1_low_leaf); - w << node(2, node::MAX_ID, ptr_uint64(true), ptr_uint64(true)) - << node(1, node::MAX_ID, ptr_uint64(2, ptr_uint64::MAX_ID), ptr_uint64(false)) - << node(1, node::MAX_ID-1, ptr_uint64(false), ptr_uint64(2, ptr_uint64::MAX_ID)) - << node(0, node::MAX_ID, ptr_uint64(1, ptr_uint64::MAX_ID-1), ptr_uint64(1, ptr_uint64::MAX_ID)); + w << node(2, node::max_id, ptr_uint64(true), ptr_uint64(true)) + << node(1, node::max_id, ptr_uint64(2, ptr_uint64::max_id), ptr_uint64(false)) + << node(1, node::max_id-1, ptr_uint64(false), ptr_uint64(2, ptr_uint64::max_id)) + << node(0, node::max_id, ptr_uint64(1, ptr_uint64::max_id-1), ptr_uint64(1, ptr_uint64::max_id)); } // bdd_1 with child of (3) and high child of (4) flipped in truth value shared_levelized_file bdd_1_high_leaf; { node_writer w(bdd_1_high_leaf); - w << node(2, node::MAX_ID, ptr_uint64(false), ptr_uint64(false)) - << node(1, node::MAX_ID, ptr_uint64(2, ptr_uint64::MAX_ID), ptr_uint64(true)) - << node(1, node::MAX_ID-1, ptr_uint64(true), ptr_uint64(2, ptr_uint64::MAX_ID)) - << node(0, node::MAX_ID, ptr_uint64(1, ptr_uint64::MAX_ID-1), ptr_uint64(1, ptr_uint64::MAX_ID)); + w << node(2, node::max_id, ptr_uint64(false), ptr_uint64(false)) + << node(1, node::max_id, ptr_uint64(2, ptr_uint64::max_id), ptr_uint64(true)) + << node(1, node::max_id-1, ptr_uint64(true), ptr_uint64(2, ptr_uint64::max_id)) + << node(0, node::max_id, ptr_uint64(1, ptr_uint64::max_id-1), ptr_uint64(1, ptr_uint64::max_id)); } shared_levelized_file bdd_2; @@ -233,21 +233,21 @@ go_bandit([]() { T F T */ { node_writer w(bdd_2); - w << node(2, node::MAX_ID, ptr_uint64(false), ptr_uint64(true)) - << node(2, node::MAX_ID-1, ptr_uint64(true), ptr_uint64(false)) - << node(1, node::MAX_ID, ptr_uint64(2, ptr_uint64::MAX_ID-1), ptr_uint64(false)) - << node(1, node::MAX_ID-1, ptr_uint64(false), ptr_uint64(2, ptr_uint64::MAX_ID)) - << node(0, node::MAX_ID, ptr_uint64(1, ptr_uint64::MAX_ID-1), ptr_uint64(1, ptr_uint64::MAX_ID)); + w << node(2, node::max_id, ptr_uint64(false), ptr_uint64(true)) + << node(2, node::max_id-1, ptr_uint64(true), ptr_uint64(false)) + << node(1, node::max_id, ptr_uint64(2, ptr_uint64::max_id-1), ptr_uint64(false)) + << node(1, node::max_id-1, ptr_uint64(false), ptr_uint64(2, ptr_uint64::max_id)) + << node(0, node::max_id, ptr_uint64(1, ptr_uint64::max_id-1), ptr_uint64(1, ptr_uint64::max_id)); } shared_levelized_file bdd_2n; /* bdd_2 negated */ { node_writer w(bdd_2n); - w << node(2, node::MAX_ID, ptr_uint64(true), ptr_uint64(false)) - << node(2, node::MAX_ID-1, ptr_uint64(false), ptr_uint64(true)) - << node(1, node::MAX_ID, ptr_uint64(2, ptr_uint64::MAX_ID-1), ptr_uint64(true)) - << node(1, node::MAX_ID-1, ptr_uint64(true), ptr_uint64(2, ptr_uint64::MAX_ID)) - << node(0, node::MAX_ID, ptr_uint64(1, ptr_uint64::MAX_ID-1), ptr_uint64(1, ptr_uint64::MAX_ID)); + w << node(2, node::max_id, ptr_uint64(true), ptr_uint64(false)) + << node(2, node::max_id-1, ptr_uint64(false), ptr_uint64(true)) + << node(1, node::max_id, ptr_uint64(2, ptr_uint64::max_id-1), ptr_uint64(true)) + << node(1, node::max_id-1, ptr_uint64(true), ptr_uint64(2, ptr_uint64::max_id)) + << node(0, node::max_id, ptr_uint64(1, ptr_uint64::max_id-1), ptr_uint64(1, ptr_uint64::max_id)); } shared_levelized_file bdd_2_low_child; @@ -263,11 +263,11 @@ go_bandit([]() { which in traversal look similar to bdd_2 until (3) on level x1 */ { node_writer w(bdd_2_low_child); - w << node(2, node::MAX_ID, ptr_uint64(false), ptr_uint64(true)) - << node(2, node::MAX_ID-1, ptr_uint64(true), ptr_uint64(false)) - << node(1, node::MAX_ID, ptr_uint64(true), ptr_uint64(false)) - << node(1, node::MAX_ID-1, ptr_uint64(2, ptr_uint64::MAX_ID-1), ptr_uint64(2, ptr_uint64::MAX_ID)) - << node(0, node::MAX_ID, ptr_uint64(1, ptr_uint64::MAX_ID-1), ptr_uint64(1, ptr_uint64::MAX_ID)); + w << node(2, node::max_id, ptr_uint64(false), ptr_uint64(true)) + << node(2, node::max_id-1, ptr_uint64(true), ptr_uint64(false)) + << node(1, node::max_id, ptr_uint64(true), ptr_uint64(false)) + << node(1, node::max_id-1, ptr_uint64(2, ptr_uint64::max_id-1), ptr_uint64(2, ptr_uint64::max_id)) + << node(0, node::max_id, ptr_uint64(1, ptr_uint64::max_id-1), ptr_uint64(1, ptr_uint64::max_id)); } shared_levelized_file bdd_2_high_child; @@ -283,11 +283,11 @@ go_bandit([]() { which in traversal look similar to bdd_2 until (2) on level x1 */ { node_writer w(bdd_2_high_child); - w << node(2, node::MAX_ID, ptr_uint64(false), ptr_uint64(true)) - << node(2, node::MAX_ID-1, ptr_uint64(true), ptr_uint64(false)) - << node(1, node::MAX_ID, ptr_uint64(false), ptr_uint64(true)) - << node(1, node::MAX_ID-1, ptr_uint64(2, ptr_uint64::MAX_ID-1), ptr_uint64(2, ptr_uint64::MAX_ID)) - << node(0, node::MAX_ID, ptr_uint64(1, ptr_uint64::MAX_ID), ptr_uint64(1, ptr_uint64::MAX_ID-1)); + w << node(2, node::max_id, ptr_uint64(false), ptr_uint64(true)) + << node(2, node::max_id-1, ptr_uint64(true), ptr_uint64(false)) + << node(1, node::max_id, ptr_uint64(false), ptr_uint64(true)) + << node(1, node::max_id-1, ptr_uint64(2, ptr_uint64::max_id-1), ptr_uint64(2, ptr_uint64::max_id)) + << node(0, node::max_id, ptr_uint64(1, ptr_uint64::max_id), ptr_uint64(1, ptr_uint64::max_id-1)); } shared_levelized_file bdd_3; @@ -303,10 +303,10 @@ go_bandit([]() { F T */ { node_writer w(bdd_3); - w << node(3, node::MAX_ID, ptr_uint64(false), ptr_uint64(true)) - << node(2, node::MAX_ID, ptr_uint64(true), ptr_uint64(3, ptr_uint64::MAX_ID)) - << node(1, node::MAX_ID, ptr_uint64(2, ptr_uint64::MAX_ID), ptr_uint64(false)) - << node(0, node::MAX_ID, ptr_uint64(2, ptr_uint64::MAX_ID), ptr_uint64(1, ptr_uint64::MAX_ID)); + w << node(3, node::max_id, ptr_uint64(false), ptr_uint64(true)) + << node(2, node::max_id, ptr_uint64(true), ptr_uint64(3, ptr_uint64::max_id)) + << node(1, node::max_id, ptr_uint64(2, ptr_uint64::max_id), ptr_uint64(false)) + << node(0, node::max_id, ptr_uint64(2, ptr_uint64::max_id), ptr_uint64(1, ptr_uint64::max_id)); } shared_levelized_file bdd_4; @@ -324,10 +324,10 @@ go_bandit([]() { The same as bdd_3 but mirrored horisontally */ { node_writer w(bdd_4); - w << node(3, node::MAX_ID, ptr_uint64(true), ptr_uint64(false)) - << node(2, node::MAX_ID, ptr_uint64(3, ptr_uint64::MAX_ID), ptr_uint64(true)) - << node(1, node::MAX_ID, ptr_uint64(false), ptr_uint64(2, ptr_uint64::MAX_ID)) - << node(0, node::MAX_ID, ptr_uint64(1, ptr_uint64::MAX_ID), ptr_uint64(2, ptr_uint64::MAX_ID)); + w << node(3, node::max_id, ptr_uint64(true), ptr_uint64(false)) + << node(2, node::max_id, ptr_uint64(3, ptr_uint64::max_id), ptr_uint64(true)) + << node(1, node::max_id, ptr_uint64(false), ptr_uint64(2, ptr_uint64::max_id)) + << node(0, node::max_id, ptr_uint64(1, ptr_uint64::max_id), ptr_uint64(2, ptr_uint64::max_id)); } shared_levelized_file bdd_5; @@ -345,10 +345,10 @@ go_bandit([]() { The same as bdd_4 but (2) goes to a terminal instead of (3) */ { node_writer w(bdd_5); - w << node(3, node::MAX_ID, ptr_uint64(true), ptr_uint64(false)) - << node(2, node::MAX_ID, ptr_uint64(3, ptr_uint64::MAX_ID), ptr_uint64(true)) - << node(1, node::MAX_ID, ptr_uint64(false), ptr_uint64(true)) - << node(0, node::MAX_ID, ptr_uint64(1, ptr_uint64::MAX_ID), ptr_uint64(2, ptr_uint64::MAX_ID)); + w << node(3, node::max_id, ptr_uint64(true), ptr_uint64(false)) + << node(2, node::max_id, ptr_uint64(3, ptr_uint64::max_id), ptr_uint64(true)) + << node(1, node::max_id, ptr_uint64(false), ptr_uint64(true)) + << node(0, node::max_id, ptr_uint64(1, ptr_uint64::max_id), ptr_uint64(2, ptr_uint64::max_id)); } shared_levelized_file bdd_6; @@ -366,10 +366,10 @@ go_bandit([]() { The same as bdd_5 but (3) goes to a false terminal instead of true */ { node_writer w(bdd_5); - w << node(3, node::MAX_ID, ptr_uint64(true), ptr_uint64(false)) - << node(2, node::MAX_ID, ptr_uint64(3, ptr_uint64::MAX_ID), ptr_uint64(false)) - << node(1, node::MAX_ID, ptr_uint64(false), ptr_uint64(true)) - << node(0, node::MAX_ID, ptr_uint64(1, ptr_uint64::MAX_ID), ptr_uint64(2, ptr_uint64::MAX_ID)); + w << node(3, node::max_id, ptr_uint64(true), ptr_uint64(false)) + << node(2, node::max_id, ptr_uint64(3, ptr_uint64::max_id), ptr_uint64(false)) + << node(1, node::max_id, ptr_uint64(false), ptr_uint64(true)) + << node(0, node::max_id, ptr_uint64(1, ptr_uint64::max_id), ptr_uint64(2, ptr_uint64::max_id)); } describe("Fast 2N/B check", [&]() { @@ -436,10 +436,10 @@ go_bandit([]() { /* Same as bdd_3 but with (2) directly going to (4) on the low */ { // Garbage collect writers to free write-lock node_writer w(bdd_3_b); - w << node(3, node::MAX_ID, ptr_uint64(false), ptr_uint64(true)) - << node(2, node::MAX_ID, ptr_uint64(true), ptr_uint64(3, ptr_uint64::MAX_ID)) - << node(1, node::MAX_ID, ptr_uint64(3, ptr_uint64::MAX_ID), ptr_uint64(false)) - << node(0, node::MAX_ID, ptr_uint64(2, ptr_uint64::MAX_ID), ptr_uint64(1, ptr_uint64::MAX_ID)); + w << node(3, node::max_id, ptr_uint64(false), ptr_uint64(true)) + << node(2, node::max_id, ptr_uint64(true), ptr_uint64(3, ptr_uint64::max_id)) + << node(1, node::max_id, ptr_uint64(3, ptr_uint64::max_id), ptr_uint64(false)) + << node(0, node::max_id, ptr_uint64(2, ptr_uint64::max_id), ptr_uint64(1, ptr_uint64::max_id)); } AssertThat(is_isomorphic(bdd_3, bdd_3_b, false, false), Is().False()); @@ -460,10 +460,10 @@ go_bandit([]() { shared_levelized_file bdd_4_b; /* Same as bdd_4 but with (2) directly going to (4) on the high */ { node_writer w(bdd_4_b); - w << node(3, node::MAX_ID, ptr_uint64(true), ptr_uint64(false)) - << node(2, node::MAX_ID, ptr_uint64(3, ptr_uint64::MAX_ID), ptr_uint64(true)) - << node(1, node::MAX_ID, ptr_uint64(false), ptr_uint64(3, ptr_uint64::MAX_ID)) - << node(0, node::MAX_ID, ptr_uint64(1, ptr_uint64::MAX_ID), ptr_uint64(2, ptr_uint64::MAX_ID)); + w << node(3, node::max_id, ptr_uint64(true), ptr_uint64(false)) + << node(2, node::max_id, ptr_uint64(3, ptr_uint64::max_id), ptr_uint64(true)) + << node(1, node::max_id, ptr_uint64(false), ptr_uint64(3, ptr_uint64::max_id)) + << node(0, node::max_id, ptr_uint64(1, ptr_uint64::max_id), ptr_uint64(2, ptr_uint64::max_id)); } AssertThat(is_isomorphic(bdd_4, bdd_4_b, false, false), Is().False()); @@ -527,10 +527,10 @@ go_bandit([]() { shared_levelized_file bdd_1b; { // Garbage collect writers to free write-lock node_writer w(bdd_1b); - w << node(2, node::MAX_ID, ptr_uint64(false), ptr_uint64(true)) - << node(1, node::MAX_ID, ptr_uint64(true), ptr_uint64(2, ptr_uint64::MAX_ID)) - << node(1, node::MAX_ID-1, ptr_uint64(2, ptr_uint64::MAX_ID), ptr_uint64(false)) - << node(0, node::MAX_ID, ptr_uint64(1, ptr_uint64::MAX_ID), ptr_uint64(1, ptr_uint64::MAX_ID-1)); + w << node(2, node::max_id, ptr_uint64(false), ptr_uint64(true)) + << node(1, node::max_id, ptr_uint64(true), ptr_uint64(2, ptr_uint64::max_id)) + << node(1, node::max_id-1, ptr_uint64(2, ptr_uint64::max_id), ptr_uint64(false)) + << node(0, node::max_id, ptr_uint64(1, ptr_uint64::max_id), ptr_uint64(1, ptr_uint64::max_id-1)); } AssertThat(is_isomorphic(bdd_1, bdd_1b, false, false), Is().True()); @@ -544,11 +544,11 @@ go_bandit([]() { shared_levelized_file bdd_2b; { // Garbage collect writers to free write-lock node_writer w(bdd_2b); - w << node(2, node::MAX_ID, ptr_uint64(true), ptr_uint64(false)) - << node(2, node::MAX_ID-1, ptr_uint64(false), ptr_uint64(true)) - << node(1, node::MAX_ID, ptr_uint64(false), ptr_uint64(2, ptr_uint64::MAX_ID-1)) - << node(1, node::MAX_ID-1, ptr_uint64(2, ptr_uint64::MAX_ID), ptr_uint64(false)) - << node(0, node::MAX_ID, ptr_uint64(1, ptr_uint64::MAX_ID), ptr_uint64(1, ptr_uint64::MAX_ID-1)); + w << node(2, node::max_id, ptr_uint64(true), ptr_uint64(false)) + << node(2, node::max_id-1, ptr_uint64(false), ptr_uint64(true)) + << node(1, node::max_id, ptr_uint64(false), ptr_uint64(2, ptr_uint64::max_id-1)) + << node(1, node::max_id-1, ptr_uint64(2, ptr_uint64::max_id), ptr_uint64(false)) + << node(0, node::max_id, ptr_uint64(1, ptr_uint64::max_id), ptr_uint64(1, ptr_uint64::max_id-1)); } AssertThat(is_isomorphic(bdd_2, bdd_2b, false, false), Is().True()); @@ -571,10 +571,10 @@ go_bandit([]() { shared_levelized_file bdd_3_b; /* Same as bdd_3 negated but with (2) directly going to (4) on the low */ { node_writer w(bdd_3_b); - w << node(3, node::MAX_ID, ptr_uint64(true), ptr_uint64(false)) - << node(2, node::MAX_ID, ptr_uint64(false), ptr_uint64(3, ptr_uint64::MAX_ID)) - << node(1, node::MAX_ID, ptr_uint64(3, ptr_uint64::MAX_ID), ptr_uint64(true)) - << node(0, node::MAX_ID, ptr_uint64(2, ptr_uint64::MAX_ID), ptr_uint64(1, ptr_uint64::MAX_ID)); + w << node(3, node::max_id, ptr_uint64(true), ptr_uint64(false)) + << node(2, node::max_id, ptr_uint64(false), ptr_uint64(3, ptr_uint64::max_id)) + << node(1, node::max_id, ptr_uint64(3, ptr_uint64::max_id), ptr_uint64(true)) + << node(0, node::max_id, ptr_uint64(2, ptr_uint64::max_id), ptr_uint64(1, ptr_uint64::max_id)); } AssertThat(is_isomorphic(bdd_3, bdd_3_b, true, false), Is().False()); @@ -584,14 +584,14 @@ go_bandit([]() { it("rejects on low child mismatch on root", [&]() { shared_levelized_file bdd_a; { node_writer w(bdd_a); - w << node(1, node::MAX_ID, ptr_uint64(false), ptr_uint64(true)) - << node(0, node::MAX_ID, ptr_uint64(1, ptr_uint64::MAX_ID), ptr_uint64(false)); + w << node(1, node::max_id, ptr_uint64(false), ptr_uint64(true)) + << node(0, node::max_id, ptr_uint64(1, ptr_uint64::max_id), ptr_uint64(false)); } shared_levelized_file bdd_b; { node_writer w(bdd_b); - w << node(1, node::MAX_ID, ptr_uint64(true), ptr_uint64(false)) - << node(0, node::MAX_ID, ptr_uint64(true), ptr_uint64(1, ptr_uint64::MAX_ID)); + w << node(1, node::max_id, ptr_uint64(true), ptr_uint64(false)) + << node(0, node::max_id, ptr_uint64(true), ptr_uint64(1, ptr_uint64::max_id)); } AssertThat(is_isomorphic(bdd_a, bdd_b, true, false), Is().False()); @@ -613,10 +613,10 @@ go_bandit([]() { /* Same as bdd_4 negated but with (2) directly going to (4) on the high */ { node_writer w(bdd_4_b); - w << node(3, node::MAX_ID, ptr_uint64(false), ptr_uint64(true)) - << node(2, node::MAX_ID, ptr_uint64(3, ptr_uint64::MAX_ID), ptr_uint64(false)) - << node(1, node::MAX_ID, ptr_uint64(true), ptr_uint64(3, ptr_uint64::MAX_ID)) - << node(0, node::MAX_ID, ptr_uint64(1, ptr_uint64::MAX_ID), ptr_uint64(2, ptr_uint64::MAX_ID)); + w << node(3, node::max_id, ptr_uint64(false), ptr_uint64(true)) + << node(2, node::max_id, ptr_uint64(3, ptr_uint64::max_id), ptr_uint64(false)) + << node(1, node::max_id, ptr_uint64(true), ptr_uint64(3, ptr_uint64::max_id)) + << node(0, node::max_id, ptr_uint64(1, ptr_uint64::max_id), ptr_uint64(2, ptr_uint64::max_id)); } AssertThat(is_isomorphic(bdd_4, bdd_4_b, true, false), Is().False()); @@ -626,16 +626,16 @@ go_bandit([]() { it("rejects on high child mismatch on root", [&]() { shared_levelized_file bdd_a; { node_writer w(bdd_a); - w << node(2, node::MAX_ID, ptr_uint64(false), ptr_uint64(true)) - << node(1, node::MAX_ID, ptr_uint64(2, ptr_uint64::MAX_ID), ptr_uint64(false)) - << node(0, node::MAX_ID, ptr_uint64(1, ptr_uint64::MAX_ID), ptr_uint64(true)); + w << node(2, node::max_id, ptr_uint64(false), ptr_uint64(true)) + << node(1, node::max_id, ptr_uint64(2, ptr_uint64::max_id), ptr_uint64(false)) + << node(0, node::max_id, ptr_uint64(1, ptr_uint64::max_id), ptr_uint64(true)); } shared_levelized_file bdd_b; { node_writer w(bdd_b); - w << node(2, node::MAX_ID, ptr_uint64(true), ptr_uint64(false)) - << node(1, node::MAX_ID, ptr_uint64(2, ptr_uint64::MAX_ID), ptr_uint64(false)) - << node(0, node::MAX_ID, ptr_uint64(1, ptr_uint64::MAX_ID), ptr_uint64(true)); + w << node(2, node::max_id, ptr_uint64(true), ptr_uint64(false)) + << node(1, node::max_id, ptr_uint64(2, ptr_uint64::max_id), ptr_uint64(false)) + << node(0, node::max_id, ptr_uint64(1, ptr_uint64::max_id), ptr_uint64(true)); } AssertThat(is_isomorphic(bdd_a, bdd_b, true, false), Is().False()); @@ -668,24 +668,24 @@ go_bandit([]() { shared_levelized_file bdd_5_a; { // Garbage collect writers to free write-lock node_writer w(bdd_5_a); - w << node(3, node::MAX_ID, ptr_uint64(false), ptr_uint64(true)) - << node(3, node::MAX_ID-1, ptr_uint64(true), ptr_uint64(false)) - << node(2, node::MAX_ID, ptr_uint64(3, ptr_uint64::MAX_ID-1), ptr_uint64(3, ptr_uint64::MAX_ID)) - << node(2, node::MAX_ID-1, ptr_uint64(3, ptr_uint64::MAX_ID), ptr_uint64(3, ptr_uint64::MAX_ID-1)) - << node(1, node::MAX_ID, ptr_uint64(2, ptr_uint64::MAX_ID-1), ptr_uint64(2, ptr_uint64::MAX_ID)) - << node(0, node::MAX_ID, ptr_uint64(2, ptr_uint64::MAX_ID-1), ptr_uint64(1, ptr_uint64::MAX_ID)); + w << node(3, node::max_id, ptr_uint64(false), ptr_uint64(true)) + << node(3, node::max_id-1, ptr_uint64(true), ptr_uint64(false)) + << node(2, node::max_id, ptr_uint64(3, ptr_uint64::max_id-1), ptr_uint64(3, ptr_uint64::max_id)) + << node(2, node::max_id-1, ptr_uint64(3, ptr_uint64::max_id), ptr_uint64(3, ptr_uint64::max_id-1)) + << node(1, node::max_id, ptr_uint64(2, ptr_uint64::max_id-1), ptr_uint64(2, ptr_uint64::max_id)) + << node(0, node::max_id, ptr_uint64(2, ptr_uint64::max_id-1), ptr_uint64(1, ptr_uint64::max_id)); } shared_levelized_file bdd_5_b; { // Garbage collect writers to free write-lock node_writer w(bdd_5_b); - w << node(3, node::MAX_ID, ptr_uint64(false), ptr_uint64(true)) - << node(3, node::MAX_ID-1, ptr_uint64(true), ptr_uint64(false)) - << node(2, node::MAX_ID, ptr_uint64(3, ptr_uint64::MAX_ID-1), ptr_uint64(3, ptr_uint64::MAX_ID)) - << node(2, node::MAX_ID-1, ptr_uint64(3, ptr_uint64::MAX_ID), ptr_uint64(3, ptr_uint64::MAX_ID-1)) + w << node(3, node::max_id, ptr_uint64(false), ptr_uint64(true)) + << node(3, node::max_id-1, ptr_uint64(true), ptr_uint64(false)) + << node(2, node::max_id, ptr_uint64(3, ptr_uint64::max_id-1), ptr_uint64(3, ptr_uint64::max_id)) + << node(2, node::max_id-1, ptr_uint64(3, ptr_uint64::max_id), ptr_uint64(3, ptr_uint64::max_id-1)) // This one has its children flipped - << node(1, node::MAX_ID, ptr_uint64(2, ptr_uint64::MAX_ID), ptr_uint64(2, ptr_uint64::MAX_ID-1)) - << node(0, node::MAX_ID, ptr_uint64(2, ptr_uint64::MAX_ID-1), ptr_uint64(1, ptr_uint64::MAX_ID)); + << node(1, node::max_id, ptr_uint64(2, ptr_uint64::max_id), ptr_uint64(2, ptr_uint64::max_id-1)) + << node(0, node::max_id, ptr_uint64(2, ptr_uint64::max_id-1), ptr_uint64(1, ptr_uint64::max_id)); } AssertThat(is_isomorphic(bdd_5_a, bdd_5_b, true, false), Is().False()); diff --git a/test/adiar/internal/algorithms/test_nested_sweeping.cpp b/test/adiar/internal/algorithms/test_nested_sweeping.cpp index d3364de5e..8bcce6b18 100644 --- a/test/adiar/internal/algorithms/test_nested_sweeping.cpp +++ b/test/adiar/internal/algorithms/test_nested_sweeping.cpp @@ -2,6 +2,7 @@ #include +#include #include #include #include @@ -32,9 +33,9 @@ class test_not_sweep : public bdd_policy using request_pred_t = request_data_first_lt; - template + template using pq_t = levelized_node_priority_queue; + look_ahead, mem_mode>; public: test_not_sweep(const size_t nm) @@ -75,18 +76,18 @@ class test_not_sweep : public bdd_policy while (!inner_pq.empty()) { inner_pq.setup_next_level(); - const node::label_t level_label = inner_pq.current_level(); - node::id_t level_size = 0u; + const node::label_type level_label = inner_pq.current_level(); + node::id_type level_size = 0u; while (!inner_pq.empty_level()) { // Give node a new name - const node::uid_t u(level_label, level_size++); + const node::uid_type u(level_label, level_size++); // Get target of next request adiar_assert(!inner_pq.top().target.first().is_flagged(), "Double checking decorator indeed hides taint"); - const node::ptr_t next = inner_pq.top().target.first(); + const node::pointer_type next = inner_pq.top().target.first(); // Seek node in stream and forward its out-going edges const node n = ns.seek(next); @@ -115,12 +116,12 @@ class test_not_sweep : public bdd_policy ////////////////////////////////////////////////////////////////////////////// template void forward_arc(inner_pq_t &inner_pq, arc_writer &aw, - const node::uid_t &uid, const node::ptr_t &c) + const node::uid_type &uid, const node::pointer_type &c) { if (c.is_terminal()) { aw.push_terminal({ uid, is_high, ~c }); } else { - inner_pq.push({{c, node::ptr_t::NIL()}, {}, {uid.with(is_high)}}); + inner_pq.push({{c, node::pointer_type::nil()}, {}, {uid.with(is_high)}}); } } @@ -128,7 +129,7 @@ class test_not_sweep : public bdd_policy ////////////////////////////////////////////////////////////////////////////// /// \brief Whether it wants to sweep on some level. ////////////////////////////////////////////////////////////////////////////// - bool has_sweep(node::ptr_t::label_t l) const + bool has_sweep(node::pointer_type::label_type l) const { return (l % _nesting_modulo) == 0u; } ////////////////////////////////////////////////////////////////////////////// @@ -150,7 +151,7 @@ class test_not_sweep : public bdd_policy request_from_node(const node &n, const ptr_uint64 &parent) { // Always pick high child - return request_t({n.high(), only_gc ? node::ptr_t::NIL() : n.high()}, + return request_t({n.high(), only_gc ? node::pointer_type::nil() : n.high()}, {}, {parent}); } @@ -171,9 +172,9 @@ class test_terminal_sweep : public bdd_policy using request_t = request_data<2, with_parent, 0, 1>; using request_pred_t = request_first_lt; - template + template using pq_t = levelized_node_priority_queue; + look_ahead, mem_mode>; public: test_terminal_sweep(const size_t nm) @@ -214,25 +215,25 @@ class test_terminal_sweep : public bdd_policy while (!inner_pq.empty()) { inner_pq.setup_next_level(); - const node::label_t level_label = inner_pq.current_level(); - node::id_t level_size = 0u; + const node::label_type level_label = inner_pq.current_level(); + node::id_type level_size = 0u; while (!inner_pq.empty_level()) { // Get target of next request - const node::ptr_t next = inner_pq.top().target.first(); - node::ptr_t t; + const node::pointer_type next = inner_pq.top().target.first(); + node::pointer_type t; if (next.label() % _nesting_modulo == 1) { // Collapse immediately to a terminal - t = node::ptr_t(level_label % (_nesting_modulo+1) > 0); + t = node::pointer_type(level_label % (_nesting_modulo+1) > 0); } else { // Create a simple (i, _, _) node with two terminals. - t = node::ptr_t(level_label, level_size++); + t = node::pointer_type(level_label, level_size++); - const node::ptr_t t0((level_label) % (_nesting_modulo) > 1); + const node::pointer_type t0((level_label) % (_nesting_modulo) > 1); aw.push_terminal({ t, false, t0 }); - const node::ptr_t t1((level_label+1) % (_nesting_modulo) > 1); + const node::pointer_type t1((level_label+1) % (_nesting_modulo) > 1); aw.push_terminal({ t, true, t1 }); } @@ -257,7 +258,7 @@ class test_terminal_sweep : public bdd_policy ////////////////////////////////////////////////////////////////////////////// /// \brief Whether it wants to sweep on some level. ////////////////////////////////////////////////////////////////////////////// - bool has_sweep(node::ptr_t::label_t l) const + bool has_sweep(node::pointer_type::label_type l) const { return (l % _nesting_modulo) == 0u; } ////////////////////////////////////////////////////////////////////////////// @@ -289,7 +290,7 @@ class test_terminal_sweep : public bdd_policy go_bandit([]() { describe("adiar/internal/algorithms/nested_sweeping.h", []() { // Outer PQ - using outer_test_pq_t = nested_sweeping::outer::up__pq_t<1, memory_mode_t::INTERNAL>; + using outer_test_pq_t = nested_sweeping::outer::up__pq_t<1, memory_mode_t::Internal>; /* // 1 ---- x0 // / \ @@ -343,16 +344,16 @@ go_bandit([]() { using test_request_t = request_data<2, with_parent, 0, 1>; using test_roots_sorter_t = - nested_sweeping::outer::roots_sorter>; test_roots_sorter_t s(1024, 16); - const test_request_t i1({arc::ptr_t(1,1), arc::ptr_t::NIL()}, {}, {arc::ptr_t(0,0, false)}); + const test_request_t i1({arc::pointer_type(1,1), arc::pointer_type::nil()}, {}, {arc::pointer_type(0,0, false)}); s.push(i1); - const test_request_t i2({arc::ptr_t(1,0), arc::ptr_t::NIL()}, {}, {arc::ptr_t(0,0, true)}); + const test_request_t i2({arc::pointer_type(1,0), arc::pointer_type::nil()}, {}, {arc::pointer_type(0,0, true)}); s.push(i2); s.sort(); @@ -376,31 +377,31 @@ go_bandit([]() { using test_request_t = request_data<1, with_parent, 0, 1>; using test_roots_sorter_t = - nested_sweeping::outer::roots_sorter>; test_roots_sorter_t s(1024, 16); { - const reduce_arc i1 = arc(arc::ptr_t(0,0), false, arc::ptr_t(1,1)); + const reduce_arc i1 = arc(arc::pointer_type(0,0), false, arc::pointer_type(1,1)); s.push(i1); - const reduce_arc i2 = arc(arc::ptr_t(0,0), true, arc::ptr_t(1,0)); + const reduce_arc i2 = arc(arc::pointer_type(0,0), true, arc::pointer_type(1,0)); s.push(i2); } s.sort(); AssertThat(s.can_pull(), Is().True()); - const test_request_t e1({arc::ptr_t(1,0)}, {}, {arc::ptr_t(0,0, true)}); + const test_request_t e1({arc::pointer_type(1,0)}, {}, {arc::pointer_type(0,0, true)}); const test_request_t o1 = s.pull(); AssertThat(o1.target, Is().EqualTo(e1.target)); AssertThat(o1.data.source, Is().EqualTo(flag(e1.data.source))); AssertThat(s.can_pull(), Is().True()); - const test_request_t e2({arc::ptr_t(1,1)}, {}, {arc::ptr_t(0,0, false)}); + const test_request_t e2({arc::pointer_type(1,1)}, {}, {arc::pointer_type(0,0, false)}); const test_request_t o2 = s.pull(); AssertThat(o2.target, Is().EqualTo(e2.target)); @@ -413,31 +414,31 @@ go_bandit([]() { using test_request_t = request_data<2, with_parent, 0, 1>; using test_roots_sorter_t = - nested_sweeping::outer::roots_sorter>; test_roots_sorter_t s(1024, 16); { - const reduce_arc a1 = arc(arc::ptr_t(0,0), false, arc::ptr_t(1,1)); + const reduce_arc a1 = arc(arc::pointer_type(0,0), false, arc::pointer_type(1,1)); s.push(a1); - const reduce_arc a2 = arc(arc::ptr_t(0,0), true, arc::ptr_t(1,0)); + const reduce_arc a2 = arc(arc::pointer_type(0,0), true, arc::pointer_type(1,0)); s.push(a2); } s.sort(); AssertThat(s.can_pull(), Is().True()); - const test_request_t e1({arc::ptr_t(1,0), arc::ptr_t::NIL()}, {}, {arc::ptr_t(0,0, true)}); + const test_request_t e1({arc::pointer_type(1,0), arc::pointer_type::nil()}, {}, {arc::pointer_type(0,0, true)}); const test_request_t o1 = s.pull(); AssertThat(o1.target, Is().EqualTo(e1.target)); AssertThat(o1.data.source, Is().EqualTo(flag(e1.data.source))); AssertThat(s.can_pull(), Is().True()); - const test_request_t e2({arc::ptr_t(1,1), arc::ptr_t::NIL()}, {}, {arc::ptr_t(0,0, false)}); + const test_request_t e2({arc::pointer_type(1,1), arc::pointer_type::nil()}, {}, {arc::pointer_type(0,0, false)}); const test_request_t o2 = s.pull(); AssertThat(o2.target, Is().EqualTo(e2.target)); @@ -450,16 +451,16 @@ go_bandit([]() { using test_request_t = request_data<2, with_parent, 0, 1>; using test_roots_sorter_t = - nested_sweeping::outer::roots_sorter>; test_roots_sorter_t s(1024, 16); - const test_request_t i1({arc::ptr_t(3,3), arc::ptr_t::NIL()}, {}, {arc::ptr_t(2,0, false)}); - const test_request_t i2({arc::ptr_t(3,1), arc::ptr_t::NIL()}, {}, {arc::ptr_t(2,0, true)}); - const test_request_t i3({arc::ptr_t(3,2), arc::ptr_t::NIL()}, {}, {arc::ptr_t(2,1, false)}); - const test_request_t i4({arc::ptr_t(3,4), arc::ptr_t::NIL()}, {}, {arc::ptr_t(2,1, true)}); + const test_request_t i1({arc::pointer_type(3,3), arc::pointer_type::nil()}, {}, {arc::pointer_type(2,0, false)}); + const test_request_t i2({arc::pointer_type(3,1), arc::pointer_type::nil()}, {}, {arc::pointer_type(2,0, true)}); + const test_request_t i3({arc::pointer_type(3,2), arc::pointer_type::nil()}, {}, {arc::pointer_type(2,1, false)}); + const test_request_t i4({arc::pointer_type(3,4), arc::pointer_type::nil()}, {}, {arc::pointer_type(2,1, true)}); { s.push(reduce_arc(arc(i1.data.source, i1.target[0]))); @@ -501,16 +502,16 @@ go_bandit([]() { using test_request_t = request_data<2, with_parent, 0, 1>; using test_roots_sorter_t = - nested_sweeping::outer::roots_sorter>; test_roots_sorter_t s(1024, 16); - const test_request_t i1({arc::ptr_t(3,3), arc::ptr_t::NIL()}, {}, {arc::ptr_t(2,0, false)}); - const test_request_t i2({arc::ptr_t(3,2), arc::ptr_t::NIL()}, {}, {arc::ptr_t(2,0, true)}); - const test_request_t i3({arc::ptr_t(3,2), arc::ptr_t::NIL()}, {}, {arc::ptr_t(2,1, false)}); - const test_request_t i4({arc::ptr_t(3,1), arc::ptr_t::NIL()}, {}, {arc::ptr_t(2,1, true)}); + const test_request_t i1({arc::pointer_type(3,3), arc::pointer_type::nil()}, {}, {arc::pointer_type(2,0, false)}); + const test_request_t i2({arc::pointer_type(3,2), arc::pointer_type::nil()}, {}, {arc::pointer_type(2,0, true)}); + const test_request_t i3({arc::pointer_type(3,2), arc::pointer_type::nil()}, {}, {arc::pointer_type(2,1, false)}); + const test_request_t i4({arc::pointer_type(3,1), arc::pointer_type::nil()}, {}, {arc::pointer_type(2,1, true)}); { s.push(reduce_arc(arc(i1.data.source, i1.target[0]))); @@ -561,15 +562,15 @@ go_bandit([]() { using test_request_t = request_data<1, with_parent, 0, 1>; using test_roots_sorter_t = - nested_sweeping::outer::roots_sorter>; test_roots_sorter_t s1(1024, 16); test_roots_sorter_t s2(1024, 16); - const test_request_t i1({arc::ptr_t(3,2)}, {}, {arc::ptr_t(2,0, false)}); - const test_request_t i2({arc::ptr_t(3,1)}, {}, {arc::ptr_t(2,1, true)}); + const test_request_t i1({arc::pointer_type(3,2)}, {}, {arc::pointer_type(2,0, false)}); + const test_request_t i2({arc::pointer_type(3,1)}, {}, {arc::pointer_type(2,1, true)}); s1.push(i1); s1.push(i2); @@ -597,22 +598,22 @@ go_bandit([]() { using test_request_t = request_data<1, with_parent, 0, 1>; using test_roots_sorter_t = - nested_sweeping::outer::roots_sorter>; test_roots_sorter_t s1(1024, 16); test_roots_sorter_t s2(1024, 16); - const test_request_t i1({arc::ptr_t(3,3)}, {}, {arc::ptr_t(2,0, false)}); - const test_request_t i2({arc::ptr_t(3,1)}, {}, {arc::ptr_t(2,1, true)}); + const test_request_t i1({arc::pointer_type(3,3)}, {}, {arc::pointer_type(2,0, false)}); + const test_request_t i2({arc::pointer_type(3,1)}, {}, {arc::pointer_type(2,1, true)}); s1.push(i1); s1.push(i2); s2.move(s1); // From hereon forward s1 is in an illegal state - const test_request_t i3({arc::ptr_t(3,2)}, {}, {arc::ptr_t(2,1, false)}); + const test_request_t i3({arc::pointer_type(3,2)}, {}, {arc::pointer_type(2,1, false)}); s2.push(i3); s2.sort(); @@ -642,7 +643,7 @@ go_bandit([]() { using test_request_t = request_data<2, with_parent, 0, 1>; using test_roots_sorter_t = - nested_sweeping::outer::roots_sorter>; @@ -650,16 +651,16 @@ go_bandit([]() { AssertThat(s.size(), Is().EqualTo(0u)); - s.push(arc(arc::ptr_t(2,0), false, arc::ptr_t(3,0))); + s.push(arc(arc::pointer_type(2,0), false, arc::pointer_type(3,0))); AssertThat(s.size(), Is().EqualTo(1u)); - s.push({ {arc::ptr_t(3,0)}, {}, {arc::ptr_t(2,0, true)} }); + s.push({ {arc::pointer_type(3,0)}, {}, {arc::pointer_type(2,0, true)} }); AssertThat(s.size(), Is().EqualTo(2u)); s.reset(); AssertThat(s.size(), Is().EqualTo(0u)); - s.push({ {arc::ptr_t(1,0)}, {}, {arc::ptr_t(0,0, true)} }); + s.push({ {arc::pointer_type(1,0)}, {}, {arc::pointer_type(0,0, true)} }); AssertThat(s.size(), Is().EqualTo(1u)); }); @@ -667,25 +668,25 @@ go_bandit([]() { using test_request_t = request_data<2, with_parent, 0, 1>; using test_roots_sorter_t = - nested_sweeping::outer::roots_sorter>; test_roots_sorter_t s(1024, 16); - AssertThat(s.deepest_source(), Is().EqualTo(test_roots_sorter_t::NO_LEVEL)); + AssertThat(s.deepest_source(), Is().EqualTo(test_roots_sorter_t::no_level)); - const reduce_arc a1 = arc(arc::ptr_t(0,0), false, arc::ptr_t(1,1)); + const reduce_arc a1 = arc(arc::pointer_type(0,0), false, arc::pointer_type(1,1)); s.push(a1); AssertThat(s.deepest_source(), Is().EqualTo(0u)); - const reduce_arc a2 = arc(arc::ptr_t(1,0), false, arc::ptr_t(2,0)); + const reduce_arc a2 = arc(arc::pointer_type(1,0), false, arc::pointer_type(2,0)); s.push(a2); AssertThat(s.deepest_source(), Is().EqualTo(1u)); - const reduce_arc a3 = arc(arc::ptr_t(0,0), true, arc::ptr_t(1,0)); + const reduce_arc a3 = arc(arc::pointer_type(0,0), true, arc::pointer_type(1,0)); s.push(a3); AssertThat(s.deepest_source(), Is().EqualTo(1u)); @@ -695,20 +696,20 @@ go_bandit([]() { using test_request_t = request_data<2, with_parent, 0, 1>; using test_roots_sorter_t = - nested_sweeping::outer::roots_sorter>; test_roots_sorter_t s(1024, 16); - AssertThat(s.deepest_source(), Is().EqualTo(test_roots_sorter_t::NO_LEVEL)); + AssertThat(s.deepest_source(), Is().EqualTo(test_roots_sorter_t::no_level)); - const reduce_arc a1 = arc(arc::ptr_t(2,0), false, arc::ptr_t(3,1)); + const reduce_arc a1 = arc(arc::pointer_type(2,0), false, arc::pointer_type(3,1)); s.push(a1); AssertThat(s.deepest_source(), Is().EqualTo(2u)); - const reduce_arc a2 = arc(arc::ptr_t(1,0), false, arc::ptr_t(4,0)); + const reduce_arc a2 = arc(arc::pointer_type(1,0), false, arc::pointer_type(4,0)); s.push(a2); AssertThat(s.deepest_source(), Is().EqualTo(2u)); @@ -718,25 +719,25 @@ go_bandit([]() { using test_request_t = request_data<2, with_parent, 0, 1>; using test_roots_sorter_t = - nested_sweeping::outer::roots_sorter>; test_roots_sorter_t s(1024, 16); - AssertThat(s.deepest_source(), Is().EqualTo(test_roots_sorter_t::NO_LEVEL)); + AssertThat(s.deepest_source(), Is().EqualTo(test_roots_sorter_t::no_level)); - const test_request_t r1({arc::ptr_t(1,1)}, {}, {arc::ptr_t(0,0, false)}); + const test_request_t r1({arc::pointer_type(1,1)}, {}, {arc::pointer_type(0,0, false)}); s.push(r1); AssertThat(s.deepest_source(), Is().EqualTo(0u)); - const test_request_t r2({arc::ptr_t(2,0)}, {}, {arc::ptr_t(1,0, false)}); + const test_request_t r2({arc::pointer_type(2,0)}, {}, {arc::pointer_type(1,0, false)}); s.push(r2); AssertThat(s.deepest_source(), Is().EqualTo(1u)); - const test_request_t r3({arc::ptr_t(1,0)}, {}, {arc::ptr_t(0,0, true)}); + const test_request_t r3({arc::pointer_type(1,0)}, {}, {arc::pointer_type(0,0, true)}); s.push(r3); AssertThat(s.deepest_source(), Is().EqualTo(1u)); @@ -746,20 +747,20 @@ go_bandit([]() { using test_request_t = request_data<2, with_parent, 0, 1>; using test_roots_sorter_t = - nested_sweeping::outer::roots_sorter>; test_roots_sorter_t s(1024, 16); - AssertThat(s.deepest_source(), Is().EqualTo(test_roots_sorter_t::NO_LEVEL)); + AssertThat(s.deepest_source(), Is().EqualTo(test_roots_sorter_t::no_level)); - const test_request_t r1({arc::ptr_t(3,1)}, {}, {arc::ptr_t(2,0, false)}); + const test_request_t r1({arc::pointer_type(3,1)}, {}, {arc::pointer_type(2,0, false)}); s.push(r1); AssertThat(s.deepest_source(), Is().EqualTo(2u)); - const test_request_t r2({arc::ptr_t(4,0)}, {}, {arc::ptr_t(1,0, false)}); + const test_request_t r2({arc::pointer_type(4,0)}, {}, {arc::pointer_type(1,0, false)}); s.push(r2); AssertThat(s.deepest_source(), Is().EqualTo(2u)); @@ -769,24 +770,24 @@ go_bandit([]() { using test_request_t = request_data<2, with_parent, 0, 1>; using test_roots_sorter_t = - nested_sweeping::outer::roots_sorter>; test_roots_sorter_t s(1024, 16); - AssertThat(s.deepest_source(), Is().EqualTo(test_roots_sorter_t::NO_LEVEL)); + AssertThat(s.deepest_source(), Is().EqualTo(test_roots_sorter_t::no_level)); - const reduce_arc a1 = arc(arc::ptr_t(2,0), false, arc::ptr_t(1,1)); + const reduce_arc a1 = arc(arc::pointer_type(2,0), false, arc::pointer_type(1,1)); s.push(a1); AssertThat(s.deepest_source(), Is().EqualTo(2u)); s.reset(); - AssertThat(s.deepest_source(), Is().EqualTo(test_roots_sorter_t::NO_LEVEL)); + AssertThat(s.deepest_source(), Is().EqualTo(test_roots_sorter_t::no_level)); - const reduce_arc a2 = arc(arc::ptr_t(1,0), false, arc::ptr_t(2,0)); + const reduce_arc a2 = arc(arc::pointer_type(1,0), false, arc::pointer_type(2,0)); s.push(a2); AssertThat(s.deepest_source(), Is().EqualTo(1u)); @@ -797,11 +798,11 @@ go_bandit([]() { using test_request_t = request_data<2, with_parent, 0, 1>; using test_roots_sorter_t = - nested_sweeping::outer::roots_sorter>; - using test_pq_t = nested_sweeping::outer::up__pq_t<1, memory_mode_t::INTERNAL>; + using test_pq_t = nested_sweeping::outer::up__pq_t<1, memory_mode_t::Internal>; using test_decorator = nested_sweeping::outer::up__pq_decorator; @@ -973,7 +974,7 @@ go_bandit([]() { AssertThat(sorter.size(), Is().EqualTo(0u)); }); - it("forwards arc with NIL source to sorter", [&]() { + it("forwards arc with nil source to sorter", [&]() { test_pq_t pq({outer_dag}, memory_available(), 16); pq.setup_next_level(0u); // <-- set up pq to have no extra levels. @@ -984,7 +985,7 @@ go_bandit([]() { test_decorator d(pq, sorter, 2); // internal at threshold - d.push(arc(arc::ptr_t::NIL(), arc::ptr_t(42,0))); + d.push(arc(arc::pointer_type::nil(), arc::pointer_type(42,0))); AssertThat(pq.size(), Is().EqualTo(0u)); AssertThat(sorter.size(), Is().EqualTo(1u)); @@ -992,9 +993,9 @@ go_bandit([]() { }); describe("outer::inner_iterator", [&terminal_F, &terminal_T]() { - using test_iter_t = nested_sweeping::outer::inner_iterator>; + using test_iter_t = nested_sweeping::outer::inner_iterator>; - it("provides {NONE} for {3,2,1} % 4", [&]() { + it("provides {end} for {3,2,1} % 4", [&]() { /* // // 1 ---- x1 @@ -1005,9 +1006,9 @@ go_bandit([]() { // / \ // F T */ - const node::ptr_t n1(1,0); - const node::ptr_t n2(2,0); - const node::ptr_t n3(3,0); + const node::pointer_type n1(1,0); + const node::pointer_type n2(2,0); + const node::pointer_type n3(3,0); shared_levelized_file dag; @@ -1027,13 +1028,13 @@ go_bandit([]() { aw.push(level_info(3,1u)); } - test_not_sweep inner_impl(4); + test_not_sweep inner_impl(4); test_iter_t inner_iter(dag, inner_impl); - AssertThat(inner_iter.next_inner(), Is().EqualTo(test_iter_t::NONE)); + AssertThat(inner_iter.next_inner(), Is().EqualTo(test_iter_t::end)); }); - it("provides {2, NONE} for {3,2,1} % 2", [&]() { + it("provides {2, end} for {3,2,1} % 2", [&]() { /* // // 1 ---- x1 @@ -1044,9 +1045,9 @@ go_bandit([]() { // / \ // F T */ - const node::ptr_t n1(1,0); - const node::ptr_t n2(2,0); - const node::ptr_t n3(3,0); + const node::pointer_type n1(1,0); + const node::pointer_type n2(2,0); + const node::pointer_type n3(3,0); shared_levelized_file dag; @@ -1066,14 +1067,14 @@ go_bandit([]() { aw.push(level_info(3,1u)); } - test_not_sweep inner_impl(2); + test_not_sweep inner_impl(2); test_iter_t inner_iter(dag, inner_impl); AssertThat(inner_iter.next_inner(), Is().EqualTo(2u)); - AssertThat(inner_iter.next_inner(), Is().EqualTo(test_iter_t::NONE)); + AssertThat(inner_iter.next_inner(), Is().EqualTo(test_iter_t::end)); }); - it("provides {4, 2, 0, NONE} for {4,3,2,0} % 2", [&]() { + it("provides {4, 2, 0, end} for {4,3,2,0} % 2", [&]() { /* // // 1 ---- x0 @@ -1086,10 +1087,10 @@ go_bandit([]() { // / \ // F T */ - const node::ptr_t n1(0,0); - const node::ptr_t n2(2,0); - const node::ptr_t n3(3,0); - const node::ptr_t n4(4,0); + const node::pointer_type n1(0,0); + const node::pointer_type n2(2,0); + const node::pointer_type n3(3,0); + const node::pointer_type n4(4,0); shared_levelized_file dag; @@ -1112,13 +1113,13 @@ go_bandit([]() { aw.push(level_info(4,1u)); } - test_not_sweep inner_impl(2); + test_not_sweep inner_impl(2); test_iter_t inner_iter(dag, inner_impl); AssertThat(inner_iter.next_inner(), Is().EqualTo(4u)); AssertThat(inner_iter.next_inner(), Is().EqualTo(2u)); AssertThat(inner_iter.next_inner(), Is().EqualTo(0u)); - AssertThat(inner_iter.next_inner(), Is().EqualTo(test_iter_t::NONE)); + AssertThat(inner_iter.next_inner(), Is().EqualTo(test_iter_t::end)); }); }); @@ -1157,7 +1158,7 @@ go_bandit([]() { using test_request_t = request_data<1, with_parent, 0, 1>; using test_roots_sorter_t = - nested_sweeping::outer::roots_sorter>; @@ -1190,11 +1191,11 @@ go_bandit([]() { sorter.sort(); }); - stats_t::levelized_priority_queue_t lpq_stats; + statistics::levelized_priority_queue_t lpq_stats; using test_pq_t = levelized_node_priority_queue, - 1, memory_mode_t::INTERNAL, + 1, memory_mode_t::Internal, 1, 0 /* <-- this is important for nested sweeping */>; @@ -1682,13 +1683,13 @@ go_bandit([]() { using test_request_t = request_data<2, with_parent, 0, 1>; using test_roots_sorter_t = - nested_sweeping::outer::roots_sorter>; using test_pq_t = levelized_node_priority_queue, - 1, memory_mode_t::INTERNAL, + 1, memory_mode_t::Internal, 1, 0 /* <-- this is important for nested sweeping */>; @@ -1714,7 +1715,7 @@ go_bandit([]() { describe("inner::up__pq_decorator", [&]() { // Inner PQ - using inner_test_pq_t = nested_sweeping::inner::up__pq_t<1, memory_mode_t::INTERNAL>; + using inner_test_pq_t = nested_sweeping::inner::up__pq_t<1, memory_mode_t::Internal>; /* // // 3 ---- x2 @@ -1896,9 +1897,9 @@ go_bandit([]() { }); describe("inner::up__arc_stream__decorator", [&terminal_F, &terminal_T]() { - const arc::ptr_t n0(0,0); - const arc::ptr_t n1(1,0); - const arc::ptr_t n2(2,0); + const arc::pointer_type n0(0,0); + const arc::pointer_type n1(1,0); + const arc::pointer_type n2(2,0); shared_levelized_file outer; { // Garbage collect writer to free write-lock @@ -1988,7 +1989,7 @@ go_bandit([]() { describe("nested_sweeping::aux algorithms", []() { describe("__reduce_level__fast(...)", []() { - using pq_t = reduce_priority_queue<1, memory_mode_t::INTERNAL>; + using pq_t = reduce_priority_queue<1, memory_mode_t::Internal>; it("suppresses an entire level of redundant nodes", []() { /* @@ -2000,13 +2001,13 @@ go_bandit([]() { // / \ // F T */ - const arc::ptr_t terminal_F(false); - const arc::ptr_t terminal_T(true); + const arc::pointer_type terminal_F(false); + const arc::pointer_type terminal_T(true); - const arc::ptr_t n1(0,0); - const arc::ptr_t n2(1,0); - const arc::ptr_t n3(1,1); - const arc::ptr_t n4(2,0); + const arc::pointer_type n1(0,0); + const arc::pointer_type n2(1,0); + const arc::pointer_type n3(1,1); + const arc::pointer_type n4(2,0); shared_levelized_file in; @@ -2040,18 +2041,18 @@ go_bandit([]() { arcs.pull_terminal(); // 4 ---> T arcs.pull_terminal(); // 4 - -> F - out_writer.unsafe_push(node(2, node::MAX_ID, terminal_F, terminal_T)); + out_writer.unsafe_push(node(2, node::max_id, terminal_F, terminal_T)); out_writer.unsafe_push(level_info(2, 1)); out_writer.unsafe_max_1level_cut({ 0, 1, 1, 2 }); // 3 ---> 4 - pq.push(arc(arcs.pull_internal().source(), node::ptr_t(2, node::MAX_ID))); + pq.push(arc(arcs.pull_internal().source(), node::pointer_type(2, node::max_id))); // 3 - -> 4 - pq.push(arc(arcs.pull_internal().source(), node::ptr_t(2, node::MAX_ID))); + pq.push(arc(arcs.pull_internal().source(), node::pointer_type(2, node::max_id))); // 2 ---> 4 - pq.push(arc(arcs.pull_internal().source(), node::ptr_t(2, node::MAX_ID))); + pq.push(arc(arcs.pull_internal().source(), node::pointer_type(2, node::max_id))); // 2 - -> 4 - pq.push(arc(arcs.pull_internal().source(), node::ptr_t(2, node::MAX_ID))); + pq.push(arc(arcs.pull_internal().source(), node::pointer_type(2, node::max_id))); pq.setup_next_level(1); @@ -2063,10 +2064,10 @@ go_bandit([]() { AssertThat(out->canonical, Is().True()); - AssertThat(out->max_1level_cut[cut_type::INTERNAL], Is().EqualTo(0u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(1u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(1u)); - AssertThat(out->max_1level_cut[cut_type::ALL], Is().EqualTo(2u)); + AssertThat(out->max_1level_cut[cut::Internal], Is().EqualTo(0u)); + AssertThat(out->max_1level_cut[cut::Internal_False], Is().EqualTo(1u)); + AssertThat(out->max_1level_cut[cut::Internal_True], Is().EqualTo(1u)); + AssertThat(out->max_1level_cut[cut::All], Is().EqualTo(2u)); AssertThat(out->number_of_terminals[false], Is().EqualTo(1u)); AssertThat(out->number_of_terminals[true], Is().EqualTo(1u)); @@ -2077,7 +2078,7 @@ go_bandit([]() { node_test_stream out_nodes(out); AssertThat(out_nodes.can_pull(), Is().True()); - AssertThat(out_nodes.pull(), Is().EqualTo(node(2, node::MAX_ID, + AssertThat(out_nodes.pull(), Is().EqualTo(node(2, node::max_id, terminal_F, terminal_T))); @@ -2099,12 +2100,12 @@ go_bandit([]() { // / \ / \ // T F F T */ - const arc::ptr_t terminal_F(false); - const arc::ptr_t terminal_T(true); + const arc::pointer_type terminal_F(false); + const arc::pointer_type terminal_T(true); - const arc::ptr_t n1(0,0); - const arc::ptr_t n2(1,0); - const arc::ptr_t n3(1,1); + const arc::pointer_type n1(0,0); + const arc::pointer_type n2(1,0); + const arc::pointer_type n3(1,1); shared_levelized_file in; @@ -2140,10 +2141,10 @@ go_bandit([]() { AssertThat(out->canonical, Is().False()); - AssertThat(out->max_1level_cut[cut_type::INTERNAL], Is().EqualTo(0u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(2u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(2u)); - AssertThat(out->max_1level_cut[cut_type::ALL], Is().EqualTo(4u)); + AssertThat(out->max_1level_cut[cut::Internal], Is().EqualTo(0u)); + AssertThat(out->max_1level_cut[cut::Internal_False], Is().EqualTo(2u)); + AssertThat(out->max_1level_cut[cut::Internal_True], Is().EqualTo(2u)); + AssertThat(out->max_1level_cut[cut::All], Is().EqualTo(4u)); AssertThat(out->number_of_terminals[false], Is().EqualTo(2u)); AssertThat(out->number_of_terminals[true], Is().EqualTo(2u)); @@ -2154,12 +2155,12 @@ go_bandit([]() { node_test_stream out_nodes(out); AssertThat(out_nodes.can_pull(), Is().True()); - AssertThat(out_nodes.pull(), Is().EqualTo(node(1, node::MAX_ID, + AssertThat(out_nodes.pull(), Is().EqualTo(node(1, node::max_id, terminal_F, terminal_T))); AssertThat(out_nodes.can_pull(), Is().True()); - AssertThat(out_nodes.pull(), Is().EqualTo(node(1, node::MAX_ID-1, + AssertThat(out_nodes.pull(), Is().EqualTo(node(1, node::max_id-1, terminal_T, terminal_F))); @@ -2181,12 +2182,12 @@ go_bandit([]() { // / \ / \ // F T T F */ - const arc::ptr_t terminal_F(false); - const arc::ptr_t terminal_T(true); + const arc::pointer_type terminal_F(false); + const arc::pointer_type terminal_T(true); - const arc::ptr_t n1(0,0); - const arc::ptr_t n2(1,0); - const arc::ptr_t n3(1,1); + const arc::pointer_type n1(0,0); + const arc::pointer_type n2(1,0); + const arc::pointer_type n3(1,1); shared_levelized_file in; @@ -2222,10 +2223,10 @@ go_bandit([]() { AssertThat(out->canonical, Is().False()); - AssertThat(out->max_1level_cut[cut_type::INTERNAL], Is().EqualTo(0u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(2u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(2u)); - AssertThat(out->max_1level_cut[cut_type::ALL], Is().EqualTo(4u)); + AssertThat(out->max_1level_cut[cut::Internal], Is().EqualTo(0u)); + AssertThat(out->max_1level_cut[cut::Internal_False], Is().EqualTo(2u)); + AssertThat(out->max_1level_cut[cut::Internal_True], Is().EqualTo(2u)); + AssertThat(out->max_1level_cut[cut::All], Is().EqualTo(4u)); AssertThat(out->number_of_terminals[false], Is().EqualTo(2u)); AssertThat(out->number_of_terminals[true], Is().EqualTo(2u)); @@ -2236,12 +2237,12 @@ go_bandit([]() { node_test_stream out_nodes(out); AssertThat(out_nodes.can_pull(), Is().True()); - AssertThat(out_nodes.pull(), Is().EqualTo(node(1, node::MAX_ID, + AssertThat(out_nodes.pull(), Is().EqualTo(node(1, node::max_id, terminal_T, terminal_F))); AssertThat(out_nodes.can_pull(), Is().True()); - AssertThat(out_nodes.pull(), Is().EqualTo(node(1, node::MAX_ID-1, + AssertThat(out_nodes.pull(), Is().EqualTo(node(1, node::max_id-1, terminal_F, terminal_T))); @@ -2267,14 +2268,14 @@ go_bandit([]() { // / \ / \ // T F F T */ - const arc::ptr_t terminal_F(false); - const arc::ptr_t terminal_T(true); + const arc::pointer_type terminal_F(false); + const arc::pointer_type terminal_T(true); - const arc::ptr_t n1(0,0); - const arc::ptr_t n2(1,0); - const arc::ptr_t n3(1,1); - const arc::ptr_t n4(2,0); - const arc::ptr_t n5(2,1); + const arc::pointer_type n1(0,0); + const arc::pointer_type n2(1,0); + const arc::pointer_type n3(1,1); + const arc::pointer_type n4(2,0); + const arc::pointer_type n5(2,1); shared_levelized_file in; @@ -2310,21 +2311,21 @@ go_bandit([]() { // Simulate reduction of x2 arcs.pull_terminal(); // 5 ---> T arcs.pull_terminal(); // 5 - -> F - out_writer.unsafe_push(node(2, node::MAX_ID, terminal_F, terminal_T)); + out_writer.unsafe_push(node(2, node::max_id, terminal_F, terminal_T)); arcs.pull_terminal(); // 4 ---> F arcs.pull_terminal(); // 4 - -> T - out_writer.unsafe_push(node(2, node::MAX_ID-1, terminal_T, terminal_F)); + out_writer.unsafe_push(node(2, node::max_id-1, terminal_T, terminal_F)); out_writer.unsafe_push(level_info(2, 2)); out_writer.unsafe_max_1level_cut({ 0, 2, 3, 5 }); // 3 ---> 5 - pq.push(arc(arcs.pull_internal().source(), node::ptr_t(2, node::MAX_ID))); + pq.push(arc(arcs.pull_internal().source(), node::pointer_type(2, node::max_id))); // 3 - -> 4 - pq.push(arc(arcs.pull_internal().source(), node::ptr_t(2, node::MAX_ID-1))); + pq.push(arc(arcs.pull_internal().source(), node::pointer_type(2, node::max_id-1))); // 2 - -> 4 - pq.push(arc(arcs.pull_internal().source(), node::ptr_t(2, node::MAX_ID-1))); + pq.push(arc(arcs.pull_internal().source(), node::pointer_type(2, node::max_id-1))); pq.setup_next_level(1); @@ -2336,10 +2337,10 @@ go_bandit([]() { AssertThat(out->canonical, Is().False()); - AssertThat(out->max_1level_cut[cut_type::INTERNAL], Is().EqualTo(3u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(3u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(4u)); - AssertThat(out->max_1level_cut[cut_type::ALL], Is().EqualTo(5u)); + AssertThat(out->max_1level_cut[cut::Internal], Is().EqualTo(3u)); + AssertThat(out->max_1level_cut[cut::Internal_False], Is().EqualTo(3u)); + AssertThat(out->max_1level_cut[cut::Internal_True], Is().EqualTo(4u)); + AssertThat(out->max_1level_cut[cut::All], Is().EqualTo(5u)); AssertThat(out->number_of_terminals[false], Is().EqualTo(2u)); AssertThat(out->number_of_terminals[true], Is().EqualTo(3u)); @@ -2350,23 +2351,23 @@ go_bandit([]() { node_test_stream out_nodes(out); AssertThat(out_nodes.can_pull(), Is().True()); - AssertThat(out_nodes.pull(), Is().EqualTo(node(2, node::MAX_ID, + AssertThat(out_nodes.pull(), Is().EqualTo(node(2, node::max_id, terminal_F, terminal_T))); AssertThat(out_nodes.can_pull(), Is().True()); - AssertThat(out_nodes.pull(), Is().EqualTo(node(2, node::MAX_ID-1, + AssertThat(out_nodes.pull(), Is().EqualTo(node(2, node::max_id-1, terminal_T, terminal_F))); AssertThat(out_nodes.can_pull(), Is().True()); - AssertThat(out_nodes.pull(), Is().EqualTo(node(1, node::MAX_ID, - node::ptr_t(2, node::MAX_ID-1), - node::ptr_t(2, node::MAX_ID)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(1, node::max_id, + node::pointer_type(2, node::max_id-1), + node::pointer_type(2, node::max_id)))); AssertThat(out_nodes.can_pull(), Is().True()); - AssertThat(out_nodes.pull(), Is().EqualTo(node(1, node::MAX_ID-1, - node::ptr_t(2, node::MAX_ID-1), + AssertThat(out_nodes.pull(), Is().EqualTo(node(1, node::max_id-1, + node::pointer_type(2, node::max_id-1), terminal_T))); AssertThat(out_nodes.can_pull(), Is().False()); @@ -2394,13 +2395,13 @@ go_bandit([]() { // / \ // F T */ - const arc::ptr_t terminal_F(false); - const arc::ptr_t terminal_T(true); + const arc::pointer_type terminal_F(false); + const arc::pointer_type terminal_T(true); - const arc::ptr_t n1(0,0); - const arc::ptr_t n2(1,0); - const arc::ptr_t n3(1,1); - const arc::ptr_t n4(2,0); + const arc::pointer_type n1(0,0); + const arc::pointer_type n2(1,0); + const arc::pointer_type n3(1,1); + const arc::pointer_type n4(2,0); shared_levelized_file in; @@ -2434,17 +2435,17 @@ go_bandit([]() { // Simulate reduction of x2 arcs.pull_terminal(); // 4 ---> T arcs.pull_terminal(); // 4 - -> F - out_writer.unsafe_push(node(2, node::MAX_ID, terminal_F, terminal_T)); + out_writer.unsafe_push(node(2, node::max_id, terminal_F, terminal_T)); out_writer.unsafe_push(level_info(2, 1)); out_writer.unsafe_max_1level_cut({ 0, 1, 2, 2 }); // 3 ---> 4 - pq.push(arc(arcs.pull_internal().source(), node::ptr_t(2, node::MAX_ID))); + pq.push(arc(arcs.pull_internal().source(), node::pointer_type(2, node::max_id))); // 3 - -> 4 - pq.push(arc(arcs.pull_internal().source(), node::ptr_t(2, node::MAX_ID))); + pq.push(arc(arcs.pull_internal().source(), node::pointer_type(2, node::max_id))); // 2 - -> 4 - pq.push(arc(arcs.pull_internal().source(), node::ptr_t(2, node::MAX_ID))); + pq.push(arc(arcs.pull_internal().source(), node::pointer_type(2, node::max_id))); pq.setup_next_level(1); @@ -2456,10 +2457,10 @@ go_bandit([]() { AssertThat(out->canonical, Is().True()); - AssertThat(out->max_1level_cut[cut_type::INTERNAL], Is().EqualTo(1u)); // <-- NOTE: not '3u' - AssertThat(out->max_1level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(1u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(2u)); - AssertThat(out->max_1level_cut[cut_type::ALL], Is().EqualTo(2u)); + AssertThat(out->max_1level_cut[cut::Internal], Is().EqualTo(1u)); // <-- NOTE: not '3u' + AssertThat(out->max_1level_cut[cut::Internal_False], Is().EqualTo(1u)); + AssertThat(out->max_1level_cut[cut::Internal_True], Is().EqualTo(2u)); + AssertThat(out->max_1level_cut[cut::All], Is().EqualTo(2u)); AssertThat(out->number_of_terminals[false], Is().EqualTo(1u)); AssertThat(out->number_of_terminals[true], Is().EqualTo(2u)); @@ -2470,13 +2471,13 @@ go_bandit([]() { node_test_stream out_nodes(out); AssertThat(out_nodes.can_pull(), Is().True()); - AssertThat(out_nodes.pull(), Is().EqualTo(node(2, node::MAX_ID, + AssertThat(out_nodes.pull(), Is().EqualTo(node(2, node::max_id, terminal_F, terminal_T))); AssertThat(out_nodes.can_pull(), Is().True()); - AssertThat(out_nodes.pull(), Is().EqualTo(node(1, node::MAX_ID, - node::ptr_t(2, node::MAX_ID), + AssertThat(out_nodes.pull(), Is().EqualTo(node(1, node::max_id, + node::pointer_type(2, node::max_id), terminal_T))); AssertThat(out_nodes.can_pull(), Is().False()); @@ -2502,13 +2503,13 @@ go_bandit([]() { // / \ // F T */ - const arc::ptr_t terminal_F(false); - const arc::ptr_t terminal_T(true); + const arc::pointer_type terminal_F(false); + const arc::pointer_type terminal_T(true); - const arc::ptr_t n1(0,0); - const arc::ptr_t n2(1,0); - const arc::ptr_t n3(1,1); - const arc::ptr_t n4(2,0); + const arc::pointer_type n1(0,0); + const arc::pointer_type n2(1,0); + const arc::pointer_type n3(1,1); + const arc::pointer_type n4(2,0); shared_levelized_file in; @@ -2542,14 +2543,14 @@ go_bandit([]() { // Simulate reduction of x2 arcs.pull_terminal(); // 4 ---> T arcs.pull_terminal(); // 4 - -> F - out_writer.unsafe_push(node(2, node::MAX_ID, terminal_F, terminal_T)); + out_writer.unsafe_push(node(2, node::max_id, terminal_F, terminal_T)); out_writer.unsafe_push(level_info(2, 1)); // HACK: do not set 1-level cut to see desired behaviour // 2 - -> 4 - pq.push(arc(arcs.pull_internal().source(), node::ptr_t(2, node::MAX_ID))); + pq.push(arc(arcs.pull_internal().source(), node::pointer_type(2, node::max_id))); pq.setup_next_level(1); @@ -2561,10 +2562,10 @@ go_bandit([]() { AssertThat(out->canonical, Is().True()); - AssertThat(out->max_1level_cut[cut_type::INTERNAL], Is().EqualTo(1u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(1u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(2u)); - AssertThat(out->max_1level_cut[cut_type::ALL], Is().EqualTo(2u)); + AssertThat(out->max_1level_cut[cut::Internal], Is().EqualTo(1u)); + AssertThat(out->max_1level_cut[cut::Internal_False], Is().EqualTo(1u)); + AssertThat(out->max_1level_cut[cut::Internal_True], Is().EqualTo(2u)); + AssertThat(out->max_1level_cut[cut::All], Is().EqualTo(2u)); AssertThat(out->number_of_terminals[false], Is().EqualTo(1u)); AssertThat(out->number_of_terminals[true], Is().EqualTo(2u)); @@ -2575,13 +2576,13 @@ go_bandit([]() { node_test_stream out_nodes(out); AssertThat(out_nodes.can_pull(), Is().True()); - AssertThat(out_nodes.pull(), Is().EqualTo(node(2, node::MAX_ID, + AssertThat(out_nodes.pull(), Is().EqualTo(node(2, node::max_id, terminal_F, terminal_T))); AssertThat(out_nodes.can_pull(), Is().True()); - AssertThat(out_nodes.pull(), Is().EqualTo(node(1, node::MAX_ID, - node::ptr_t(2, node::MAX_ID), + AssertThat(out_nodes.pull(), Is().EqualTo(node(1, node::max_id, + node::pointer_type(2, node::max_id), terminal_T))); AssertThat(out_nodes.can_pull(), Is().False()); @@ -2607,14 +2608,14 @@ go_bandit([]() { // / \ / \ // T F F T */ - const arc::ptr_t terminal_F(false); - const arc::ptr_t terminal_T(true); + const arc::pointer_type terminal_F(false); + const arc::pointer_type terminal_T(true); - const arc::ptr_t n1(0,0); - const arc::ptr_t n2(1,0); - const arc::ptr_t n3(1,1); - const arc::ptr_t n4(2,0); - const arc::ptr_t n5(2,1); + const arc::pointer_type n1(0,0); + const arc::pointer_type n2(1,0); + const arc::pointer_type n3(1,1); + const arc::pointer_type n4(2,0); + const arc::pointer_type n5(2,1); shared_levelized_file in; @@ -2650,23 +2651,23 @@ go_bandit([]() { // Simulate reduction of x2 arcs.pull_terminal(); // 5 ---> T arcs.pull_terminal(); // 5 - -> F - out_writer.unsafe_push(node(2, node::MAX_ID, terminal_F, terminal_T)); + out_writer.unsafe_push(node(2, node::max_id, terminal_F, terminal_T)); arcs.pull_terminal(); // 4 ---> F arcs.pull_terminal(); // 4 - -> T - out_writer.unsafe_push(node(2, node::MAX_ID-1, terminal_T, terminal_F)); + out_writer.unsafe_push(node(2, node::max_id-1, terminal_T, terminal_F)); out_writer.unsafe_push(level_info(2, 2)); out_writer.unsafe_max_1level_cut({ 0, 2, 2, 4 }); // 3 ---> 5 - pq.push(arc(arcs.pull_internal().source(), node::ptr_t(2, node::MAX_ID))); + pq.push(arc(arcs.pull_internal().source(), node::pointer_type(2, node::max_id))); // 2 ---> 5 - pq.push(arc(arcs.pull_internal().source(), node::ptr_t(2, node::MAX_ID))); + pq.push(arc(arcs.pull_internal().source(), node::pointer_type(2, node::max_id))); // 3 - -> 4 - pq.push(arc(arcs.pull_internal().source(), node::ptr_t(2, node::MAX_ID-1))); + pq.push(arc(arcs.pull_internal().source(), node::pointer_type(2, node::max_id-1))); // 2 - -> 4 - pq.push(arc(arcs.pull_internal().source(), node::ptr_t(2, node::MAX_ID-1))); + pq.push(arc(arcs.pull_internal().source(), node::pointer_type(2, node::max_id-1))); pq.setup_next_level(1); @@ -2678,10 +2679,10 @@ go_bandit([]() { AssertThat(out->canonical, Is().False()); - AssertThat(out->max_1level_cut[cut_type::INTERNAL], Is().EqualTo(4u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(4u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(4u)); - AssertThat(out->max_1level_cut[cut_type::ALL], Is().EqualTo(4u)); + AssertThat(out->max_1level_cut[cut::Internal], Is().EqualTo(4u)); + AssertThat(out->max_1level_cut[cut::Internal_False], Is().EqualTo(4u)); + AssertThat(out->max_1level_cut[cut::Internal_True], Is().EqualTo(4u)); + AssertThat(out->max_1level_cut[cut::All], Is().EqualTo(4u)); AssertThat(out->number_of_terminals[false], Is().EqualTo(2u)); AssertThat(out->number_of_terminals[true], Is().EqualTo(2u)); @@ -2692,24 +2693,24 @@ go_bandit([]() { node_test_stream out_nodes(out); AssertThat(out_nodes.can_pull(), Is().True()); - AssertThat(out_nodes.pull(), Is().EqualTo(node(2, node::MAX_ID, + AssertThat(out_nodes.pull(), Is().EqualTo(node(2, node::max_id, terminal_F, terminal_T))); AssertThat(out_nodes.can_pull(), Is().True()); - AssertThat(out_nodes.pull(), Is().EqualTo(node(2, node::MAX_ID-1, + AssertThat(out_nodes.pull(), Is().EqualTo(node(2, node::max_id-1, terminal_T, terminal_F))); AssertThat(out_nodes.can_pull(), Is().True()); - AssertThat(out_nodes.pull(), Is().EqualTo(node(1, node::MAX_ID, - node::ptr_t(2, node::MAX_ID-1), - node::ptr_t(2, node::MAX_ID)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(1, node::max_id, + node::pointer_type(2, node::max_id-1), + node::pointer_type(2, node::max_id)))); AssertThat(out_nodes.can_pull(), Is().True()); - AssertThat(out_nodes.pull(), Is().EqualTo(node(1, node::MAX_ID-1, - node::ptr_t(2, node::MAX_ID-1), - node::ptr_t(2, node::MAX_ID)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(1, node::max_id-1, + node::pointer_type(2, node::max_id-1), + node::pointer_type(2, node::max_id)))); AssertThat(out_nodes.can_pull(), Is().False()); @@ -2730,10 +2731,10 @@ go_bandit([]() { // / \ // T T */ - const arc::ptr_t terminal_F(false); - const arc::ptr_t terminal_T(true); + const arc::pointer_type terminal_F(false); + const arc::pointer_type terminal_T(true); - const arc::ptr_t n1(0,0); + const arc::pointer_type n1(0,0); shared_levelized_file in; @@ -2763,10 +2764,10 @@ go_bandit([]() { AssertThat(out->canonical, Is().True()); - AssertThat(out->max_1level_cut[cut_type::INTERNAL], Is().EqualTo(0u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(0u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(0u)); - AssertThat(out->max_1level_cut[cut_type::ALL], Is().EqualTo(0u)); + AssertThat(out->max_1level_cut[cut::Internal], Is().EqualTo(0u)); + AssertThat(out->max_1level_cut[cut::Internal_False], Is().EqualTo(0u)); + AssertThat(out->max_1level_cut[cut::Internal_True], Is().EqualTo(0u)); + AssertThat(out->max_1level_cut[cut::All], Is().EqualTo(0u)); AssertThat(out->number_of_terminals[false], Is().EqualTo(0u)); AssertThat(out->number_of_terminals[true], Is().EqualTo(1u)); @@ -2794,12 +2795,12 @@ go_bandit([]() { // || || // T T */ - const arc::ptr_t terminal_F(false); - const arc::ptr_t terminal_T(true); + const arc::pointer_type terminal_F(false); + const arc::pointer_type terminal_T(true); - const arc::ptr_t n1(0,0); - const arc::ptr_t n2(1,0); - const arc::ptr_t n3(1,1); + const arc::pointer_type n1(0,0); + const arc::pointer_type n2(1,0); + const arc::pointer_type n3(1,1); shared_levelized_file in; @@ -2849,10 +2850,10 @@ go_bandit([]() { AssertThat(out->canonical, Is().True()); - AssertThat(out->max_1level_cut[cut_type::INTERNAL], Is().EqualTo(0u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(0u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(0u)); - AssertThat(out->max_1level_cut[cut_type::ALL], Is().EqualTo(0u)); + AssertThat(out->max_1level_cut[cut::Internal], Is().EqualTo(0u)); + AssertThat(out->max_1level_cut[cut::Internal_False], Is().EqualTo(0u)); + AssertThat(out->max_1level_cut[cut::Internal_True], Is().EqualTo(0u)); + AssertThat(out->max_1level_cut[cut::All], Is().EqualTo(0u)); AssertThat(out->number_of_terminals[false], Is().EqualTo(0u)); AssertThat(out->number_of_terminals[true], Is().EqualTo(1u)); @@ -2876,9 +2877,9 @@ go_bandit([]() { describe("nested_sweeping:: _ ::sweeps", [&terminal_F, &terminal_T, &outer_dag]() { describe("inner::down(...)", [&]() { - using inner_down_sweep = test_not_sweep; + using inner_down_sweep = test_not_sweep; using inner_roots_t = - nested_sweeping::outer::roots_sorter>; @@ -2912,7 +2913,7 @@ go_bandit([]() { // 2 3 4 ---- x1 */ inner_roots_t inner_roots(1024, 8); - const node::uid_t u1 = node::uid_t(0,0); + const node::uid_type u1 = node::uid_type(0,0); inner_roots.push({{n2.uid()}, {}, {u1.with(false)}}); inner_roots.push({{n3.uid()}, {}, {u1.with(true)}}); @@ -2985,8 +2986,8 @@ go_bandit([]() { */ inner_roots_t inner_roots(1024, 8); - const node::uid_t u0 = node::uid_t(0,0); - const node::uid_t u1 = node::uid_t(0,1); + const node::uid_type u0 = node::uid_type(0,0); + const node::uid_type u1 = node::uid_type(0,1); inner_roots.push({{n2.uid()}, {}, {u0.with(false)}}); inner_roots.push({{n3.uid()}, {}, {u0.with(true)}}); @@ -3055,16 +3056,16 @@ go_bandit([]() { }); it("can collapse to a terminal", []() { - test_terminal_sweep test_policy(2); + test_terminal_sweep test_policy(2); /* - // NIL + // nil // | // 1 ---- x1 // / \ // F T */ - const node n1(1, node::MAX_ID, node::ptr_t(false), node::ptr_t(true)); + const node n1(1, node::max_id, node::pointer_type(false), node::pointer_type(true)); shared_levelized_file outer_file; { // Garbage collect writer to free write-lock @@ -3074,7 +3075,7 @@ go_bandit([]() { inner_roots_t inner_roots(1024, 8); - inner_roots.push({{n1.uid()}, {}, {node::ptr_t::NIL()}}); + inner_roots.push({{n1.uid()}, {}, {node::pointer_type::nil()}}); const shared_levelized_file out = nested_sweeping::inner::down(test_policy, outer_file, inner_roots, memory_available()) @@ -3094,15 +3095,15 @@ go_bandit([]() { AssertThat(out->width, Is().EqualTo(0u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL], Is().EqualTo(0u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(0u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(1u)); - AssertThat(out->max_1level_cut[cut_type::ALL], Is().EqualTo(1u)); + AssertThat(out->max_1level_cut[cut::Internal], Is().EqualTo(0u)); + AssertThat(out->max_1level_cut[cut::Internal_False], Is().EqualTo(0u)); + AssertThat(out->max_1level_cut[cut::Internal_True], Is().EqualTo(1u)); + AssertThat(out->max_1level_cut[cut::All], Is().EqualTo(1u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL], Is().EqualTo(0u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(0u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(1u)); - AssertThat(out->max_2level_cut[cut_type::ALL], Is().EqualTo(1u)); + AssertThat(out->max_2level_cut[cut::Internal], Is().EqualTo(0u)); + AssertThat(out->max_2level_cut[cut::Internal_False], Is().EqualTo(0u)); + AssertThat(out->max_2level_cut[cut::Internal_True], Is().EqualTo(1u)); + AssertThat(out->max_2level_cut[cut::All], Is().EqualTo(1u)); AssertThat(out->number_of_terminals[false], Is().EqualTo(0u)); AssertThat(out->number_of_terminals[true], Is().EqualTo(1u)); @@ -3110,8 +3111,8 @@ go_bandit([]() { }); describe("inner::up(...)", []() { - using test_policy = test_not_sweep; - using outer_pq_t = nested_sweeping::outer::up__pq_t<1, memory_mode_t::INTERNAL>; + using test_policy = test_not_sweep; + using outer_pq_t = nested_sweeping::outer::up__pq_t<1, memory_mode_t::Internal>; it("reduces forest and pushes roots back out", []() { /* input @@ -3202,14 +3203,14 @@ go_bandit([]() { // Check meta variables before detach computations AssertThat(out->width, Is().EqualTo(2u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL], Is().EqualTo(1u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(2u)); + AssertThat(out->max_1level_cut[cut::Internal], Is().EqualTo(1u)); + AssertThat(out->max_1level_cut[cut::Internal_False], Is().EqualTo(2u)); // Over-approximation, since T-terminal from level (2) is removed - AssertThat(out->max_1level_cut[cut_type::INTERNAL_TRUE], Is().GreaterThanOrEqualTo(3u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_TRUE], Is().LessThanOrEqualTo(4u)); - AssertThat(out->max_1level_cut[cut_type::ALL], Is().GreaterThanOrEqualTo(4u)); - AssertThat(out->max_1level_cut[cut_type::ALL], Is().LessThanOrEqualTo(6u)); + AssertThat(out->max_1level_cut[cut::Internal_True], Is().GreaterThanOrEqualTo(3u)); + AssertThat(out->max_1level_cut[cut::Internal_True], Is().LessThanOrEqualTo(4u)); + AssertThat(out->max_1level_cut[cut::All], Is().GreaterThanOrEqualTo(4u)); + AssertThat(out->max_1level_cut[cut::All], Is().LessThanOrEqualTo(6u)); AssertThat(out->number_of_terminals[false], Is().EqualTo(2u)); AssertThat(out->number_of_terminals[true], Is().EqualTo(3u)); @@ -3220,18 +3221,18 @@ go_bandit([]() { node_test_stream out_nodes(out); AssertThat(out_nodes.can_pull(), Is().True()); - AssertThat(out_nodes.pull(), Is().EqualTo(node(3, node::MAX_ID, + AssertThat(out_nodes.pull(), Is().EqualTo(node(3, node::max_id, terminal_T, terminal_F))); AssertThat(out_nodes.can_pull(), Is().True()); - AssertThat(out_nodes.pull(), Is().EqualTo(node(2, node::MAX_ID, + AssertThat(out_nodes.pull(), Is().EqualTo(node(2, node::max_id, terminal_F, terminal_T))); AssertThat(out_nodes.can_pull(), Is().True()); - AssertThat(out_nodes.pull(), Is().EqualTo(node(2, node::MAX_ID-1, + AssertThat(out_nodes.pull(), Is().EqualTo(node(2, node::max_id-1, terminal_T, - ptr_uint64(3, ptr_uint64::MAX_ID)))); + ptr_uint64(3, ptr_uint64::max_id)))); AssertThat(out_nodes.can_pull(), Is().False()); @@ -3251,13 +3252,13 @@ go_bandit([]() { out_pq.setup_next_level(); AssertThat(out_pq.can_pull(), Is().True()); - AssertThat(out_pq.pull(), Is().EqualTo(arc(n2, true, ptr_uint64(2, ptr_uint64::MAX_ID)))); + AssertThat(out_pq.pull(), Is().EqualTo(arc(n2, true, ptr_uint64(2, ptr_uint64::max_id)))); AssertThat(out_pq.can_pull(), Is().True()); - AssertThat(out_pq.pull(), Is().EqualTo(arc(n2, false, ptr_uint64(2, ptr_uint64::MAX_ID-1)))); + AssertThat(out_pq.pull(), Is().EqualTo(arc(n2, false, ptr_uint64(2, ptr_uint64::max_id-1)))); AssertThat(out_pq.can_pull(), Is().True()); - AssertThat(out_pq.pull(), Is().EqualTo(arc(n1, true, ptr_uint64(2, ptr_uint64::MAX_ID-1)))); + AssertThat(out_pq.pull(), Is().EqualTo(arc(n1, true, ptr_uint64(2, ptr_uint64::max_id-1)))); AssertThat(out_pq.can_pull(), Is().False()); }); @@ -3327,10 +3328,10 @@ go_bandit([]() { // Check meta variables before detach computations AssertThat(out->width, Is().EqualTo(1u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL], Is().EqualTo(0u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(2u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(1u)); - AssertThat(out->max_1level_cut[cut_type::ALL], Is().EqualTo(3u)); + AssertThat(out->max_1level_cut[cut::Internal], Is().EqualTo(0u)); + AssertThat(out->max_1level_cut[cut::Internal_False], Is().EqualTo(2u)); + AssertThat(out->max_1level_cut[cut::Internal_True], Is().EqualTo(1u)); + AssertThat(out->max_1level_cut[cut::All], Is().EqualTo(3u)); AssertThat(out->number_of_terminals[false], Is().EqualTo(1u)); AssertThat(out->number_of_terminals[true], Is().EqualTo(1u)); @@ -3341,7 +3342,7 @@ go_bandit([]() { node_test_stream out_nodes(out); AssertThat(out_nodes.can_pull(), Is().True()); - AssertThat(out_nodes.pull(), Is().EqualTo(node(3, node::MAX_ID, + AssertThat(out_nodes.pull(), Is().EqualTo(node(3, node::max_id, terminal_F, terminal_T))); @@ -3360,7 +3361,7 @@ go_bandit([]() { out_pq.setup_next_level(); AssertThat(out_pq.can_pull(), Is().True()); - AssertThat(out_pq.pull(), Is().EqualTo(arc(n1, true, ptr_uint64(3, ptr_uint64::MAX_ID)))); + AssertThat(out_pq.pull(), Is().EqualTo(arc(n1, true, ptr_uint64(3, ptr_uint64::max_id)))); AssertThat(out_pq.can_pull(), Is().True()); AssertThat(out_pq.pull(), Is().EqualTo(arc(n1, false, terminal_F))); @@ -3435,10 +3436,10 @@ go_bandit([]() { // Check meta variables before detach computations AssertThat(out->width, Is().EqualTo(1u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL], Is().EqualTo(0u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(2u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(1u)); - AssertThat(out->max_1level_cut[cut_type::ALL], Is().EqualTo(3u)); + AssertThat(out->max_1level_cut[cut::Internal], Is().EqualTo(0u)); + AssertThat(out->max_1level_cut[cut::Internal_False], Is().EqualTo(2u)); + AssertThat(out->max_1level_cut[cut::Internal_True], Is().EqualTo(1u)); + AssertThat(out->max_1level_cut[cut::All], Is().EqualTo(3u)); AssertThat(out->number_of_terminals[false], Is().EqualTo(1u)); AssertThat(out->number_of_terminals[true], Is().EqualTo(1u)); @@ -3449,7 +3450,7 @@ go_bandit([]() { node_test_stream out_nodes(out); AssertThat(out_nodes.can_pull(), Is().True()); - AssertThat(out_nodes.pull(), Is().EqualTo(node(3, node::MAX_ID, + AssertThat(out_nodes.pull(), Is().EqualTo(node(3, node::max_id, terminal_F, terminal_T))); @@ -3468,7 +3469,7 @@ go_bandit([]() { out_pq.setup_next_level(); AssertThat(out_pq.can_pull(), Is().True()); - AssertThat(out_pq.pull(), Is().EqualTo(arc(n1, true, ptr_uint64(3, ptr_uint64::MAX_ID)))); + AssertThat(out_pq.pull(), Is().EqualTo(arc(n1, true, ptr_uint64(3, ptr_uint64::max_id)))); AssertThat(out_pq.can_pull(), Is().False()); }); @@ -3541,10 +3542,10 @@ go_bandit([]() { // Check meta variables before detach computations AssertThat(out->width, Is().EqualTo(1u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL], Is().EqualTo(0u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(1u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(1u)); - AssertThat(out->max_1level_cut[cut_type::ALL], Is().EqualTo(2u)); + AssertThat(out->max_1level_cut[cut::Internal], Is().EqualTo(0u)); + AssertThat(out->max_1level_cut[cut::Internal_False], Is().EqualTo(1u)); + AssertThat(out->max_1level_cut[cut::Internal_True], Is().EqualTo(1u)); + AssertThat(out->max_1level_cut[cut::All], Is().EqualTo(2u)); AssertThat(out->number_of_terminals[false], Is().EqualTo(1u)); AssertThat(out->number_of_terminals[true], Is().EqualTo(1u)); @@ -3555,7 +3556,7 @@ go_bandit([]() { node_test_stream out_nodes(out); AssertThat(out_nodes.can_pull(), Is().True()); - AssertThat(out_nodes.pull(), Is().EqualTo(node(3, node::MAX_ID, + AssertThat(out_nodes.pull(), Is().EqualTo(node(3, node::max_id, terminal_F, terminal_T))); @@ -3574,7 +3575,7 @@ go_bandit([]() { out_pq.setup_next_level(); AssertThat(out_pq.can_pull(), Is().True()); - AssertThat(out_pq.pull(), Is().EqualTo(arc(n1, true, ptr_uint64(3, ptr_uint64::MAX_ID)))); + AssertThat(out_pq.pull(), Is().EqualTo(arc(n1, true, ptr_uint64(3, ptr_uint64::max_id)))); AssertThat(out_pq.can_pull(), Is().False()); }); @@ -3639,10 +3640,10 @@ go_bandit([]() { // Check meta variables before detach computations AssertThat(out->width, Is().EqualTo(0u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL], Is().EqualTo(0u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(0u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(0u)); - AssertThat(out->max_1level_cut[cut_type::ALL], Is().EqualTo(0u)); + AssertThat(out->max_1level_cut[cut::Internal], Is().EqualTo(0u)); + AssertThat(out->max_1level_cut[cut::Internal_False], Is().EqualTo(0u)); + AssertThat(out->max_1level_cut[cut::Internal_True], Is().EqualTo(0u)); + AssertThat(out->max_1level_cut[cut::All], Is().EqualTo(0u)); AssertThat(out->number_of_terminals[false], Is().EqualTo(0u)); AssertThat(out->number_of_terminals[true], Is().EqualTo(0u)); @@ -3732,10 +3733,10 @@ go_bandit([]() { // Check meta variables before detach computations AssertThat(out->width, Is().EqualTo(1u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL], Is().EqualTo(0u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(2u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(1u)); - AssertThat(out->max_1level_cut[cut_type::ALL], Is().EqualTo(3u)); + AssertThat(out->max_1level_cut[cut::Internal], Is().EqualTo(0u)); + AssertThat(out->max_1level_cut[cut::Internal_False], Is().EqualTo(2u)); + AssertThat(out->max_1level_cut[cut::Internal_True], Is().EqualTo(1u)); + AssertThat(out->max_1level_cut[cut::All], Is().EqualTo(3u)); AssertThat(out->number_of_terminals[false], Is().EqualTo(1u)); AssertThat(out->number_of_terminals[true], Is().EqualTo(1u)); @@ -3746,7 +3747,7 @@ go_bandit([]() { node_test_stream out_nodes(out); AssertThat(out_nodes.can_pull(), Is().True()); - AssertThat(out_nodes.pull(), Is().EqualTo(node(3, node::MAX_ID, + AssertThat(out_nodes.pull(), Is().EqualTo(node(3, node::max_id, terminal_F, terminal_T))); @@ -3765,7 +3766,7 @@ go_bandit([]() { out_pq.setup_next_level(); AssertThat(out_pq.can_pull(), Is().True()); // Edge is tainted by reduction rule 1 - AssertThat(out_pq.pull(), Is().EqualTo(arc(n1, true, node::ptr_t(3, node::MAX_ID)))); + AssertThat(out_pq.pull(), Is().EqualTo(arc(n1, true, node::pointer_type(3, node::max_id)))); AssertThat(out_pq.can_pull(), Is().True()); // Edge is tainted by reduction rule 1 AssertThat(out_pq.pull(), Is().EqualTo(arc(n1, false, terminal_F))); @@ -3785,7 +3786,7 @@ go_bandit([]() { nw << node(true); } - test_not_sweep inner_impl(2); + test_not_sweep inner_impl(2); const bdd out = nested_sweep<>(in, inner_impl); @@ -3832,7 +3833,7 @@ go_bandit([]() { in->max_1level_cut = 3; } - test_not_sweep inner_impl(2); + test_not_sweep inner_impl(2); /* output // 1 ---- x1 @@ -3850,13 +3851,13 @@ go_bandit([]() { // n4 AssertThat(out_nodes.can_pull(), Is().True()); - AssertThat(out_nodes.pull(), Is().EqualTo(node(3, node::MAX_ID, terminal_T, terminal_F))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(3, node::max_id, terminal_T, terminal_F))); // n1 AssertThat(out_nodes.can_pull(), Is().True()); - AssertThat(out_nodes.pull(), Is().EqualTo(node(1, node::MAX_ID, + AssertThat(out_nodes.pull(), Is().EqualTo(node(1, node::max_id, terminal_T, - node::ptr_t(3, node::MAX_ID)))); + node::pointer_type(3, node::max_id)))); AssertThat(out_nodes.can_pull(), Is().False()); level_info_test_stream out_meta(out); @@ -3871,15 +3872,15 @@ go_bandit([]() { AssertThat(out->width, Is().EqualTo(1u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL], Is().EqualTo(1u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(1u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(2u)); - AssertThat(out->max_1level_cut[cut_type::ALL], Is().EqualTo(3u)); + AssertThat(out->max_1level_cut[cut::Internal], Is().EqualTo(1u)); + AssertThat(out->max_1level_cut[cut::Internal_False], Is().EqualTo(1u)); + AssertThat(out->max_1level_cut[cut::Internal_True], Is().EqualTo(2u)); + AssertThat(out->max_1level_cut[cut::All], Is().EqualTo(3u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL], Is().EqualTo(1u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(1u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(2u)); - AssertThat(out->max_2level_cut[cut_type::ALL], Is().EqualTo(3u)); + AssertThat(out->max_2level_cut[cut::Internal], Is().EqualTo(1u)); + AssertThat(out->max_2level_cut[cut::Internal_False], Is().EqualTo(1u)); + AssertThat(out->max_2level_cut[cut::Internal_True], Is().EqualTo(2u)); + AssertThat(out->max_2level_cut[cut::All], Is().EqualTo(3u)); AssertThat(out->number_of_terminals[false], Is().EqualTo(1u)); AssertThat(out->number_of_terminals[true], Is().EqualTo(2u)); @@ -3928,7 +3929,7 @@ go_bandit([]() { in->max_1level_cut = 3; } - test_not_sweep inner_impl(2); + test_not_sweep inner_impl(2); /* output // 1 ---- x1 @@ -3946,12 +3947,12 @@ go_bandit([]() { // n4 AssertThat(out_nodes.can_pull(), Is().True()); - AssertThat(out_nodes.pull(), Is().EqualTo(node(3, node::MAX_ID, terminal_T, terminal_F))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(3, node::max_id, terminal_T, terminal_F))); // n1 AssertThat(out_nodes.can_pull(), Is().True()); - AssertThat(out_nodes.pull(), Is().EqualTo(node(1, node::MAX_ID, - ptr_uint64(3, ptr_uint64::MAX_ID), + AssertThat(out_nodes.pull(), Is().EqualTo(node(1, node::max_id, + ptr_uint64(3, ptr_uint64::max_id), terminal_T))); AssertThat(out_nodes.can_pull(), Is().False()); @@ -3968,21 +3969,21 @@ go_bandit([]() { AssertThat(out->width, Is().EqualTo(1u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL], Is().EqualTo(1u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(1u)); + AssertThat(out->max_1level_cut[cut::Internal], Is().EqualTo(1u)); + AssertThat(out->max_1level_cut[cut::Internal_False], Is().EqualTo(1u)); // NOTE: Since the outer priority queue includes a tainted arc to T, it // is in fact counted twice: first it is counted in the inner // sweep to then be counted once more in the outer - AssertThat(out->max_1level_cut[cut_type::INTERNAL_TRUE], Is().GreaterThanOrEqualTo(2u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_TRUE], Is().LessThanOrEqualTo(3u)); - AssertThat(out->max_1level_cut[cut_type::ALL], Is().EqualTo(3u)); + AssertThat(out->max_1level_cut[cut::Internal_True], Is().GreaterThanOrEqualTo(2u)); + AssertThat(out->max_1level_cut[cut::Internal_True], Is().LessThanOrEqualTo(3u)); + AssertThat(out->max_1level_cut[cut::All], Is().EqualTo(3u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL], Is().EqualTo(1u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(1u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_TRUE], Is().GreaterThanOrEqualTo(2u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_TRUE], Is().LessThanOrEqualTo(3u)); - AssertThat(out->max_2level_cut[cut_type::ALL], Is().EqualTo(3u)); + AssertThat(out->max_2level_cut[cut::Internal], Is().EqualTo(1u)); + AssertThat(out->max_2level_cut[cut::Internal_False], Is().EqualTo(1u)); + AssertThat(out->max_2level_cut[cut::Internal_True], Is().GreaterThanOrEqualTo(2u)); + AssertThat(out->max_2level_cut[cut::Internal_True], Is().LessThanOrEqualTo(3u)); + AssertThat(out->max_2level_cut[cut::All], Is().EqualTo(3u)); AssertThat(out->number_of_terminals[false], Is().EqualTo(1u)); AssertThat(out->number_of_terminals[true], Is().EqualTo(2u)); @@ -4019,7 +4020,7 @@ go_bandit([]() { in->max_1level_cut = 1; } - test_not_sweep inner_impl(2); + test_not_sweep inner_impl(2); /* output // ---- x0 @@ -4035,7 +4036,7 @@ go_bandit([]() { // n2 AssertThat(out_nodes.can_pull(), Is().True()); - AssertThat(out_nodes.pull(), Is().EqualTo(node(1, node::MAX_ID, terminal_T, terminal_F))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(1, node::max_id, terminal_T, terminal_F))); AssertThat(out_nodes.can_pull(), Is().False()); @@ -4048,15 +4049,15 @@ go_bandit([]() { AssertThat(out->width, Is().EqualTo(1u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL], Is().EqualTo(1u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(1u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(1u)); - AssertThat(out->max_1level_cut[cut_type::ALL], Is().EqualTo(2u)); + AssertThat(out->max_1level_cut[cut::Internal], Is().EqualTo(1u)); + AssertThat(out->max_1level_cut[cut::Internal_False], Is().EqualTo(1u)); + AssertThat(out->max_1level_cut[cut::Internal_True], Is().EqualTo(1u)); + AssertThat(out->max_1level_cut[cut::All], Is().EqualTo(2u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL], Is().EqualTo(1u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(1u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(1u)); - AssertThat(out->max_2level_cut[cut_type::ALL], Is().EqualTo(2u)); + AssertThat(out->max_2level_cut[cut::Internal], Is().EqualTo(1u)); + AssertThat(out->max_2level_cut[cut::Internal_False], Is().EqualTo(1u)); + AssertThat(out->max_2level_cut[cut::Internal_True], Is().EqualTo(1u)); + AssertThat(out->max_2level_cut[cut::All], Is().EqualTo(2u)); AssertThat(out->number_of_terminals[false], Is().EqualTo(1u)); AssertThat(out->number_of_terminals[true], Is().EqualTo(1u)); @@ -4120,7 +4121,7 @@ go_bandit([]() { in->max_1level_cut = 3; } - test_not_sweep inner_impl(2); + test_not_sweep inner_impl(2); /* output (note, the deepest ones are doubly-negated!) // 1 ---- x1 @@ -4142,23 +4143,23 @@ go_bandit([]() { // n8 AssertThat(out_nodes.can_pull(), Is().True()); - AssertThat(out_nodes.pull(), Is().EqualTo(node(5, node::MAX_ID, terminal_F, terminal_T))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(5, node::max_id, terminal_F, terminal_T))); // n7 AssertThat(out_nodes.can_pull(), Is().True()); - AssertThat(out_nodes.pull(), Is().EqualTo(node(5, node::MAX_ID-1, terminal_T, terminal_F))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(5, node::max_id-1, terminal_T, terminal_F))); // n4 AssertThat(out_nodes.can_pull(), Is().True()); - AssertThat(out_nodes.pull(), Is().EqualTo(node(3, node::MAX_ID, + AssertThat(out_nodes.pull(), Is().EqualTo(node(3, node::max_id, terminal_T, - ptr_uint64(5, ptr_uint64::MAX_ID)))); + ptr_uint64(5, ptr_uint64::max_id)))); // n1 AssertThat(out_nodes.can_pull(), Is().True()); - AssertThat(out_nodes.pull(), Is().EqualTo(node(1, node::MAX_ID, - ptr_uint64(3, ptr_uint64::MAX_ID), - ptr_uint64(5, ptr_uint64::MAX_ID-1)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(1, node::max_id, + ptr_uint64(3, ptr_uint64::max_id), + ptr_uint64(5, ptr_uint64::max_id-1)))); AssertThat(out_nodes.can_pull(), Is().False()); @@ -4177,18 +4178,18 @@ go_bandit([]() { AssertThat(out->width, Is().EqualTo(2u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL], Is().EqualTo(2u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(2u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(3u)); - AssertThat(out->max_1level_cut[cut_type::ALL], Is().EqualTo(5u)); + AssertThat(out->max_1level_cut[cut::Internal], Is().EqualTo(2u)); + AssertThat(out->max_1level_cut[cut::Internal_False], Is().EqualTo(2u)); + AssertThat(out->max_1level_cut[cut::Internal_True], Is().EqualTo(3u)); + AssertThat(out->max_1level_cut[cut::All], Is().EqualTo(5u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL], Is().GreaterThanOrEqualTo(2u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL], Is().LessThanOrEqualTo(3u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_FALSE], Is().GreaterThanOrEqualTo(2u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_FALSE], Is().LessThanOrEqualTo(3u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_TRUE], Is().GreaterThanOrEqualTo(3u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_TRUE], Is().LessThanOrEqualTo(4u)); - AssertThat(out->max_2level_cut[cut_type::ALL], Is().EqualTo(5u)); + AssertThat(out->max_2level_cut[cut::Internal], Is().GreaterThanOrEqualTo(2u)); + AssertThat(out->max_2level_cut[cut::Internal], Is().LessThanOrEqualTo(3u)); + AssertThat(out->max_2level_cut[cut::Internal_False], Is().GreaterThanOrEqualTo(2u)); + AssertThat(out->max_2level_cut[cut::Internal_False], Is().LessThanOrEqualTo(3u)); + AssertThat(out->max_2level_cut[cut::Internal_True], Is().GreaterThanOrEqualTo(3u)); + AssertThat(out->max_2level_cut[cut::Internal_True], Is().LessThanOrEqualTo(4u)); + AssertThat(out->max_2level_cut[cut::All], Is().EqualTo(5u)); AssertThat(out->number_of_terminals[false], Is().EqualTo(2u)); AssertThat(out->number_of_terminals[true], Is().EqualTo(3u)); @@ -4243,7 +4244,7 @@ go_bandit([]() { in->max_1level_cut = 3; } - test_not_sweep inner_impl(2); + test_not_sweep inner_impl(2); /* output // ---- x0 @@ -4263,14 +4264,14 @@ go_bandit([]() { // n6 AssertThat(out_nodes.can_pull(), Is().True()); - AssertThat(out_nodes.pull(), Is().EqualTo(node(3, node::MAX_ID, + AssertThat(out_nodes.pull(), Is().EqualTo(node(3, node::max_id, terminal_F, terminal_T))); // n3 AssertThat(out_nodes.can_pull(), Is().True()); - AssertThat(out_nodes.pull(), Is().EqualTo(node(1, node::MAX_ID, - node::ptr_t(3, node::MAX_ID), + AssertThat(out_nodes.pull(), Is().EqualTo(node(1, node::max_id, + node::pointer_type(3, node::max_id), terminal_T))); AssertThat(out_nodes.can_pull(), Is().False()); @@ -4287,15 +4288,15 @@ go_bandit([]() { AssertThat(out->width, Is().EqualTo(1u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL], Is().EqualTo(1u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(1u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(2u)); - AssertThat(out->max_1level_cut[cut_type::ALL], Is().EqualTo(3u)); + AssertThat(out->max_1level_cut[cut::Internal], Is().EqualTo(1u)); + AssertThat(out->max_1level_cut[cut::Internal_False], Is().EqualTo(1u)); + AssertThat(out->max_1level_cut[cut::Internal_True], Is().EqualTo(2u)); + AssertThat(out->max_1level_cut[cut::All], Is().EqualTo(3u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL], Is().EqualTo(1u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(1u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(2u)); - AssertThat(out->max_2level_cut[cut_type::ALL], Is().EqualTo(3u)); + AssertThat(out->max_2level_cut[cut::Internal], Is().EqualTo(1u)); + AssertThat(out->max_2level_cut[cut::Internal_False], Is().EqualTo(1u)); + AssertThat(out->max_2level_cut[cut::Internal_True], Is().EqualTo(2u)); + AssertThat(out->max_2level_cut[cut::All], Is().EqualTo(3u)); AssertThat(out->number_of_terminals[false], Is().EqualTo(1u)); AssertThat(out->number_of_terminals[true], Is().EqualTo(2u)); @@ -4310,14 +4311,14 @@ go_bandit([]() { const ptr_uint64 terminal_T(true); // In canonical order (realistic output from Reduce) - const node n7(5,node::MAX_ID, terminal_F, terminal_T); - const node n8(5,node::MAX_ID-1, terminal_T, terminal_F); - const node n6(4,node::MAX_ID, n7.uid(), n8.uid()); + const node n7(5,node::max_id, terminal_F, terminal_T); + const node n8(5,node::max_id-1, terminal_T, terminal_F); + const node n6(4,node::max_id, n7.uid(), n8.uid()); //const node n5(3,_, n6.uid(), n6.uid()); - const node n4(3,node::MAX_ID, terminal_F, n7.uid()); - const node n3(2,node::MAX_ID, n4.uid(), n6.uid()); - const node n2(2,node::MAX_ID-1, terminal_F, n4.uid()); - const node n1(1,node::MAX_ID, n2.uid(), n3.uid()); + const node n4(3,node::max_id, terminal_F, n7.uid()); + const node n3(2,node::max_id, n4.uid(), n6.uid()); + const node n2(2,node::max_id-1, terminal_F, n4.uid()); + const node n1(1,node::max_id, n2.uid(), n3.uid()); shared_levelized_file in; @@ -4329,7 +4330,7 @@ go_bandit([]() { // Just a sanity check we created the input as intended AssertThat(in->canonical, Is().True()); - test_not_sweep inner_impl(2); + test_not_sweep inner_impl(2); /* output // See 'accumulates multiple nested sweeps [excl. root]' above. @@ -4341,23 +4342,23 @@ go_bandit([]() { // n8 AssertThat(out_nodes.can_pull(), Is().True()); - AssertThat(out_nodes.pull(), Is().EqualTo(node(5, node::MAX_ID, terminal_F, terminal_T))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(5, node::max_id, terminal_F, terminal_T))); // n7 AssertThat(out_nodes.can_pull(), Is().True()); - AssertThat(out_nodes.pull(), Is().EqualTo(node(5, node::MAX_ID-1, terminal_T, terminal_F))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(5, node::max_id-1, terminal_T, terminal_F))); // n4 AssertThat(out_nodes.can_pull(), Is().True()); - AssertThat(out_nodes.pull(), Is().EqualTo(node(3, node::MAX_ID, + AssertThat(out_nodes.pull(), Is().EqualTo(node(3, node::max_id, terminal_T, - ptr_uint64(5, ptr_uint64::MAX_ID)))); + ptr_uint64(5, ptr_uint64::max_id)))); // n1 AssertThat(out_nodes.can_pull(), Is().True()); - AssertThat(out_nodes.pull(), Is().EqualTo(node(1, node::MAX_ID, - ptr_uint64(3, ptr_uint64::MAX_ID), - ptr_uint64(5, ptr_uint64::MAX_ID-1)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(1, node::max_id, + ptr_uint64(3, ptr_uint64::max_id), + ptr_uint64(5, ptr_uint64::max_id-1)))); AssertThat(out_nodes.can_pull(), Is().False()); @@ -4376,18 +4377,18 @@ go_bandit([]() { AssertThat(out->width, Is().EqualTo(2u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL], Is().EqualTo(2u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(2u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(3u)); - AssertThat(out->max_1level_cut[cut_type::ALL], Is().EqualTo(5u)); + AssertThat(out->max_1level_cut[cut::Internal], Is().EqualTo(2u)); + AssertThat(out->max_1level_cut[cut::Internal_False], Is().EqualTo(2u)); + AssertThat(out->max_1level_cut[cut::Internal_True], Is().EqualTo(3u)); + AssertThat(out->max_1level_cut[cut::All], Is().EqualTo(5u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL], Is().GreaterThanOrEqualTo(2u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL], Is().LessThanOrEqualTo(3u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_FALSE], Is().GreaterThanOrEqualTo(2u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_FALSE], Is().LessThanOrEqualTo(3u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_TRUE], Is().GreaterThanOrEqualTo(3u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_TRUE], Is().LessThanOrEqualTo(4u)); - AssertThat(out->max_2level_cut[cut_type::ALL], Is().EqualTo(5u)); + AssertThat(out->max_2level_cut[cut::Internal], Is().GreaterThanOrEqualTo(2u)); + AssertThat(out->max_2level_cut[cut::Internal], Is().LessThanOrEqualTo(3u)); + AssertThat(out->max_2level_cut[cut::Internal_False], Is().GreaterThanOrEqualTo(2u)); + AssertThat(out->max_2level_cut[cut::Internal_False], Is().LessThanOrEqualTo(3u)); + AssertThat(out->max_2level_cut[cut::Internal_True], Is().GreaterThanOrEqualTo(3u)); + AssertThat(out->max_2level_cut[cut::Internal_True], Is().LessThanOrEqualTo(4u)); + AssertThat(out->max_2level_cut[cut::All], Is().EqualTo(5u)); AssertThat(out->number_of_terminals[false], Is().EqualTo(2u)); AssertThat(out->number_of_terminals[true], Is().EqualTo(3u)); @@ -4446,7 +4447,7 @@ go_bandit([]() { in->max_1level_cut = 3; } - test_not_sweep inner_impl(2); + test_not_sweep inner_impl(2); /* output // _1_ ---- x1 @@ -4468,21 +4469,21 @@ go_bandit([]() { // n5 AssertThat(out_nodes.can_pull(), Is().True()); - AssertThat(out_nodes.pull(), Is().EqualTo(node(5, node::MAX_ID, + AssertThat(out_nodes.pull(), Is().EqualTo(node(5, node::max_id, terminal_F, terminal_T))); // n3 AssertThat(out_nodes.can_pull(), Is().True()); - AssertThat(out_nodes.pull(), Is().EqualTo(node(3, node::MAX_ID, - node::ptr_t(5, node::MAX_ID), + AssertThat(out_nodes.pull(), Is().EqualTo(node(3, node::max_id, + node::pointer_type(5, node::max_id), terminal_T))); // n1 AssertThat(out_nodes.can_pull(), Is().True()); - AssertThat(out_nodes.pull(), Is().EqualTo(node(1, node::MAX_ID, - node::ptr_t(3, node::MAX_ID), - node::ptr_t(5, node::MAX_ID)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(1, node::max_id, + node::pointer_type(3, node::max_id), + node::pointer_type(5, node::max_id)))); AssertThat(out_nodes.can_pull(), Is().False()); @@ -4501,15 +4502,15 @@ go_bandit([]() { AssertThat(out->width, Is().EqualTo(1u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL], Is().EqualTo(2u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(2u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(3u)); - AssertThat(out->max_1level_cut[cut_type::ALL], Is().EqualTo(3u)); + AssertThat(out->max_1level_cut[cut::Internal], Is().EqualTo(2u)); + AssertThat(out->max_1level_cut[cut::Internal_False], Is().EqualTo(2u)); + AssertThat(out->max_1level_cut[cut::Internal_True], Is().EqualTo(3u)); + AssertThat(out->max_1level_cut[cut::All], Is().EqualTo(3u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL], Is().EqualTo(2u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(2u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(3u)); - AssertThat(out->max_2level_cut[cut_type::ALL], Is().EqualTo(3u)); + AssertThat(out->max_2level_cut[cut::Internal], Is().EqualTo(2u)); + AssertThat(out->max_2level_cut[cut::Internal_False], Is().EqualTo(2u)); + AssertThat(out->max_2level_cut[cut::Internal_True], Is().EqualTo(3u)); + AssertThat(out->max_2level_cut[cut::All], Is().EqualTo(3u)); AssertThat(out->number_of_terminals[false], Is().EqualTo(1u)); AssertThat(out->number_of_terminals[true], Is().EqualTo(2u)); @@ -4569,7 +4570,7 @@ go_bandit([]() { in->max_1level_cut = 4; } - test_terminal_sweep inner_impl(2); + test_terminal_sweep inner_impl(2); /* output // 1 ---- x1 @@ -4583,7 +4584,7 @@ go_bandit([]() { // n1 AssertThat(out_nodes.can_pull(), Is().True()); - AssertThat(out_nodes.pull(), Is().EqualTo(node(1, node::MAX_ID, + AssertThat(out_nodes.pull(), Is().EqualTo(node(1, node::max_id, terminal_T, terminal_F))); @@ -4598,15 +4599,15 @@ go_bandit([]() { AssertThat(out->width, Is().EqualTo(1u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL], Is().EqualTo(1u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(1u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(1u)); - AssertThat(out->max_1level_cut[cut_type::ALL], Is().EqualTo(2u)); + AssertThat(out->max_1level_cut[cut::Internal], Is().EqualTo(1u)); + AssertThat(out->max_1level_cut[cut::Internal_False], Is().EqualTo(1u)); + AssertThat(out->max_1level_cut[cut::Internal_True], Is().EqualTo(1u)); + AssertThat(out->max_1level_cut[cut::All], Is().EqualTo(2u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL], Is().EqualTo(1u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(1u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(1u)); - AssertThat(out->max_2level_cut[cut_type::ALL], Is().EqualTo(2u)); + AssertThat(out->max_2level_cut[cut::Internal], Is().EqualTo(1u)); + AssertThat(out->max_2level_cut[cut::Internal_False], Is().EqualTo(1u)); + AssertThat(out->max_2level_cut[cut::Internal_True], Is().EqualTo(1u)); + AssertThat(out->max_2level_cut[cut::All], Is().EqualTo(2u)); AssertThat(out->number_of_terminals[false], Is().EqualTo(1u)); AssertThat(out->number_of_terminals[true], Is().EqualTo(1u)); @@ -4658,7 +4659,7 @@ go_bandit([]() { in->max_1level_cut = 2; } - test_terminal_sweep inner_impl(3); + test_terminal_sweep inner_impl(3); /* output // _1_ ---- x2 @@ -4679,15 +4680,15 @@ go_bandit([]() { // n4' AssertThat(out_nodes.can_pull(), Is().True()); - AssertThat(out_nodes.pull(), Is().EqualTo(node(5, node::MAX_ID, + AssertThat(out_nodes.pull(), Is().EqualTo(node(5, node::max_id, terminal_T, terminal_F))); // n1 AssertThat(out_nodes.can_pull(), Is().True()); - AssertThat(out_nodes.pull(), Is().EqualTo(node(2, node::MAX_ID, + AssertThat(out_nodes.pull(), Is().EqualTo(node(2, node::max_id, terminal_F, - node::ptr_t(5, node::MAX_ID)))); + node::pointer_type(5, node::max_id)))); AssertThat(out_nodes.can_pull(), Is().False()); @@ -4702,15 +4703,15 @@ go_bandit([]() { AssertThat(out->width, Is().EqualTo(1u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL], Is().EqualTo(1u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(2u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(1u)); - AssertThat(out->max_1level_cut[cut_type::ALL], Is().EqualTo(3u)); + AssertThat(out->max_1level_cut[cut::Internal], Is().EqualTo(1u)); + AssertThat(out->max_1level_cut[cut::Internal_False], Is().EqualTo(2u)); + AssertThat(out->max_1level_cut[cut::Internal_True], Is().EqualTo(1u)); + AssertThat(out->max_1level_cut[cut::All], Is().EqualTo(3u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL], Is().EqualTo(1u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(2u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(1u)); - AssertThat(out->max_2level_cut[cut_type::ALL], Is().EqualTo(3u)); + AssertThat(out->max_2level_cut[cut::Internal], Is().EqualTo(1u)); + AssertThat(out->max_2level_cut[cut::Internal_False], Is().EqualTo(2u)); + AssertThat(out->max_2level_cut[cut::Internal_True], Is().EqualTo(1u)); + AssertThat(out->max_2level_cut[cut::All], Is().EqualTo(3u)); AssertThat(out->number_of_terminals[false], Is().EqualTo(2u)); AssertThat(out->number_of_terminals[true], Is().EqualTo(1u)); @@ -4753,7 +4754,7 @@ go_bandit([]() { in->max_1level_cut = 1; } - test_not_sweep inner_impl(2); + test_not_sweep inner_impl(2); /* output // 1 ---- x1 @@ -4767,7 +4768,7 @@ go_bandit([]() { // n1 AssertThat(out_nodes.can_pull(), Is().True()); - AssertThat(out_nodes.pull(), Is().EqualTo(node(1, node::MAX_ID, + AssertThat(out_nodes.pull(), Is().EqualTo(node(1, node::max_id, terminal_F, terminal_T))); AssertThat(out_nodes.can_pull(), Is().False()); @@ -4781,15 +4782,15 @@ go_bandit([]() { AssertThat(out->width, Is().EqualTo(1u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL], Is().EqualTo(1u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(1u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(1u)); - AssertThat(out->max_1level_cut[cut_type::ALL], Is().EqualTo(2u)); + AssertThat(out->max_1level_cut[cut::Internal], Is().EqualTo(1u)); + AssertThat(out->max_1level_cut[cut::Internal_False], Is().EqualTo(1u)); + AssertThat(out->max_1level_cut[cut::Internal_True], Is().EqualTo(1u)); + AssertThat(out->max_1level_cut[cut::All], Is().EqualTo(2u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL], Is().EqualTo(1u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(1u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(1u)); - AssertThat(out->max_2level_cut[cut_type::ALL], Is().EqualTo(2u)); + AssertThat(out->max_2level_cut[cut::Internal], Is().EqualTo(1u)); + AssertThat(out->max_2level_cut[cut::Internal_False], Is().EqualTo(1u)); + AssertThat(out->max_2level_cut[cut::Internal_True], Is().EqualTo(1u)); + AssertThat(out->max_2level_cut[cut::All], Is().EqualTo(2u)); AssertThat(out->number_of_terminals[false], Is().EqualTo(1u)); AssertThat(out->number_of_terminals[true], Is().EqualTo(1u)); @@ -4832,7 +4833,7 @@ go_bandit([]() { in->max_1level_cut = 1; } - test_not_sweep inner_impl(2); + test_not_sweep inner_impl(2); /* output // 1 ---- x1 @@ -4846,7 +4847,7 @@ go_bandit([]() { // n1 AssertThat(out_nodes.can_pull(), Is().True()); - AssertThat(out_nodes.pull(), Is().EqualTo(node(1, node::MAX_ID, + AssertThat(out_nodes.pull(), Is().EqualTo(node(1, node::max_id, terminal_F, terminal_T))); AssertThat(out_nodes.can_pull(), Is().False()); @@ -4860,15 +4861,15 @@ go_bandit([]() { AssertThat(out->width, Is().EqualTo(1u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL], Is().EqualTo(1u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(1u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(1u)); - AssertThat(out->max_1level_cut[cut_type::ALL], Is().EqualTo(2u)); + AssertThat(out->max_1level_cut[cut::Internal], Is().EqualTo(1u)); + AssertThat(out->max_1level_cut[cut::Internal_False], Is().EqualTo(1u)); + AssertThat(out->max_1level_cut[cut::Internal_True], Is().EqualTo(1u)); + AssertThat(out->max_1level_cut[cut::All], Is().EqualTo(2u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL], Is().EqualTo(1u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(1u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(1u)); - AssertThat(out->max_2level_cut[cut_type::ALL], Is().EqualTo(2u)); + AssertThat(out->max_2level_cut[cut::Internal], Is().EqualTo(1u)); + AssertThat(out->max_2level_cut[cut::Internal_False], Is().EqualTo(1u)); + AssertThat(out->max_2level_cut[cut::Internal_True], Is().EqualTo(1u)); + AssertThat(out->max_2level_cut[cut::All], Is().EqualTo(2u)); AssertThat(out->number_of_terminals[false], Is().EqualTo(1u)); AssertThat(out->number_of_terminals[true], Is().EqualTo(1u)); @@ -4905,7 +4906,7 @@ go_bandit([]() { in->max_1level_cut = 1; } - test_not_sweep inner_impl(2); + test_not_sweep inner_impl(2); /* output // T @@ -4926,15 +4927,15 @@ go_bandit([]() { AssertThat(out->width, Is().EqualTo(0u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL], Is().EqualTo(0u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(0u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(1u)); - AssertThat(out->max_1level_cut[cut_type::ALL], Is().EqualTo(1u)); + AssertThat(out->max_1level_cut[cut::Internal], Is().EqualTo(0u)); + AssertThat(out->max_1level_cut[cut::Internal_False], Is().EqualTo(0u)); + AssertThat(out->max_1level_cut[cut::Internal_True], Is().EqualTo(1u)); + AssertThat(out->max_1level_cut[cut::All], Is().EqualTo(1u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL], Is().EqualTo(0u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(0u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(1u)); - AssertThat(out->max_2level_cut[cut_type::ALL], Is().EqualTo(1u)); + AssertThat(out->max_2level_cut[cut::Internal], Is().EqualTo(0u)); + AssertThat(out->max_2level_cut[cut::Internal_False], Is().EqualTo(0u)); + AssertThat(out->max_2level_cut[cut::Internal_True], Is().EqualTo(1u)); + AssertThat(out->max_2level_cut[cut::All], Is().EqualTo(1u)); AssertThat(out->number_of_terminals[false], Is().EqualTo(0u)); AssertThat(out->number_of_terminals[true], Is().EqualTo(1u)); @@ -4972,7 +4973,7 @@ go_bandit([]() { in->max_1level_cut = 2; } - test_not_sweep inner_impl(2); + test_not_sweep inner_impl(2); /* output // 2 ---- x1 @@ -4985,7 +4986,7 @@ go_bandit([]() { node_test_stream out_nodes(out); AssertThat(out_nodes.can_pull(), Is().True()); - AssertThat(out_nodes.pull(), Is().EqualTo(node(1, node::MAX_ID, terminal_T, terminal_F))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(1, node::max_id, terminal_T, terminal_F))); AssertThat(out_nodes.can_pull(), Is().False()); @@ -4998,15 +4999,15 @@ go_bandit([]() { AssertThat(out->width, Is().EqualTo(1u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL], Is().EqualTo(1u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(1u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(1u)); - AssertThat(out->max_1level_cut[cut_type::ALL], Is().EqualTo(2u)); + AssertThat(out->max_1level_cut[cut::Internal], Is().EqualTo(1u)); + AssertThat(out->max_1level_cut[cut::Internal_False], Is().EqualTo(1u)); + AssertThat(out->max_1level_cut[cut::Internal_True], Is().EqualTo(1u)); + AssertThat(out->max_1level_cut[cut::All], Is().EqualTo(2u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL], Is().EqualTo(1u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(1u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(1u)); - AssertThat(out->max_2level_cut[cut_type::ALL], Is().EqualTo(2u)); + AssertThat(out->max_2level_cut[cut::Internal], Is().EqualTo(1u)); + AssertThat(out->max_2level_cut[cut::Internal_False], Is().EqualTo(1u)); + AssertThat(out->max_2level_cut[cut::Internal_True], Is().EqualTo(1u)); + AssertThat(out->max_2level_cut[cut::All], Is().EqualTo(2u)); AssertThat(out->number_of_terminals[false], Is().EqualTo(1u)); AssertThat(out->number_of_terminals[true], Is().EqualTo(1u)); @@ -5043,7 +5044,7 @@ go_bandit([]() { in->max_1level_cut = 1; } - test_not_sweep inner_impl(2); + test_not_sweep inner_impl(2); /* output // T @@ -5064,15 +5065,15 @@ go_bandit([]() { AssertThat(out->width, Is().EqualTo(0u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL], Is().EqualTo(0u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(0u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(1u)); - AssertThat(out->max_1level_cut[cut_type::ALL], Is().EqualTo(1u)); + AssertThat(out->max_1level_cut[cut::Internal], Is().EqualTo(0u)); + AssertThat(out->max_1level_cut[cut::Internal_False], Is().EqualTo(0u)); + AssertThat(out->max_1level_cut[cut::Internal_True], Is().EqualTo(1u)); + AssertThat(out->max_1level_cut[cut::All], Is().EqualTo(1u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL], Is().EqualTo(0u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(0u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(1u)); - AssertThat(out->max_2level_cut[cut_type::ALL], Is().EqualTo(1u)); + AssertThat(out->max_2level_cut[cut::Internal], Is().EqualTo(0u)); + AssertThat(out->max_2level_cut[cut::Internal_False], Is().EqualTo(0u)); + AssertThat(out->max_2level_cut[cut::Internal_True], Is().EqualTo(1u)); + AssertThat(out->max_2level_cut[cut::All], Is().EqualTo(1u)); AssertThat(out->number_of_terminals[false], Is().EqualTo(0u)); AssertThat(out->number_of_terminals[true], Is().EqualTo(1u)); @@ -5109,7 +5110,7 @@ go_bandit([]() { in->max_1level_cut = 1; } - test_not_sweep inner_impl(2); + test_not_sweep inner_impl(2); /* output // F @@ -5131,15 +5132,15 @@ go_bandit([]() { AssertThat(out->width, Is().EqualTo(0u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL], Is().EqualTo(0u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(1u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(0u)); - AssertThat(out->max_1level_cut[cut_type::ALL], Is().EqualTo(1u)); + AssertThat(out->max_1level_cut[cut::Internal], Is().EqualTo(0u)); + AssertThat(out->max_1level_cut[cut::Internal_False], Is().EqualTo(1u)); + AssertThat(out->max_1level_cut[cut::Internal_True], Is().EqualTo(0u)); + AssertThat(out->max_1level_cut[cut::All], Is().EqualTo(1u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL], Is().EqualTo(0u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(1u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(0u)); - AssertThat(out->max_2level_cut[cut_type::ALL], Is().EqualTo(1u)); + AssertThat(out->max_2level_cut[cut::Internal], Is().EqualTo(0u)); + AssertThat(out->max_2level_cut[cut::Internal_False], Is().EqualTo(1u)); + AssertThat(out->max_2level_cut[cut::Internal_True], Is().EqualTo(0u)); + AssertThat(out->max_2level_cut[cut::All], Is().EqualTo(1u)); AssertThat(out->number_of_terminals[false], Is().EqualTo(1u)); AssertThat(out->number_of_terminals[true], Is().EqualTo(0u)); @@ -5176,7 +5177,7 @@ go_bandit([]() { in->max_1level_cut = 1; } - test_terminal_sweep inner_impl(2); + test_terminal_sweep inner_impl(2); /* output // T @@ -5197,15 +5198,15 @@ go_bandit([]() { AssertThat(out->width, Is().EqualTo(0u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL], Is().EqualTo(0u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(0u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(1u)); - AssertThat(out->max_1level_cut[cut_type::ALL], Is().EqualTo(1u)); + AssertThat(out->max_1level_cut[cut::Internal], Is().EqualTo(0u)); + AssertThat(out->max_1level_cut[cut::Internal_False], Is().EqualTo(0u)); + AssertThat(out->max_1level_cut[cut::Internal_True], Is().EqualTo(1u)); + AssertThat(out->max_1level_cut[cut::All], Is().EqualTo(1u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL], Is().EqualTo(0u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(0u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(1u)); - AssertThat(out->max_2level_cut[cut_type::ALL], Is().EqualTo(1u)); + AssertThat(out->max_2level_cut[cut::Internal], Is().EqualTo(0u)); + AssertThat(out->max_2level_cut[cut::Internal_False], Is().EqualTo(0u)); + AssertThat(out->max_2level_cut[cut::Internal_True], Is().EqualTo(1u)); + AssertThat(out->max_2level_cut[cut::All], Is().EqualTo(1u)); AssertThat(out->number_of_terminals[false], Is().EqualTo(0u)); AssertThat(out->number_of_terminals[true], Is().EqualTo(1u)); @@ -5244,7 +5245,7 @@ go_bandit([]() { in->max_1level_cut = 1; } - test_terminal_sweep inner_impl(4); + test_terminal_sweep inner_impl(4); /* output // T <-- reduced from 2' ---- x2 // / \ @@ -5266,15 +5267,15 @@ go_bandit([]() { AssertThat(out->width, Is().EqualTo(0u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL], Is().EqualTo(0u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(0u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(1u)); - AssertThat(out->max_1level_cut[cut_type::ALL], Is().EqualTo(1u)); + AssertThat(out->max_1level_cut[cut::Internal], Is().EqualTo(0u)); + AssertThat(out->max_1level_cut[cut::Internal_False], Is().EqualTo(0u)); + AssertThat(out->max_1level_cut[cut::Internal_True], Is().EqualTo(1u)); + AssertThat(out->max_1level_cut[cut::All], Is().EqualTo(1u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL], Is().EqualTo(0u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(0u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(1u)); - AssertThat(out->max_2level_cut[cut_type::ALL], Is().EqualTo(1u)); + AssertThat(out->max_2level_cut[cut::Internal], Is().EqualTo(0u)); + AssertThat(out->max_2level_cut[cut::Internal_False], Is().EqualTo(0u)); + AssertThat(out->max_2level_cut[cut::Internal_True], Is().EqualTo(1u)); + AssertThat(out->max_2level_cut[cut::All], Is().EqualTo(1u)); AssertThat(out->number_of_terminals[false], Is().EqualTo(0u)); AssertThat(out->number_of_terminals[true], Is().EqualTo(1u)); @@ -5336,7 +5337,7 @@ go_bandit([]() { in->max_1level_cut = 3; } - test_not_sweep inner_impl(2); + test_not_sweep inner_impl(2); /* output // _1_ ---- x1 @@ -5358,27 +5359,27 @@ go_bandit([]() { // n7 AssertThat(out_nodes.can_pull(), Is().True()); - AssertThat(out_nodes.pull(), Is().EqualTo(node(5, node::MAX_ID, + AssertThat(out_nodes.pull(), Is().EqualTo(node(5, node::max_id, terminal_T, terminal_F))); // n5 AssertThat(out_nodes.can_pull(), Is().True()); - AssertThat(out_nodes.pull(), Is().EqualTo(node(3, node::MAX_ID, - node::ptr_t(5, node::MAX_ID), + AssertThat(out_nodes.pull(), Is().EqualTo(node(3, node::max_id, + node::pointer_type(5, node::max_id), terminal_T))); // n4 AssertThat(out_nodes.can_pull(), Is().True()); - AssertThat(out_nodes.pull(), Is().EqualTo(node(3, node::MAX_ID-1, + AssertThat(out_nodes.pull(), Is().EqualTo(node(3, node::max_id-1, terminal_F, - node::ptr_t(5, node::MAX_ID)))); + node::pointer_type(5, node::max_id)))); // n1 AssertThat(out_nodes.can_pull(), Is().True()); - AssertThat(out_nodes.pull(), Is().EqualTo(node(1, node::MAX_ID, - node::ptr_t(3, node::MAX_ID-1), - node::ptr_t(3, node::MAX_ID)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(1, node::max_id, + node::pointer_type(3, node::max_id-1), + node::pointer_type(3, node::max_id)))); AssertThat(out_nodes.can_pull(), Is().False()); @@ -5397,19 +5398,19 @@ go_bandit([]() { AssertThat(out->width, Is().EqualTo(2u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL], Is().EqualTo(2u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(3u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(3u)); - AssertThat(out->max_1level_cut[cut_type::ALL], Is().EqualTo(4u)); + AssertThat(out->max_1level_cut[cut::Internal], Is().EqualTo(2u)); + AssertThat(out->max_1level_cut[cut::Internal_False], Is().EqualTo(3u)); + AssertThat(out->max_1level_cut[cut::Internal_True], Is().EqualTo(3u)); + AssertThat(out->max_1level_cut[cut::All], Is().EqualTo(4u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL], Is().GreaterThanOrEqualTo(2u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL], Is().LessThanOrEqualTo(3u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_FALSE], Is().GreaterThanOrEqualTo(3u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_FALSE], Is().LessThanOrEqualTo(4u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_TRUE], Is().GreaterThanOrEqualTo(3u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_TRUE], Is().LessThanOrEqualTo(4u)); - AssertThat(out->max_2level_cut[cut_type::ALL], Is().GreaterThanOrEqualTo(4u)); - AssertThat(out->max_2level_cut[cut_type::ALL], Is().LessThanOrEqualTo(5u)); + AssertThat(out->max_2level_cut[cut::Internal], Is().GreaterThanOrEqualTo(2u)); + AssertThat(out->max_2level_cut[cut::Internal], Is().LessThanOrEqualTo(3u)); + AssertThat(out->max_2level_cut[cut::Internal_False], Is().GreaterThanOrEqualTo(3u)); + AssertThat(out->max_2level_cut[cut::Internal_False], Is().LessThanOrEqualTo(4u)); + AssertThat(out->max_2level_cut[cut::Internal_True], Is().GreaterThanOrEqualTo(3u)); + AssertThat(out->max_2level_cut[cut::Internal_True], Is().LessThanOrEqualTo(4u)); + AssertThat(out->max_2level_cut[cut::All], Is().GreaterThanOrEqualTo(4u)); + AssertThat(out->max_2level_cut[cut::All], Is().LessThanOrEqualTo(5u)); AssertThat(out->number_of_terminals[false], Is().EqualTo(2u)); AssertThat(out->number_of_terminals[true], Is().EqualTo(2u)); @@ -5473,7 +5474,7 @@ go_bandit([]() { in->max_1level_cut = 3; } - test_not_sweep inner_impl(2); + test_not_sweep inner_impl(2); /* output // _1_ ---- x1 @@ -5496,20 +5497,20 @@ go_bandit([]() { // n7 AssertThat(out_nodes.can_pull(), Is().True()); - AssertThat(out_nodes.pull(), Is().EqualTo(node(5, node::MAX_ID, + AssertThat(out_nodes.pull(), Is().EqualTo(node(5, node::max_id, terminal_T, terminal_F))); // n5 AssertThat(out_nodes.can_pull(), Is().True()); - AssertThat(out_nodes.pull(), Is().EqualTo(node(3, node::MAX_ID, + AssertThat(out_nodes.pull(), Is().EqualTo(node(3, node::max_id, terminal_F, - node::ptr_t(5, node::MAX_ID)))); + node::pointer_type(5, node::max_id)))); // n1 AssertThat(out_nodes.can_pull(), Is().True()); - AssertThat(out_nodes.pull(), Is().EqualTo(node(1, node::MAX_ID, - node::ptr_t(3, node::MAX_ID), + AssertThat(out_nodes.pull(), Is().EqualTo(node(1, node::max_id, + node::pointer_type(3, node::max_id), terminal_F))); AssertThat(out_nodes.can_pull(), Is().False()); @@ -5529,25 +5530,25 @@ go_bandit([]() { AssertThat(out->width, Is().EqualTo(1u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL], Is().EqualTo(1u)); + AssertThat(out->max_1level_cut[cut::Internal], Is().EqualTo(1u)); // NOTE: Since the outer priority queue includes a tainted arc to F, it // is in fact counted twice: first it is counted in the inner // sweep to then be counted once more in the outer - AssertThat(out->max_1level_cut[cut_type::INTERNAL_FALSE], Is().GreaterThanOrEqualTo(3u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_FALSE], Is().LessThanOrEqualTo(4u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(1u)); - AssertThat(out->max_1level_cut[cut_type::ALL], Is().GreaterThanOrEqualTo(4u)); - AssertThat(out->max_1level_cut[cut_type::ALL], Is().LessThanOrEqualTo(5u)); + AssertThat(out->max_1level_cut[cut::Internal_False], Is().GreaterThanOrEqualTo(3u)); + AssertThat(out->max_1level_cut[cut::Internal_False], Is().LessThanOrEqualTo(4u)); + AssertThat(out->max_1level_cut[cut::Internal_True], Is().EqualTo(1u)); + AssertThat(out->max_1level_cut[cut::All], Is().GreaterThanOrEqualTo(4u)); + AssertThat(out->max_1level_cut[cut::All], Is().LessThanOrEqualTo(5u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL], Is().EqualTo(1u)); + AssertThat(out->max_2level_cut[cut::Internal], Is().EqualTo(1u)); // NOTE: See above - AssertThat(out->max_2level_cut[cut_type::INTERNAL_FALSE], Is().GreaterThanOrEqualTo(3u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_FALSE], Is().LessThanOrEqualTo(4u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(1u)); - AssertThat(out->max_2level_cut[cut_type::ALL], Is().GreaterThanOrEqualTo(4u)); - AssertThat(out->max_2level_cut[cut_type::ALL], Is().LessThanOrEqualTo(4u)); + AssertThat(out->max_2level_cut[cut::Internal_False], Is().GreaterThanOrEqualTo(3u)); + AssertThat(out->max_2level_cut[cut::Internal_False], Is().LessThanOrEqualTo(4u)); + AssertThat(out->max_2level_cut[cut::Internal_True], Is().EqualTo(1u)); + AssertThat(out->max_2level_cut[cut::All], Is().GreaterThanOrEqualTo(4u)); + AssertThat(out->max_2level_cut[cut::All], Is().LessThanOrEqualTo(4u)); AssertThat(out->number_of_terminals[false], Is().EqualTo(3u)); AssertThat(out->number_of_terminals[true], Is().EqualTo(1u)); @@ -5572,18 +5573,18 @@ go_bandit([]() { // / \/ \ // F T F */ - const node::ptr_t n1(1,0); - const node::ptr_t n2(2,0); - const node::ptr_t n3(3,0); - const node::ptr_t n4(5,0); - const node::ptr_t n5(5,1); - const node::ptr_t n6(5,2); - const node::ptr_t n7(6,0); - const node::ptr_t n8(7,0); - const node::ptr_t n9(7,1); - - const node::ptr_t terminal_F(false); - const node::ptr_t terminal_T(true); + const node::pointer_type n1(1,0); + const node::pointer_type n2(2,0); + const node::pointer_type n3(3,0); + const node::pointer_type n4(5,0); + const node::pointer_type n5(5,1); + const node::pointer_type n6(5,2); + const node::pointer_type n7(6,0); + const node::pointer_type n8(7,0); + const node::pointer_type n9(7,1); + + const node::pointer_type terminal_F(false); + const node::pointer_type terminal_T(true); shared_levelized_file in; @@ -5646,8 +5647,8 @@ go_bandit([]() { // T F T */ - it("outputs with 'ALWAYS_CANONICAL' a canonical BDD", [&]() { - test_not_sweep inner_impl(2); + it("outputs with 'Always_Canonical' a canonical BDD", [&]() { + test_not_sweep inner_impl(2); const bdd out = nested_sweep<>(in, inner_impl); @@ -5656,23 +5657,23 @@ go_bandit([]() { // n8 AssertThat(out_nodes.can_pull(), Is().True()); - AssertThat(out_nodes.pull(), Is().EqualTo(node(7, node::MAX_ID, terminal_F, terminal_T))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(7, node::max_id, terminal_F, terminal_T))); // n9 AssertThat(out_nodes.can_pull(), Is().True()); - AssertThat(out_nodes.pull(), Is().EqualTo(node(7, node::MAX_ID-1, terminal_T, terminal_F))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(7, node::max_id-1, terminal_T, terminal_F))); // n4 AssertThat(out_nodes.can_pull(), Is().True()); - AssertThat(out_nodes.pull(), Is().EqualTo(node(5, node::MAX_ID, + AssertThat(out_nodes.pull(), Is().EqualTo(node(5, node::max_id, terminal_T, - node::ptr_t(7, node::MAX_ID)))); + node::pointer_type(7, node::max_id)))); // n1 AssertThat(out_nodes.can_pull(), Is().True()); - AssertThat(out_nodes.pull(), Is().EqualTo(node(1, node::MAX_ID, - node::ptr_t(5, node::MAX_ID), - node::ptr_t(7, node::MAX_ID-1)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(1, node::max_id, + node::pointer_type(5, node::max_id), + node::pointer_type(7, node::max_id-1)))); AssertThat(out_nodes.can_pull(), Is().False()); @@ -5693,25 +5694,25 @@ go_bandit([]() { AssertThat(out->canonical, Is().True()); - AssertThat(out->max_1level_cut[cut_type::INTERNAL], Is().EqualTo(2u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(2u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(3u)); - AssertThat(out->max_1level_cut[cut_type::ALL], Is().EqualTo(5u)); + AssertThat(out->max_1level_cut[cut::Internal], Is().EqualTo(2u)); + AssertThat(out->max_1level_cut[cut::Internal_False], Is().EqualTo(2u)); + AssertThat(out->max_1level_cut[cut::Internal_True], Is().EqualTo(3u)); + AssertThat(out->max_1level_cut[cut::All], Is().EqualTo(5u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL], Is().GreaterThanOrEqualTo(2u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL], Is().LessThanOrEqualTo(3u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_FALSE], Is().GreaterThanOrEqualTo(2u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_FALSE], Is().LessThanOrEqualTo(3u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_TRUE], Is().GreaterThanOrEqualTo(3u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_TRUE], Is().LessThanOrEqualTo(4u)); - AssertThat(out->max_2level_cut[cut_type::ALL], Is().EqualTo(5u)); + AssertThat(out->max_2level_cut[cut::Internal], Is().GreaterThanOrEqualTo(2u)); + AssertThat(out->max_2level_cut[cut::Internal], Is().LessThanOrEqualTo(3u)); + AssertThat(out->max_2level_cut[cut::Internal_False], Is().GreaterThanOrEqualTo(2u)); + AssertThat(out->max_2level_cut[cut::Internal_False], Is().LessThanOrEqualTo(3u)); + AssertThat(out->max_2level_cut[cut::Internal_True], Is().GreaterThanOrEqualTo(3u)); + AssertThat(out->max_2level_cut[cut::Internal_True], Is().LessThanOrEqualTo(4u)); + AssertThat(out->max_2level_cut[cut::All], Is().EqualTo(5u)); AssertThat(out->number_of_terminals[false], Is().EqualTo(2u)); AssertThat(out->number_of_terminals[true], Is().EqualTo(3u)); }); - it("outputs with 'FINAL_CANONICAL' a canonical BDD", [&]() { - test_not_sweep inner_impl(2); + it("outputs with 'Final_Canonical' a canonical BDD", [&]() { + test_not_sweep inner_impl(2); const bdd out = nested_sweep<>(in, inner_impl); @@ -5720,23 +5721,23 @@ go_bandit([]() { // n8 AssertThat(out_nodes.can_pull(), Is().True()); - AssertThat(out_nodes.pull(), Is().EqualTo(node(7, node::MAX_ID, terminal_F, terminal_T))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(7, node::max_id, terminal_F, terminal_T))); // n9 AssertThat(out_nodes.can_pull(), Is().True()); - AssertThat(out_nodes.pull(), Is().EqualTo(node(7, node::MAX_ID-1, terminal_T, terminal_F))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(7, node::max_id-1, terminal_T, terminal_F))); // n4 AssertThat(out_nodes.can_pull(), Is().True()); - AssertThat(out_nodes.pull(), Is().EqualTo(node(5, node::MAX_ID, + AssertThat(out_nodes.pull(), Is().EqualTo(node(5, node::max_id, terminal_T, - node::ptr_t(7, node::MAX_ID)))); + node::pointer_type(7, node::max_id)))); // n1 AssertThat(out_nodes.can_pull(), Is().True()); - AssertThat(out_nodes.pull(), Is().EqualTo(node(1, node::MAX_ID, - node::ptr_t(5, node::MAX_ID), - node::ptr_t(7, node::MAX_ID-1)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(1, node::max_id, + node::pointer_type(5, node::max_id), + node::pointer_type(7, node::max_id-1)))); AssertThat(out_nodes.can_pull(), Is().False()); @@ -5761,37 +5762,37 @@ go_bandit([]() { // 4 and 5 are only merged after the second inner sweep for x2. This // propagates to 3 only in the last sweep, which in turn taints the // arc 1 ---> 4/5 which is added onto the final cut-size. - AssertThat(out->max_1level_cut[cut_type::INTERNAL], Is().GreaterThanOrEqualTo(2u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL], Is().LessThanOrEqualTo(3u)); + AssertThat(out->max_1level_cut[cut::Internal], Is().GreaterThanOrEqualTo(2u)); + AssertThat(out->max_1level_cut[cut::Internal], Is().LessThanOrEqualTo(3u)); // Over-approximation: // See above. - AssertThat(out->max_1level_cut[cut_type::INTERNAL_FALSE], Is().GreaterThanOrEqualTo(2u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_FALSE], Is().LessThanOrEqualTo(3u)); + AssertThat(out->max_1level_cut[cut::Internal_False], Is().GreaterThanOrEqualTo(2u)); + AssertThat(out->max_1level_cut[cut::Internal_False], Is().LessThanOrEqualTo(3u)); // Over-approximation: // The merge of 4 and 5 is unknown at 8 and 9, so both 4 - -> T and // 5 - -> must be counted. Add on-top of this the above mentioned, taint - AssertThat(out->max_1level_cut[cut_type::INTERNAL_TRUE], Is().GreaterThanOrEqualTo(3u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_TRUE], Is().LessThanOrEqualTo(5u)); + AssertThat(out->max_1level_cut[cut::Internal_True], Is().GreaterThanOrEqualTo(3u)); + AssertThat(out->max_1level_cut[cut::Internal_True], Is().LessThanOrEqualTo(5u)); // Over-approximation: // Despite the above, there is still the saving grace of 4 BDD Nodes +1. - AssertThat(out->max_1level_cut[cut_type::ALL], Is().EqualTo(5u)); + AssertThat(out->max_1level_cut[cut::All], Is().EqualTo(5u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL], Is().GreaterThanOrEqualTo(2u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL], Is().LessThanOrEqualTo(3u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_FALSE], Is().GreaterThanOrEqualTo(2u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_FALSE], Is().LessThanOrEqualTo(4u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_TRUE], Is().GreaterThanOrEqualTo(3u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_TRUE], Is().LessThanOrEqualTo(5u)); - AssertThat(out->max_2level_cut[cut_type::ALL], Is().EqualTo(5u)); + AssertThat(out->max_2level_cut[cut::Internal], Is().GreaterThanOrEqualTo(2u)); + AssertThat(out->max_2level_cut[cut::Internal], Is().LessThanOrEqualTo(3u)); + AssertThat(out->max_2level_cut[cut::Internal_False], Is().GreaterThanOrEqualTo(2u)); + AssertThat(out->max_2level_cut[cut::Internal_False], Is().LessThanOrEqualTo(4u)); + AssertThat(out->max_2level_cut[cut::Internal_True], Is().GreaterThanOrEqualTo(3u)); + AssertThat(out->max_2level_cut[cut::Internal_True], Is().LessThanOrEqualTo(5u)); + AssertThat(out->max_2level_cut[cut::All], Is().EqualTo(5u)); AssertThat(out->number_of_terminals[false], Is().EqualTo(2u)); AssertThat(out->number_of_terminals[true], Is().EqualTo(3u)); }); - it("outputs with 'NEVER_CANONICAL' an unordered and unmerged BDD", [&]() { + it("outputs with 'Never_Canonical' an unordered and unmerged BDD", [&]() { /* fast-reduce output // _1_ ---- x1 // / \ @@ -5810,7 +5811,7 @@ go_bandit([]() { // F T T F */ - test_not_sweep inner_impl(2); + test_not_sweep inner_impl(2); const bdd out = nested_sweep<>(in, inner_impl); @@ -5819,35 +5820,35 @@ go_bandit([]() { // n9 AssertThat(out_nodes.can_pull(), Is().True()); - AssertThat(out_nodes.pull(), Is().EqualTo(node(7, node::MAX_ID, terminal_T, terminal_F))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(7, node::max_id, terminal_T, terminal_F))); // n9 AssertThat(out_nodes.can_pull(), Is().True()); - AssertThat(out_nodes.pull(), Is().EqualTo(node(7, node::MAX_ID-1, terminal_F, terminal_T))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(7, node::max_id-1, terminal_F, terminal_T))); // n5 AssertThat(out_nodes.can_pull(), Is().True()); - AssertThat(out_nodes.pull(), Is().EqualTo(node(5, node::MAX_ID, + AssertThat(out_nodes.pull(), Is().EqualTo(node(5, node::max_id, terminal_T, - node::ptr_t(7, node::MAX_ID-1)))); + node::pointer_type(7, node::max_id-1)))); // n4 AssertThat(out_nodes.can_pull(), Is().True()); - AssertThat(out_nodes.pull(), Is().EqualTo(node(5, node::MAX_ID-1, + AssertThat(out_nodes.pull(), Is().EqualTo(node(5, node::max_id-1, terminal_T, - node::ptr_t(7, node::MAX_ID-1)))); + node::pointer_type(7, node::max_id-1)))); // n3 AssertThat(out_nodes.can_pull(), Is().True()); - AssertThat(out_nodes.pull(), Is().EqualTo(node(3, node::MAX_ID, - node::ptr_t(5, node::MAX_ID-1), - node::ptr_t(5, node::MAX_ID)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(3, node::max_id, + node::pointer_type(5, node::max_id-1), + node::pointer_type(5, node::max_id)))); // n1 AssertThat(out_nodes.can_pull(), Is().True()); - AssertThat(out_nodes.pull(), Is().EqualTo(node(1, node::MAX_ID, - node::ptr_t(3, node::MAX_ID), - node::ptr_t(7, node::MAX_ID)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(1, node::max_id, + node::pointer_type(3, node::max_id), + node::pointer_type(7, node::max_id)))); AssertThat(out_nodes.can_pull(), Is().False()); @@ -5871,26 +5872,26 @@ go_bandit([]() { AssertThat(out->canonical, Is().False()); - AssertThat(out->max_1level_cut[cut_type::INTERNAL], Is().EqualTo(3u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(3u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(5u)); - AssertThat(out->max_1level_cut[cut_type::ALL], Is().EqualTo(6u)); + AssertThat(out->max_1level_cut[cut::Internal], Is().EqualTo(3u)); + AssertThat(out->max_1level_cut[cut::Internal_False], Is().EqualTo(3u)); + AssertThat(out->max_1level_cut[cut::Internal_True], Is().EqualTo(5u)); + AssertThat(out->max_1level_cut[cut::All], Is().EqualTo(6u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL], Is().GreaterThanOrEqualTo(3u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL], Is().LessThanOrEqualTo(4u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_FALSE], Is().GreaterThanOrEqualTo(3u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_FALSE], Is().LessThanOrEqualTo(4u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_TRUE], Is().GreaterThanOrEqualTo(5u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_TRUE], Is().LessThanOrEqualTo(6u)); - AssertThat(out->max_2level_cut[cut_type::ALL], Is().GreaterThanOrEqualTo(6u)); - AssertThat(out->max_2level_cut[cut_type::ALL], Is().LessThanOrEqualTo(7u)); + AssertThat(out->max_2level_cut[cut::Internal], Is().GreaterThanOrEqualTo(3u)); + AssertThat(out->max_2level_cut[cut::Internal], Is().LessThanOrEqualTo(4u)); + AssertThat(out->max_2level_cut[cut::Internal_False], Is().GreaterThanOrEqualTo(3u)); + AssertThat(out->max_2level_cut[cut::Internal_False], Is().LessThanOrEqualTo(4u)); + AssertThat(out->max_2level_cut[cut::Internal_True], Is().GreaterThanOrEqualTo(5u)); + AssertThat(out->max_2level_cut[cut::Internal_True], Is().LessThanOrEqualTo(6u)); + AssertThat(out->max_2level_cut[cut::All], Is().GreaterThanOrEqualTo(6u)); + AssertThat(out->max_2level_cut[cut::All], Is().LessThanOrEqualTo(7u)); AssertThat(out->number_of_terminals[false], Is().EqualTo(2u)); AssertThat(out->number_of_terminals[true], Is().EqualTo(4u)); }); - it("outputs with 'AUTO' a canonical BDD", [&]() { - test_not_sweep inner_impl(2); + it("outputs with 'Auto' a canonical BDD", [&]() { + test_not_sweep inner_impl(2); const bdd out = nested_sweep<>(in, inner_impl); @@ -5899,23 +5900,23 @@ go_bandit([]() { // n8 AssertThat(out_nodes.can_pull(), Is().True()); - AssertThat(out_nodes.pull(), Is().EqualTo(node(7, node::MAX_ID, terminal_F, terminal_T))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(7, node::max_id, terminal_F, terminal_T))); // n9 AssertThat(out_nodes.can_pull(), Is().True()); - AssertThat(out_nodes.pull(), Is().EqualTo(node(7, node::MAX_ID-1, terminal_T, terminal_F))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(7, node::max_id-1, terminal_T, terminal_F))); // n4 AssertThat(out_nodes.can_pull(), Is().True()); - AssertThat(out_nodes.pull(), Is().EqualTo(node(5, node::MAX_ID, + AssertThat(out_nodes.pull(), Is().EqualTo(node(5, node::max_id, terminal_T, - node::ptr_t(7, node::MAX_ID)))); + node::pointer_type(7, node::max_id)))); // n1 AssertThat(out_nodes.can_pull(), Is().True()); - AssertThat(out_nodes.pull(), Is().EqualTo(node(1, node::MAX_ID, - node::ptr_t(5, node::MAX_ID), - node::ptr_t(7, node::MAX_ID-1)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(1, node::max_id, + node::pointer_type(5, node::max_id), + node::pointer_type(7, node::max_id-1)))); AssertThat(out_nodes.can_pull(), Is().False()); @@ -5937,23 +5938,23 @@ go_bandit([]() { AssertThat(out->canonical, Is().True()); // Over-approximation: - // It is somewhere in-between ALWAYS_CANONICAL and FINAL_CANONICAL, + // It is somewhere in-between Always_Canonical and Final_Canonical, // and so should the cuts too. - AssertThat(out->max_1level_cut[cut_type::INTERNAL], Is().GreaterThanOrEqualTo(2u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL], Is().LessThanOrEqualTo(3u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_FALSE], Is().GreaterThanOrEqualTo(2u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_FALSE], Is().LessThanOrEqualTo(3u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_TRUE], Is().GreaterThanOrEqualTo(3u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_TRUE], Is().LessThanOrEqualTo(5u)); - AssertThat(out->max_1level_cut[cut_type::ALL], Is().EqualTo(5u)); - - AssertThat(out->max_2level_cut[cut_type::INTERNAL], Is().GreaterThanOrEqualTo(2u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL], Is().LessThanOrEqualTo(3u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_FALSE], Is().GreaterThanOrEqualTo(2u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_FALSE], Is().LessThanOrEqualTo(4u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_TRUE], Is().GreaterThanOrEqualTo(3u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_TRUE], Is().LessThanOrEqualTo(5u)); - AssertThat(out->max_2level_cut[cut_type::ALL], Is().EqualTo(5u)); + AssertThat(out->max_1level_cut[cut::Internal], Is().GreaterThanOrEqualTo(2u)); + AssertThat(out->max_1level_cut[cut::Internal], Is().LessThanOrEqualTo(3u)); + AssertThat(out->max_1level_cut[cut::Internal_False], Is().GreaterThanOrEqualTo(2u)); + AssertThat(out->max_1level_cut[cut::Internal_False], Is().LessThanOrEqualTo(3u)); + AssertThat(out->max_1level_cut[cut::Internal_True], Is().GreaterThanOrEqualTo(3u)); + AssertThat(out->max_1level_cut[cut::Internal_True], Is().LessThanOrEqualTo(5u)); + AssertThat(out->max_1level_cut[cut::All], Is().EqualTo(5u)); + + AssertThat(out->max_2level_cut[cut::Internal], Is().GreaterThanOrEqualTo(2u)); + AssertThat(out->max_2level_cut[cut::Internal], Is().LessThanOrEqualTo(3u)); + AssertThat(out->max_2level_cut[cut::Internal_False], Is().GreaterThanOrEqualTo(2u)); + AssertThat(out->max_2level_cut[cut::Internal_False], Is().LessThanOrEqualTo(4u)); + AssertThat(out->max_2level_cut[cut::Internal_True], Is().GreaterThanOrEqualTo(3u)); + AssertThat(out->max_2level_cut[cut::Internal_True], Is().LessThanOrEqualTo(5u)); + AssertThat(out->max_2level_cut[cut::All], Is().EqualTo(5u)); AssertThat(out->number_of_terminals[false], Is().EqualTo(2u)); AssertThat(out->number_of_terminals[true], Is().EqualTo(3u)); diff --git a/test/adiar/internal/algorithms/test_reduce.cpp b/test/adiar/internal/algorithms/test_reduce.cpp index 68b1c216c..bdea098f9 100644 --- a/test/adiar/internal/algorithms/test_reduce.cpp +++ b/test/adiar/internal/algorithms/test_reduce.cpp @@ -5,16 +5,16 @@ go_bandit([]() { // The reduce function is used within the constructors of the BDD // and ZDD classes. - const arc::ptr_t terminal_F(false); - const arc::ptr_t terminal_T(true); + const arc::pointer_type terminal_F(false); + const arc::pointer_type terminal_T(true); shared_levelized_file x0x1_node_file; { // Garbage collect writer to free write-lock node_writer nw(x0x1_node_file); - nw << node(1, node::MAX_ID, terminal_F, terminal_T) - << node(0, node::MAX_ID, terminal_F, node::ptr_t(1, node::MAX_ID)); + nw << node(1, node::max_id, terminal_F, terminal_T) + << node(0, node::max_id, terminal_F, node::pointer_type(1, node::max_id)); } it("preserves negation flag on reduced input [1]", [&]() { @@ -61,10 +61,10 @@ go_bandit([]() { // F T F T */ - const arc::ptr_t n1(0,0); - const arc::ptr_t n2(1,0); - const arc::ptr_t n3(2,0); - const arc::ptr_t n4(2,1); + const arc::pointer_type n1(0,0); + const arc::pointer_type n2(1,0); + const arc::pointer_type n3(2,0); + const arc::pointer_type n4(2,1); shared_levelized_file in; @@ -91,7 +91,7 @@ go_bandit([]() { // Reduce it bdd out(in); - AssertThat(adiar::is_canonical(out), Is().True()); + AssertThat(bdd_iscanonical(out), Is().True()); // Check it looks all right node_test_stream out_nodes(out); @@ -99,21 +99,21 @@ go_bandit([]() { AssertThat(out_nodes.can_pull(), Is().True()); // n4 - AssertThat(out_nodes.pull(), Is().EqualTo(node(2, node::MAX_ID, + AssertThat(out_nodes.pull(), Is().EqualTo(node(2, node::max_id, terminal_F, terminal_T))); AssertThat(out_nodes.can_pull(), Is().True()); // n2 - AssertThat(out_nodes.pull(), Is().EqualTo(node(1, node::MAX_ID, - node::ptr_t(2, node::MAX_ID), + AssertThat(out_nodes.pull(), Is().EqualTo(node(1, node::max_id, + node::pointer_type(2, node::max_id), terminal_T))); AssertThat(out_nodes.can_pull(), Is().True()); // n1 - AssertThat(out_nodes.pull(), Is().EqualTo(node(0, node::MAX_ID, - node::ptr_t(2, node::MAX_ID), - node::ptr_t(1, node::MAX_ID)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(0, node::max_id, + node::pointer_type(2, node::max_id), + node::pointer_type(1, node::max_id)))); AssertThat(out_nodes.can_pull(), Is().False()); level_info_test_stream out_meta(out); @@ -131,19 +131,19 @@ go_bandit([]() { AssertThat(out->width, Is().EqualTo(1u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL], Is().EqualTo(2u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(2u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(3u)); - AssertThat(out->max_1level_cut[cut_type::ALL], Is().EqualTo(3u)); + AssertThat(out->max_1level_cut[cut::Internal], Is().EqualTo(2u)); + AssertThat(out->max_1level_cut[cut::Internal_False], Is().EqualTo(2u)); + AssertThat(out->max_1level_cut[cut::Internal_True], Is().EqualTo(3u)); + AssertThat(out->max_1level_cut[cut::All], Is().EqualTo(3u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL], Is().GreaterThanOrEqualTo(2u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL], Is().LessThanOrEqualTo(3u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_FALSE], Is().GreaterThanOrEqualTo(2u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_FALSE], Is().LessThanOrEqualTo(4u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_TRUE], Is().GreaterThanOrEqualTo(3u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_TRUE], Is().LessThanOrEqualTo(4u)); - AssertThat(out->max_2level_cut[cut_type::ALL], Is().GreaterThanOrEqualTo(3u)); - AssertThat(out->max_2level_cut[cut_type::ALL], Is().LessThanOrEqualTo(4u)); + AssertThat(out->max_2level_cut[cut::Internal], Is().GreaterThanOrEqualTo(2u)); + AssertThat(out->max_2level_cut[cut::Internal], Is().LessThanOrEqualTo(3u)); + AssertThat(out->max_2level_cut[cut::Internal_False], Is().GreaterThanOrEqualTo(2u)); + AssertThat(out->max_2level_cut[cut::Internal_False], Is().LessThanOrEqualTo(4u)); + AssertThat(out->max_2level_cut[cut::Internal_True], Is().GreaterThanOrEqualTo(3u)); + AssertThat(out->max_2level_cut[cut::Internal_True], Is().LessThanOrEqualTo(4u)); + AssertThat(out->max_2level_cut[cut::All], Is().GreaterThanOrEqualTo(3u)); + AssertThat(out->max_2level_cut[cut::All], Is().LessThanOrEqualTo(4u)); AssertThat(out->number_of_terminals[false], Is().EqualTo(1u)); AssertThat(out->number_of_terminals[true], Is().EqualTo(2u)); @@ -162,11 +162,11 @@ go_bandit([]() { // /| |\ / \ // FT FT F T */ - const arc::ptr_t n1(0,0); - const arc::ptr_t n2(2,0); - const arc::ptr_t n3(2,1); - const arc::ptr_t n4(3,0); - const arc::ptr_t n5(3,1); + const arc::pointer_type n1(0,0); + const arc::pointer_type n2(2,0); + const arc::pointer_type n3(2,1); + const arc::pointer_type n4(3,0); + const arc::pointer_type n5(3,1); shared_levelized_file in; @@ -195,29 +195,29 @@ go_bandit([]() { // Reduce it bdd out(in); - AssertThat(adiar::is_canonical(out), Is().True()); + AssertThat(bdd_iscanonical(out), Is().True()); // Check it looks all right node_test_stream out_nodes(out); AssertThat(out_nodes.can_pull(), Is().True()); - AssertThat(out_nodes.pull(), Is().EqualTo(node(3, node::MAX_ID, + AssertThat(out_nodes.pull(), Is().EqualTo(node(3, node::max_id, terminal_F, terminal_T))); AssertThat(out_nodes.can_pull(), Is().True()); - AssertThat(out_nodes.pull(), Is().EqualTo(node(2, node::MAX_ID, - node::ptr_t(3, node::MAX_ID), + AssertThat(out_nodes.pull(), Is().EqualTo(node(2, node::max_id, + node::pointer_type(3, node::max_id), terminal_T))); AssertThat(out_nodes.can_pull(), Is().True()); - AssertThat(out_nodes.pull(), Is().EqualTo(node(2, node::MAX_ID-1, + AssertThat(out_nodes.pull(), Is().EqualTo(node(2, node::max_id-1, terminal_F, - node::ptr_t(3, node::MAX_ID)))); + node::pointer_type(3, node::max_id)))); AssertThat(out_nodes.can_pull(), Is().True()); - AssertThat(out_nodes.pull(), Is().EqualTo(node(0, node::MAX_ID, - node::ptr_t(2, node::MAX_ID-1), - node::ptr_t(2, node::MAX_ID)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(0, node::max_id, + node::pointer_type(2, node::max_id-1), + node::pointer_type(2, node::max_id)))); AssertThat(out_nodes.can_pull(), Is().False()); @@ -236,19 +236,19 @@ go_bandit([]() { AssertThat(out->width, Is().EqualTo(2u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL], Is().EqualTo(2u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(3u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(3u)); - AssertThat(out->max_1level_cut[cut_type::ALL], Is().EqualTo(4u)); + AssertThat(out->max_1level_cut[cut::Internal], Is().EqualTo(2u)); + AssertThat(out->max_1level_cut[cut::Internal_False], Is().EqualTo(3u)); + AssertThat(out->max_1level_cut[cut::Internal_True], Is().EqualTo(3u)); + AssertThat(out->max_1level_cut[cut::All], Is().EqualTo(4u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL], Is().GreaterThanOrEqualTo(2u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL], Is().LessThanOrEqualTo(4u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_FALSE], Is().GreaterThanOrEqualTo(3u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_FALSE], Is().LessThanOrEqualTo(5u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_TRUE], Is().GreaterThanOrEqualTo(3u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_TRUE], Is().LessThanOrEqualTo(5u)); - AssertThat(out->max_2level_cut[cut_type::ALL], Is().GreaterThanOrEqualTo(4u)); - AssertThat(out->max_2level_cut[cut_type::ALL], Is().LessThanOrEqualTo(5u)); + AssertThat(out->max_2level_cut[cut::Internal], Is().GreaterThanOrEqualTo(2u)); + AssertThat(out->max_2level_cut[cut::Internal], Is().LessThanOrEqualTo(4u)); + AssertThat(out->max_2level_cut[cut::Internal_False], Is().GreaterThanOrEqualTo(3u)); + AssertThat(out->max_2level_cut[cut::Internal_False], Is().LessThanOrEqualTo(5u)); + AssertThat(out->max_2level_cut[cut::Internal_True], Is().GreaterThanOrEqualTo(3u)); + AssertThat(out->max_2level_cut[cut::Internal_True], Is().LessThanOrEqualTo(5u)); + AssertThat(out->max_2level_cut[cut::All], Is().GreaterThanOrEqualTo(4u)); + AssertThat(out->max_2level_cut[cut::All], Is().LessThanOrEqualTo(5u)); AssertThat(out->number_of_terminals[false], Is().EqualTo(2u)); AssertThat(out->number_of_terminals[true], Is().EqualTo(2u)); @@ -267,12 +267,12 @@ go_bandit([]() { // F T T F F T F */ - const arc::ptr_t n1(0,0); - const arc::ptr_t n2(1,0); - const arc::ptr_t n3(2,0); - const arc::ptr_t n4(2,1); - const arc::ptr_t n5(3,0); - const arc::ptr_t n6(3,1); + const arc::pointer_type n1(0,0); + const arc::pointer_type n2(1,0); + const arc::pointer_type n3(2,0); + const arc::pointer_type n4(2,1); + const arc::pointer_type n5(3,0); + const arc::pointer_type n6(3,1); shared_levelized_file in; @@ -304,7 +304,7 @@ go_bandit([]() { // Reduce it bdd out(in); - AssertThat(adiar::is_canonical(out), Is().True()); + AssertThat(bdd_iscanonical(out), Is().True()); // Check it looks all right node_test_stream out_nodes(out); @@ -312,29 +312,29 @@ go_bandit([]() { AssertThat(out_nodes.can_pull(), Is().True()); // n5 - AssertThat(out_nodes.pull(), Is().EqualTo(node(3, node::MAX_ID, terminal_F, terminal_T))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(3, node::max_id, terminal_F, terminal_T))); AssertThat(out_nodes.can_pull(), Is().True()); // n6 - AssertThat(out_nodes.pull(), Is().EqualTo(node(3, node::MAX_ID-1, terminal_T, terminal_F))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(3, node::max_id-1, terminal_T, terminal_F))); AssertThat(out_nodes.can_pull(), Is().True()); // n4 - AssertThat(out_nodes.pull(), Is().EqualTo(node(2, node::MAX_ID, - node::ptr_t(3, node::MAX_ID), - node::ptr_t(3, node::MAX_ID-1)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(2, node::max_id, + node::pointer_type(3, node::max_id), + node::pointer_type(3, node::max_id-1)))); AssertThat(out_nodes.can_pull(), Is().True()); // n2 - AssertThat(out_nodes.pull(), Is().EqualTo(node(1, node::MAX_ID, - node::ptr_t(2, node::MAX_ID), + AssertThat(out_nodes.pull(), Is().EqualTo(node(1, node::max_id, + node::pointer_type(2, node::max_id), terminal_T))); AssertThat(out_nodes.can_pull(), Is().True()); // n1 - AssertThat(out_nodes.pull(), Is().EqualTo(node(0, node::MAX_ID, - node::ptr_t(2, node::MAX_ID), - node::ptr_t(1, node::MAX_ID)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(0, node::max_id, + node::pointer_type(2, node::max_id), + node::pointer_type(1, node::max_id)))); AssertThat(out_nodes.can_pull(), Is().False()); @@ -356,19 +356,19 @@ go_bandit([]() { AssertThat(out->width, Is().EqualTo(2u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL], Is().EqualTo(2u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(2u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(3u)); - AssertThat(out->max_1level_cut[cut_type::ALL], Is().EqualTo(5u)); + AssertThat(out->max_1level_cut[cut::Internal], Is().EqualTo(2u)); + AssertThat(out->max_1level_cut[cut::Internal_False], Is().EqualTo(2u)); + AssertThat(out->max_1level_cut[cut::Internal_True], Is().EqualTo(3u)); + AssertThat(out->max_1level_cut[cut::All], Is().EqualTo(5u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL], Is().GreaterThanOrEqualTo(2u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL], Is().LessThanOrEqualTo(5u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_FALSE], Is().GreaterThanOrEqualTo(2u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_FALSE], Is().LessThanOrEqualTo(6u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_TRUE], Is().GreaterThanOrEqualTo(3u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_TRUE], Is().LessThanOrEqualTo(6u)); - AssertThat(out->max_2level_cut[cut_type::ALL], Is().GreaterThanOrEqualTo(5u)); - AssertThat(out->max_2level_cut[cut_type::ALL], Is().LessThanOrEqualTo(6u)); + AssertThat(out->max_2level_cut[cut::Internal], Is().GreaterThanOrEqualTo(2u)); + AssertThat(out->max_2level_cut[cut::Internal], Is().LessThanOrEqualTo(5u)); + AssertThat(out->max_2level_cut[cut::Internal_False], Is().GreaterThanOrEqualTo(2u)); + AssertThat(out->max_2level_cut[cut::Internal_False], Is().LessThanOrEqualTo(6u)); + AssertThat(out->max_2level_cut[cut::Internal_True], Is().GreaterThanOrEqualTo(3u)); + AssertThat(out->max_2level_cut[cut::Internal_True], Is().LessThanOrEqualTo(6u)); + AssertThat(out->max_2level_cut[cut::All], Is().GreaterThanOrEqualTo(5u)); + AssertThat(out->max_2level_cut[cut::All], Is().LessThanOrEqualTo(6u)); AssertThat(out->number_of_terminals[false], Is().EqualTo(2u)); AssertThat(out->number_of_terminals[true], Is().EqualTo(3u)); @@ -387,11 +387,11 @@ go_bandit([]() { // F T F T */ - const arc::ptr_t n1(0,0); - const arc::ptr_t n2(1,0); - const arc::ptr_t n3(2,0); - const arc::ptr_t n4(2,1); - const arc::ptr_t n5(3,0); + const arc::pointer_type n1(0,0); + const arc::pointer_type n2(1,0); + const arc::pointer_type n3(2,0); + const arc::pointer_type n4(2,1); + const arc::pointer_type n5(3,0); shared_levelized_file in; @@ -421,7 +421,7 @@ go_bandit([]() { // Reduce it bdd out(in); - AssertThat(adiar::is_canonical(out), Is().True()); + AssertThat(bdd_iscanonical(out), Is().True()); // Check it looks all right node_test_stream out_nodes(out); @@ -429,25 +429,25 @@ go_bandit([]() { AssertThat(out_nodes.can_pull(), Is().True()); // n5 - AssertThat(out_nodes.pull(), Is().EqualTo(node(3, node::MAX_ID, terminal_F, terminal_T))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(3, node::max_id, terminal_F, terminal_T))); AssertThat(out_nodes.can_pull(), Is().True()); // n4 - AssertThat(out_nodes.pull(), Is().EqualTo(node(2, node::MAX_ID, - node::ptr_t(3, node::MAX_ID), + AssertThat(out_nodes.pull(), Is().EqualTo(node(2, node::max_id, + node::pointer_type(3, node::max_id), terminal_T))); AssertThat(out_nodes.can_pull(), Is().True()); // n2 - AssertThat(out_nodes.pull(), Is().EqualTo(node(1, node::MAX_ID, - node::ptr_t(2, node::MAX_ID), + AssertThat(out_nodes.pull(), Is().EqualTo(node(1, node::max_id, + node::pointer_type(2, node::max_id), terminal_T))); AssertThat(out_nodes.can_pull(), Is().True()); // n1 - AssertThat(out_nodes.pull(), Is().EqualTo(node(0, node::MAX_ID, - node::ptr_t(2, node::MAX_ID), - node::ptr_t(1, node::MAX_ID)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(0, node::max_id, + node::pointer_type(2, node::max_id), + node::pointer_type(1, node::max_id)))); AssertThat(out_nodes.can_pull(), Is().False()); level_info_test_stream out_meta(out); @@ -468,24 +468,24 @@ go_bandit([]() { AssertThat(out->width, Is().EqualTo(1u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL], Is().EqualTo(2u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(2u)); + AssertThat(out->max_1level_cut[cut::Internal], Is().EqualTo(2u)); + AssertThat(out->max_1level_cut[cut::Internal_False], Is().EqualTo(2u)); // Over-approximation, since T-terminal from level (3) is removed - AssertThat(out->max_1level_cut[cut_type::INTERNAL_TRUE], Is().GreaterThanOrEqualTo(3u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_TRUE], Is().LessThanOrEqualTo(5u)); + AssertThat(out->max_1level_cut[cut::Internal_True], Is().GreaterThanOrEqualTo(3u)); + AssertThat(out->max_1level_cut[cut::Internal_True], Is().LessThanOrEqualTo(5u)); - AssertThat(out->max_1level_cut[cut_type::ALL], Is().GreaterThanOrEqualTo(4u)); - AssertThat(out->max_1level_cut[cut_type::ALL], Is().LessThanOrEqualTo(5u)); + AssertThat(out->max_1level_cut[cut::All], Is().GreaterThanOrEqualTo(4u)); + AssertThat(out->max_1level_cut[cut::All], Is().LessThanOrEqualTo(5u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL], Is().GreaterThanOrEqualTo(2u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL], Is().LessThanOrEqualTo(4u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_FALSE], Is().GreaterThanOrEqualTo(2u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_FALSE], Is().LessThanOrEqualTo(5u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_TRUE], Is().GreaterThanOrEqualTo(3u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_TRUE], Is().LessThanOrEqualTo(5u)); - AssertThat(out->max_2level_cut[cut_type::ALL], Is().GreaterThanOrEqualTo(4u)); - AssertThat(out->max_2level_cut[cut_type::ALL], Is().LessThanOrEqualTo(5u)); + AssertThat(out->max_2level_cut[cut::Internal], Is().GreaterThanOrEqualTo(2u)); + AssertThat(out->max_2level_cut[cut::Internal], Is().LessThanOrEqualTo(4u)); + AssertThat(out->max_2level_cut[cut::Internal_False], Is().GreaterThanOrEqualTo(2u)); + AssertThat(out->max_2level_cut[cut::Internal_False], Is().LessThanOrEqualTo(5u)); + AssertThat(out->max_2level_cut[cut::Internal_True], Is().GreaterThanOrEqualTo(3u)); + AssertThat(out->max_2level_cut[cut::Internal_True], Is().LessThanOrEqualTo(5u)); + AssertThat(out->max_2level_cut[cut::All], Is().GreaterThanOrEqualTo(4u)); + AssertThat(out->max_2level_cut[cut::All], Is().LessThanOrEqualTo(5u)); AssertThat(out->number_of_terminals[false], Is().EqualTo(1u)); AssertThat(out->number_of_terminals[true], Is().EqualTo(3u)); @@ -505,13 +505,13 @@ go_bandit([]() { // F T F T */ - const arc::ptr_t n1(0,0); - const arc::ptr_t n2(1,0); - const arc::ptr_t n3(1,1); - const arc::ptr_t n4(2,0); - const arc::ptr_t n5(2,1); - const arc::ptr_t n6(2,2); - const arc::ptr_t n7(3,0); + const arc::pointer_type n1(0,0); + const arc::pointer_type n2(1,0); + const arc::pointer_type n3(1,1); + const arc::pointer_type n4(2,0); + const arc::pointer_type n5(2,1); + const arc::pointer_type n6(2,2); + const arc::pointer_type n7(3,0); shared_levelized_file in; @@ -545,7 +545,7 @@ go_bandit([]() { // Reduce it bdd out(in); - AssertThat(adiar::is_canonical(out), Is().True()); + AssertThat(bdd_iscanonical(out), Is().True()); // Check it looks all right node_test_stream out_nodes(out); @@ -553,39 +553,39 @@ go_bandit([]() { AssertThat(out_nodes.can_pull(), Is().True()); // n7 - AssertThat(out_nodes.pull(), Is().EqualTo(node(3, node::MAX_ID, + AssertThat(out_nodes.pull(), Is().EqualTo(node(3, node::max_id, terminal_F, terminal_T))); AssertThat(out_nodes.can_pull(), Is().True()); // n6 - AssertThat(out_nodes.pull(), Is().EqualTo(node(2, node::MAX_ID, + AssertThat(out_nodes.pull(), Is().EqualTo(node(2, node::max_id, terminal_F, terminal_T))); AssertThat(out_nodes.can_pull(), Is().True()); // n5 - AssertThat(out_nodes.pull(), Is().EqualTo(node(2, node::MAX_ID-1, - node::ptr_t(3, node::MAX_ID), + AssertThat(out_nodes.pull(), Is().EqualTo(node(2, node::max_id-1, + node::pointer_type(3, node::max_id), terminal_T))); AssertThat(out_nodes.can_pull(), Is().True()); // n3 - AssertThat(out_nodes.pull(), Is().EqualTo(node(1, node::MAX_ID, - node::ptr_t(2, node::MAX_ID-1), - node::ptr_t(2, node::MAX_ID)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(1, node::max_id, + node::pointer_type(2, node::max_id-1), + node::pointer_type(2, node::max_id)))); AssertThat(out_nodes.can_pull(), Is().True()); // n2 - AssertThat(out_nodes.pull(), Is().EqualTo(node(1, node::MAX_ID-1, - node::ptr_t(2, node::MAX_ID), - node::ptr_t(2, node::MAX_ID-1)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(1, node::max_id-1, + node::pointer_type(2, node::max_id), + node::pointer_type(2, node::max_id-1)))); AssertThat(out_nodes.can_pull(), Is().True()); // n1 - AssertThat(out_nodes.pull(), Is().EqualTo(node(0, node::MAX_ID, - node::ptr_t(1, node::MAX_ID-1), - node::ptr_t(1, node::MAX_ID)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(0, node::max_id, + node::pointer_type(1, node::max_id-1), + node::pointer_type(1, node::max_id)))); AssertThat(out_nodes.can_pull(), Is().False()); level_info_test_stream out_meta(out); @@ -606,23 +606,23 @@ go_bandit([]() { AssertThat(out->width, Is().EqualTo(2u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL], Is().EqualTo(4u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(4u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(4u)); + AssertThat(out->max_1level_cut[cut::Internal], Is().EqualTo(4u)); + AssertThat(out->max_1level_cut[cut::Internal_False], Is().EqualTo(4u)); + AssertThat(out->max_1level_cut[cut::Internal_True], Is().EqualTo(4u)); // Over-approximation: since at level 3 the reductions of (4) and (6) is // yet not applied. - AssertThat(out->max_1level_cut[cut_type::ALL], Is().GreaterThanOrEqualTo(4u)); - AssertThat(out->max_1level_cut[cut_type::ALL], Is().LessThanOrEqualTo(7u)); - - AssertThat(out->max_2level_cut[cut_type::INTERNAL], Is().GreaterThanOrEqualTo(4u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL], Is().LessThanOrEqualTo(7u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_FALSE], Is().GreaterThanOrEqualTo(4u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_FALSE], Is().LessThanOrEqualTo(7u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_TRUE], Is().GreaterThanOrEqualTo(4u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_TRUE], Is().LessThanOrEqualTo(7u)); - AssertThat(out->max_2level_cut[cut_type::ALL], Is().GreaterThanOrEqualTo(4u)); - AssertThat(out->max_2level_cut[cut_type::ALL], Is().LessThanOrEqualTo(7u)); + AssertThat(out->max_1level_cut[cut::All], Is().GreaterThanOrEqualTo(4u)); + AssertThat(out->max_1level_cut[cut::All], Is().LessThanOrEqualTo(7u)); + + AssertThat(out->max_2level_cut[cut::Internal], Is().GreaterThanOrEqualTo(4u)); + AssertThat(out->max_2level_cut[cut::Internal], Is().LessThanOrEqualTo(7u)); + AssertThat(out->max_2level_cut[cut::Internal_False], Is().GreaterThanOrEqualTo(4u)); + AssertThat(out->max_2level_cut[cut::Internal_False], Is().LessThanOrEqualTo(7u)); + AssertThat(out->max_2level_cut[cut::Internal_True], Is().GreaterThanOrEqualTo(4u)); + AssertThat(out->max_2level_cut[cut::Internal_True], Is().LessThanOrEqualTo(7u)); + AssertThat(out->max_2level_cut[cut::All], Is().GreaterThanOrEqualTo(4u)); + AssertThat(out->max_2level_cut[cut::All], Is().LessThanOrEqualTo(7u)); AssertThat(out->number_of_terminals[false], Is().EqualTo(2u)); AssertThat(out->number_of_terminals[true], Is().EqualTo(3u)); @@ -639,12 +639,12 @@ go_bandit([]() { // F T F T T F F T T F */ - const arc::ptr_t n1(0,0); - const arc::ptr_t n2(1,0); - const arc::ptr_t n3(1,1); - const arc::ptr_t n4(2,0); - const arc::ptr_t n5(2,1); - const arc::ptr_t n6(2,2); + const arc::pointer_type n1(0,0); + const arc::pointer_type n2(1,0); + const arc::pointer_type n3(1,1); + const arc::pointer_type n4(2,0); + const arc::pointer_type n5(2,1); + const arc::pointer_type n6(2,2); shared_levelized_file in; @@ -675,30 +675,30 @@ go_bandit([]() { // Reduce it bdd out(in); - AssertThat(adiar::is_canonical(out), Is().True()); + AssertThat(bdd_iscanonical(out), Is().True()); // Check it looks all right node_test_stream out_nodes(out); AssertThat(out_nodes.can_pull(), Is().True()); // 5 - AssertThat(out_nodes.pull(), Is().EqualTo(node(2, node::MAX_ID, + AssertThat(out_nodes.pull(), Is().EqualTo(node(2, node::max_id, terminal_F, terminal_T))); AssertThat(out_nodes.can_pull(), Is().True()); // 6 - AssertThat(out_nodes.pull(), Is().EqualTo(node(2, node::MAX_ID-1, + AssertThat(out_nodes.pull(), Is().EqualTo(node(2, node::max_id-1, terminal_T, terminal_F))); AssertThat(out_nodes.can_pull(), Is().True()); // 3 - AssertThat(out_nodes.pull(), Is().EqualTo(node(1, node::MAX_ID, - node::ptr_t(2, node::MAX_ID), - node::ptr_t(2, node::MAX_ID-1)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(1, node::max_id, + node::pointer_type(2, node::max_id), + node::pointer_type(2, node::max_id-1)))); AssertThat(out_nodes.can_pull(), Is().True()); // 1 - AssertThat(out_nodes.pull(), Is().EqualTo(node(0, node::MAX_ID, - node::ptr_t(2, node::MAX_ID), - node::ptr_t(1, node::MAX_ID)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(0, node::max_id, + node::pointer_type(2, node::max_id), + node::pointer_type(1, node::max_id)))); AssertThat(out_nodes.can_pull(), Is().False()); @@ -717,22 +717,22 @@ go_bandit([]() { AssertThat(out->width, Is().EqualTo(2u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL], Is().EqualTo(3u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(3u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(3u)); + AssertThat(out->max_1level_cut[cut::Internal], Is().EqualTo(3u)); + AssertThat(out->max_1level_cut[cut::Internal_False], Is().EqualTo(3u)); + AssertThat(out->max_1level_cut[cut::Internal_True], Is().EqualTo(3u)); // Over-approximation: globally counted arc from (1) to (3) - AssertThat(out->max_1level_cut[cut_type::ALL], Is().GreaterThanOrEqualTo(4u)); - AssertThat(out->max_1level_cut[cut_type::ALL], Is().LessThanOrEqualTo(5u)); - - AssertThat(out->max_2level_cut[cut_type::INTERNAL], Is().GreaterThanOrEqualTo(3u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL], Is().LessThanOrEqualTo(4u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_FALSE], Is().GreaterThanOrEqualTo(3u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_FALSE], Is().LessThanOrEqualTo(5u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_TRUE], Is().GreaterThanOrEqualTo(3u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_TRUE], Is().LessThanOrEqualTo(5u)); - AssertThat(out->max_2level_cut[cut_type::ALL], Is().GreaterThanOrEqualTo(3u)); - AssertThat(out->max_2level_cut[cut_type::ALL], Is().LessThanOrEqualTo(5u)); + AssertThat(out->max_1level_cut[cut::All], Is().GreaterThanOrEqualTo(4u)); + AssertThat(out->max_1level_cut[cut::All], Is().LessThanOrEqualTo(5u)); + + AssertThat(out->max_2level_cut[cut::Internal], Is().GreaterThanOrEqualTo(3u)); + AssertThat(out->max_2level_cut[cut::Internal], Is().LessThanOrEqualTo(4u)); + AssertThat(out->max_2level_cut[cut::Internal_False], Is().GreaterThanOrEqualTo(3u)); + AssertThat(out->max_2level_cut[cut::Internal_False], Is().LessThanOrEqualTo(5u)); + AssertThat(out->max_2level_cut[cut::Internal_True], Is().GreaterThanOrEqualTo(3u)); + AssertThat(out->max_2level_cut[cut::Internal_True], Is().LessThanOrEqualTo(5u)); + AssertThat(out->max_2level_cut[cut::All], Is().GreaterThanOrEqualTo(3u)); + AssertThat(out->max_2level_cut[cut::All], Is().LessThanOrEqualTo(5u)); AssertThat(out->number_of_terminals[false], Is().EqualTo(2u)); AssertThat(out->number_of_terminals[true], Is().EqualTo(2u)); @@ -749,12 +749,12 @@ go_bandit([]() { // T F T F F T T F F T */ - const arc::ptr_t n1(0,0); - const arc::ptr_t n2(1,0); - const arc::ptr_t n3(1,1); - const arc::ptr_t n4(2,0); - const arc::ptr_t n5(2,1); - const arc::ptr_t n6(2,2); + const arc::pointer_type n1(0,0); + const arc::pointer_type n2(1,0); + const arc::pointer_type n3(1,1); + const arc::pointer_type n4(2,0); + const arc::pointer_type n5(2,1); + const arc::pointer_type n6(2,2); shared_levelized_file in; @@ -785,30 +785,30 @@ go_bandit([]() { // Reduce it bdd out(in); - AssertThat(adiar::is_canonical(out), Is().True()); + AssertThat(bdd_iscanonical(out), Is().True()); // Check it looks all right node_test_stream out_nodes(out); AssertThat(out_nodes.can_pull(), Is().True()); // 6 - AssertThat(out_nodes.pull(), Is().EqualTo(node(2, node::MAX_ID, + AssertThat(out_nodes.pull(), Is().EqualTo(node(2, node::max_id, terminal_F, terminal_T))); AssertThat(out_nodes.can_pull(), Is().True()); // 5 - AssertThat(out_nodes.pull(), Is().EqualTo(node(2, node::MAX_ID-1, + AssertThat(out_nodes.pull(), Is().EqualTo(node(2, node::max_id-1, terminal_T, terminal_F))); AssertThat(out_nodes.can_pull(), Is().True()); // 3 - AssertThat(out_nodes.pull(), Is().EqualTo(node(1, node::MAX_ID, - node::ptr_t(2, node::MAX_ID-1), - node::ptr_t(2, node::MAX_ID)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(1, node::max_id, + node::pointer_type(2, node::max_id-1), + node::pointer_type(2, node::max_id)))); AssertThat(out_nodes.can_pull(), Is().True()); // 1 - AssertThat(out_nodes.pull(), Is().EqualTo(node(0, node::MAX_ID, - node::ptr_t(2, node::MAX_ID-1), - node::ptr_t(1, node::MAX_ID)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(0, node::max_id, + node::pointer_type(2, node::max_id-1), + node::pointer_type(1, node::max_id)))); AssertThat(out_nodes.can_pull(), Is().False()); @@ -827,21 +827,21 @@ go_bandit([]() { AssertThat(out->width, Is().EqualTo(2u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL], Is().EqualTo(3u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(3u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(3u)); + AssertThat(out->max_1level_cut[cut::Internal], Is().EqualTo(3u)); + AssertThat(out->max_1level_cut[cut::Internal_False], Is().EqualTo(3u)); + AssertThat(out->max_1level_cut[cut::Internal_True], Is().EqualTo(3u)); // Over-approxmation: globally counted arc from (2) to (3) - AssertThat(out->max_1level_cut[cut_type::ALL], Is().GreaterThanOrEqualTo(4u)); - AssertThat(out->max_1level_cut[cut_type::ALL], Is().GreaterThanOrEqualTo(5u)); + AssertThat(out->max_1level_cut[cut::All], Is().GreaterThanOrEqualTo(4u)); + AssertThat(out->max_1level_cut[cut::All], Is().GreaterThanOrEqualTo(5u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL], Is().GreaterThanOrEqualTo(2u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL], Is().LessThanOrEqualTo(5u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_FALSE], Is().GreaterThanOrEqualTo(2u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_FALSE], Is().LessThanOrEqualTo(5u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_TRUE], Is().GreaterThanOrEqualTo(3u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_TRUE], Is().LessThanOrEqualTo(5u)); - AssertThat(out->max_2level_cut[cut_type::ALL], Is().EqualTo(5u)); + AssertThat(out->max_2level_cut[cut::Internal], Is().GreaterThanOrEqualTo(2u)); + AssertThat(out->max_2level_cut[cut::Internal], Is().LessThanOrEqualTo(5u)); + AssertThat(out->max_2level_cut[cut::Internal_False], Is().GreaterThanOrEqualTo(2u)); + AssertThat(out->max_2level_cut[cut::Internal_False], Is().LessThanOrEqualTo(5u)); + AssertThat(out->max_2level_cut[cut::Internal_True], Is().GreaterThanOrEqualTo(3u)); + AssertThat(out->max_2level_cut[cut::Internal_True], Is().LessThanOrEqualTo(5u)); + AssertThat(out->max_2level_cut[cut::All], Is().EqualTo(5u)); AssertThat(out->number_of_terminals[false], Is().EqualTo(2u)); AssertThat(out->number_of_terminals[true], Is().EqualTo(2u)); @@ -860,10 +860,10 @@ go_bandit([]() { // F T F T */ - const arc::ptr_t n1(0,0); - const arc::ptr_t n2(1,0); - const arc::ptr_t n3(2,0); - const arc::ptr_t n4(2,1); + const arc::pointer_type n1(0,0); + const arc::pointer_type n2(1,0); + const arc::pointer_type n3(2,0); + const arc::pointer_type n4(2,1); shared_levelized_file in; @@ -890,7 +890,7 @@ go_bandit([]() { // Reduce it bdd out(in); - AssertThat(adiar::is_canonical(out), Is().True()); + AssertThat(bdd_iscanonical(out), Is().True()); // Check it looks all right node_test_stream out_nodes(out); @@ -898,21 +898,21 @@ go_bandit([]() { AssertThat(out_nodes.can_pull(), Is().True()); // n3 - AssertThat(out_nodes.pull(), Is().EqualTo(node(2, node::MAX_ID, + AssertThat(out_nodes.pull(), Is().EqualTo(node(2, node::max_id, terminal_F, terminal_T))); AssertThat(out_nodes.can_pull(), Is().True()); // n2 - AssertThat(out_nodes.pull(), Is().EqualTo(node(1, node::MAX_ID, - node::ptr_t(2, node::MAX_ID), + AssertThat(out_nodes.pull(), Is().EqualTo(node(1, node::max_id, + node::pointer_type(2, node::max_id), terminal_T))); AssertThat(out_nodes.can_pull(), Is().True()); // n1 - AssertThat(out_nodes.pull(), Is().EqualTo(node(0, node::MAX_ID, - node::ptr_t(2, node::MAX_ID), - node::ptr_t(1, node::MAX_ID)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(0, node::max_id, + node::pointer_type(2, node::max_id), + node::pointer_type(1, node::max_id)))); AssertThat(out_nodes.can_pull(), Is().False()); @@ -931,19 +931,19 @@ go_bandit([]() { AssertThat(out->width, Is().EqualTo(1u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL], Is().EqualTo(2u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(2u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(3u)); - AssertThat(out->max_1level_cut[cut_type::ALL], Is().EqualTo(3u)); + AssertThat(out->max_1level_cut[cut::Internal], Is().EqualTo(2u)); + AssertThat(out->max_1level_cut[cut::Internal_False], Is().EqualTo(2u)); + AssertThat(out->max_1level_cut[cut::Internal_True], Is().EqualTo(3u)); + AssertThat(out->max_1level_cut[cut::All], Is().EqualTo(3u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL], Is().GreaterThanOrEqualTo(2u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL], Is().LessThanOrEqualTo(3u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_FALSE], Is().GreaterThanOrEqualTo(2u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_FALSE], Is().LessThanOrEqualTo(4u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_TRUE], Is().GreaterThanOrEqualTo(3u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_TRUE], Is().LessThanOrEqualTo(4u)); - AssertThat(out->max_2level_cut[cut_type::ALL], Is().GreaterThanOrEqualTo(3u)); - AssertThat(out->max_2level_cut[cut_type::ALL], Is().LessThanOrEqualTo(4u)); + AssertThat(out->max_2level_cut[cut::Internal], Is().GreaterThanOrEqualTo(2u)); + AssertThat(out->max_2level_cut[cut::Internal], Is().LessThanOrEqualTo(3u)); + AssertThat(out->max_2level_cut[cut::Internal_False], Is().GreaterThanOrEqualTo(2u)); + AssertThat(out->max_2level_cut[cut::Internal_False], Is().LessThanOrEqualTo(4u)); + AssertThat(out->max_2level_cut[cut::Internal_True], Is().GreaterThanOrEqualTo(3u)); + AssertThat(out->max_2level_cut[cut::Internal_True], Is().LessThanOrEqualTo(4u)); + AssertThat(out->max_2level_cut[cut::All], Is().GreaterThanOrEqualTo(3u)); + AssertThat(out->max_2level_cut[cut::All], Is().LessThanOrEqualTo(4u)); AssertThat(out->number_of_terminals[false], Is().EqualTo(1u)); AssertThat(out->number_of_terminals[true], Is().EqualTo(2u)); @@ -962,11 +962,11 @@ go_bandit([]() { // F T F T */ - const arc::ptr_t n1(0,0); - const arc::ptr_t n2(1,0); - const arc::ptr_t n3(2,0); - const arc::ptr_t n4(2,1); - const arc::ptr_t n5(3,0); + const arc::pointer_type n1(0,0); + const arc::pointer_type n2(1,0); + const arc::pointer_type n3(2,0); + const arc::pointer_type n4(2,1); + const arc::pointer_type n5(3,0); shared_levelized_file in; @@ -996,7 +996,7 @@ go_bandit([]() { // Reduce it bdd out(in); - AssertThat(adiar::is_canonical(out), Is().True()); + AssertThat(bdd_iscanonical(out), Is().True()); // Check it looks all right node_test_stream out_nodes(out); @@ -1004,23 +1004,23 @@ go_bandit([]() { AssertThat(out_nodes.can_pull(), Is().True()); // n5 - AssertThat(out_nodes.pull(), Is().EqualTo(node(3, node::MAX_ID, terminal_F, terminal_T))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(3, node::max_id, terminal_F, terminal_T))); AssertThat(out_nodes.can_pull(), Is().True()); // n3 - AssertThat(out_nodes.pull(), Is().EqualTo(node(2, node::MAX_ID, terminal_F, terminal_T))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(2, node::max_id, terminal_F, terminal_T))); AssertThat(out_nodes.can_pull(), Is().True()); // n2 - AssertThat(out_nodes.pull(), Is().EqualTo(node(1, node::MAX_ID, - node::ptr_t(2, node::MAX_ID), - node::ptr_t(3, node::MAX_ID)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(1, node::max_id, + node::pointer_type(2, node::max_id), + node::pointer_type(3, node::max_id)))); AssertThat(out_nodes.can_pull(), Is().True()); // n1 - AssertThat(out_nodes.pull(), Is().EqualTo(node(0, node::MAX_ID, - node::ptr_t(2, node::MAX_ID), - node::ptr_t(1, node::MAX_ID)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(0, node::max_id, + node::pointer_type(2, node::max_id), + node::pointer_type(1, node::max_id)))); AssertThat(out_nodes.can_pull(), Is().False()); @@ -1042,22 +1042,22 @@ go_bandit([]() { AssertThat(out->width, Is().EqualTo(1u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL], Is().EqualTo(3u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(3u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(3u)); + AssertThat(out->max_1level_cut[cut::Internal], Is().EqualTo(3u)); + AssertThat(out->max_1level_cut[cut::Internal_False], Is().EqualTo(3u)); + AssertThat(out->max_1level_cut[cut::Internal_True], Is().EqualTo(3u)); // Over-approxmation: globally counted arc from (2) to (5) - AssertThat(out->max_1level_cut[cut_type::ALL], Is().GreaterThanOrEqualTo(4u)); - AssertThat(out->max_1level_cut[cut_type::ALL], Is().LessThanOrEqualTo(5u)); - - AssertThat(out->max_2level_cut[cut_type::INTERNAL], Is().GreaterThanOrEqualTo(3u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL], Is().LessThanOrEqualTo(4u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_FALSE], Is().GreaterThanOrEqualTo(3u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_FALSE], Is().LessThanOrEqualTo(5u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_TRUE], Is().GreaterThanOrEqualTo(3u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_TRUE], Is().LessThanOrEqualTo(5u)); - AssertThat(out->max_2level_cut[cut_type::ALL], Is().GreaterThanOrEqualTo(4u)); - AssertThat(out->max_2level_cut[cut_type::ALL], Is().LessThanOrEqualTo(5u)); + AssertThat(out->max_1level_cut[cut::All], Is().GreaterThanOrEqualTo(4u)); + AssertThat(out->max_1level_cut[cut::All], Is().LessThanOrEqualTo(5u)); + + AssertThat(out->max_2level_cut[cut::Internal], Is().GreaterThanOrEqualTo(3u)); + AssertThat(out->max_2level_cut[cut::Internal], Is().LessThanOrEqualTo(4u)); + AssertThat(out->max_2level_cut[cut::Internal_False], Is().GreaterThanOrEqualTo(3u)); + AssertThat(out->max_2level_cut[cut::Internal_False], Is().LessThanOrEqualTo(5u)); + AssertThat(out->max_2level_cut[cut::Internal_True], Is().GreaterThanOrEqualTo(3u)); + AssertThat(out->max_2level_cut[cut::Internal_True], Is().LessThanOrEqualTo(5u)); + AssertThat(out->max_2level_cut[cut::All], Is().GreaterThanOrEqualTo(4u)); + AssertThat(out->max_2level_cut[cut::All], Is().LessThanOrEqualTo(5u)); AssertThat(out->number_of_terminals[false], Is().EqualTo(2u)); AssertThat(out->number_of_terminals[true], Is().EqualTo(2u)); @@ -1074,11 +1074,11 @@ go_bandit([]() { // F T T F F T T F */ - const arc::ptr_t n1(0,0); - const arc::ptr_t n2(1,0); - const arc::ptr_t n3(1,1); - const arc::ptr_t n4(2,0); - const arc::ptr_t n5(2,1); + const arc::pointer_type n1(0,0); + const arc::pointer_type n2(1,0); + const arc::pointer_type n3(1,1); + const arc::pointer_type n4(2,0); + const arc::pointer_type n5(2,1); shared_levelized_file in; @@ -1107,7 +1107,7 @@ go_bandit([]() { // Reduce it bdd out(in); - AssertThat(adiar::is_canonical(out), Is().True()); + AssertThat(bdd_iscanonical(out), Is().True()); // Check it looks all right node_test_stream out_nodes(out); @@ -1115,17 +1115,17 @@ go_bandit([]() { AssertThat(out_nodes.can_pull(), Is().True()); // n5 - AssertThat(out_nodes.pull(), Is().EqualTo(node(2, node::MAX_ID, terminal_F, terminal_T))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(2, node::max_id, terminal_F, terminal_T))); AssertThat(out_nodes.can_pull(), Is().True()); // n4 - AssertThat(out_nodes.pull(), Is().EqualTo(node(2, node::MAX_ID-1, terminal_T, terminal_F))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(2, node::max_id-1, terminal_T, terminal_F))); AssertThat(out_nodes.can_pull(), Is().True()); // n1 - AssertThat(out_nodes.pull(), Is().EqualTo(node(0, node::MAX_ID, - node::ptr_t(2, node::MAX_ID), - node::ptr_t(2, node::MAX_ID-1)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(0, node::max_id, + node::pointer_type(2, node::max_id), + node::pointer_type(2, node::max_id-1)))); AssertThat(out_nodes.can_pull(), Is().False()); @@ -1141,23 +1141,23 @@ go_bandit([]() { AssertThat(out->width, Is().EqualTo(2u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL], Is().EqualTo(2u)); + AssertThat(out->max_1level_cut[cut::Internal], Is().EqualTo(2u)); // Over-approxmation: globally counted arcs (1) to (4) and (1) to (5) - AssertThat(out->max_1level_cut[cut_type::INTERNAL_FALSE], Is().GreaterThanOrEqualTo(2u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_FALSE], Is().LessThanOrEqualTo(4u)); + AssertThat(out->max_1level_cut[cut::Internal_False], Is().GreaterThanOrEqualTo(2u)); + AssertThat(out->max_1level_cut[cut::Internal_False], Is().LessThanOrEqualTo(4u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_TRUE], Is().GreaterThanOrEqualTo(2u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_FALSE], Is().LessThanOrEqualTo(4u)); + AssertThat(out->max_1level_cut[cut::Internal_True], Is().GreaterThanOrEqualTo(2u)); + AssertThat(out->max_1level_cut[cut::Internal_False], Is().LessThanOrEqualTo(4u)); - AssertThat(out->max_1level_cut[cut_type::ALL], Is().EqualTo(4u)); + AssertThat(out->max_1level_cut[cut::All], Is().EqualTo(4u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL], Is().EqualTo(2u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_FALSE], Is().GreaterThanOrEqualTo(2u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_FALSE], Is().LessThanOrEqualTo(4u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_TRUE], Is().GreaterThanOrEqualTo(2u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_TRUE], Is().LessThanOrEqualTo(4u)); - AssertThat(out->max_2level_cut[cut_type::ALL], Is().EqualTo(4u)); + AssertThat(out->max_2level_cut[cut::Internal], Is().EqualTo(2u)); + AssertThat(out->max_2level_cut[cut::Internal_False], Is().GreaterThanOrEqualTo(2u)); + AssertThat(out->max_2level_cut[cut::Internal_False], Is().LessThanOrEqualTo(4u)); + AssertThat(out->max_2level_cut[cut::Internal_True], Is().GreaterThanOrEqualTo(2u)); + AssertThat(out->max_2level_cut[cut::Internal_True], Is().LessThanOrEqualTo(4u)); + AssertThat(out->max_2level_cut[cut::All], Is().EqualTo(4u)); AssertThat(out->number_of_terminals[false], Is().EqualTo(2u)); AssertThat(out->number_of_terminals[true], Is().EqualTo(2u)); @@ -1174,10 +1174,10 @@ go_bandit([]() { // F T F T */ - const arc::ptr_t n1(0,0); - const arc::ptr_t n2(1,0); - const arc::ptr_t n3(2,0); - const arc::ptr_t n4(2,1); + const arc::pointer_type n1(0,0); + const arc::pointer_type n2(1,0); + const arc::pointer_type n3(2,0); + const arc::pointer_type n4(2,1); shared_levelized_file in; @@ -1204,7 +1204,7 @@ go_bandit([]() { // Reduce it bdd out(in); - AssertThat(adiar::is_canonical(out), Is().True()); + AssertThat(bdd_iscanonical(out), Is().True()); // Check it looks all right node_test_stream out_nodes(out); @@ -1212,14 +1212,14 @@ go_bandit([]() { AssertThat(out_nodes.can_pull(), Is().True()); // n4 - AssertThat(out_nodes.pull(), Is().EqualTo(node(2, node::MAX_ID, + AssertThat(out_nodes.pull(), Is().EqualTo(node(2, node::max_id, terminal_F, terminal_T))); AssertThat(out_nodes.can_pull(), Is().True()); // n1 - AssertThat(out_nodes.pull(), Is().EqualTo(node(0, node::MAX_ID, - node::ptr_t(2, node::MAX_ID), + AssertThat(out_nodes.pull(), Is().EqualTo(node(0, node::max_id, + node::pointer_type(2, node::max_id), terminal_T))); AssertThat(out_nodes.can_pull(), Is().False()); @@ -1235,23 +1235,23 @@ go_bandit([]() { AssertThat(out->width, Is().EqualTo(1u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL], Is().EqualTo(1u)); + AssertThat(out->max_1level_cut[cut::Internal], Is().EqualTo(1u)); // Over-approximation: globally counted arc (1) to (4) - AssertThat(out->max_1level_cut[cut_type::INTERNAL_FALSE], Is().GreaterThanOrEqualTo(1u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_FALSE], Is().LessThanOrEqualTo(2u)); + AssertThat(out->max_1level_cut[cut::Internal_False], Is().GreaterThanOrEqualTo(1u)); + AssertThat(out->max_1level_cut[cut::Internal_False], Is().LessThanOrEqualTo(2u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_TRUE], Is().GreaterThanOrEqualTo(2u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_TRUE], Is().LessThanOrEqualTo(3u)); + AssertThat(out->max_1level_cut[cut::Internal_True], Is().GreaterThanOrEqualTo(2u)); + AssertThat(out->max_1level_cut[cut::Internal_True], Is().LessThanOrEqualTo(3u)); - AssertThat(out->max_1level_cut[cut_type::ALL], Is().EqualTo(3u)); + AssertThat(out->max_1level_cut[cut::All], Is().EqualTo(3u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL], Is().EqualTo(1u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_FALSE], Is().GreaterThanOrEqualTo(1u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_FALSE], Is().LessThanOrEqualTo(3u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_TRUE], Is().GreaterThanOrEqualTo(2u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_TRUE], Is().LessThanOrEqualTo(3u)); - AssertThat(out->max_2level_cut[cut_type::ALL], Is().EqualTo(3u)); + AssertThat(out->max_2level_cut[cut::Internal], Is().EqualTo(1u)); + AssertThat(out->max_2level_cut[cut::Internal_False], Is().GreaterThanOrEqualTo(1u)); + AssertThat(out->max_2level_cut[cut::Internal_False], Is().LessThanOrEqualTo(3u)); + AssertThat(out->max_2level_cut[cut::Internal_True], Is().GreaterThanOrEqualTo(2u)); + AssertThat(out->max_2level_cut[cut::Internal_True], Is().LessThanOrEqualTo(3u)); + AssertThat(out->max_2level_cut[cut::All], Is().EqualTo(3u)); AssertThat(out->number_of_terminals[false], Is().EqualTo(1u)); AssertThat(out->number_of_terminals[true], Is().EqualTo(2u)); @@ -1270,12 +1270,12 @@ go_bandit([]() { // F T F T */ - const arc::ptr_t n1(0,0); - const arc::ptr_t n2(1,0); - const arc::ptr_t n3(1,1); - const arc::ptr_t n4(2,0); - const arc::ptr_t n5(2,1); - const arc::ptr_t n6(3,0); + const arc::pointer_type n1(0,0); + const arc::pointer_type n2(1,0); + const arc::pointer_type n3(1,1); + const arc::pointer_type n4(2,0); + const arc::pointer_type n5(2,1); + const arc::pointer_type n6(3,0); shared_levelized_file in; @@ -1307,34 +1307,34 @@ go_bandit([]() { // Reduce it bdd out(in); - AssertThat(adiar::is_canonical(out), Is().True()); + AssertThat(bdd_iscanonical(out), Is().True()); // Check it looks all right node_test_stream out_nodes(out); // n6 AssertThat(out_nodes.can_pull(), Is().True()); - AssertThat(out_nodes.pull(), Is().EqualTo(node(3, node::MAX_ID, + AssertThat(out_nodes.pull(), Is().EqualTo(node(3, node::max_id, terminal_F, terminal_T))); // n4 AssertThat(out_nodes.can_pull(), Is().True()); - AssertThat(out_nodes.pull(), Is().EqualTo(node(2, node::MAX_ID, + AssertThat(out_nodes.pull(), Is().EqualTo(node(2, node::max_id, terminal_F, terminal_T))); // n2 AssertThat(out_nodes.can_pull(), Is().True()); - AssertThat(out_nodes.pull(), Is().EqualTo(node(1, node::MAX_ID, - node::ptr_t(3, node::MAX_ID), - node::ptr_t(2, node::MAX_ID)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(1, node::max_id, + node::pointer_type(3, node::max_id), + node::pointer_type(2, node::max_id)))); // n1 AssertThat(out_nodes.can_pull(), Is().True()); - AssertThat(out_nodes.pull(), Is().EqualTo(node(0, node::MAX_ID, - node::ptr_t(1, node::MAX_ID), - node::ptr_t(2, node::MAX_ID)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(0, node::max_id, + node::pointer_type(1, node::max_id), + node::pointer_type(2, node::max_id)))); AssertThat(out_nodes.can_pull(), Is().False()); level_info_test_stream out_meta(out); @@ -1355,30 +1355,30 @@ go_bandit([]() { AssertThat(out->width, Is().EqualTo(1u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL], Is().EqualTo(3u)); + AssertThat(out->max_1level_cut[cut::Internal], Is().EqualTo(3u)); // Over-approximation: globally counted arc from (1) to (4) - AssertThat(out->max_1level_cut[cut_type::INTERNAL_FALSE], Is().GreaterThanOrEqualTo(3u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_FALSE], Is().LessThanOrEqualTo(5u)); + AssertThat(out->max_1level_cut[cut::Internal_False], Is().GreaterThanOrEqualTo(3u)); + AssertThat(out->max_1level_cut[cut::Internal_False], Is().LessThanOrEqualTo(5u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_TRUE], Is().GreaterThanOrEqualTo(3u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_TRUE], Is().LessThanOrEqualTo(5u)); + AssertThat(out->max_1level_cut[cut::Internal_True], Is().GreaterThanOrEqualTo(3u)); + AssertThat(out->max_1level_cut[cut::Internal_True], Is().LessThanOrEqualTo(5u)); // Over-approximation: at the lowest level we don't know yet, that // nodes (4) and (5) will be merged. // // Currently, returns 5, i.e. maximum DiCut of '.size() + 1'. - AssertThat(out->max_1level_cut[cut_type::ALL], Is().GreaterThanOrEqualTo(3u)); - AssertThat(out->max_1level_cut[cut_type::ALL], Is().LessThanOrEqualTo(5u)); - - AssertThat(out->max_2level_cut[cut_type::INTERNAL], Is().GreaterThanOrEqualTo(3u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL], Is().LessThanOrEqualTo(5u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_FALSE], Is().GreaterThanOrEqualTo(3u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_FALSE], Is().LessThanOrEqualTo(5u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_TRUE], Is().GreaterThanOrEqualTo(3u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_TRUE], Is().LessThanOrEqualTo(5u)); - AssertThat(out->max_2level_cut[cut_type::ALL], Is().GreaterThanOrEqualTo(3u)); - AssertThat(out->max_2level_cut[cut_type::ALL], Is().LessThanOrEqualTo(5u)); + AssertThat(out->max_1level_cut[cut::All], Is().GreaterThanOrEqualTo(3u)); + AssertThat(out->max_1level_cut[cut::All], Is().LessThanOrEqualTo(5u)); + + AssertThat(out->max_2level_cut[cut::Internal], Is().GreaterThanOrEqualTo(3u)); + AssertThat(out->max_2level_cut[cut::Internal], Is().LessThanOrEqualTo(5u)); + AssertThat(out->max_2level_cut[cut::Internal_False], Is().GreaterThanOrEqualTo(3u)); + AssertThat(out->max_2level_cut[cut::Internal_False], Is().LessThanOrEqualTo(5u)); + AssertThat(out->max_2level_cut[cut::Internal_True], Is().GreaterThanOrEqualTo(3u)); + AssertThat(out->max_2level_cut[cut::Internal_True], Is().LessThanOrEqualTo(5u)); + AssertThat(out->max_2level_cut[cut::All], Is().GreaterThanOrEqualTo(3u)); + AssertThat(out->max_2level_cut[cut::All], Is().LessThanOrEqualTo(5u)); AssertThat(out->number_of_terminals[false], Is().EqualTo(2u)); AssertThat(out->number_of_terminals[true], Is().EqualTo(2u)); @@ -1395,10 +1395,10 @@ go_bandit([]() { // F T F T */ - const arc::ptr_t n1(0,0); - const arc::ptr_t n2(1,0); - const arc::ptr_t n3(2,0); - const arc::ptr_t n4(2,1); + const arc::pointer_type n1(0,0); + const arc::pointer_type n2(1,0); + const arc::pointer_type n3(2,0); + const arc::pointer_type n4(2,1); shared_levelized_file in; @@ -1425,7 +1425,7 @@ go_bandit([]() { // Reduce it bdd out(in); - AssertThat(adiar::is_canonical(out), Is().True()); + AssertThat(bdd_iscanonical(out), Is().True()); // Check it looks all right node_test_stream out_nodes(out); @@ -1433,7 +1433,7 @@ go_bandit([]() { AssertThat(out_nodes.can_pull(), Is().True()); // n4 - AssertThat(out_nodes.pull(), Is().EqualTo(node(2, node::MAX_ID, terminal_F, terminal_T))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(2, node::max_id, terminal_F, terminal_T))); AssertThat(out_nodes.can_pull(), Is().False()); level_info_test_stream out_meta(out); @@ -1445,15 +1445,15 @@ go_bandit([]() { AssertThat(out->width, Is().EqualTo(1u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL], Is().EqualTo(1u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(1u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(1u)); - AssertThat(out->max_1level_cut[cut_type::ALL], Is().EqualTo(2u)); + AssertThat(out->max_1level_cut[cut::Internal], Is().EqualTo(1u)); + AssertThat(out->max_1level_cut[cut::Internal_False], Is().EqualTo(1u)); + AssertThat(out->max_1level_cut[cut::Internal_True], Is().EqualTo(1u)); + AssertThat(out->max_1level_cut[cut::All], Is().EqualTo(2u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL], Is().EqualTo(1u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(1u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(1u)); - AssertThat(out->max_2level_cut[cut_type::ALL], Is().EqualTo(2u)); + AssertThat(out->max_2level_cut[cut::Internal], Is().EqualTo(1u)); + AssertThat(out->max_2level_cut[cut::Internal_False], Is().EqualTo(1u)); + AssertThat(out->max_2level_cut[cut::Internal_True], Is().EqualTo(1u)); + AssertThat(out->max_2level_cut[cut::All], Is().EqualTo(2u)); AssertThat(out->number_of_terminals[false], Is().EqualTo(1u)); AssertThat(out->number_of_terminals[true], Is().EqualTo(1u)); @@ -1474,15 +1474,15 @@ go_bandit([]() { // F T F T */ - const arc::ptr_t n1(0,0); - const arc::ptr_t n2(1,0); - const arc::ptr_t n3(1,1); - const arc::ptr_t n4(2,0); - const arc::ptr_t n5(2,1); - const arc::ptr_t n6(3,0); - const arc::ptr_t n7(3,1); - const arc::ptr_t n8(3,2); - const arc::ptr_t n9(4,0); + const arc::pointer_type n1(0,0); + const arc::pointer_type n2(1,0); + const arc::pointer_type n3(1,1); + const arc::pointer_type n4(2,0); + const arc::pointer_type n5(2,1); + const arc::pointer_type n6(3,0); + const arc::pointer_type n7(3,1); + const arc::pointer_type n8(3,2); + const arc::pointer_type n9(4,0); shared_levelized_file in; @@ -1521,7 +1521,7 @@ go_bandit([]() { // Reduce it bdd out(in); - AssertThat(adiar::is_canonical(out), Is().True()); + AssertThat(bdd_iscanonical(out), Is().True()); // Check it looks all right node_test_stream out_nodes(out); @@ -1529,42 +1529,42 @@ go_bandit([]() { AssertThat(out_nodes.can_pull(), Is().True()); // n9 - AssertThat(out_nodes.pull(), Is().EqualTo(node(4, node::MAX_ID, terminal_F, terminal_T))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(4, node::max_id, terminal_F, terminal_T))); AssertThat(out_nodes.can_pull(), Is().True()); // n8 - AssertThat(out_nodes.pull(), Is().EqualTo(node(3, node::MAX_ID, + AssertThat(out_nodes.pull(), Is().EqualTo(node(3, node::max_id, terminal_F, terminal_T))); AssertThat(out_nodes.can_pull(), Is().True()); // n7 - AssertThat(out_nodes.pull(), Is().EqualTo(node(3, node::MAX_ID-1, - node::ptr_t(4, node::MAX_ID), + AssertThat(out_nodes.pull(), Is().EqualTo(node(3, node::max_id-1, + node::pointer_type(4, node::max_id), terminal_T))); AssertThat(out_nodes.can_pull(), Is().True()); // n6 - AssertThat(out_nodes.pull(), Is().EqualTo(node(3, node::MAX_ID-2, + AssertThat(out_nodes.pull(), Is().EqualTo(node(3, node::max_id-2, terminal_F, - node::ptr_t(4, node::MAX_ID)))); + node::pointer_type(4, node::max_id)))); AssertThat(out_nodes.can_pull(), Is().True()); // n5 - AssertThat(out_nodes.pull(), Is().EqualTo(node(2, node::MAX_ID, - node::ptr_t(3, node::MAX_ID-1), - node::ptr_t(3, node::MAX_ID)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(2, node::max_id, + node::pointer_type(3, node::max_id-1), + node::pointer_type(3, node::max_id)))); AssertThat(out_nodes.can_pull(), Is().True()); // n4 - AssertThat(out_nodes.pull(), Is().EqualTo(node(2, node::MAX_ID-1, - node::ptr_t(3, node::MAX_ID-2), - node::ptr_t(3, node::MAX_ID-1)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(2, node::max_id-1, + node::pointer_type(3, node::max_id-2), + node::pointer_type(3, node::max_id-1)))); // n1 - AssertThat(out_nodes.pull(), Is().EqualTo(node(1, node::MAX_ID, - node::ptr_t(2, node::MAX_ID-1), - node::ptr_t(2, node::MAX_ID)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(1, node::max_id, + node::pointer_type(2, node::max_id-1), + node::pointer_type(2, node::max_id)))); AssertThat(out_nodes.can_pull(), Is().False()); @@ -1584,19 +1584,19 @@ go_bandit([]() { AssertThat(out->width, Is().EqualTo(3u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL], Is().EqualTo(4u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(4u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(4u)); - AssertThat(out->max_1level_cut[cut_type::ALL], Is().EqualTo(6u)); + AssertThat(out->max_1level_cut[cut::Internal], Is().EqualTo(4u)); + AssertThat(out->max_1level_cut[cut::Internal_False], Is().EqualTo(4u)); + AssertThat(out->max_1level_cut[cut::Internal_True], Is().EqualTo(4u)); + AssertThat(out->max_1level_cut[cut::All], Is().EqualTo(6u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL], Is().GreaterThanOrEqualTo(4u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL], Is().LessThanOrEqualTo(6u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_FALSE], Is().GreaterThanOrEqualTo(4u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_FALSE], Is().LessThanOrEqualTo(6u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_TRUE], Is().GreaterThanOrEqualTo(4u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_TRUE], Is().LessThanOrEqualTo(6u)); - AssertThat(out->max_2level_cut[cut_type::ALL], Is().GreaterThanOrEqualTo(6u)); - AssertThat(out->max_2level_cut[cut_type::ALL], Is().LessThanOrEqualTo(8u)); + AssertThat(out->max_2level_cut[cut::Internal], Is().GreaterThanOrEqualTo(4u)); + AssertThat(out->max_2level_cut[cut::Internal], Is().LessThanOrEqualTo(6u)); + AssertThat(out->max_2level_cut[cut::Internal_False], Is().GreaterThanOrEqualTo(4u)); + AssertThat(out->max_2level_cut[cut::Internal_False], Is().LessThanOrEqualTo(6u)); + AssertThat(out->max_2level_cut[cut::Internal_True], Is().GreaterThanOrEqualTo(4u)); + AssertThat(out->max_2level_cut[cut::Internal_True], Is().LessThanOrEqualTo(6u)); + AssertThat(out->max_2level_cut[cut::All], Is().GreaterThanOrEqualTo(6u)); + AssertThat(out->max_2level_cut[cut::All], Is().LessThanOrEqualTo(8u)); AssertThat(out->number_of_terminals[false], Is().EqualTo(3u)); AssertThat(out->number_of_terminals[true], Is().EqualTo(3u)); @@ -1615,12 +1615,12 @@ go_bandit([]() { // T F F T T T T F F T */ - const arc::ptr_t n1(0,0); - const arc::ptr_t n2(1,0); - const arc::ptr_t n3(2,0); - const arc::ptr_t n4(3,0); - const arc::ptr_t n5(3,1); - const arc::ptr_t n6(3,2); + const arc::pointer_type n1(0,0); + const arc::pointer_type n2(1,0); + const arc::pointer_type n3(2,0); + const arc::pointer_type n4(3,0); + const arc::pointer_type n5(3,1); + const arc::pointer_type n6(3,2); shared_levelized_file in; @@ -1652,38 +1652,38 @@ go_bandit([]() { // Reduce it bdd out(in); - AssertThat(adiar::is_canonical(out), Is().True()); + AssertThat(bdd_iscanonical(out), Is().True()); // Check it looks all right node_test_stream out_nodes(out); // n4 AssertThat(out_nodes.can_pull(), Is().True()); - AssertThat(out_nodes.pull(), Is().EqualTo(node(3, node::MAX_ID, + AssertThat(out_nodes.pull(), Is().EqualTo(node(3, node::max_id, terminal_F, terminal_T))); AssertThat(out_nodes.can_pull(), Is().True()); - AssertThat(out_nodes.pull(), Is().EqualTo(node(3, node::MAX_ID-1, + AssertThat(out_nodes.pull(), Is().EqualTo(node(3, node::max_id-1, terminal_T, terminal_F))); // n4 AssertThat(out_nodes.can_pull(), Is().True()); - AssertThat(out_nodes.pull(), Is().EqualTo(node(2, node::MAX_ID, - node::ptr_t(3, node::MAX_ID-1), - node::ptr_t(3, node::MAX_ID)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(2, node::max_id, + node::pointer_type(3, node::max_id-1), + node::pointer_type(3, node::max_id)))); // n2 AssertThat(out_nodes.can_pull(), Is().True()); - AssertThat(out_nodes.pull(), Is().EqualTo(node(1, node::MAX_ID, - node::ptr_t(2, node::MAX_ID), + AssertThat(out_nodes.pull(), Is().EqualTo(node(1, node::max_id, + node::pointer_type(2, node::max_id), terminal_T))); // n1 AssertThat(out_nodes.can_pull(), Is().True()); - AssertThat(out_nodes.pull(), Is().EqualTo(node(0, node::MAX_ID, - node::ptr_t(1, node::MAX_ID), + AssertThat(out_nodes.pull(), Is().EqualTo(node(0, node::max_id, + node::pointer_type(1, node::max_id), terminal_T))); AssertThat(out_nodes.can_pull(), Is().False()); @@ -1705,25 +1705,25 @@ go_bandit([]() { AssertThat(out->width, Is().EqualTo(2u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL], Is().EqualTo(2u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(2u)); + AssertThat(out->max_1level_cut[cut::Internal], Is().EqualTo(2u)); + AssertThat(out->max_1level_cut[cut::Internal_False], Is().EqualTo(2u)); // Over-approximation: globally counted arc (1) to T and (2) to T - AssertThat(out->max_1level_cut[cut_type::INTERNAL_TRUE], Is().GreaterThanOrEqualTo(4u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_TRUE], Is().LessThanOrEqualTo(6u)); + AssertThat(out->max_1level_cut[cut::Internal_True], Is().GreaterThanOrEqualTo(4u)); + AssertThat(out->max_1level_cut[cut::Internal_True], Is().LessThanOrEqualTo(6u)); - AssertThat(out->max_1level_cut[cut_type::ALL], Is().EqualTo(6u)); + AssertThat(out->max_1level_cut[cut::All], Is().EqualTo(6u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL], Is().GreaterThanOrEqualTo(2u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL], Is().LessThanOrEqualTo(4u)); + AssertThat(out->max_2level_cut[cut::Internal], Is().GreaterThanOrEqualTo(2u)); + AssertThat(out->max_2level_cut[cut::Internal], Is().LessThanOrEqualTo(4u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_FALSE], Is().GreaterThanOrEqualTo(2u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_FALSE], Is().LessThanOrEqualTo(3u)); + AssertThat(out->max_2level_cut[cut::Internal_False], Is().GreaterThanOrEqualTo(2u)); + AssertThat(out->max_2level_cut[cut::Internal_False], Is().LessThanOrEqualTo(3u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_TRUE], Is().GreaterThanOrEqualTo(4u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_TRUE], Is().LessThanOrEqualTo(6u)); + AssertThat(out->max_2level_cut[cut::Internal_True], Is().GreaterThanOrEqualTo(4u)); + AssertThat(out->max_2level_cut[cut::Internal_True], Is().LessThanOrEqualTo(6u)); - AssertThat(out->max_2level_cut[cut_type::ALL], Is().EqualTo(6u)); + AssertThat(out->max_2level_cut[cut::All], Is().EqualTo(6u)); AssertThat(out->number_of_terminals[false], Is().EqualTo(2u)); AssertThat(out->number_of_terminals[true], Is().EqualTo(4u)); @@ -1736,7 +1736,7 @@ go_bandit([]() { // F F */ - const arc::ptr_t n1(0,0); + const arc::pointer_type n1(0,0); shared_levelized_file in; @@ -1754,7 +1754,7 @@ go_bandit([]() { // Reduce it bdd out(in); - AssertThat(adiar::is_canonical(out), Is().True()); + AssertThat(bdd_iscanonical(out), Is().True()); // Check it looks all right node_test_stream out_nodes(out); @@ -1770,15 +1770,15 @@ go_bandit([]() { AssertThat(out->width, Is().EqualTo(0u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL], Is().EqualTo(0u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(1u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(0u)); - AssertThat(out->max_1level_cut[cut_type::ALL], Is().EqualTo(1u)); + AssertThat(out->max_1level_cut[cut::Internal], Is().EqualTo(0u)); + AssertThat(out->max_1level_cut[cut::Internal_False], Is().EqualTo(1u)); + AssertThat(out->max_1level_cut[cut::Internal_True], Is().EqualTo(0u)); + AssertThat(out->max_1level_cut[cut::All], Is().EqualTo(1u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL], Is().EqualTo(0u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(1u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(0u)); - AssertThat(out->max_2level_cut[cut_type::ALL], Is().EqualTo(1u)); + AssertThat(out->max_2level_cut[cut::Internal], Is().EqualTo(0u)); + AssertThat(out->max_2level_cut[cut::Internal_False], Is().EqualTo(1u)); + AssertThat(out->max_2level_cut[cut::Internal_True], Is().EqualTo(0u)); + AssertThat(out->max_2level_cut[cut::All], Is().EqualTo(1u)); AssertThat(out->number_of_terminals[false], Is().EqualTo(1u)); AssertThat(out->number_of_terminals[true], Is().EqualTo(0u)); @@ -1793,8 +1793,8 @@ go_bandit([]() { // T T */ - const arc::ptr_t n1(0,0); - const arc::ptr_t n2(1,0); + const arc::pointer_type n1(0,0); + const arc::pointer_type n2(1,0); shared_levelized_file in; @@ -1816,7 +1816,7 @@ go_bandit([]() { // Reduce it bdd out(in); - AssertThat(adiar::is_canonical(out), Is().True()); + AssertThat(bdd_iscanonical(out), Is().True()); // Check it looks all right node_test_stream out_nodes(out); @@ -1830,28 +1830,28 @@ go_bandit([]() { AssertThat(out->width, Is().EqualTo(0u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL], Is().EqualTo(0u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(0u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(1u)); - AssertThat(out->max_1level_cut[cut_type::ALL], Is().EqualTo(1u)); + AssertThat(out->max_1level_cut[cut::Internal], Is().EqualTo(0u)); + AssertThat(out->max_1level_cut[cut::Internal_False], Is().EqualTo(0u)); + AssertThat(out->max_1level_cut[cut::Internal_True], Is().EqualTo(1u)); + AssertThat(out->max_1level_cut[cut::All], Is().EqualTo(1u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL], Is().EqualTo(0u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(0u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(1u)); - AssertThat(out->max_2level_cut[cut_type::ALL], Is().EqualTo(1u)); + AssertThat(out->max_2level_cut[cut::Internal], Is().EqualTo(0u)); + AssertThat(out->max_2level_cut[cut::Internal_False], Is().EqualTo(0u)); + AssertThat(out->max_2level_cut[cut::Internal_True], Is().EqualTo(1u)); + AssertThat(out->max_2level_cut[cut::All], Is().EqualTo(1u)); AssertThat(out->number_of_terminals[false], Is().EqualTo(0u)); AssertThat(out->number_of_terminals[true], Is().EqualTo(1u)); }); - it("can return non-reducible single-node variable with MAX_ID", [&]() { + it("can return non-reducible single-node variable with max_id", [&]() { /* // 1 1 ---- x0 // / \ => / \ // F T F T */ - const arc::ptr_t n1(0,0); + const arc::pointer_type n1(0,0); shared_levelized_file in; @@ -1869,13 +1869,13 @@ go_bandit([]() { // Reduce it bdd out(in); - AssertThat(adiar::is_canonical(out), Is().True()); + AssertThat(bdd_iscanonical(out), Is().True()); // Check it looks all right node_test_stream out_nodes(out); AssertThat(out_nodes.can_pull(), Is().True()); - AssertThat(out_nodes.pull(), Is().EqualTo(node(0, node::MAX_ID, terminal_F, terminal_T))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(0, node::max_id, terminal_F, terminal_T))); AssertThat(out_nodes.can_pull(), Is().False()); level_info_test_stream out_meta(out); @@ -1886,15 +1886,15 @@ go_bandit([]() { AssertThat(out->width, Is().EqualTo(1u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL], Is().EqualTo(1u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(1u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(1u)); - AssertThat(out->max_1level_cut[cut_type::ALL], Is().EqualTo(2u)); + AssertThat(out->max_1level_cut[cut::Internal], Is().EqualTo(1u)); + AssertThat(out->max_1level_cut[cut::Internal_False], Is().EqualTo(1u)); + AssertThat(out->max_1level_cut[cut::Internal_True], Is().EqualTo(1u)); + AssertThat(out->max_1level_cut[cut::All], Is().EqualTo(2u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL], Is().EqualTo(1u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(1u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(1u)); - AssertThat(out->max_2level_cut[cut_type::ALL], Is().EqualTo(2u)); + AssertThat(out->max_2level_cut[cut::Internal], Is().EqualTo(1u)); + AssertThat(out->max_2level_cut[cut::Internal_False], Is().EqualTo(1u)); + AssertThat(out->max_2level_cut[cut::Internal_True], Is().EqualTo(1u)); + AssertThat(out->max_2level_cut[cut::All], Is().EqualTo(2u)); AssertThat(out->number_of_terminals[false], Is().EqualTo(1u)); AssertThat(out->number_of_terminals[true], Is().EqualTo(1u)); @@ -1917,17 +1917,17 @@ go_bandit([]() { // T F T T F F T */ - const arc::ptr_t n1(0,0); - const arc::ptr_t n2(1,0); - const arc::ptr_t n3(1,1); - const arc::ptr_t n4(2,0); - const arc::ptr_t n5(2,1); - const arc::ptr_t n6(3,0); - const arc::ptr_t n7(3,1); - const arc::ptr_t n8(4,0); - const arc::ptr_t n9(4,1); - const arc::ptr_t n10(5,0); - const arc::ptr_t n11(5,1); + const arc::pointer_type n1(0,0); + const arc::pointer_type n2(1,0); + const arc::pointer_type n3(1,1); + const arc::pointer_type n4(2,0); + const arc::pointer_type n5(2,1); + const arc::pointer_type n6(3,0); + const arc::pointer_type n7(3,1); + const arc::pointer_type n8(4,0); + const arc::pointer_type n9(4,1); + const arc::pointer_type n10(5,0); + const arc::pointer_type n11(5,1); shared_levelized_file in; @@ -1971,46 +1971,46 @@ go_bandit([]() { // Reduce it bdd out(in); - AssertThat(adiar::is_canonical(out), Is().True()); + AssertThat(bdd_iscanonical(out), Is().True()); // Check it looks all right node_test_stream out_nodes(out); AssertThat(out_nodes.can_pull(), Is().True()); // n11 - AssertThat(out_nodes.pull(), Is().EqualTo(node(5, node::MAX_ID, + AssertThat(out_nodes.pull(), Is().EqualTo(node(5, node::max_id, terminal_F, terminal_T))); AssertThat(out_nodes.can_pull(), Is().True()); // n10 - AssertThat(out_nodes.pull(), Is().EqualTo(node(5, node::MAX_ID-1, + AssertThat(out_nodes.pull(), Is().EqualTo(node(5, node::max_id-1, terminal_T, terminal_F))); AssertThat(out_nodes.can_pull(), Is().True()); // n9 - AssertThat(out_nodes.pull(), Is().EqualTo(node(4, node::MAX_ID, - node::ptr_t(5, node::MAX_ID-1), - node::ptr_t(5, node::MAX_ID)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(4, node::max_id, + node::pointer_type(5, node::max_id-1), + node::pointer_type(5, node::max_id)))); AssertThat(out_nodes.can_pull(), Is().True()); // n7 - AssertThat(out_nodes.pull(), Is().EqualTo(node(3, node::MAX_ID, - node::ptr_t(5, node::MAX_ID-1), - node::ptr_t(4, node::MAX_ID)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(3, node::max_id, + node::pointer_type(5, node::max_id-1), + node::pointer_type(4, node::max_id)))); AssertThat(out_nodes.can_pull(), Is().True()); // n5 - AssertThat(out_nodes.pull(), Is().EqualTo(node(2, node::MAX_ID, - node::ptr_t(5, node::MAX_ID-1), - node::ptr_t(3, node::MAX_ID)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(2, node::max_id, + node::pointer_type(5, node::max_id-1), + node::pointer_type(3, node::max_id)))); AssertThat(out_nodes.can_pull(), Is().True()); // n3 - AssertThat(out_nodes.pull(), Is().EqualTo(node(1, node::MAX_ID, - node::ptr_t(5, node::MAX_ID-1), - node::ptr_t(2, node::MAX_ID)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(1, node::max_id, + node::pointer_type(5, node::max_id-1), + node::pointer_type(2, node::max_id)))); AssertThat(out_nodes.can_pull(), Is().True()); // n1 - AssertThat(out_nodes.pull(), Is().EqualTo(node(0, node::MAX_ID, - node::ptr_t(5, node::MAX_ID-1), - node::ptr_t(1, node::MAX_ID)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(0, node::max_id, + node::pointer_type(5, node::max_id-1), + node::pointer_type(1, node::max_id)))); AssertThat(out_nodes.can_pull(), Is().False()); @@ -2038,23 +2038,23 @@ go_bandit([]() { AssertThat(out->width, Is().EqualTo(2u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL], Is().GreaterThanOrEqualTo(6u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL], Is().LessThanOrEqualTo(8u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_FALSE], Is().GreaterThanOrEqualTo(6u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_FALSE], Is().LessThanOrEqualTo(8u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_TRUE], Is().GreaterThanOrEqualTo(6u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_TRUE], Is().LessThanOrEqualTo(8u)); - AssertThat(out->max_1level_cut[cut_type::ALL], Is().GreaterThanOrEqualTo(6u)); - AssertThat(out->max_1level_cut[cut_type::ALL], Is().LessThanOrEqualTo(8u)); - - AssertThat(out->max_2level_cut[cut_type::INTERNAL], Is().GreaterThanOrEqualTo(6u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL], Is().LessThanOrEqualTo(8u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_FALSE], Is().GreaterThanOrEqualTo(6u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_FALSE], Is().LessThanOrEqualTo(8u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_TRUE], Is().GreaterThanOrEqualTo(6u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_TRUE], Is().LessThanOrEqualTo(8u)); - AssertThat(out->max_2level_cut[cut_type::ALL], Is().GreaterThanOrEqualTo(6u)); - AssertThat(out->max_2level_cut[cut_type::ALL], Is().LessThanOrEqualTo(8u)); + AssertThat(out->max_1level_cut[cut::Internal], Is().GreaterThanOrEqualTo(6u)); + AssertThat(out->max_1level_cut[cut::Internal], Is().LessThanOrEqualTo(8u)); + AssertThat(out->max_1level_cut[cut::Internal_False], Is().GreaterThanOrEqualTo(6u)); + AssertThat(out->max_1level_cut[cut::Internal_False], Is().LessThanOrEqualTo(8u)); + AssertThat(out->max_1level_cut[cut::Internal_True], Is().GreaterThanOrEqualTo(6u)); + AssertThat(out->max_1level_cut[cut::Internal_True], Is().LessThanOrEqualTo(8u)); + AssertThat(out->max_1level_cut[cut::All], Is().GreaterThanOrEqualTo(6u)); + AssertThat(out->max_1level_cut[cut::All], Is().LessThanOrEqualTo(8u)); + + AssertThat(out->max_2level_cut[cut::Internal], Is().GreaterThanOrEqualTo(6u)); + AssertThat(out->max_2level_cut[cut::Internal], Is().LessThanOrEqualTo(8u)); + AssertThat(out->max_2level_cut[cut::Internal_False], Is().GreaterThanOrEqualTo(6u)); + AssertThat(out->max_2level_cut[cut::Internal_False], Is().LessThanOrEqualTo(8u)); + AssertThat(out->max_2level_cut[cut::Internal_True], Is().GreaterThanOrEqualTo(6u)); + AssertThat(out->max_2level_cut[cut::Internal_True], Is().LessThanOrEqualTo(8u)); + AssertThat(out->max_2level_cut[cut::All], Is().GreaterThanOrEqualTo(6u)); + AssertThat(out->max_2level_cut[cut::All], Is().LessThanOrEqualTo(8u)); AssertThat(out->number_of_terminals[false], Is().EqualTo(2u)); AssertThat(out->number_of_terminals[true], Is().EqualTo(2u)); @@ -2077,20 +2077,20 @@ go_bandit([]() { // T F T T F F T */ - const arc::ptr_t n1(0,0); - const arc::ptr_t n2(1,0); - const arc::ptr_t n3(1,1); - const arc::ptr_t n4(2,0); - const arc::ptr_t n5(2,1); - const arc::ptr_t n6(2,2); - const arc::ptr_t n7(3,0); - const arc::ptr_t n8(3,1); - const arc::ptr_t n9(3,2); - const arc::ptr_t n10(4,0); - const arc::ptr_t n11(4,1); - const arc::ptr_t n12(4,2); - const arc::ptr_t n13(5,0); - const arc::ptr_t n14(5,1); + const arc::pointer_type n1(0,0); + const arc::pointer_type n2(1,0); + const arc::pointer_type n3(1,1); + const arc::pointer_type n4(2,0); + const arc::pointer_type n5(2,1); + const arc::pointer_type n6(2,2); + const arc::pointer_type n7(3,0); + const arc::pointer_type n8(3,1); + const arc::pointer_type n9(3,2); + const arc::pointer_type n10(4,0); + const arc::pointer_type n11(4,1); + const arc::pointer_type n12(4,2); + const arc::pointer_type n13(5,0); + const arc::pointer_type n14(5,1); shared_levelized_file in; @@ -2140,65 +2140,65 @@ go_bandit([]() { // Reduce it bdd out(in); - AssertThat(adiar::is_canonical(out), Is().True()); + AssertThat(bdd_iscanonical(out), Is().True()); // Check it looks all right node_test_stream out_nodes(out); AssertThat(out_nodes.can_pull(), Is().True()); // n14 - AssertThat(out_nodes.pull(), Is().EqualTo(node(5, node::MAX_ID, + AssertThat(out_nodes.pull(), Is().EqualTo(node(5, node::max_id, terminal_F, terminal_T))); AssertThat(out_nodes.can_pull(), Is().True()); // n13 - AssertThat(out_nodes.pull(), Is().EqualTo(node(5, node::MAX_ID-1, + AssertThat(out_nodes.pull(), Is().EqualTo(node(5, node::max_id-1, terminal_T, terminal_F))); AssertThat(out_nodes.can_pull(), Is().True()); // n12 - AssertThat(out_nodes.pull(), Is().EqualTo(node(4, node::MAX_ID, - node::ptr_t(5, node::MAX_ID-1), - node::ptr_t(5, node::MAX_ID)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(4, node::max_id, + node::pointer_type(5, node::max_id-1), + node::pointer_type(5, node::max_id)))); AssertThat(out_nodes.can_pull(), Is().True()); // n10 - AssertThat(out_nodes.pull(), Is().EqualTo(node(4, node::MAX_ID-1, - node::ptr_t(5, node::MAX_ID), - node::ptr_t(5, node::MAX_ID-1)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(4, node::max_id-1, + node::pointer_type(5, node::max_id), + node::pointer_type(5, node::max_id-1)))); AssertThat(out_nodes.can_pull(), Is().True()); // n7 - AssertThat(out_nodes.pull(), Is().EqualTo(node(3, node::MAX_ID, - node::ptr_t(4, node::MAX_ID-1), - node::ptr_t(5, node::MAX_ID-1)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(3, node::max_id, + node::pointer_type(4, node::max_id-1), + node::pointer_type(5, node::max_id-1)))); AssertThat(out_nodes.can_pull(), Is().True()); // n9 - AssertThat(out_nodes.pull(), Is().EqualTo(node(3, node::MAX_ID-1, - node::ptr_t(5, node::MAX_ID-1), - node::ptr_t(4, node::MAX_ID)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(3, node::max_id-1, + node::pointer_type(5, node::max_id-1), + node::pointer_type(4, node::max_id)))); AssertThat(out_nodes.can_pull(), Is().True()); // n4 - AssertThat(out_nodes.pull(), Is().EqualTo(node(2, node::MAX_ID, - node::ptr_t(3, node::MAX_ID), - node::ptr_t(5, node::MAX_ID-1)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(2, node::max_id, + node::pointer_type(3, node::max_id), + node::pointer_type(5, node::max_id-1)))); AssertThat(out_nodes.can_pull(), Is().True()); // n6 - AssertThat(out_nodes.pull(), Is().EqualTo(node(2, node::MAX_ID-1, - node::ptr_t(5, node::MAX_ID-1), - node::ptr_t(3, node::MAX_ID-1)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(2, node::max_id-1, + node::pointer_type(5, node::max_id-1), + node::pointer_type(3, node::max_id-1)))); AssertThat(out_nodes.can_pull(), Is().True()); // n2 - AssertThat(out_nodes.pull(), Is().EqualTo(node(1, node::MAX_ID, - node::ptr_t(2, node::MAX_ID), - node::ptr_t(5, node::MAX_ID-1)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(1, node::max_id, + node::pointer_type(2, node::max_id), + node::pointer_type(5, node::max_id-1)))); AssertThat(out_nodes.can_pull(), Is().True()); // n3 - AssertThat(out_nodes.pull(), Is().EqualTo(node(1, node::MAX_ID-1, - node::ptr_t(5, node::MAX_ID-1), - node::ptr_t(2, node::MAX_ID-1)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(1, node::max_id-1, + node::pointer_type(5, node::max_id-1), + node::pointer_type(2, node::max_id-1)))); AssertThat(out_nodes.can_pull(), Is().True()); // n1 - AssertThat(out_nodes.pull(), Is().EqualTo(node(0, node::MAX_ID, - node::ptr_t(1, node::MAX_ID), - node::ptr_t(1, node::MAX_ID-1)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(0, node::max_id, + node::pointer_type(1, node::max_id), + node::pointer_type(1, node::max_id-1)))); AssertThat(out_nodes.can_pull(), Is().False()); @@ -2226,23 +2226,23 @@ go_bandit([]() { AssertThat(out->width, Is().EqualTo(2u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL], Is().GreaterThanOrEqualTo(10u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL], Is().LessThanOrEqualTo(15u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_FALSE], Is().GreaterThanOrEqualTo(10u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_FALSE], Is().LessThanOrEqualTo(15u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_TRUE], Is().GreaterThanOrEqualTo(10u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_TRUE], Is().LessThanOrEqualTo(15u)); - AssertThat(out->max_1level_cut[cut_type::ALL], Is().GreaterThanOrEqualTo(10u)); - AssertThat(out->max_1level_cut[cut_type::ALL], Is().LessThanOrEqualTo(15u)); - - AssertThat(out->max_2level_cut[cut_type::INTERNAL], Is().GreaterThanOrEqualTo(10u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL], Is().LessThanOrEqualTo(15u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_FALSE], Is().GreaterThanOrEqualTo(10u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_FALSE], Is().LessThanOrEqualTo(15u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_TRUE], Is().GreaterThanOrEqualTo(10u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_TRUE], Is().LessThanOrEqualTo(15u)); - AssertThat(out->max_2level_cut[cut_type::ALL], Is().GreaterThanOrEqualTo(10u)); - AssertThat(out->max_2level_cut[cut_type::ALL], Is().LessThanOrEqualTo(15u)); + AssertThat(out->max_1level_cut[cut::Internal], Is().GreaterThanOrEqualTo(10u)); + AssertThat(out->max_1level_cut[cut::Internal], Is().LessThanOrEqualTo(15u)); + AssertThat(out->max_1level_cut[cut::Internal_False], Is().GreaterThanOrEqualTo(10u)); + AssertThat(out->max_1level_cut[cut::Internal_False], Is().LessThanOrEqualTo(15u)); + AssertThat(out->max_1level_cut[cut::Internal_True], Is().GreaterThanOrEqualTo(10u)); + AssertThat(out->max_1level_cut[cut::Internal_True], Is().LessThanOrEqualTo(15u)); + AssertThat(out->max_1level_cut[cut::All], Is().GreaterThanOrEqualTo(10u)); + AssertThat(out->max_1level_cut[cut::All], Is().LessThanOrEqualTo(15u)); + + AssertThat(out->max_2level_cut[cut::Internal], Is().GreaterThanOrEqualTo(10u)); + AssertThat(out->max_2level_cut[cut::Internal], Is().LessThanOrEqualTo(15u)); + AssertThat(out->max_2level_cut[cut::Internal_False], Is().GreaterThanOrEqualTo(10u)); + AssertThat(out->max_2level_cut[cut::Internal_False], Is().LessThanOrEqualTo(15u)); + AssertThat(out->max_2level_cut[cut::Internal_True], Is().GreaterThanOrEqualTo(10u)); + AssertThat(out->max_2level_cut[cut::Internal_True], Is().LessThanOrEqualTo(15u)); + AssertThat(out->max_2level_cut[cut::All], Is().GreaterThanOrEqualTo(10u)); + AssertThat(out->max_2level_cut[cut::All], Is().LessThanOrEqualTo(15u)); AssertThat(out->number_of_terminals[false], Is().EqualTo(2u)); AssertThat(out->number_of_terminals[true], Is().EqualTo(2u)); @@ -2263,14 +2263,14 @@ go_bandit([]() { // F T F T */ - const arc::ptr_t n1(0,0); - const arc::ptr_t n2(1,0); - const arc::ptr_t n3(1,1); - const arc::ptr_t n4(2,0); - const arc::ptr_t n5(2,1); - const arc::ptr_t n6(2,2); - const arc::ptr_t n7(3,0); - const arc::ptr_t n8(4,0); + const arc::pointer_type n1(0,0); + const arc::pointer_type n2(1,0); + const arc::pointer_type n3(1,1); + const arc::pointer_type n4(2,0); + const arc::pointer_type n5(2,1); + const arc::pointer_type n6(2,2); + const arc::pointer_type n7(3,0); + const arc::pointer_type n8(4,0); shared_levelized_file in; @@ -2307,37 +2307,37 @@ go_bandit([]() { // Reduce it bdd out(in); - AssertThat(adiar::is_canonical(out), Is().True()); + AssertThat(bdd_iscanonical(out), Is().True()); // Check it looks all right node_test_stream out_nodes(out); AssertThat(out_nodes.can_pull(), Is().True()); // n8 - AssertThat(out_nodes.pull(), Is().EqualTo(node(4, node::MAX_ID, terminal_F, terminal_T))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(4, node::max_id, terminal_F, terminal_T))); AssertThat(out_nodes.can_pull(), Is().True()); // n4 - AssertThat(out_nodes.pull(), Is().EqualTo(node(2, node::MAX_ID, terminal_F, terminal_T))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(2, node::max_id, terminal_F, terminal_T))); AssertThat(out_nodes.can_pull(), Is().True()); // n6 - AssertThat(out_nodes.pull(), Is().EqualTo(node(2, node::MAX_ID-1, terminal_T, terminal_F))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(2, node::max_id-1, terminal_T, terminal_F))); AssertThat(out_nodes.can_pull(), Is().True()); // n5 - AssertThat(out_nodes.pull(), Is().EqualTo(node(2, node::MAX_ID-2, terminal_F, node::ptr_t(4, node::MAX_ID)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(2, node::max_id-2, terminal_F, node::pointer_type(4, node::max_id)))); AssertThat(out_nodes.can_pull(), Is().True()); // n3 - AssertThat(out_nodes.pull(), Is().EqualTo(node(1, node::MAX_ID, - node::ptr_t(2, node::MAX_ID-2), - node::ptr_t(2, node::MAX_ID-1)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(1, node::max_id, + node::pointer_type(2, node::max_id-2), + node::pointer_type(2, node::max_id-1)))); AssertThat(out_nodes.can_pull(), Is().True()); // n2 - AssertThat(out_nodes.pull(), Is().EqualTo(node(1, node::MAX_ID-1, - node::ptr_t(2, node::MAX_ID), - node::ptr_t(2, node::MAX_ID-2)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(1, node::max_id-1, + node::pointer_type(2, node::max_id), + node::pointer_type(2, node::max_id-2)))); AssertThat(out_nodes.can_pull(), Is().True()); // n2 - AssertThat(out_nodes.pull(), Is().EqualTo(node(0, node::MAX_ID, - node::ptr_t(1, node::MAX_ID-1), - node::ptr_t(1, node::MAX_ID)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(0, node::max_id, + node::pointer_type(1, node::max_id-1), + node::pointer_type(1, node::max_id)))); AssertThat(out_nodes.can_pull(), Is().False()); @@ -2359,26 +2359,26 @@ go_bandit([]() { AssertThat(out->width, Is().EqualTo(3u)); - // NOTE: the INTERNAL cut is only 4, since the tainted edge is accounted for below x1. - AssertThat(out->max_1level_cut[cut_type::INTERNAL], Is().EqualTo(4u)); + // NOTE: the Internal cut is only 4, since the tainted edge is accounted for below x1. + AssertThat(out->max_1level_cut[cut::Internal], Is().EqualTo(4u)); // Yet, of course the cut is still an over-approximation when the arc is // tainting the levels below x2. - AssertThat(out->max_1level_cut[cut_type::INTERNAL_FALSE], Is().GreaterThanOrEqualTo(4u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_FALSE], Is().LessThanOrEqualTo(5u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_TRUE], Is().GreaterThanOrEqualTo(4u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_TRUE], Is().LessThanOrEqualTo(5u)); - AssertThat(out->max_1level_cut[cut_type::ALL], Is().GreaterThanOrEqualTo(7u)); - AssertThat(out->max_1level_cut[cut_type::ALL], Is().LessThanOrEqualTo(8u)); - - AssertThat(out->max_2level_cut[cut_type::INTERNAL], Is().GreaterThanOrEqualTo(4u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL], Is().LessThanOrEqualTo(6u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_FALSE], Is().GreaterThanOrEqualTo(4u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_FALSE], Is().LessThanOrEqualTo(7u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_TRUE], Is().GreaterThanOrEqualTo(4u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_TRUE], Is().LessThanOrEqualTo(7u)); - AssertThat(out->max_2level_cut[cut_type::ALL], Is().GreaterThanOrEqualTo(7u)); - AssertThat(out->max_2level_cut[cut_type::ALL], Is().LessThanOrEqualTo(9u)); + AssertThat(out->max_1level_cut[cut::Internal_False], Is().GreaterThanOrEqualTo(4u)); + AssertThat(out->max_1level_cut[cut::Internal_False], Is().LessThanOrEqualTo(5u)); + AssertThat(out->max_1level_cut[cut::Internal_True], Is().GreaterThanOrEqualTo(4u)); + AssertThat(out->max_1level_cut[cut::Internal_True], Is().LessThanOrEqualTo(5u)); + AssertThat(out->max_1level_cut[cut::All], Is().GreaterThanOrEqualTo(7u)); + AssertThat(out->max_1level_cut[cut::All], Is().LessThanOrEqualTo(8u)); + + AssertThat(out->max_2level_cut[cut::Internal], Is().GreaterThanOrEqualTo(4u)); + AssertThat(out->max_2level_cut[cut::Internal], Is().LessThanOrEqualTo(6u)); + AssertThat(out->max_2level_cut[cut::Internal_False], Is().GreaterThanOrEqualTo(4u)); + AssertThat(out->max_2level_cut[cut::Internal_False], Is().LessThanOrEqualTo(7u)); + AssertThat(out->max_2level_cut[cut::Internal_True], Is().GreaterThanOrEqualTo(4u)); + AssertThat(out->max_2level_cut[cut::Internal_True], Is().LessThanOrEqualTo(7u)); + AssertThat(out->max_2level_cut[cut::All], Is().GreaterThanOrEqualTo(7u)); + AssertThat(out->max_2level_cut[cut::All], Is().LessThanOrEqualTo(9u)); AssertThat(out->number_of_terminals[false], Is().EqualTo(4u)); AssertThat(out->number_of_terminals[true], Is().EqualTo(3u)); @@ -2395,10 +2395,10 @@ go_bandit([]() { // T T */ - const arc::ptr_t n1(0,0); - const arc::ptr_t n2(1,0); - const arc::ptr_t n3(1,1); - const arc::ptr_t n4(2,0); + const arc::pointer_type n1(0,0); + const arc::pointer_type n2(1,0); + const arc::pointer_type n3(1,1); + const arc::pointer_type n4(2,0); shared_levelized_file in; @@ -2425,13 +2425,13 @@ go_bandit([]() { // Reduce it bdd out(in); - AssertThat(adiar::is_canonical(out), Is().True()); + AssertThat(bdd_iscanonical(out), Is().True()); // Check it looks all right node_test_stream out_nodes(out); AssertThat(out_nodes.can_pull(), Is().True()); // n2 - AssertThat(out_nodes.pull(), Is().EqualTo(node(1, node::MAX_ID, terminal_F, terminal_T))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(1, node::max_id, terminal_F, terminal_T))); AssertThat(out_nodes.can_pull(), Is().False()); @@ -2444,15 +2444,15 @@ go_bandit([]() { AssertThat(out->width, Is().EqualTo(1u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL], Is().EqualTo(1u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(1u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(1u)); - AssertThat(out->max_1level_cut[cut_type::ALL], Is().GreaterThanOrEqualTo(2u)); + AssertThat(out->max_1level_cut[cut::Internal], Is().EqualTo(1u)); + AssertThat(out->max_1level_cut[cut::Internal_False], Is().EqualTo(1u)); + AssertThat(out->max_1level_cut[cut::Internal_True], Is().EqualTo(1u)); + AssertThat(out->max_1level_cut[cut::All], Is().GreaterThanOrEqualTo(2u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL], Is().EqualTo(1u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(1u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(1u)); - AssertThat(out->max_2level_cut[cut_type::ALL], Is().EqualTo(2u)); + AssertThat(out->max_2level_cut[cut::Internal], Is().EqualTo(1u)); + AssertThat(out->max_2level_cut[cut::Internal_False], Is().EqualTo(1u)); + AssertThat(out->max_2level_cut[cut::Internal_True], Is().EqualTo(1u)); + AssertThat(out->max_2level_cut[cut::All], Is().EqualTo(2u)); AssertThat(out->number_of_terminals[false], Is().EqualTo(1u)); AssertThat(out->number_of_terminals[true], Is().EqualTo(1u)); @@ -2469,8 +2469,8 @@ go_bandit([]() { // T F */ - const arc::ptr_t n1(0,0); - const arc::ptr_t n2(1,0); + const arc::pointer_type n1(0,0); + const arc::pointer_type n2(1,0); shared_levelized_file in; @@ -2492,13 +2492,13 @@ go_bandit([]() { // Reduce it zdd out(in); - AssertThat(adiar::is_canonical(out), Is().True()); + AssertThat(zdd_iscanonical(out), Is().True()); // Check it looks all right node_test_stream out_nodes(out); AssertThat(out_nodes.can_pull(), Is().True()); - AssertThat(out_nodes.pull(), Is().EqualTo(node(0, node::MAX_ID, terminal_T, terminal_T))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(0, node::max_id, terminal_T, terminal_T))); AssertThat(out_nodes.can_pull(), Is().False()); @@ -2511,15 +2511,15 @@ go_bandit([]() { AssertThat(out->width, Is().EqualTo(1u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL], Is().EqualTo(1u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(1u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(2u)); - AssertThat(out->max_1level_cut[cut_type::ALL], Is().EqualTo(2u)); + AssertThat(out->max_1level_cut[cut::Internal], Is().EqualTo(1u)); + AssertThat(out->max_1level_cut[cut::Internal_False], Is().EqualTo(1u)); + AssertThat(out->max_1level_cut[cut::Internal_True], Is().EqualTo(2u)); + AssertThat(out->max_1level_cut[cut::All], Is().EqualTo(2u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL], Is().EqualTo(1u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(1u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(2u)); - AssertThat(out->max_2level_cut[cut_type::ALL], Is().EqualTo(2u)); + AssertThat(out->max_2level_cut[cut::Internal], Is().EqualTo(1u)); + AssertThat(out->max_2level_cut[cut::Internal_False], Is().EqualTo(1u)); + AssertThat(out->max_2level_cut[cut::Internal_True], Is().EqualTo(2u)); + AssertThat(out->max_2level_cut[cut::All], Is().EqualTo(2u)); AssertThat(out->number_of_terminals[false], Is().EqualTo(0u)); AssertThat(out->number_of_terminals[true], Is().EqualTo(2u)); @@ -2538,11 +2538,11 @@ go_bandit([]() { // F T F T */ - const arc::ptr_t n1(0,0); - const arc::ptr_t n2(1,0); - const arc::ptr_t n3(2,0); - const arc::ptr_t n4(2,1); - const arc::ptr_t n5(3,0); + const arc::pointer_type n1(0,0); + const arc::pointer_type n2(1,0); + const arc::pointer_type n3(2,0); + const arc::pointer_type n4(2,1); + const arc::pointer_type n5(3,0); shared_levelized_file in; @@ -2572,7 +2572,7 @@ go_bandit([]() { // Reduce it zdd out(in); - AssertThat(adiar::is_canonical(out), Is().True()); + AssertThat(zdd_iscanonical(out), Is().True()); // Check it looks all right node_test_stream out_nodes(out); @@ -2580,23 +2580,23 @@ go_bandit([]() { AssertThat(out_nodes.can_pull(), Is().True()); // n5 - AssertThat(out_nodes.pull(), Is().EqualTo(node(3, node::MAX_ID, terminal_F, terminal_T))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(3, node::max_id, terminal_F, terminal_T))); AssertThat(out_nodes.can_pull(), Is().True()); // n3 - AssertThat(out_nodes.pull(), Is().EqualTo(node(2, node::MAX_ID, terminal_F, terminal_T))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(2, node::max_id, terminal_F, terminal_T))); AssertThat(out_nodes.can_pull(), Is().True()); // n2 - AssertThat(out_nodes.pull(), Is().EqualTo(node(1, node::MAX_ID, - node::ptr_t(2, node::MAX_ID), - node::ptr_t(3, node::MAX_ID)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(1, node::max_id, + node::pointer_type(2, node::max_id), + node::pointer_type(3, node::max_id)))); AssertThat(out_nodes.can_pull(), Is().True()); // n1 - AssertThat(out_nodes.pull(), Is().EqualTo(node(0, node::MAX_ID, - node::ptr_t(2, node::MAX_ID), - node::ptr_t(1, node::MAX_ID)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(0, node::max_id, + node::pointer_type(2, node::max_id), + node::pointer_type(1, node::max_id)))); AssertThat(out_nodes.can_pull(), Is().False()); @@ -2618,27 +2618,27 @@ go_bandit([]() { AssertThat(out->width, Is().EqualTo(1u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL], Is().EqualTo(3u)); + AssertThat(out->max_1level_cut[cut::Internal], Is().EqualTo(3u)); // Over-approximation: globally counted arc (2) to (5) - AssertThat(out->max_1level_cut[cut_type::INTERNAL_FALSE], Is().GreaterThanOrEqualTo(3u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_FALSE], Is().LessThanOrEqualTo(4u)); + AssertThat(out->max_1level_cut[cut::Internal_False], Is().GreaterThanOrEqualTo(3u)); + AssertThat(out->max_1level_cut[cut::Internal_False], Is().LessThanOrEqualTo(4u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_TRUE], Is().GreaterThanOrEqualTo(3u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_TRUE], Is().LessThanOrEqualTo(4u)); + AssertThat(out->max_1level_cut[cut::Internal_True], Is().GreaterThanOrEqualTo(3u)); + AssertThat(out->max_1level_cut[cut::Internal_True], Is().LessThanOrEqualTo(4u)); // Over-approximation: at (5) we do not know the merge of (3) and (4). - AssertThat(out->max_1level_cut[cut_type::ALL], Is().GreaterThanOrEqualTo(4u)); - AssertThat(out->max_1level_cut[cut_type::ALL], Is().LessThanOrEqualTo(5u)); - - AssertThat(out->max_2level_cut[cut_type::INTERNAL], Is().GreaterThanOrEqualTo(3u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL], Is().LessThanOrEqualTo(4u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_FALSE], Is().GreaterThanOrEqualTo(3u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_FALSE], Is().LessThanOrEqualTo(5u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_TRUE], Is().GreaterThanOrEqualTo(3u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_TRUE], Is().LessThanOrEqualTo(5u)); - AssertThat(out->max_2level_cut[cut_type::ALL], Is().GreaterThanOrEqualTo(4u)); - AssertThat(out->max_2level_cut[cut_type::ALL], Is().LessThanOrEqualTo(5u)); + AssertThat(out->max_1level_cut[cut::All], Is().GreaterThanOrEqualTo(4u)); + AssertThat(out->max_1level_cut[cut::All], Is().LessThanOrEqualTo(5u)); + + AssertThat(out->max_2level_cut[cut::Internal], Is().GreaterThanOrEqualTo(3u)); + AssertThat(out->max_2level_cut[cut::Internal], Is().LessThanOrEqualTo(4u)); + AssertThat(out->max_2level_cut[cut::Internal_False], Is().GreaterThanOrEqualTo(3u)); + AssertThat(out->max_2level_cut[cut::Internal_False], Is().LessThanOrEqualTo(5u)); + AssertThat(out->max_2level_cut[cut::Internal_True], Is().GreaterThanOrEqualTo(3u)); + AssertThat(out->max_2level_cut[cut::Internal_True], Is().LessThanOrEqualTo(5u)); + AssertThat(out->max_2level_cut[cut::All], Is().GreaterThanOrEqualTo(4u)); + AssertThat(out->max_2level_cut[cut::All], Is().LessThanOrEqualTo(5u)); AssertThat(out->number_of_terminals[false], Is().EqualTo(2u)); AssertThat(out->number_of_terminals[true], Is().EqualTo(2u)); @@ -2655,10 +2655,10 @@ go_bandit([]() { // T F */ - const arc::ptr_t n1(0,0); - const arc::ptr_t n2(1,0); - const arc::ptr_t n3(1,1); - const arc::ptr_t n4(2,0); + const arc::pointer_type n1(0,0); + const arc::pointer_type n2(1,0); + const arc::pointer_type n3(1,1); + const arc::pointer_type n4(2,0); shared_levelized_file in; @@ -2685,7 +2685,7 @@ go_bandit([]() { // Reduce it zdd out(in); - AssertThat(adiar::is_canonical(out), Is().True()); + AssertThat(zdd_iscanonical(out), Is().True()); // Check it looks all right node_test_stream out_nodes(out); @@ -2693,15 +2693,15 @@ go_bandit([]() { AssertThat(out_nodes.can_pull(), Is().True()); // n3 - AssertThat(out_nodes.pull(), Is().EqualTo(node(1, node::MAX_ID, + AssertThat(out_nodes.pull(), Is().EqualTo(node(1, node::max_id, terminal_F, terminal_T))); AssertThat(out_nodes.can_pull(), Is().True()); // n1 - AssertThat(out_nodes.pull(), Is().EqualTo(node(0, node::MAX_ID, - node::ptr_t(1, node::MAX_ID), - node::ptr_t(1, node::MAX_ID)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(0, node::max_id, + node::pointer_type(1, node::max_id), + node::pointer_type(1, node::max_id)))); AssertThat(out_nodes.can_pull(), Is().False()); level_info_test_stream out_meta(out); @@ -2716,25 +2716,25 @@ go_bandit([]() { AssertThat(out->width, Is().EqualTo(1u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL], Is().EqualTo(2u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(2u)); + AssertThat(out->max_1level_cut[cut::Internal], Is().EqualTo(2u)); + AssertThat(out->max_1level_cut[cut::Internal_False], Is().EqualTo(2u)); // Over-approximation: globally counted arc (1) to (2) and (1) to (3) - AssertThat(out->max_1level_cut[cut_type::INTERNAL_TRUE], Is().GreaterThanOrEqualTo(2u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_TRUE], Is().LessThanOrEqualTo(3u)); + AssertThat(out->max_1level_cut[cut::Internal_True], Is().GreaterThanOrEqualTo(2u)); + AssertThat(out->max_1level_cut[cut::Internal_True], Is().LessThanOrEqualTo(3u)); // Over-approximation: after (4) is removed we don't know (2) and (3) // will be merged. - AssertThat(out->max_1level_cut[cut_type::ALL], Is().GreaterThanOrEqualTo(2u)); - AssertThat(out->max_1level_cut[cut_type::ALL], Is().LessThanOrEqualTo(3u)); + AssertThat(out->max_1level_cut[cut::All], Is().GreaterThanOrEqualTo(2u)); + AssertThat(out->max_1level_cut[cut::All], Is().LessThanOrEqualTo(3u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL], Is().EqualTo(2u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_FALSE], Is().GreaterThanOrEqualTo(2u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_FALSE], Is().LessThanOrEqualTo(3u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_TRUE], Is().GreaterThanOrEqualTo(2u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_TRUE], Is().LessThanOrEqualTo(3u)); - AssertThat(out->max_2level_cut[cut_type::ALL], Is().GreaterThanOrEqualTo(2u)); - AssertThat(out->max_2level_cut[cut_type::ALL], Is().LessThanOrEqualTo(3u)); + AssertThat(out->max_2level_cut[cut::Internal], Is().EqualTo(2u)); + AssertThat(out->max_2level_cut[cut::Internal_False], Is().GreaterThanOrEqualTo(2u)); + AssertThat(out->max_2level_cut[cut::Internal_False], Is().LessThanOrEqualTo(3u)); + AssertThat(out->max_2level_cut[cut::Internal_True], Is().GreaterThanOrEqualTo(2u)); + AssertThat(out->max_2level_cut[cut::Internal_True], Is().LessThanOrEqualTo(3u)); + AssertThat(out->max_2level_cut[cut::All], Is().GreaterThanOrEqualTo(2u)); + AssertThat(out->max_2level_cut[cut::All], Is().LessThanOrEqualTo(3u)); AssertThat(out->number_of_terminals[false], Is().EqualTo(1u)); AssertThat(out->number_of_terminals[true], Is().EqualTo(1u)); @@ -2747,7 +2747,7 @@ go_bandit([]() { // T F */ - const arc::ptr_t n1(0,0); + const arc::pointer_type n1(0,0); shared_levelized_file in; @@ -2765,7 +2765,7 @@ go_bandit([]() { // Reduce it zdd out(in); - AssertThat(adiar::is_canonical(out), Is().True()); + AssertThat(zdd_iscanonical(out), Is().True()); // Check it looks all right node_test_stream out_nodes(out); @@ -2781,15 +2781,15 @@ go_bandit([]() { AssertThat(out->width, Is().EqualTo(0u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL], Is().EqualTo(0u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(0u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(1u)); - AssertThat(out->max_1level_cut[cut_type::ALL], Is().EqualTo(1u)); + AssertThat(out->max_1level_cut[cut::Internal], Is().EqualTo(0u)); + AssertThat(out->max_1level_cut[cut::Internal_False], Is().EqualTo(0u)); + AssertThat(out->max_1level_cut[cut::Internal_True], Is().EqualTo(1u)); + AssertThat(out->max_1level_cut[cut::All], Is().EqualTo(1u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL], Is().EqualTo(0u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(0u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(1u)); - AssertThat(out->max_2level_cut[cut_type::ALL], Is().EqualTo(1u)); + AssertThat(out->max_2level_cut[cut::Internal], Is().EqualTo(0u)); + AssertThat(out->max_2level_cut[cut::Internal_False], Is().EqualTo(0u)); + AssertThat(out->max_2level_cut[cut::Internal_True], Is().EqualTo(1u)); + AssertThat(out->max_2level_cut[cut::All], Is().EqualTo(1u)); AssertThat(out->number_of_terminals[false], Is().EqualTo(0u)); AssertThat(out->number_of_terminals[true], Is().EqualTo(1u)); @@ -2804,8 +2804,8 @@ go_bandit([]() { // F T F T */ - const arc::ptr_t n1(0,0); - const arc::ptr_t n2(1,0); + const arc::pointer_type n1(0,0); + const arc::pointer_type n2(1,0); shared_levelized_file in; @@ -2827,7 +2827,7 @@ go_bandit([]() { // Reduce it zdd out(in); - AssertThat(adiar::is_canonical(out), Is().True()); + AssertThat(zdd_iscanonical(out), Is().True()); // Check it looks all right node_test_stream out_nodes(out); @@ -2835,7 +2835,7 @@ go_bandit([]() { AssertThat(out_nodes.can_pull(), Is().True()); // n2 - AssertThat(out_nodes.pull(), Is().EqualTo(node(1, node::MAX_ID, terminal_F, terminal_T))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(1, node::max_id, terminal_F, terminal_T))); AssertThat(out_nodes.can_pull(), Is().False()); level_info_test_stream out_meta(out); @@ -2847,15 +2847,15 @@ go_bandit([]() { AssertThat(out->width, Is().EqualTo(1u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL], Is().EqualTo(1u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(1u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(1u)); - AssertThat(out->max_1level_cut[cut_type::ALL], Is().EqualTo(2u)); + AssertThat(out->max_1level_cut[cut::Internal], Is().EqualTo(1u)); + AssertThat(out->max_1level_cut[cut::Internal_False], Is().EqualTo(1u)); + AssertThat(out->max_1level_cut[cut::Internal_True], Is().EqualTo(1u)); + AssertThat(out->max_1level_cut[cut::All], Is().EqualTo(2u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL], Is().EqualTo(1u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(1u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(1u)); - AssertThat(out->max_2level_cut[cut_type::ALL], Is().EqualTo(2u)); + AssertThat(out->max_2level_cut[cut::Internal], Is().EqualTo(1u)); + AssertThat(out->max_2level_cut[cut::Internal_False], Is().EqualTo(1u)); + AssertThat(out->max_2level_cut[cut::Internal_True], Is().EqualTo(1u)); + AssertThat(out->max_2level_cut[cut::All], Is().EqualTo(2u)); AssertThat(out->number_of_terminals[false], Is().EqualTo(1u)); AssertThat(out->number_of_terminals[true], Is().EqualTo(1u)); @@ -2870,8 +2870,8 @@ go_bandit([]() { // F F */ - const arc::ptr_t n1(0,0); - const arc::ptr_t n2(1,0); + const arc::pointer_type n1(0,0); + const arc::pointer_type n2(1,0); shared_levelized_file in; @@ -2907,28 +2907,28 @@ go_bandit([]() { AssertThat(out->width, Is().EqualTo(0u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL], Is().EqualTo(0u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(1u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(0u)); - AssertThat(out->max_1level_cut[cut_type::ALL], Is().EqualTo(1u)); + AssertThat(out->max_1level_cut[cut::Internal], Is().EqualTo(0u)); + AssertThat(out->max_1level_cut[cut::Internal_False], Is().EqualTo(1u)); + AssertThat(out->max_1level_cut[cut::Internal_True], Is().EqualTo(0u)); + AssertThat(out->max_1level_cut[cut::All], Is().EqualTo(1u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL], Is().EqualTo(0u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(1u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(0u)); - AssertThat(out->max_2level_cut[cut_type::ALL], Is().EqualTo(1u)); + AssertThat(out->max_2level_cut[cut::Internal], Is().EqualTo(0u)); + AssertThat(out->max_2level_cut[cut::Internal_False], Is().EqualTo(1u)); + AssertThat(out->max_2level_cut[cut::Internal_True], Is().EqualTo(0u)); + AssertThat(out->max_2level_cut[cut::All], Is().EqualTo(1u)); AssertThat(out->number_of_terminals[false], Is().EqualTo(1u)); AssertThat(out->number_of_terminals[true], Is().EqualTo(0u)); }); - it("can return non-reducible single-node variable with MAX_ID [1]", [&]() { + it("can return non-reducible single-node variable with max_id [1]", [&]() { /* // 1 1 ---- x42 // / \ => / \ // F T F T */ - const arc::ptr_t n1(42,0); + const arc::pointer_type n1(42,0); shared_levelized_file in; @@ -2946,13 +2946,13 @@ go_bandit([]() { // Reduce it zdd out(in); - AssertThat(adiar::is_canonical(out), Is().True()); + AssertThat(zdd_iscanonical(out), Is().True()); // Check it looks all right node_test_stream out_nodes(out); AssertThat(out_nodes.can_pull(), Is().True()); - AssertThat(out_nodes.pull(), Is().EqualTo(node(42, node::MAX_ID, terminal_F, terminal_T))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(42, node::max_id, terminal_F, terminal_T))); AssertThat(out_nodes.can_pull(), Is().False()); level_info_test_stream out_meta(out); @@ -2964,28 +2964,28 @@ go_bandit([]() { AssertThat(out->width, Is().EqualTo(1u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL], Is().EqualTo(1u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(1u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(1u)); - AssertThat(out->max_1level_cut[cut_type::ALL], Is().EqualTo(2u)); + AssertThat(out->max_1level_cut[cut::Internal], Is().EqualTo(1u)); + AssertThat(out->max_1level_cut[cut::Internal_False], Is().EqualTo(1u)); + AssertThat(out->max_1level_cut[cut::Internal_True], Is().EqualTo(1u)); + AssertThat(out->max_1level_cut[cut::All], Is().EqualTo(2u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL], Is().EqualTo(1u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(1u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(1u)); - AssertThat(out->max_2level_cut[cut_type::ALL], Is().EqualTo(2u)); + AssertThat(out->max_2level_cut[cut::Internal], Is().EqualTo(1u)); + AssertThat(out->max_2level_cut[cut::Internal_False], Is().EqualTo(1u)); + AssertThat(out->max_2level_cut[cut::Internal_True], Is().EqualTo(1u)); + AssertThat(out->max_2level_cut[cut::All], Is().EqualTo(2u)); AssertThat(out->number_of_terminals[false], Is().EqualTo(1u)); AssertThat(out->number_of_terminals[true], Is().EqualTo(1u)); }); - it("can return non-reducible single-node variable with MAX_ID [2]", [&]() { + it("can return non-reducible single-node variable with max_id [2]", [&]() { /* // 1 1 ---- x12 // / \ => / \ // T T T T */ - const arc::ptr_t n1(12,0); + const arc::pointer_type n1(12,0); shared_levelized_file in; @@ -3003,13 +3003,13 @@ go_bandit([]() { // Reduce it zdd out(in); - AssertThat(adiar::is_canonical(out), Is().True()); + AssertThat(zdd_iscanonical(out), Is().True()); // Check it looks all right node_test_stream out_nodes(out); AssertThat(out_nodes.can_pull(), Is().True()); - AssertThat(out_nodes.pull(), Is().EqualTo(node(12, node::MAX_ID, terminal_T, terminal_T))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(12, node::max_id, terminal_T, terminal_T))); AssertThat(out_nodes.can_pull(), Is().False()); level_info_test_stream out_meta(out); @@ -3021,15 +3021,15 @@ go_bandit([]() { AssertThat(out->width, Is().EqualTo(1u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL], Is().EqualTo(1u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(1u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(2u)); - AssertThat(out->max_1level_cut[cut_type::ALL], Is().EqualTo(2u)); + AssertThat(out->max_1level_cut[cut::Internal], Is().EqualTo(1u)); + AssertThat(out->max_1level_cut[cut::Internal_False], Is().EqualTo(1u)); + AssertThat(out->max_1level_cut[cut::Internal_True], Is().EqualTo(2u)); + AssertThat(out->max_1level_cut[cut::All], Is().EqualTo(2u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL], Is().EqualTo(1u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(1u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(2u)); - AssertThat(out->max_2level_cut[cut_type::ALL], Is().EqualTo(2u)); + AssertThat(out->max_2level_cut[cut::Internal], Is().EqualTo(1u)); + AssertThat(out->max_2level_cut[cut::Internal_False], Is().EqualTo(1u)); + AssertThat(out->max_2level_cut[cut::Internal_True], Is().EqualTo(2u)); + AssertThat(out->max_2level_cut[cut::All], Is().EqualTo(2u)); AssertThat(out->number_of_terminals[false], Is().EqualTo(0u)); AssertThat(out->number_of_terminals[true], Is().EqualTo(2u)); @@ -3053,17 +3053,17 @@ go_bandit([]() { // F T T T F T T T */ - const arc::ptr_t n1(0,0); - const arc::ptr_t n2(1,0); - const arc::ptr_t n3(1,1); - const arc::ptr_t n4(2,0); - const arc::ptr_t n5(2,1); - const arc::ptr_t n6(3,0); - const arc::ptr_t n7(3,1); - const arc::ptr_t n8(4,0); - const arc::ptr_t n9(4,1); - const arc::ptr_t n10(5,0); - const arc::ptr_t n11(5,1); + const arc::pointer_type n1(0,0); + const arc::pointer_type n2(1,0); + const arc::pointer_type n3(1,1); + const arc::pointer_type n4(2,0); + const arc::pointer_type n5(2,1); + const arc::pointer_type n6(3,0); + const arc::pointer_type n7(3,1); + const arc::pointer_type n8(4,0); + const arc::pointer_type n9(4,1); + const arc::pointer_type n10(5,0); + const arc::pointer_type n11(5,1); shared_levelized_file in; @@ -3107,46 +3107,46 @@ go_bandit([]() { // Reduce it zdd out(in); - AssertThat(adiar::is_canonical(out), Is().True()); + AssertThat(zdd_iscanonical(out), Is().True()); // Check it looks all right node_test_stream out_nodes(out); AssertThat(out_nodes.can_pull(), Is().True()); // n11 - AssertThat(out_nodes.pull(), Is().EqualTo(node(5, node::MAX_ID, + AssertThat(out_nodes.pull(), Is().EqualTo(node(5, node::max_id, terminal_T, terminal_T))); AssertThat(out_nodes.can_pull(), Is().True()); // n10 - AssertThat(out_nodes.pull(), Is().EqualTo(node(5, node::MAX_ID-1, + AssertThat(out_nodes.pull(), Is().EqualTo(node(5, node::max_id-1, terminal_F, terminal_T))); AssertThat(out_nodes.can_pull(), Is().True()); // n9 - AssertThat(out_nodes.pull(), Is().EqualTo(node(4, node::MAX_ID, - node::ptr_t(5, node::MAX_ID-1), - node::ptr_t(5, node::MAX_ID)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(4, node::max_id, + node::pointer_type(5, node::max_id-1), + node::pointer_type(5, node::max_id)))); AssertThat(out_nodes.can_pull(), Is().True()); // n7 - AssertThat(out_nodes.pull(), Is().EqualTo(node(3, node::MAX_ID, - node::ptr_t(4, node::MAX_ID), - node::ptr_t(5, node::MAX_ID)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(3, node::max_id, + node::pointer_type(4, node::max_id), + node::pointer_type(5, node::max_id)))); AssertThat(out_nodes.can_pull(), Is().True()); // n5 - AssertThat(out_nodes.pull(), Is().EqualTo(node(2, node::MAX_ID, - node::ptr_t(3, node::MAX_ID), - node::ptr_t(5, node::MAX_ID)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(2, node::max_id, + node::pointer_type(3, node::max_id), + node::pointer_type(5, node::max_id)))); AssertThat(out_nodes.can_pull(), Is().True()); // n3 - AssertThat(out_nodes.pull(), Is().EqualTo(node(1, node::MAX_ID, - node::ptr_t(2, node::MAX_ID), - node::ptr_t(5, node::MAX_ID)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(1, node::max_id, + node::pointer_type(2, node::max_id), + node::pointer_type(5, node::max_id)))); AssertThat(out_nodes.can_pull(), Is().True()); // n1 - AssertThat(out_nodes.pull(), Is().EqualTo(node(0, node::MAX_ID, - node::ptr_t(1, node::MAX_ID), - node::ptr_t(5, node::MAX_ID)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(0, node::max_id, + node::pointer_type(1, node::max_id), + node::pointer_type(5, node::max_id)))); AssertThat(out_nodes.can_pull(), Is().False()); @@ -3174,23 +3174,23 @@ go_bandit([]() { AssertThat(out->width, Is().EqualTo(2u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL], Is().GreaterThanOrEqualTo(6u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL], Is().LessThanOrEqualTo(8u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_FALSE], Is().GreaterThanOrEqualTo(6u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_FALSE], Is().LessThanOrEqualTo(8u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_TRUE], Is().GreaterThanOrEqualTo(6u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_TRUE], Is().LessThanOrEqualTo(8u)); - AssertThat(out->max_1level_cut[cut_type::ALL], Is().GreaterThanOrEqualTo(6u)); - AssertThat(out->max_1level_cut[cut_type::ALL], Is().LessThanOrEqualTo(8u)); - - AssertThat(out->max_2level_cut[cut_type::INTERNAL], Is().GreaterThanOrEqualTo(6u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL], Is().LessThanOrEqualTo(8u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_FALSE], Is().GreaterThanOrEqualTo(6u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_FALSE], Is().LessThanOrEqualTo(8u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_TRUE], Is().GreaterThanOrEqualTo(6u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_TRUE], Is().LessThanOrEqualTo(8u)); - AssertThat(out->max_2level_cut[cut_type::ALL], Is().GreaterThanOrEqualTo(6u)); - AssertThat(out->max_2level_cut[cut_type::ALL], Is().LessThanOrEqualTo(8u)); + AssertThat(out->max_1level_cut[cut::Internal], Is().GreaterThanOrEqualTo(6u)); + AssertThat(out->max_1level_cut[cut::Internal], Is().LessThanOrEqualTo(8u)); + AssertThat(out->max_1level_cut[cut::Internal_False], Is().GreaterThanOrEqualTo(6u)); + AssertThat(out->max_1level_cut[cut::Internal_False], Is().LessThanOrEqualTo(8u)); + AssertThat(out->max_1level_cut[cut::Internal_True], Is().GreaterThanOrEqualTo(6u)); + AssertThat(out->max_1level_cut[cut::Internal_True], Is().LessThanOrEqualTo(8u)); + AssertThat(out->max_1level_cut[cut::All], Is().GreaterThanOrEqualTo(6u)); + AssertThat(out->max_1level_cut[cut::All], Is().LessThanOrEqualTo(8u)); + + AssertThat(out->max_2level_cut[cut::Internal], Is().GreaterThanOrEqualTo(6u)); + AssertThat(out->max_2level_cut[cut::Internal], Is().LessThanOrEqualTo(8u)); + AssertThat(out->max_2level_cut[cut::Internal_False], Is().GreaterThanOrEqualTo(6u)); + AssertThat(out->max_2level_cut[cut::Internal_False], Is().LessThanOrEqualTo(8u)); + AssertThat(out->max_2level_cut[cut::Internal_True], Is().GreaterThanOrEqualTo(6u)); + AssertThat(out->max_2level_cut[cut::Internal_True], Is().LessThanOrEqualTo(8u)); + AssertThat(out->max_2level_cut[cut::All], Is().GreaterThanOrEqualTo(6u)); + AssertThat(out->max_2level_cut[cut::All], Is().LessThanOrEqualTo(8u)); AssertThat(out->number_of_terminals[false], Is().EqualTo(1u)); AssertThat(out->number_of_terminals[true], Is().EqualTo(3u)); @@ -3207,10 +3207,10 @@ go_bandit([]() { // T F */ - const arc::ptr_t n1(0,0); - const arc::ptr_t n2(1,0); - const arc::ptr_t n3(1,1); - const arc::ptr_t n4(2,0); + const arc::pointer_type n1(0,0); + const arc::pointer_type n2(1,0); + const arc::pointer_type n3(1,1); + const arc::pointer_type n4(2,0); shared_levelized_file in; @@ -3237,18 +3237,18 @@ go_bandit([]() { // Reduce it zdd out(in); - AssertThat(adiar::is_canonical(out), Is().True()); + AssertThat(zdd_iscanonical(out), Is().True()); // Check it looks all right node_test_stream out_nodes(out); AssertThat(out_nodes.can_pull(), Is().True()); // n2 - AssertThat(out_nodes.pull(), Is().EqualTo(node(1, node::MAX_ID, terminal_F, terminal_T))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(1, node::max_id, terminal_F, terminal_T))); AssertThat(out_nodes.can_pull(), Is().True()); // n1 - AssertThat(out_nodes.pull(), Is().EqualTo(node(0, node::MAX_ID, - node::ptr_t(1, node::MAX_ID), - node::ptr_t(1, node::MAX_ID)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(0, node::max_id, + node::pointer_type(1, node::max_id), + node::pointer_type(1, node::max_id)))); AssertThat(out_nodes.can_pull(), Is().False()); @@ -3264,24 +3264,24 @@ go_bandit([]() { AssertThat(out->width, Is().EqualTo(1u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL], Is().EqualTo(2u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(2u)); + AssertThat(out->max_1level_cut[cut::Internal], Is().EqualTo(2u)); + AssertThat(out->max_1level_cut[cut::Internal_False], Is().EqualTo(2u)); // Over-approximation: arc (2) to T is counted globally - AssertThat(out->max_1level_cut[cut_type::INTERNAL_TRUE], Is().GreaterThanOrEqualTo(2u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_TRUE], Is().LessThanOrEqualTo(3u)); + AssertThat(out->max_1level_cut[cut::Internal_True], Is().GreaterThanOrEqualTo(2u)); + AssertThat(out->max_1level_cut[cut::Internal_True], Is().LessThanOrEqualTo(3u)); - AssertThat(out->max_1level_cut[cut_type::ALL], Is().GreaterThanOrEqualTo(2u)); - AssertThat(out->max_1level_cut[cut_type::ALL], Is().LessThanOrEqualTo(3u)); + AssertThat(out->max_1level_cut[cut::All], Is().GreaterThanOrEqualTo(2u)); + AssertThat(out->max_1level_cut[cut::All], Is().LessThanOrEqualTo(3u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL], Is().EqualTo(2u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(2u)); + AssertThat(out->max_2level_cut[cut::Internal], Is().EqualTo(2u)); + AssertThat(out->max_2level_cut[cut::Internal_False], Is().EqualTo(2u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_TRUE], Is().GreaterThanOrEqualTo(2u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_TRUE], Is().LessThanOrEqualTo(3u)); + AssertThat(out->max_2level_cut[cut::Internal_True], Is().GreaterThanOrEqualTo(2u)); + AssertThat(out->max_2level_cut[cut::Internal_True], Is().LessThanOrEqualTo(3u)); - AssertThat(out->max_2level_cut[cut_type::ALL], Is().GreaterThanOrEqualTo(2u)); - AssertThat(out->max_2level_cut[cut_type::ALL], Is().LessThanOrEqualTo(3u)); + AssertThat(out->max_2level_cut[cut::All], Is().GreaterThanOrEqualTo(2u)); + AssertThat(out->max_2level_cut[cut::All], Is().LessThanOrEqualTo(3u)); AssertThat(out->number_of_terminals[false], Is().EqualTo(1u)); AssertThat(out->number_of_terminals[true], Is().EqualTo(1u)); diff --git a/test/adiar/internal/data_structures/test_level_merger.cpp b/test/adiar/internal/data_structures/test_level_merger.cpp index be40a0878..bb305d4a3 100644 --- a/test/adiar/internal/data_structures/test_level_merger.cpp +++ b/test/adiar/internal/data_structures/test_level_merger.cpp @@ -290,16 +290,16 @@ go_bandit([]() { }); }); - describe("level_merger, ...>", [&]() { + describe("level_merger, ...>", [&]() { it("can use a single label_file", [&]() { - adiar::shared_file f; + adiar::shared_file f; { // Garbage collect the writers label_writer w(f); w << 0 << 2 << 3; } - level_merger, std::less<>, 1> merger; + level_merger, std::less<>, 1> merger; merger.hook({f}); @@ -316,8 +316,8 @@ go_bandit([]() { }); it("can merge two label_files", [&]() { - adiar::shared_file f1; - adiar::shared_file f2; + adiar::shared_file f1; + adiar::shared_file f2; { // Garbage collect the writers label_writer w1(f1); @@ -327,7 +327,7 @@ go_bandit([]() { w2 << 0 << 1 << 3; } - level_merger, std::less<>, 2> merger; + level_merger, std::less<>, 2> merger; merger.hook({f1, f2}); diff --git a/test/adiar/internal/data_structures/test_levelized_priority_queue.cpp b/test/adiar/internal/data_structures/test_levelized_priority_queue.cpp index 9cc0c6892..caec1d2c2 100644 --- a/test/adiar/internal/data_structures/test_levelized_priority_queue.cpp +++ b/test/adiar/internal/data_structures/test_levelized_priority_queue.cpp @@ -3,10 +3,10 @@ #include struct lpq_test_data { - ptr_uint64::label_t label; + ptr_uint64::label_type label; uint64_t nonce; - ptr_uint64::label_t level() const + ptr_uint64::label_type level() const { return label; } }; @@ -25,7 +25,7 @@ namespace snowhouse }; } -stats_t::levelized_priority_queue_t stats_lpq_tests; +statistics::levelized_priority_queue_t stats_lpq_tests; namespace adiar::internal { @@ -61,10 +61,10 @@ struct lpq_test_gt { typedef shared_file_ptr> lpq_test_file; typedef levelized_file_writer lpq_test_writer; -template +template using test_priority_queue = levelized_priority_queue, false, 1u>; @@ -72,12 +72,12 @@ go_bandit([]() { describe("adiar/internal/levelized_priority_queue.h", []() { //////////////////////////////////////////////////////////////////////////// // TODO: Most level files should be replaced with a simpler - // adiar::shared_file (and use the << operator). + // adiar::shared_file (and use the << operator). // Yet, we of course need one test or two with a meta file. // // TODO: Are we not missing some unit tests for the very simple accessors? - describe("levelized_priority_queue<..., LOOK_AHEAD=1, ..., INIT_LEVEL=1>", []() { + describe("levelized_priority_queue<..., look_ahead=1, ..., init_level=1>", []() { ////////////////////////////////////////////////////////////////////////// // initialisation // it("initialises #levels = 0", []() { @@ -91,14 +91,14 @@ go_bandit([]() { }); it("initialises with #levels = 1 (which is skipped)", []() { - adiar::shared_file f; + adiar::shared_file f; { // Garbage collect the writer early label_writer fw(f); fw << 2; } - test_priority_queue, 1> pq({f}, memory_available(), 32, stats_lpq_tests); + test_priority_queue, 1> pq({f}, memory_available(), 32, stats_lpq_tests); AssertThat(pq.can_pull(), Is().False()); AssertThat(pq.has_current_level(), Is().False()); @@ -106,14 +106,14 @@ go_bandit([]() { }); it("initialises with #levels = 2 (#buckets = 1)", []() { - adiar::shared_file f; + adiar::shared_file f; { // Garbage collect the writer early label_writer fw(f); fw << 1 << 2; } - test_priority_queue, 1> pq({f}, memory_available(), 32, stats_lpq_tests); + test_priority_queue, 1> pq({f}, memory_available(), 32, stats_lpq_tests); AssertThat(pq.can_pull(), Is().False()); AssertThat(pq.has_current_level(), Is().False()); @@ -123,7 +123,7 @@ go_bandit([]() { }); it("initialises with #buckets == #levels", []() { - adiar::shared_file f; + adiar::shared_file f; { // Garbage collect the writer early label_writer fw(f); @@ -131,7 +131,7 @@ go_bandit([]() { << 3 << 4; // buckets } - test_priority_queue, 1> pq({f}, memory_available(), 32, stats_lpq_tests); + test_priority_queue, 1> pq({f}, memory_available(), 32, stats_lpq_tests); AssertThat(pq.can_pull(), Is().False()); AssertThat(pq.has_current_level(), Is().False()); @@ -141,7 +141,7 @@ go_bandit([]() { }); it("initialises with #buckets < #levels", []() { - adiar::shared_file f; + adiar::shared_file f; { // Garbage collect the writer early label_writer fw(f); @@ -150,7 +150,7 @@ go_bandit([]() { << 5; // overflow } - test_priority_queue, 1> pq({f}, memory_available(), 32, stats_lpq_tests); + test_priority_queue, 1> pq({f}, memory_available(), 32, stats_lpq_tests); AssertThat(pq.can_pull(), Is().False()); AssertThat(pq.has_current_level(), Is().False()); @@ -168,7 +168,7 @@ go_bandit([]() { describe(".setup_next_level()", []() { it("can forward until the first non-empty bucket [1]", []() { - adiar::shared_file f; + adiar::shared_file f; { // Garbage collect the writer early label_writer fw(f); @@ -178,7 +178,7 @@ go_bandit([]() { << 4; // overflow } - test_priority_queue, 1> pq({f}, memory_available(), 32, stats_lpq_tests); + test_priority_queue, 1> pq({f}, memory_available(), 32, stats_lpq_tests); AssertThat(pq.has_current_level(), Is().False()); @@ -200,7 +200,7 @@ go_bandit([]() { }); it("can forward until the first non-empty bucket [2]", []() { - adiar::shared_file f; + adiar::shared_file f; { // Garbage collect the writer early label_writer fw(f); @@ -210,7 +210,7 @@ go_bandit([]() { << 4; // overflow } - test_priority_queue, 1> pq({f}, memory_available(), 32, stats_lpq_tests); + test_priority_queue, 1> pq({f}, memory_available(), 32, stats_lpq_tests); AssertThat(pq.has_current_level(), Is().False()); @@ -232,7 +232,7 @@ go_bandit([]() { }); it("can forward up until the overflow queue [1]", []() { - adiar::shared_file f; + adiar::shared_file f; { // Garbage collect the writer early label_writer fw(f); @@ -242,7 +242,7 @@ go_bandit([]() { << 4; // overflow } - test_priority_queue, 1> pq({f}, memory_available(), 32, stats_lpq_tests); + test_priority_queue, 1> pq({f}, memory_available(), 32, stats_lpq_tests); AssertThat(pq.has_current_level(), Is().False()); @@ -263,7 +263,7 @@ go_bandit([]() { }); it("can forward up until the overflow queue [2]", []() { - adiar::shared_file f; + adiar::shared_file f; { // Garbage collect the writer early label_writer fw(f); @@ -273,7 +273,7 @@ go_bandit([]() { << 4 << 5 << 6; // overflow } - test_priority_queue, 1> pq({f}, memory_available(), 32, stats_lpq_tests); + test_priority_queue, 1> pq({f}, memory_available(), 32, stats_lpq_tests); AssertThat(pq.has_current_level(), Is().False()); @@ -303,7 +303,7 @@ go_bandit([]() { }); it("can forward until next bucket", []() { - adiar::shared_file f; + adiar::shared_file f; { // Garbage collect the writer early label_writer fw(f); @@ -313,7 +313,7 @@ go_bandit([]() { << 4; // overflow } - test_priority_queue, 1> pq({f}, memory_available(), 32, stats_lpq_tests); + test_priority_queue, 1> pq({f}, memory_available(), 32, stats_lpq_tests); AssertThat(pq.has_current_level(), Is().False()); @@ -350,7 +350,7 @@ go_bandit([]() { }); it("can forward past buckets until top of overflow queue", []() { - adiar::shared_file f; + adiar::shared_file f; { // Garbage collect the writer early label_writer fw(f); @@ -360,7 +360,7 @@ go_bandit([]() { << 4 << 5; // overflow } - test_priority_queue, 1> pq({f}, memory_available(), 32, stats_lpq_tests); + test_priority_queue, 1> pq({f}, memory_available(), 32, stats_lpq_tests); AssertThat(pq.has_current_level(), Is().False()); @@ -397,7 +397,7 @@ go_bandit([]() { }); it("can relabel buckets until top of overflow queue", []() { - adiar::shared_file f; + adiar::shared_file f; { // Garbage collect the writer early label_writer fw(f); @@ -410,7 +410,7 @@ go_bandit([]() { << 9; // overflow not yet touched } - test_priority_queue, 1> pq({f}, memory_available(), 32, stats_lpq_tests); + test_priority_queue, 1> pq({f}, memory_available(), 32, stats_lpq_tests); AssertThat(pq.has_current_level(), Is().False()); @@ -432,7 +432,7 @@ go_bandit([]() { }); it("can relabel buckets until top of overflow queue (on second last level)", []() { - adiar::shared_file f; + adiar::shared_file f; { // Garbage collect the writer early label_writer fw(f); @@ -444,7 +444,7 @@ go_bandit([]() { << 8; // overflow that will have relabelled bucket(s) } - test_priority_queue, 1> pq({f}, memory_available(), 32, stats_lpq_tests); + test_priority_queue, 1> pq({f}, memory_available(), 32, stats_lpq_tests); AssertThat(pq.has_current_level(), Is().False()); @@ -481,7 +481,7 @@ go_bandit([]() { describe(".setup_next_level(stop_label)", []() { it("does nothing when given level prior to next bucket [1]", []() { - adiar::shared_file f; + adiar::shared_file f; { // Garbage collect the writer early label_writer fw(f); @@ -491,7 +491,7 @@ go_bandit([]() { << 5; // overflow } - test_priority_queue, 1> pq({f}, memory_available(), 32, stats_lpq_tests); + test_priority_queue, 1> pq({f}, memory_available(), 32, stats_lpq_tests); AssertThat(pq.has_current_level(), Is().False()); @@ -509,7 +509,7 @@ go_bandit([]() { }); it("does nothing when given level prior to next bucket [2]", []() { - adiar::shared_file f; + adiar::shared_file f; { // Garbage collect the writer early label_writer fw(f); @@ -519,7 +519,7 @@ go_bandit([]() { << 6; // overflow } - test_priority_queue, 1> pq({f}, memory_available(), 32, stats_lpq_tests); + test_priority_queue, 1> pq({f}, memory_available(), 32, stats_lpq_tests); pq.push(lpq_test_data {2, 1}); pq.setup_next_level(); // 2 @@ -538,7 +538,7 @@ go_bandit([]() { }); it("forwards to first bucket", []() { - adiar::shared_file f; + adiar::shared_file f; { // Garbage collect the writer early label_writer fw(f); @@ -548,7 +548,7 @@ go_bandit([]() { << 4; // overflow } - test_priority_queue, 1> pq({f}, memory_available(), 32, stats_lpq_tests); + test_priority_queue, 1> pq({f}, memory_available(), 32, stats_lpq_tests); AssertThat(pq.has_current_level(), Is().False()); @@ -570,7 +570,7 @@ go_bandit([]() { }); it("forwards to second bucket", []() { - adiar::shared_file f; + adiar::shared_file f; { // Garbage collect the writer early label_writer fw(f); @@ -580,7 +580,7 @@ go_bandit([]() { << 4; // overflow } - test_priority_queue, 1> pq({f}, memory_available(), 32, stats_lpq_tests); + test_priority_queue, 1> pq({f}, memory_available(), 32, stats_lpq_tests); AssertThat(pq.has_current_level(), Is().False()); @@ -602,7 +602,7 @@ go_bandit([]() { }); it("forwards to next bucket with content", []() { - adiar::shared_file f; + adiar::shared_file f; { // Garbage collect the writer early label_writer fw(f); @@ -612,7 +612,7 @@ go_bandit([]() { << 4; // overflow } - test_priority_queue, 1> pq({f}, memory_available(), 32, stats_lpq_tests); + test_priority_queue, 1> pq({f}, memory_available(), 32, stats_lpq_tests); AssertThat(pq.has_current_level(), Is().False()); @@ -632,7 +632,7 @@ go_bandit([]() { }); it("forwards to next bucket without content", []() { - adiar::shared_file f; + adiar::shared_file f; { // Garbage collect the writer early label_writer fw(f); @@ -642,7 +642,7 @@ go_bandit([]() { << 4; // overflow } - test_priority_queue, 1> pq({f}, memory_available(), 32, stats_lpq_tests); + test_priority_queue, 1> pq({f}, memory_available(), 32, stats_lpq_tests); pq.push(lpq_test_data {3, 1}); @@ -659,7 +659,7 @@ go_bandit([]() { }); it("stops early at bucket with content", []() { - adiar::shared_file f; + adiar::shared_file f; { // Garbage collect the writer early label_writer fw(f); @@ -669,7 +669,7 @@ go_bandit([]() { << 4; // overflow } - test_priority_queue, 1> pq({f}, memory_available(), 32, stats_lpq_tests); + test_priority_queue, 1> pq({f}, memory_available(), 32, stats_lpq_tests); AssertThat(pq.has_current_level(), Is().False()); @@ -686,7 +686,7 @@ go_bandit([]() { }); it("forwards to first bucket for unknown level prior to second bucket", []() { - adiar::shared_file f; + adiar::shared_file f; { // Garbage collect the writer early label_writer fw(f); @@ -696,7 +696,7 @@ go_bandit([]() { << 5; // overflow } - test_priority_queue, 1> pq({f}, memory_available(), 32, stats_lpq_tests); + test_priority_queue, 1> pq({f}, memory_available(), 32, stats_lpq_tests); AssertThat(pq.has_current_level(), Is().False()); @@ -716,7 +716,7 @@ go_bandit([]() { }); it("relabels with current buckets included", []() { - adiar::shared_file f; + adiar::shared_file f; { // Garbage collect the writer early label_writer fw(f); @@ -726,7 +726,7 @@ go_bandit([]() { << 4; // overflow } - test_priority_queue, 1> pq({f}, memory_available(), 32, stats_lpq_tests); + test_priority_queue, 1> pq({f}, memory_available(), 32, stats_lpq_tests); AssertThat(pq.has_current_level(), Is().False()); @@ -748,7 +748,7 @@ go_bandit([]() { }); it("relabels early at top of overflow queue", []() { - adiar::shared_file f; + adiar::shared_file f; { // Garbage collect the writer early label_writer fw(f); @@ -758,7 +758,7 @@ go_bandit([]() { << 4 << 5 << 6; // overflow } - test_priority_queue, 1> pq({f}, memory_available(), 32, stats_lpq_tests); + test_priority_queue, 1> pq({f}, memory_available(), 32, stats_lpq_tests); AssertThat(pq.has_current_level(), Is().False()); AssertThat(pq.can_pull(), Is().False()); @@ -781,7 +781,7 @@ go_bandit([]() { }); it("can relabel for unknown level", []() { - adiar::shared_file f; + adiar::shared_file f; { // Garbage collect the writer early label_writer fw(f); @@ -793,7 +793,7 @@ go_bandit([]() { << 11 ; // overflow } - test_priority_queue, 1> pq({f}, memory_available(), 32, stats_lpq_tests); + test_priority_queue, 1> pq({f}, memory_available(), 32, stats_lpq_tests); pq.push(lpq_test_data {2, 1}); pq.setup_next_level(); @@ -1088,7 +1088,7 @@ go_bandit([]() { }); it("can use relabelled buckets [1]", []() { - adiar::shared_file f; + adiar::shared_file f; { label_writer w(f); @@ -1097,7 +1097,7 @@ go_bandit([]() { << 3 << 4 << 5 << 6; // overflow } - test_priority_queue, 1> pq({f}, memory_available(), 32, stats_lpq_tests); + test_priority_queue, 1> pq({f}, memory_available(), 32, stats_lpq_tests); pq.push(lpq_test_data {2, 1}); // bucket @@ -1136,7 +1136,7 @@ go_bandit([]() { }); it("can use relabelled buckets [2]", []() { - adiar::shared_file f; + adiar::shared_file f; { label_writer w(f); @@ -1145,7 +1145,7 @@ go_bandit([]() { << 3 << 4 << 5 << 6; // overflow } - test_priority_queue, 1> pq({f}, memory_available(), 32, stats_lpq_tests); + test_priority_queue, 1> pq({f}, memory_available(), 32, stats_lpq_tests); pq.push(lpq_test_data {3, 1}); // overflow @@ -1175,7 +1175,7 @@ go_bandit([]() { }); it("can push after relabelling that skips levels [1]", []() { - adiar::shared_file f; + adiar::shared_file f; { label_writer w(f); @@ -1184,7 +1184,7 @@ go_bandit([]() { << 3 << 4 << 5 << 6 << 7; // overflow } - test_priority_queue, 1> pq({f}, memory_available(), 32, stats_lpq_tests); + test_priority_queue, 1> pq({f}, memory_available(), 32, stats_lpq_tests); pq.push(lpq_test_data {1, 1}); // bucket pq.push(lpq_test_data {5, 1}); // overflow @@ -1226,7 +1226,7 @@ go_bandit([]() { }); it("can push after relabelling that skips levels [2]", []() { - adiar::shared_file f; + adiar::shared_file f; { label_writer w(f); @@ -1235,7 +1235,7 @@ go_bandit([]() { << 3 << 4 << 5 << 6 << 7; // overflow } - test_priority_queue, 1> pq({f}, memory_available(), 32, stats_lpq_tests); + test_priority_queue, 1> pq({f}, memory_available(), 32, stats_lpq_tests); pq.push(lpq_test_data {5, 1}); // overflow pq.push(lpq_test_data {6, 1}); // overflow @@ -1273,7 +1273,7 @@ go_bandit([]() { }); it("can use buckets after relabelling close to the end", []() { - adiar::shared_file f; + adiar::shared_file f; { label_writer w(f); @@ -1282,7 +1282,7 @@ go_bandit([]() { << 3 << 4 << 5; // overflow } - test_priority_queue, 1> pq({f}, memory_available(), 32, stats_lpq_tests); + test_priority_queue, 1> pq({f}, memory_available(), 32, stats_lpq_tests); pq.push(lpq_test_data {4, 1}); // overflow pq.push(lpq_test_data {1, 1}); // bucket @@ -1317,7 +1317,7 @@ go_bandit([]() { }); it("can use buckets after relabelling close to the end (the current read bucket dies)", []() { - adiar::shared_file f; + adiar::shared_file f; { label_writer w(f); @@ -1326,7 +1326,7 @@ go_bandit([]() { << 4 << 5; } - test_priority_queue, 1> pq({f}, memory_available(), 32, stats_lpq_tests); + test_priority_queue, 1> pq({f}, memory_available(), 32, stats_lpq_tests); pq.push(lpq_test_data {4, 1}); // overflow pq.push(lpq_test_data {2, 1}); // bucket @@ -1361,7 +1361,7 @@ go_bandit([]() { }); it("can use buckets after bucket-hitting stop-level", []() { - adiar::shared_file f; + adiar::shared_file f; { label_writer w(f); @@ -1370,7 +1370,7 @@ go_bandit([]() { << 3 << 4; // overflow } - test_priority_queue, 1> pq({f}, memory_available(), 32, stats_lpq_tests); + test_priority_queue, 1> pq({f}, memory_available(), 32, stats_lpq_tests); pq.push(lpq_test_data {2, 1}); // buckete @@ -1404,7 +1404,7 @@ go_bandit([]() { }); it("can use relabelled buckets (with stop-level)", []() { - adiar::shared_file f; + adiar::shared_file f; { label_writer w(f); @@ -1413,7 +1413,7 @@ go_bandit([]() { << 3 << 4 << 5 << 6; // overflow } - test_priority_queue, 1> pq({f}, memory_available(), 32, stats_lpq_tests); + test_priority_queue, 1> pq({f}, memory_available(), 32, stats_lpq_tests); pq.push(lpq_test_data {4, 1}); // overflow @@ -1442,7 +1442,7 @@ go_bandit([]() { }); it("can use relabelled bucket of a level that was also a prior bucket due to the stop-level", []() { - adiar::shared_file f; + adiar::shared_file f; { label_writer w(f); @@ -1451,7 +1451,7 @@ go_bandit([]() { << 3 << 4; // overflow } - test_priority_queue, 1> pq({f}, memory_available(), 32, stats_lpq_tests); + test_priority_queue, 1> pq({f}, memory_available(), 32, stats_lpq_tests); pq.setup_next_level(1u); // buckets: [2,3] @@ -1479,7 +1479,7 @@ go_bandit([]() { }); it("can push after relabelling (with stop-level) that skips levels [1]", []() { - adiar::shared_file f; + adiar::shared_file f; { label_writer w(f); @@ -1488,7 +1488,7 @@ go_bandit([]() { << 3 << 4 << 5 << 6 << 7; // overflow } - test_priority_queue, 1> pq({f}, memory_available(), 32, stats_lpq_tests); + test_priority_queue, 1> pq({f}, memory_available(), 32, stats_lpq_tests); pq.push(lpq_test_data {1, 1}); // bucket pq.push(lpq_test_data {7, 2}); // overflow @@ -1524,7 +1524,7 @@ go_bandit([]() { }); it("can push after relabelling (with stop-level) that skips levels [2]", []() { - adiar::shared_file f; + adiar::shared_file f; { label_writer w(f); @@ -1533,7 +1533,7 @@ go_bandit([]() { << 3 << 4 << 5 << 6 << 7; // overflow } - test_priority_queue, 1> pq({f}, memory_available(), 32, stats_lpq_tests); + test_priority_queue, 1> pq({f}, memory_available(), 32, stats_lpq_tests); pq.push(lpq_test_data {6, 1}); // overflow pq.push(lpq_test_data {7, 2}); // overflow @@ -1567,7 +1567,7 @@ go_bandit([]() { }); it("can use buckets after relabelling (with stop-level) close to the end", []() { - adiar::shared_file f; + adiar::shared_file f; { label_writer w(f); @@ -1576,7 +1576,7 @@ go_bandit([]() { << 3 << 4 << 5; // overflow } - test_priority_queue, 1> pq({f}, memory_available(), 32, stats_lpq_tests); + test_priority_queue, 1> pq({f}, memory_available(), 32, stats_lpq_tests); pq.push(lpq_test_data {1, 1}); // bucket @@ -1607,7 +1607,7 @@ go_bandit([]() { }); it("can use buckets after relabelling (with stop-level) close to the end (the current read bucket dies)", []() { - adiar::shared_file f; + adiar::shared_file f; { label_writer w(f); @@ -1616,7 +1616,7 @@ go_bandit([]() { << 4 << 5; } - test_priority_queue, 1> pq({f}, memory_available(), 32, stats_lpq_tests); + test_priority_queue, 1> pq({f}, memory_available(), 32, stats_lpq_tests); pq.push(lpq_test_data {2, 1}); // bucket @@ -1649,7 +1649,7 @@ go_bandit([]() { describe(".pop()", []{ it("can pop from bucket [1]", []() { - adiar::shared_file f; + adiar::shared_file f; { label_writer w(f); @@ -1658,7 +1658,7 @@ go_bandit([]() { << 3; // overflow } - test_priority_queue, 1> pq({f}, memory_available(), 32, stats_lpq_tests); + test_priority_queue, 1> pq({f}, memory_available(), 32, stats_lpq_tests); pq.push(lpq_test_data {2,1}); @@ -1672,7 +1672,7 @@ go_bandit([]() { }); it("can pop from bucket [2]", []() { - adiar::shared_file f; + adiar::shared_file f; { label_writer w(f); @@ -1681,7 +1681,7 @@ go_bandit([]() { << 3; // overflow } - test_priority_queue, 1> pq({f}, memory_available(), 32, stats_lpq_tests); + test_priority_queue, 1> pq({f}, memory_available(), 32, stats_lpq_tests); pq.push(lpq_test_data {2,1}); pq.push(lpq_test_data {2,2}); @@ -1699,7 +1699,7 @@ go_bandit([]() { }); it("can pop from overflow [1]", []() { - adiar::shared_file f; + adiar::shared_file f; { label_writer w(f); @@ -1708,7 +1708,7 @@ go_bandit([]() { << 3 << 4; // overflow } - test_priority_queue, 1> pq({f}, memory_available(), 32, stats_lpq_tests); + test_priority_queue, 1> pq({f}, memory_available(), 32, stats_lpq_tests); pq.push(lpq_test_data {3,1}); // overflow @@ -1722,7 +1722,7 @@ go_bandit([]() { }); it("can pop from overflow [2]", []() { - adiar::shared_file f; + adiar::shared_file f; { label_writer w(f); @@ -1731,7 +1731,7 @@ go_bandit([]() { << 3 << 4; // overflow } - test_priority_queue, 1> pq({f}, memory_available(), 32, stats_lpq_tests); + test_priority_queue, 1> pq({f}, memory_available(), 32, stats_lpq_tests); pq.push(lpq_test_data {3,1}); // overflow pq.push(lpq_test_data {2,1}); // bucket @@ -1763,7 +1763,7 @@ go_bandit([]() { ////////////////////////////////////////////////////////////////////////// // .can_pull() // describe(".empty_level() / .can_pull()", []{ - adiar::shared_file f; + adiar::shared_file f; { // Garbage collect the writer early label_writer fw(f); @@ -1774,14 +1774,14 @@ go_bandit([]() { } it("cannot pull after initialisation", [&f]() { - test_priority_queue, 1> pq({f}, memory_available(), 32, stats_lpq_tests); + test_priority_queue, 1> pq({f}, memory_available(), 32, stats_lpq_tests); AssertThat(pq.has_current_level(), Is().False()); AssertThat(pq.can_pull(), Is().False()); }); it("shows element after forwarding to level", [&f]() { - test_priority_queue, 1> pq({f}, memory_available(), 32, stats_lpq_tests); + test_priority_queue, 1> pq({f}, memory_available(), 32, stats_lpq_tests); pq.push(lpq_test_data { 2,1 }); pq.setup_next_level(); // 2 @@ -1790,7 +1790,7 @@ go_bandit([]() { }); it("shows a level becomes empty", [&f]() { - test_priority_queue, 1> pq({f}, memory_available(), 32, stats_lpq_tests); + test_priority_queue, 1> pq({f}, memory_available(), 32, stats_lpq_tests); pq.push(lpq_test_data { 2,1 }); pq.setup_next_level(); // 2 @@ -1807,7 +1807,7 @@ go_bandit([]() { }); it("shows forwarding to an empty level", [&f]() { - test_priority_queue, 1> pq({f}, memory_available(), 32, stats_lpq_tests); + test_priority_queue, 1> pq({f}, memory_available(), 32, stats_lpq_tests); pq.push(lpq_test_data { 3,1 }); pq.setup_next_level(2); // 2 @@ -1960,7 +1960,7 @@ go_bandit([]() { describe(".size()", []{ it("increments on push to bucket [1]", []() { - adiar::shared_file f; + adiar::shared_file f; { // Garbage collect the writer early label_writer fw(f); @@ -1968,7 +1968,7 @@ go_bandit([]() { << 1 << 2; // buckets } - test_priority_queue, 1> pq({f}, memory_available(), 32, stats_lpq_tests); + test_priority_queue, 1> pq({f}, memory_available(), 32, stats_lpq_tests); AssertThat(pq.size(), Is().EqualTo(0u)); @@ -1980,7 +1980,7 @@ go_bandit([]() { }); it("increments on push to bucket [2]", []() { - adiar::shared_file f; + adiar::shared_file f; { // Garbage collect the writer early label_writer fw(f); @@ -1988,7 +1988,7 @@ go_bandit([]() { << 1 << 2; // buckets } - test_priority_queue, 1> pq({f}, memory_available(), 32, stats_lpq_tests); + test_priority_queue, 1> pq({f}, memory_available(), 32, stats_lpq_tests); AssertThat(pq.size(), Is().EqualTo(0u)); @@ -2002,7 +2002,7 @@ go_bandit([]() { }); it("increments on push to overflow queue", []() { - adiar::shared_file f; + adiar::shared_file f; { // Garbage collect the writer early label_writer fw(f); @@ -2012,7 +2012,7 @@ go_bandit([]() { } - test_priority_queue, 1> pq({f}, memory_available(), 32, stats_lpq_tests); + test_priority_queue, 1> pq({f}, memory_available(), 32, stats_lpq_tests); AssertThat(pq.size(), Is().EqualTo(0u)); @@ -2024,7 +2024,7 @@ go_bandit([]() { }); it("decrements on pull from bucket", []() { - adiar::shared_file f; + adiar::shared_file f; { // Garbage collect the writer early label_writer fw(f); @@ -2032,7 +2032,7 @@ go_bandit([]() { << 1 << 2; // buckets } - test_priority_queue, 1> pq({f}, memory_available(), 32, stats_lpq_tests); + test_priority_queue, 1> pq({f}, memory_available(), 32, stats_lpq_tests); pq.push(lpq_test_data {1, 1}); pq.push(lpq_test_data {1, 2}); @@ -2046,7 +2046,7 @@ go_bandit([]() { }); it("decrements on pull from overflow queue", []() { - adiar::shared_file f; + adiar::shared_file f; { // Garbage collect the writer early label_writer fw(f); @@ -2055,7 +2055,7 @@ go_bandit([]() { << 3 << 4; // overflow } - test_priority_queue, 1> pq({f}, memory_available(), 32, stats_lpq_tests); + test_priority_queue, 1> pq({f}, memory_available(), 32, stats_lpq_tests); pq.push(lpq_test_data {4, 1}); pq.push(lpq_test_data {4, 2}); @@ -2069,7 +2069,7 @@ go_bandit([]() { }); it("decrements on pull from bucket", []() { - adiar::shared_file f; + adiar::shared_file f; { // Garbage collect the writer early label_writer fw(f); @@ -2077,7 +2077,7 @@ go_bandit([]() { << 1 << 2; // buckets } - test_priority_queue, 1> pq({f}, memory_available(), 32, stats_lpq_tests); + test_priority_queue, 1> pq({f}, memory_available(), 32, stats_lpq_tests); pq.push(lpq_test_data {1, 1}); pq.push(lpq_test_data {1, 2}); @@ -2091,7 +2091,7 @@ go_bandit([]() { }); it("decrements on pull from overflow queue", []() { - adiar::shared_file f; + adiar::shared_file f; { // Garbage collect the writer early label_writer fw(f); @@ -2100,7 +2100,7 @@ go_bandit([]() { << 3 << 4; // overflow } - test_priority_queue, 1> pq({f}, memory_available(), 32, stats_lpq_tests); + test_priority_queue, 1> pq({f}, memory_available(), 32, stats_lpq_tests); pq.push(lpq_test_data {4, 1}); pq.push(lpq_test_data {4, 2}); @@ -2114,7 +2114,7 @@ go_bandit([]() { }); it("is unchanged on top from bucket", []() { - adiar::shared_file f; + adiar::shared_file f; { // Garbage collect the writer early label_writer fw(f); @@ -2122,7 +2122,7 @@ go_bandit([]() { << 1 << 2; // buckets } - test_priority_queue, 1> pq({f}, memory_available(), 32, stats_lpq_tests); + test_priority_queue, 1> pq({f}, memory_available(), 32, stats_lpq_tests); pq.push(lpq_test_data {1, 1}); pq.push(lpq_test_data {1, 2}); @@ -2134,7 +2134,7 @@ go_bandit([]() { }); it("is unchanged on top from overflow queue", []() { - adiar::shared_file f; + adiar::shared_file f; { // Garbage collect the writer early label_writer fw(f); @@ -2143,7 +2143,7 @@ go_bandit([]() { << 3 << 4; // overflow } - test_priority_queue, 1> pq({f}, memory_available(), 32, stats_lpq_tests); + test_priority_queue, 1> pq({f}, memory_available(), 32, stats_lpq_tests); pq.push(lpq_test_data {4, 1}); pq.push(lpq_test_data {4, 2}); @@ -2156,7 +2156,7 @@ go_bandit([]() { }); }); - describe("levelized_priority_queue<..., LOOK_AHEAD=0, ..., INIT_LEVEL=1>", []() { + describe("levelized_priority_queue<..., look_ahead=0, ..., init_level=1>", []() { ////////////////////////////////////////////////////////////////////////// // initialisation // it("initialises correctly", []() { @@ -2178,7 +2178,7 @@ go_bandit([]() { describe(".setup_next_level()", []() { it("can forward until the first non-empty level [1]", []() { - adiar::shared_file f; + adiar::shared_file f; { // Garbage collect the writer early label_writer fw(f); @@ -2187,7 +2187,7 @@ go_bandit([]() { << 2 << 3 << 4; } - test_priority_queue, 0> pq({f}, memory_available(), 32, stats_lpq_tests); + test_priority_queue, 0> pq({f}, memory_available(), 32, stats_lpq_tests); AssertThat(pq.has_current_level(), Is().False()); @@ -2206,7 +2206,7 @@ go_bandit([]() { }); it("can forward until the first non-empty level [2]", []() { - adiar::shared_file f; + adiar::shared_file f; { // Garbage collect the writer early label_writer fw(f); @@ -2215,7 +2215,7 @@ go_bandit([]() { << 2 << 3 << 4; } - test_priority_queue, 0> pq({f}, memory_available(), 32, stats_lpq_tests); + test_priority_queue, 0> pq({f}, memory_available(), 32, stats_lpq_tests); AssertThat(pq.has_current_level(), Is().False()); @@ -2234,7 +2234,7 @@ go_bandit([]() { }); it("can forward until the first non-empty level [3]", []() { - adiar::shared_file f; + adiar::shared_file f; { // Garbage collect the writer early label_writer fw(f); @@ -2243,7 +2243,7 @@ go_bandit([]() { << 2 << 3 << 4; } - test_priority_queue, 0> pq({f}, memory_available(), 32, stats_lpq_tests); + test_priority_queue, 0> pq({f}, memory_available(), 32, stats_lpq_tests); AssertThat(pq.has_current_level(), Is().False()); @@ -2264,7 +2264,7 @@ go_bandit([]() { }); it("can forward until the first non-empty level [4]", []() { - adiar::shared_file f; + adiar::shared_file f; { // Garbage collect the writer early label_writer fw(f); @@ -2273,7 +2273,7 @@ go_bandit([]() { << 2 << 3 << 4 << 5 << 6; } - test_priority_queue, 0> pq({f}, memory_available(), 32, stats_lpq_tests); + test_priority_queue, 0> pq({f}, memory_available(), 32, stats_lpq_tests); AssertThat(pq.has_current_level(), Is().False()); @@ -2303,7 +2303,7 @@ go_bandit([]() { }); it("can forward until next level [1]", []() { - adiar::shared_file f; + adiar::shared_file f; { // Garbage collect the writer early label_writer fw(f); @@ -2312,7 +2312,7 @@ go_bandit([]() { << 2 << 3 << 4; } - test_priority_queue, 0> pq({f}, memory_available(), 32, stats_lpq_tests); + test_priority_queue, 0> pq({f}, memory_available(), 32, stats_lpq_tests); AssertThat(pq.has_current_level(), Is().False()); @@ -2346,7 +2346,7 @@ go_bandit([]() { }); it("can forward until next level [2]", []() { - adiar::shared_file f; + adiar::shared_file f; { // Garbage collect the writer early label_writer fw(f); @@ -2355,7 +2355,7 @@ go_bandit([]() { << 2 << 3 << 4 << 5; } - test_priority_queue, 0> pq({f}, memory_available(), 32, stats_lpq_tests); + test_priority_queue, 0> pq({f}, memory_available(), 32, stats_lpq_tests); AssertThat(pq.has_current_level(), Is().False()); @@ -2389,7 +2389,7 @@ go_bandit([]() { }); it("can forward until next level [3]", []() { - adiar::shared_file f; + adiar::shared_file f; { // Garbage collect the writer early label_writer fw(f); @@ -2398,7 +2398,7 @@ go_bandit([]() { << 2 << 3 << 4 << 5 << 6 << 7 << 8 << 9; } - test_priority_queue, 0> pq({f}, memory_available(), 32, stats_lpq_tests); + test_priority_queue, 0> pq({f}, memory_available(), 32, stats_lpq_tests); AssertThat(pq.has_current_level(), Is().False()); @@ -2417,7 +2417,7 @@ go_bandit([]() { }); it("can forward until next level [4]", []() { - adiar::shared_file f; + adiar::shared_file f; { // Garbage collect the writer early label_writer fw(f); @@ -2426,7 +2426,7 @@ go_bandit([]() { << 2 << 3 << 4 << 5 << 6 << 7 << 8; // overflow that will have relabelled bucket(s) } - test_priority_queue, 0> pq({f}, memory_available(), 32, stats_lpq_tests); + test_priority_queue, 0> pq({f}, memory_available(), 32, stats_lpq_tests); AssertThat(pq.has_current_level(), Is().False()); @@ -2460,7 +2460,7 @@ go_bandit([]() { describe(".setup_next_level(stop_label)", []() { it("forwards to first level", []() { - adiar::shared_file f; + adiar::shared_file f; { // Garbage collect the writer early label_writer fw(f); @@ -2469,7 +2469,7 @@ go_bandit([]() { << 2 << 3 << 4; } - test_priority_queue, 0> pq({f}, memory_available(), 32, stats_lpq_tests); + test_priority_queue, 0> pq({f}, memory_available(), 32, stats_lpq_tests); AssertThat(pq.has_current_level(), Is().False()); @@ -2491,7 +2491,7 @@ go_bandit([]() { }); it("forwards to next level with content [1]", []() { - adiar::shared_file f; + adiar::shared_file f; { // Garbage collect the writer early label_writer fw(f); @@ -2500,7 +2500,7 @@ go_bandit([]() { << 2 << 3 << 4; } - test_priority_queue, 0> pq({f}, memory_available(), 32, stats_lpq_tests); + test_priority_queue, 0> pq({f}, memory_available(), 32, stats_lpq_tests); AssertThat(pq.has_current_level(), Is().False()); @@ -2519,7 +2519,7 @@ go_bandit([]() { }); it("stops early at level with content", []() { - adiar::shared_file f; + adiar::shared_file f; { // Garbage collect the writer early label_writer fw(f); @@ -2528,7 +2528,7 @@ go_bandit([]() { << 2 << 3 << 4; } - test_priority_queue, 0> pq({f}, memory_available(), 32, stats_lpq_tests); + test_priority_queue, 0> pq({f}, memory_available(), 32, stats_lpq_tests); AssertThat(pq.has_current_level(), Is().False()); @@ -2545,7 +2545,7 @@ go_bandit([]() { }); it("forwards to unknown level without content [1]", []() { - adiar::shared_file f; + adiar::shared_file f; { // Garbage collect the writer early label_writer fw(f); @@ -2554,7 +2554,7 @@ go_bandit([]() { << 2 << 4 << 5; } - test_priority_queue, 0> pq({f}, memory_available(), 32, stats_lpq_tests); + test_priority_queue, 0> pq({f}, memory_available(), 32, stats_lpq_tests); AssertThat(pq.has_current_level(), Is().False()); @@ -2574,7 +2574,7 @@ go_bandit([]() { }); it("forwards to stop level [2]", []() { - adiar::shared_file f; + adiar::shared_file f; { // Garbage collect the writer early label_writer fw(f); @@ -2583,7 +2583,7 @@ go_bandit([]() { << 2 << 3 << 4; } - test_priority_queue, 0> pq({f}, memory_available(), 32, stats_lpq_tests); + test_priority_queue, 0> pq({f}, memory_available(), 32, stats_lpq_tests); AssertThat(pq.has_current_level(), Is().False()); @@ -2605,7 +2605,7 @@ go_bandit([]() { }); it("forwards to next level with content [2]", []() { - adiar::shared_file f; + adiar::shared_file f; { // Garbage collect the writer early label_writer fw(f); @@ -2614,7 +2614,7 @@ go_bandit([]() { << 2 << 3 << 4 << 5 << 6; } - test_priority_queue, 0> pq({f}, memory_available(), 32, stats_lpq_tests); + test_priority_queue, 0> pq({f}, memory_available(), 32, stats_lpq_tests); AssertThat(pq.has_current_level(), Is().False()); AssertThat(pq.can_pull(), Is().False()); @@ -2634,7 +2634,7 @@ go_bandit([]() { }); it("forwards to unknown level without content [2]", []() { - adiar::shared_file f; + adiar::shared_file f; { // Garbage collect the writer early label_writer fw(f); @@ -2643,7 +2643,7 @@ go_bandit([]() { << 2 << 3 << 4 << 5 << 6 << 7 << 9 << 10 << 11; } - test_priority_queue, 0> pq({f}, memory_available(), 32, stats_lpq_tests); + test_priority_queue, 0> pq({f}, memory_available(), 32, stats_lpq_tests); pq.push(lpq_test_data {2, 1}); pq.setup_next_level(); @@ -2938,7 +2938,7 @@ go_bandit([]() { }); it("can push [5]", []() { - adiar::shared_file f; + adiar::shared_file f; { label_writer w(f); @@ -2946,7 +2946,7 @@ go_bandit([]() { << 1 << 2 << 3 << 4 << 5 << 6; } - test_priority_queue, 0> pq({f}, memory_available(), 32, stats_lpq_tests); + test_priority_queue, 0> pq({f}, memory_available(), 32, stats_lpq_tests); pq.push(lpq_test_data {2, 1}); @@ -2985,7 +2985,7 @@ go_bandit([]() { }); it("can push [6]", []() { - adiar::shared_file f; + adiar::shared_file f; { label_writer w(f); @@ -2993,7 +2993,7 @@ go_bandit([]() { << 1 << 2 << 3 << 4 << 5 << 6; } - test_priority_queue, 0> pq({f}, memory_available(), 32, stats_lpq_tests); + test_priority_queue, 0> pq({f}, memory_available(), 32, stats_lpq_tests); pq.push(lpq_test_data {3, 1}); @@ -3023,7 +3023,7 @@ go_bandit([]() { }); it("can push [7]", []() { - adiar::shared_file f; + adiar::shared_file f; { label_writer w(f); @@ -3031,7 +3031,7 @@ go_bandit([]() { << 1 << 2 << 3 << 4 << 5 << 6 << 7; } - test_priority_queue, 0> pq({f}, memory_available(), 32, stats_lpq_tests); + test_priority_queue, 0> pq({f}, memory_available(), 32, stats_lpq_tests); pq.push(lpq_test_data {1, 1}); pq.push(lpq_test_data {5, 1}); @@ -3073,7 +3073,7 @@ go_bandit([]() { }); it("can push [8]", []() { - adiar::shared_file f; + adiar::shared_file f; { label_writer w(f); @@ -3081,7 +3081,7 @@ go_bandit([]() { << 1 << 2 << 3 << 4 << 5 << 6 << 7; } - test_priority_queue, 0> pq({f}, memory_available(), 32, stats_lpq_tests); + test_priority_queue, 0> pq({f}, memory_available(), 32, stats_lpq_tests); pq.push(lpq_test_data {5, 1}); pq.push(lpq_test_data {6, 1}); @@ -3119,7 +3119,7 @@ go_bandit([]() { }); it("can push [9]", []() { - adiar::shared_file f; + adiar::shared_file f; { label_writer w(f); @@ -3127,7 +3127,7 @@ go_bandit([]() { << 1 << 2 << 3 << 4 << 5; } - test_priority_queue, 0> pq({f}, memory_available(), 32, stats_lpq_tests); + test_priority_queue, 0> pq({f}, memory_available(), 32, stats_lpq_tests); pq.push(lpq_test_data {4, 1}); pq.push(lpq_test_data {1, 1}); @@ -3162,7 +3162,7 @@ go_bandit([]() { }); it("can push [10]", []() { - adiar::shared_file f; + adiar::shared_file f; { label_writer w(f); @@ -3170,7 +3170,7 @@ go_bandit([]() { << 1 << 2 << 3 << 4 << 5; } - test_priority_queue, 0> pq({f}, memory_available(), 32, stats_lpq_tests); + test_priority_queue, 0> pq({f}, memory_available(), 32, stats_lpq_tests); pq.push(lpq_test_data {4, 1}); pq.push(lpq_test_data {2, 1}); @@ -3205,7 +3205,7 @@ go_bandit([]() { }); it("can set up next level with a stop_label [3]", []() { - adiar::shared_file f; + adiar::shared_file f; { label_writer w(f); @@ -3213,7 +3213,7 @@ go_bandit([]() { << 1 << 2 << 3 << 4; } - test_priority_queue, 0> pq({f}, memory_available(), 32, stats_lpq_tests); + test_priority_queue, 0> pq({f}, memory_available(), 32, stats_lpq_tests); pq.push(lpq_test_data {2, 1}); @@ -3247,7 +3247,7 @@ go_bandit([]() { }); it("can set up next level with a stop_label [4]", []() { - adiar::shared_file f; + adiar::shared_file f; { label_writer w(f); @@ -3255,7 +3255,7 @@ go_bandit([]() { << 1 << 2 << 3 << 4 << 5 << 6; } - test_priority_queue, 0> pq({f}, memory_available(), 32, stats_lpq_tests); + test_priority_queue, 0> pq({f}, memory_available(), 32, stats_lpq_tests); pq.push(lpq_test_data {4, 1}); @@ -3284,7 +3284,7 @@ go_bandit([]() { }); it("can set up next level with a stop_label [5]", []() { - adiar::shared_file f; + adiar::shared_file f; { label_writer w(f); @@ -3292,7 +3292,7 @@ go_bandit([]() { << 1 << 2 << 3 << 4; } - test_priority_queue, 0> pq({f}, memory_available(), 32, stats_lpq_tests); + test_priority_queue, 0> pq({f}, memory_available(), 32, stats_lpq_tests); pq.push(lpq_test_data {2, 1}); pq.push(lpq_test_data {3, 2}); @@ -3318,7 +3318,7 @@ go_bandit([]() { }); it("can set up next level with a stop_label [6]", []() { - adiar::shared_file f; + adiar::shared_file f; { label_writer w(f); @@ -3326,7 +3326,7 @@ go_bandit([]() { << 1 << 2 << 3 << 4 << 5 << 6 << 7; } - test_priority_queue, 0> pq({f}, memory_available(), 32, stats_lpq_tests); + test_priority_queue, 0> pq({f}, memory_available(), 32, stats_lpq_tests); pq.push(lpq_test_data {1, 1}); pq.push(lpq_test_data {7, 2}); @@ -3362,7 +3362,7 @@ go_bandit([]() { }); it("can set up next level with a stop_label [7]", []() { - adiar::shared_file f; + adiar::shared_file f; { label_writer w(f); @@ -3370,7 +3370,7 @@ go_bandit([]() { << 1 << 2 << 3 << 4 << 5 << 6 << 7; } - test_priority_queue, 0> pq({f}, memory_available(), 32, stats_lpq_tests); + test_priority_queue, 0> pq({f}, memory_available(), 32, stats_lpq_tests); pq.push(lpq_test_data {6, 1}); pq.push(lpq_test_data {7, 2}); @@ -3404,7 +3404,7 @@ go_bandit([]() { }); it("can set up next level with a stop_label [8]", []() { - adiar::shared_file f; + adiar::shared_file f; { label_writer w(f); @@ -3412,7 +3412,7 @@ go_bandit([]() { << 1 << 2 << 3 << 4 << 5; } - test_priority_queue, 0> pq({f}, memory_available(), 32, stats_lpq_tests); + test_priority_queue, 0> pq({f}, memory_available(), 32, stats_lpq_tests); pq.push(lpq_test_data {1, 1}); @@ -3443,7 +3443,7 @@ go_bandit([]() { }); it("can set up next level with a stop_label [9]", []() { - adiar::shared_file f; + adiar::shared_file f; { label_writer w(f); @@ -3451,7 +3451,7 @@ go_bandit([]() { << 1 << 2 << 3 << 4 << 5; } - test_priority_queue, 0> pq({f}, memory_available(), 32, stats_lpq_tests); + test_priority_queue, 0> pq({f}, memory_available(), 32, stats_lpq_tests); pq.push(lpq_test_data {2, 1}); @@ -3484,7 +3484,7 @@ go_bandit([]() { describe(".pop()", []{ it("can pop [1]", []() { - adiar::shared_file f; + adiar::shared_file f; { label_writer w(f); @@ -3492,7 +3492,7 @@ go_bandit([]() { << 1 << 2 << 3; } - test_priority_queue, 0> pq({f}, memory_available(), 32, stats_lpq_tests); + test_priority_queue, 0> pq({f}, memory_available(), 32, stats_lpq_tests); pq.push(lpq_test_data {2,1}); @@ -3506,7 +3506,7 @@ go_bandit([]() { }); it("can pop [2]", []() { - adiar::shared_file f; + adiar::shared_file f; { label_writer w(f); @@ -3514,7 +3514,7 @@ go_bandit([]() { << 1 << 2 << 3; } - test_priority_queue, 0> pq({f}, memory_available(), 32, stats_lpq_tests); + test_priority_queue, 0> pq({f}, memory_available(), 32, stats_lpq_tests); pq.push(lpq_test_data {2,1}); pq.push(lpq_test_data {2,2}); @@ -3532,7 +3532,7 @@ go_bandit([]() { }); it("can pop [3]", []() { - adiar::shared_file f; + adiar::shared_file f; { label_writer w(f); @@ -3540,7 +3540,7 @@ go_bandit([]() { << 1 << 2 << 3 << 4; } - test_priority_queue, 0> pq({f}, memory_available(), 32, stats_lpq_tests); + test_priority_queue, 0> pq({f}, memory_available(), 32, stats_lpq_tests); pq.push(lpq_test_data {3,1}); @@ -3554,7 +3554,7 @@ go_bandit([]() { }); it("can pop [4]", []() { - adiar::shared_file f; + adiar::shared_file f; { label_writer w(f); @@ -3562,7 +3562,7 @@ go_bandit([]() { << 1 << 2 << 3 << 4; } - test_priority_queue, 0> pq({f}, memory_available(), 32, stats_lpq_tests); + test_priority_queue, 0> pq({f}, memory_available(), 32, stats_lpq_tests); pq.push(lpq_test_data {3,1}); // overflow pq.push(lpq_test_data {2,1}); // bucket @@ -3594,7 +3594,7 @@ go_bandit([]() { ////////////////////////////////////////////////////////////////////////// // .can_pull() // describe(".empty_level() / .can_pull()", []{ - adiar::shared_file f; + adiar::shared_file f; { // Garbage collect the writer early label_writer fw(f); @@ -3605,14 +3605,14 @@ go_bandit([]() { } it("cannot pull after initialisation", [&f]() { - test_priority_queue, 0> pq({f}, memory_available(), 32, stats_lpq_tests); + test_priority_queue, 0> pq({f}, memory_available(), 32, stats_lpq_tests); AssertThat(pq.has_current_level(), Is().False()); AssertThat(pq.can_pull(), Is().False()); }); it("shows element after forwarding to level", [&f]() { - test_priority_queue, 0> pq({f}, memory_available(), 32, stats_lpq_tests); + test_priority_queue, 0> pq({f}, memory_available(), 32, stats_lpq_tests); pq.push(lpq_test_data { 2,1 }); pq.setup_next_level(); // 2 @@ -3621,7 +3621,7 @@ go_bandit([]() { }); it("shows a level becomes empty", [&f]() { - test_priority_queue, 0> pq({f}, memory_available(), 32, stats_lpq_tests); + test_priority_queue, 0> pq({f}, memory_available(), 32, stats_lpq_tests); pq.push(lpq_test_data { 2,1 }); pq.setup_next_level(); // 2 @@ -3638,7 +3638,7 @@ go_bandit([]() { }); it("shows forwarding to an empty level", [&f]() { - test_priority_queue, 0> pq({f}, memory_available(), 32, stats_lpq_tests); + test_priority_queue, 0> pq({f}, memory_available(), 32, stats_lpq_tests); pq.push(lpq_test_data { 3,1 }); pq.setup_next_level(2); // 2 @@ -3790,7 +3790,7 @@ go_bandit([]() { describe(".size()", []{ it("increments on push to priority queue [1]", []() { - adiar::shared_file f; + adiar::shared_file f; { // Garbage collect the writer early label_writer fw(f); @@ -3798,7 +3798,7 @@ go_bandit([]() { << 1 << 2; } - test_priority_queue, 0> pq({f}, memory_available(), 32, stats_lpq_tests); + test_priority_queue, 0> pq({f}, memory_available(), 32, stats_lpq_tests); AssertThat(pq.size(), Is().EqualTo(0u)); @@ -3810,7 +3810,7 @@ go_bandit([]() { }); it("increments on push to priority queue [2]", []() { - adiar::shared_file f; + adiar::shared_file f; { // Garbage collect the writer early label_writer fw(f); @@ -3818,7 +3818,7 @@ go_bandit([]() { << 1 << 2; } - test_priority_queue, 0> pq({f}, memory_available(), 32, stats_lpq_tests); + test_priority_queue, 0> pq({f}, memory_available(), 32, stats_lpq_tests); AssertThat(pq.size(), Is().EqualTo(0u)); @@ -3832,7 +3832,7 @@ go_bandit([]() { }); it("increments on push to priority queue [3]", []() { - adiar::shared_file f; + adiar::shared_file f; { // Garbage collect the writer early label_writer fw(f); @@ -3840,7 +3840,7 @@ go_bandit([]() { << 1 << 2 << 3 << 4; } - test_priority_queue, 0> pq({f}, memory_available(), 32, stats_lpq_tests); + test_priority_queue, 0> pq({f}, memory_available(), 32, stats_lpq_tests); AssertThat(pq.size(), Is().EqualTo(0u)); @@ -3852,7 +3852,7 @@ go_bandit([]() { }); it("decrements on pull from priority queue [1]", []() { - adiar::shared_file f; + adiar::shared_file f; { // Garbage collect the writer early label_writer fw(f); @@ -3860,7 +3860,7 @@ go_bandit([]() { << 1 << 2; } - test_priority_queue, 0> pq({f}, memory_available(), 32, stats_lpq_tests); + test_priority_queue, 0> pq({f}, memory_available(), 32, stats_lpq_tests); pq.push(lpq_test_data {1, 1}); pq.push(lpq_test_data {1, 2}); @@ -3874,7 +3874,7 @@ go_bandit([]() { }); it("decrements on pull from priority queue [2]", []() { - adiar::shared_file f; + adiar::shared_file f; { // Garbage collect the writer early label_writer fw(f); @@ -3882,7 +3882,7 @@ go_bandit([]() { << 1 << 2 << 3 << 4; } - test_priority_queue, 0> pq({f}, memory_available(), 32, stats_lpq_tests); + test_priority_queue, 0> pq({f}, memory_available(), 32, stats_lpq_tests); pq.push(lpq_test_data {4, 1}); pq.push(lpq_test_data {4, 2}); @@ -3896,7 +3896,7 @@ go_bandit([]() { }); it("decrements on pull from priority queue [3]", []() { - adiar::shared_file f; + adiar::shared_file f; { // Garbage collect the writer early label_writer fw(f); @@ -3904,7 +3904,7 @@ go_bandit([]() { << 1 << 2; } - test_priority_queue, 0> pq({f}, memory_available(), 32, stats_lpq_tests); + test_priority_queue, 0> pq({f}, memory_available(), 32, stats_lpq_tests); pq.push(lpq_test_data {1, 1}); pq.push(lpq_test_data {1, 2}); @@ -3918,7 +3918,7 @@ go_bandit([]() { }); it("decrements on pull from priority queue [4]", []() { - adiar::shared_file f; + adiar::shared_file f; { // Garbage collect the writer early label_writer fw(f); @@ -3926,7 +3926,7 @@ go_bandit([]() { << 1 << 2 << 3 << 4; } - test_priority_queue, 0> pq({f}, memory_available(), 32, stats_lpq_tests); + test_priority_queue, 0> pq({f}, memory_available(), 32, stats_lpq_tests); pq.push(lpq_test_data {4, 1}); pq.push(lpq_test_data {4, 2}); @@ -3940,7 +3940,7 @@ go_bandit([]() { }); it("is unchanged on top from priority queue [1]", []() { - adiar::shared_file f; + adiar::shared_file f; { // Garbage collect the writer early label_writer fw(f); @@ -3948,7 +3948,7 @@ go_bandit([]() { << 1 << 2; } - test_priority_queue, 0> pq({f}, memory_available(), 32, stats_lpq_tests); + test_priority_queue, 0> pq({f}, memory_available(), 32, stats_lpq_tests); pq.push(lpq_test_data {1, 1}); pq.push(lpq_test_data {1, 2}); @@ -3960,7 +3960,7 @@ go_bandit([]() { }); it("is unchanged on top from priority queue [2]", []() { - adiar::shared_file f; + adiar::shared_file f; { // Garbage collect the writer early label_writer fw(f); @@ -3968,7 +3968,7 @@ go_bandit([]() { << 1 << 2 << 3 << 4; } - test_priority_queue, 0> pq({f}, memory_available(), 32, stats_lpq_tests); + test_priority_queue, 0> pq({f}, memory_available(), 32, stats_lpq_tests); pq.push(lpq_test_data {4, 1}); pq.push(lpq_test_data {4, 2}); @@ -3982,7 +3982,7 @@ go_bandit([]() { }); describe("levelized_priority_queue<..., lpq_test_gt, ..., std::greater<>, ...>", []() { - adiar::shared_file f; + adiar::shared_file f; { // Garbage collect the writer early label_writer fw(f); @@ -3994,8 +3994,8 @@ go_bandit([]() { it("can sort elements from buckets", [&f]() { levelized_priority_queue, 1u, std::greater<>, false, + memory_mode_t::Internal, + adiar::shared_file, 1u, std::greater<>, false, 1u> pq({f}, memory_available(), 32, stats_lpq_tests); @@ -4030,8 +4030,8 @@ go_bandit([]() { it("can sort elements in overflow priority queue", [&f]() { levelized_priority_queue, 1u, std::greater<>, false, + memory_mode_t::Internal, + adiar::shared_file, 1u, std::greater<>, false, 1u> pq({f}, memory_available(), 32, stats_lpq_tests); @@ -4053,8 +4053,8 @@ go_bandit([]() { it("can merge elements from buckets and overflow", [&f]() { levelized_priority_queue, 1u, std::greater<>, false, + memory_mode_t::Internal, + adiar::shared_file, 1u, std::greater<>, false, 1u> pq({f}, memory_available(), 32, stats_lpq_tests); @@ -4096,8 +4096,8 @@ go_bandit([]() { }); //Fixed (ub) - describe("levelized_priority_queue<..., LOOK_AHEAD=0, lpq_test_gt, ..., std::greater<>, ...>", []() { - adiar::shared_file f; + describe("levelized_priority_queue<..., look_ahead=0, lpq_test_gt, ..., std::greater<>, ...>", []() { + adiar::shared_file f; { // Garbage collect the writer early label_writer fw(f); @@ -4109,8 +4109,8 @@ go_bandit([]() { it("can sort elements from the priority queue [1]", [&f]() { levelized_priority_queue, 1u, std::greater<>, false, + memory_mode_t::Internal, + adiar::shared_file, 1u, std::greater<>, false, 1u> pq({f}, memory_available(), 32, stats_lpq_tests); @@ -4145,8 +4145,8 @@ go_bandit([]() { it("can sort elements from the priority queue [2]", [&f]() { levelized_priority_queue, 1u, std::greater<>, false, + memory_mode_t::Internal, + adiar::shared_file, 1u, std::greater<>, false, 1u> pq({f}, memory_available(), 32, stats_lpq_tests); @@ -4168,8 +4168,8 @@ go_bandit([]() { it("can sort elements from the priority queue [3]", [&f]() { levelized_priority_queue, 1u, std::greater<>, false, + memory_mode_t::Internal, + adiar::shared_file, 1u, std::greater<>, false, 1u> pq({f}, memory_available(), 32, stats_lpq_tests); @@ -4210,13 +4210,13 @@ go_bandit([]() { }); }); - describe("levelized_priority_queue<..., LOOK_AHEAD=1, ..., INIT_LEVEL=0>", []() { + describe("levelized_priority_queue<..., look_ahead=1, ..., init_level=0>", []() { it("initialises #levels = 0", []() { - adiar::shared_file f; + adiar::shared_file f; levelized_priority_queue, 1u, std::less<>, false, + memory_mode_t::Internal, + adiar::shared_file, 1u, std::less<>, false, 0u> pq({f}, memory_available(), 32, stats_lpq_tests); @@ -4228,7 +4228,7 @@ go_bandit([]() { }); it("initialises with #levels = 1 < #buckets", []() { - adiar::shared_file f; + adiar::shared_file f; { // Garbage collect the writer early label_writer fw(f); @@ -4236,8 +4236,8 @@ go_bandit([]() { } levelized_priority_queue, 1u, std::less<>, false, + memory_mode_t::Internal, + adiar::shared_file, 1u, std::less<>, false, 0u> pq({f}, memory_available(), 32, stats_lpq_tests); @@ -4249,7 +4249,7 @@ go_bandit([]() { }); it("initialises #buckets <= #levels", []() { - adiar::shared_file f; + adiar::shared_file f; { // Garbage collect the writer early label_writer fw(f); @@ -4257,8 +4257,8 @@ go_bandit([]() { } levelized_priority_queue, 1u, std::less<>, false, + memory_mode_t::Internal, + adiar::shared_file, 1u, std::less<>, false, 0u> pq({f}, memory_available(), 32, stats_lpq_tests); @@ -4280,7 +4280,7 @@ go_bandit([]() { } levelized_priority_queue, false, 0u> pq({f}, memory_available(), 32, stats_lpq_tests); @@ -4319,7 +4319,7 @@ go_bandit([]() { } levelized_priority_queue, false, 0u> pq({f}, memory_available(), 32, stats_lpq_tests); @@ -4347,7 +4347,7 @@ go_bandit([]() { }); describe("levelized_priority_queue<..., level_reverse=true, ...>", []() { - // TODO: these tests break with a LOOK_AHEAD of 0. Is this indicating some bug? + // TODO: these tests break with a look_ahead of 0. Is this indicating some bug? it("can setup buckets in reverse order", []() { lpq_test_file f; @@ -4362,7 +4362,7 @@ go_bandit([]() { } levelized_priority_queue, true, 0u> pq({f}, memory_available(), 32, stats_lpq_tests); @@ -4412,7 +4412,7 @@ go_bandit([]() { } levelized_priority_queue, true, 0u> pq({f}, memory_available(), 32, stats_lpq_tests); @@ -4481,7 +4481,7 @@ go_bandit([]() { } levelized_priority_queue, true, 0u> pq({f1,f2}, memory_available(), 32, stats_lpq_tests); @@ -4550,13 +4550,13 @@ go_bandit([]() { }); }); - describe("levelized_priority_queue<..., LOOK_AHEAD=0, ..., INIT_LEVEL=0>", []() { + describe("levelized_priority_queue<..., look_ahead=0, ..., init_level=0>", []() { it("initialises correctly", []() { - adiar::shared_file f; + adiar::shared_file f; levelized_priority_queue, 1u, std::less<>, false, + memory_mode_t::Internal, + adiar::shared_file, 1u, std::less<>, false, 0u> pq({f}, memory_available(), 32, stats_lpq_tests); @@ -4576,7 +4576,7 @@ go_bandit([]() { } levelized_priority_queue, false, 0u> pq({f}, memory_available(), 32, stats_lpq_tests); @@ -4615,8 +4615,8 @@ go_bandit([]() { } levelized_priority_queue, false, + memory_mode_t::Internal, + lpq_test_file, 1u, std::less, false, 0u> pq({f}, memory_available(), 32, stats_lpq_tests); @@ -4659,7 +4659,7 @@ go_bandit([]() { } levelized_priority_queue, false, 0u> pq({f1,f2}, memory_available(), 32, stats_lpq_tests); @@ -4710,7 +4710,7 @@ go_bandit([]() { }); }); - describe("levelized_priority_queue<..., LOOK_AHEAD=0, ..., FILES=2, ...>", []() { + describe("levelized_priority_queue<..., look_ahead=0, ..., FILES=2, ...>", []() { it("can push into and pull from merge of two meta files' levels", []() { lpq_test_file f1; lpq_test_file f2; @@ -4729,7 +4729,7 @@ go_bandit([]() { } levelized_priority_queue, false, 0u> pq({f1,f2}, memory_available(), 32, stats_lpq_tests); @@ -4778,7 +4778,7 @@ go_bandit([]() { }); }); - describe("levelized_priority_queue<..., INIT_LEVEL=1, LOOK_AHEAD=3>", []() { + describe("levelized_priority_queue<..., init_level=1, look_ahead=3>", []() { // TODO: size, pop, peek tests and more it("initialises with #levels = 0", []() { @@ -5473,7 +5473,7 @@ go_bandit([]() { }); it("can push into relabelled buckets", []() { - adiar::shared_file f; + adiar::shared_file f; { // Garbage collect the writer early label_writer w(f); @@ -5483,7 +5483,7 @@ go_bandit([]() { << 5 << 6 << 7 << 8 << 9 << 10; // overflow } - test_priority_queue, 3> pq({f}, memory_available(), 32, stats_lpq_tests); + test_priority_queue, 3> pq({f}, memory_available(), 32, stats_lpq_tests); pq.push(lpq_test_data {5, 2}); // overflow AssertThat(pq.size(), Is().EqualTo(1u)); @@ -5518,7 +5518,7 @@ go_bandit([]() { }); it("can push into relabelled buckets (with stop-level)", []() { - adiar::shared_file f; + adiar::shared_file f; { // Garbage collect the writer early label_writer w(f); @@ -5528,7 +5528,7 @@ go_bandit([]() { << 5 << 6 << 7 << 8 << 9 << 10; // overflow } - test_priority_queue, 3> pq({f}, memory_available(), 32, stats_lpq_tests); + test_priority_queue, 3> pq({f}, memory_available(), 32, stats_lpq_tests); pq.push(lpq_test_data {9, 2}); // overflow AssertThat(pq.size(), Is().EqualTo(1u)); diff --git a/test/adiar/internal/data_types/test_arc.cpp b/test/adiar/internal/data_types/test_arc.cpp index ae9137aeb..652ee51fb 100644 --- a/test/adiar/internal/data_types/test_arc.cpp +++ b/test/adiar/internal/data_types/test_arc.cpp @@ -15,7 +15,7 @@ go_bandit([]() { AssertThat(sizeof(arc), Is().EqualTo(2u * 8u)); }); - describe("arc(ptr_t &s, ptr_t &t)", [&] { + describe("arc(pointer_type &s, pointer_type &t)", [&] { it("creates arc (42,2) - -> F", [&]() { const arc a = { ptr_uint64(42,2,0), terminal_F }; @@ -57,7 +57,7 @@ go_bandit([]() { }); }); - describe("arc(ptr_t &s, ptr_t::out_idx o, ptr_t &t)", [&] { + describe("arc(pointer_type &s, pointer_type::out_idx o, pointer_type &t)", [&] { it("creates arc '(42,2) - -> F'", [&]() { const arc a = { uid_uint64(42,2), 0, terminal_F }; diff --git a/test/adiar/internal/data_types/test_node.cpp b/test/adiar/internal/data_types/test_node.cpp index 4e6cbbbda..add987fb1 100644 --- a/test/adiar/internal/data_types/test_node.cpp +++ b/test/adiar/internal/data_types/test_node.cpp @@ -18,7 +18,7 @@ go_bandit([]() { }); describe("node(...), .label(), .id(), .low(), .high()", [&]() { - it("should create node [label_t, id_t, ptr_uint64, ptr_uint64] [1]", [&]() { + it("should create node [label_type, id_type, ptr_uint64, ptr_uint64] [1]", [&]() { const node n = node(3u,12u, terminal_F, terminal_T); AssertThat(n.uid(), Is().EqualTo(ptr_uint64(3,12))); AssertThat(n.label(), Is().EqualTo(3u)); @@ -30,7 +30,7 @@ go_bandit([]() { AssertThat(n.high(), Is().EqualTo(terminal_T)); }); - it("should create node [label_t, id_t, ptr_uint64, ptr_uint64] [2]", [&]() { + it("should create node [label_type, id_type, ptr_uint64, ptr_uint64] [2]", [&]() { const node n = node(3u,42u, terminal_T, terminal_F); AssertThat(n.uid(), Is().EqualTo(ptr_uint64(3,42))); AssertThat(n.label(), Is().EqualTo(3u)); @@ -42,7 +42,7 @@ go_bandit([]() { AssertThat(n.high(), Is().EqualTo(terminal_F)); }); - it("should create node [label_t, id_t, node&, node&]", [&]() { + it("should create node [label_type, id_type, node&, node&]", [&]() { const node n_child1 = node(3u,12u, terminal_F, terminal_T); const node n_child2 = node(3u,42u, terminal_T, terminal_F); @@ -57,7 +57,7 @@ go_bandit([]() { AssertThat(n.high(), Is().EqualTo(n_child2.uid())); }); - it("should create node [label_t, id_t, node&, ptr_uint64]", [&]() { + it("should create node [label_type, id_type, node&, ptr_uint64]", [&]() { const node n_child = node(2u,2u, terminal_F, terminal_T); const node n = node(1u,7u,terminal_T,n_child); @@ -71,7 +71,7 @@ go_bandit([]() { AssertThat(n.high(), Is().EqualTo(n_child.uid())); }); - it("should create node [label_t, id_t, ptr_uint64, node&]", [&]() { + it("should create node [label_type, id_type, ptr_uint64, node&]", [&]() { const node n_child = node(2u,2u, terminal_F,terminal_T); const node n = node(0u,3u, terminal_T,n_child); @@ -90,14 +90,14 @@ go_bandit([]() { const node terminal_node_T = node(true); const node terminal_node_F = node(false); - it("has NIL() children [F]", [&]() { - AssertThat(terminal_node_F.low(), Is().EqualTo(node::ptr_t::NIL())); - AssertThat(terminal_node_F.high(), Is().EqualTo(node::ptr_t::NIL())); + it("has nil() children [F]", [&]() { + AssertThat(terminal_node_F.low(), Is().EqualTo(node::pointer_type::nil())); + AssertThat(terminal_node_F.high(), Is().EqualTo(node::pointer_type::nil())); }); - it("has NIL() children [T]", [&]() { - AssertThat(terminal_node_T.low(), Is().EqualTo(node::ptr_t::NIL())); - AssertThat(terminal_node_T.high(), Is().EqualTo(node::ptr_t::NIL())); + it("has nil() children [T]", [&]() { + AssertThat(terminal_node_T.low(), Is().EqualTo(node::pointer_type::nil())); + AssertThat(terminal_node_T.high(), Is().EqualTo(node::pointer_type::nil())); }); describe("is_terminal", [&]() { @@ -278,7 +278,7 @@ go_bandit([]() { describe("comparators [uid]", [&]() { it("should primarily sort by label [ 1]", [&]() { const node n = node(0u, 1u, terminal_F, terminal_T); - const node::uid_t u = node::uid_t(1u,0u); + const node::uid_type u = node::uid_type(1u,0u); AssertThat(n, Is().LessThan(u)); AssertThat(n, Is().LessThanOrEqualTo(u)); @@ -288,7 +288,7 @@ go_bandit([]() { it("should primarily sort by label [!1]", [&]() { const node n = node(0u, 1u, terminal_F, terminal_T); - const node::uid_t u = node::uid_t(1u,0u); + const node::uid_type u = node::uid_type(1u,0u); AssertThat(u, Is().Not().LessThan(n)); AssertThat(u, Is().Not().LessThanOrEqualTo(n)); @@ -298,7 +298,7 @@ go_bandit([]() { it("should primarily sort by label [ 2]", [&]() { const node n = node(21u, 8u, terminal_F, terminal_T); - const node::uid_t u = node::uid_t(42u,2u); + const node::uid_type u = node::uid_type(42u,2u); AssertThat(n, Is().LessThan(u)); AssertThat(n, Is().LessThanOrEqualTo(u)); @@ -308,7 +308,7 @@ go_bandit([]() { it("should primarily sort by label [ 3]", [&]() { const node n = node(1u, 1u, terminal_F, terminal_T); - const node::uid_t u = node::uid_t(0u,2u); + const node::uid_type u = node::uid_type(0u,2u); AssertThat(u, Is().LessThan(n)); AssertThat(u, Is().LessThanOrEqualTo(n)); @@ -318,7 +318,7 @@ go_bandit([]() { it("should primarily sort by label [ 4]", [&]() { const node n = node(42u, 0u, terminal_F, terminal_T); - const node::uid_t u = node::uid_t(21u,8u); + const node::uid_type u = node::uid_type(21u,8u); AssertThat(u, Is().LessThan(n)); AssertThat(u, Is().LessThanOrEqualTo(n)); @@ -328,7 +328,7 @@ go_bandit([]() { it("should primarily sort by label [!4]", [&]() { const node n = node(42u, 0u, terminal_F, terminal_T); - const node::uid_t u = node::uid_t(21u,8u); + const node::uid_type u = node::uid_type(21u,8u); AssertThat(n, Is().Not().LessThan(u)); AssertThat(n, Is().Not().LessThanOrEqualTo(u)); @@ -338,7 +338,7 @@ go_bandit([]() { it("should secondly sort by id [ 1]", [&]() { const node n = node(42u, 0u, terminal_F, terminal_T); - const node::uid_t u = node::uid_t(42u, 1u); + const node::uid_type u = node::uid_type(42u, 1u); AssertThat(n, Is().LessThan(u)); AssertThat(n, Is().LessThanOrEqualTo(u)); @@ -348,7 +348,7 @@ go_bandit([]() { it("should secondly sort by id [ 2]", [&]() { const node n = node(42u, 1u, terminal_F, terminal_T); - const node::uid_t u = node::uid_t(42u, 0u); + const node::uid_type u = node::uid_type(42u, 0u); AssertThat(u, Is().LessThan(n)); AssertThat(u, Is().LessThanOrEqualTo(n)); diff --git a/test/adiar/internal/data_types/test_ptr.cpp b/test/adiar/internal/data_types/test_ptr.cpp index 15219deff..9c5ba6227 100644 --- a/test/adiar/internal/data_types/test_ptr.cpp +++ b/test/adiar/internal/data_types/test_ptr.cpp @@ -3,28 +3,28 @@ go_bandit([]() { describe("adiar/internal/data_types/ptr.h", []() { describe("ptr_uint64", []() { - it("should recognise NIL (unflagged)", [&]() { - const ptr_uint64 some_value = ptr_uint64::NIL(); + it("should recognise nil (unflagged)", [&]() { + const ptr_uint64 some_value = ptr_uint64::nil(); AssertThat(some_value.is_nil(), Is().True()); }); - describe("NIL", [&](){ - it("should recognise NIL (unflagged)", [&]() { - const ptr_uint64 some_value = ptr_uint64::NIL(); + describe("nil", [&](){ + it("should recognise nil (unflagged)", [&]() { + const ptr_uint64 some_value = ptr_uint64::nil(); AssertThat(some_value.is_nil(), Is().True()); }); - it("should recognise NIL (flagged)", [&]() { - const ptr_uint64 some_value = flag(ptr_uint64::NIL()); + it("should recognise nil (flagged)", [&]() { + const ptr_uint64 some_value = flag(ptr_uint64::nil()); AssertThat(some_value.is_nil(), Is().True()); }); it("can see whether the flag is set", [&]() { - AssertThat(flag(ptr_uint64::NIL()).is_flagged(), Is().True()); + AssertThat(flag(ptr_uint64::nil()).is_flagged(), Is().True()); }); it("can see whether the flag is not set", [&]() { - AssertThat(ptr_uint64::NIL().is_flagged(), Is().False()); + AssertThat(ptr_uint64::nil().is_flagged(), Is().False()); }); }); @@ -72,8 +72,8 @@ go_bandit([]() { }); it("should not be confused with Node Ptr (unflagged)", [&]() { - ptr_uint64 arc_node_max = ptr_uint64(ptr_uint64::MAX_LABEL, - ptr_uint64::MAX_ID); + ptr_uint64 arc_node_max = ptr_uint64(ptr_uint64::max_label, + ptr_uint64::max_id); AssertThat(arc_node_max.is_terminal(), Is().False()); AssertThat(arc_node_max.is_false(), Is().False()); @@ -91,8 +91,8 @@ go_bandit([]() { }); it("should not be confused with Node Ptr (flagged)", [&]() { - ptr_uint64 arc_node_max = flag(ptr_uint64(ptr_uint64::MAX_LABEL, - ptr_uint64::MAX_ID)); + ptr_uint64 arc_node_max = flag(ptr_uint64(ptr_uint64::max_label, + ptr_uint64::max_id)); AssertThat(arc_node_max.is_terminal(), Is().False()); AssertThat(arc_node_max.is_false(), Is().False()); @@ -110,11 +110,11 @@ go_bandit([]() { }); it("should not be confused with Nil (unflagged)", [&]() { - AssertThat(ptr_uint64::NIL().is_terminal(), Is().False()); + AssertThat(ptr_uint64::nil().is_terminal(), Is().False()); }); it("should not be confused with Nil (flagged)", [&]() { - AssertThat(flag(ptr_uint64::NIL()).is_terminal(), Is().False()); + AssertThat(flag(ptr_uint64::nil()).is_terminal(), Is().False()); }); }); @@ -151,8 +151,8 @@ go_bandit([]() { AssertThat(p.is_false(), Is().False()); }); - it("should reject NIL", [&]() { - ptr_uint64 p = ptr_uint64::NIL(); + it("should reject nil", [&]() { + ptr_uint64 p = ptr_uint64::nil(); AssertThat(p.is_false(), Is().False()); }); }); @@ -178,8 +178,8 @@ go_bandit([]() { AssertThat(p.is_true(), Is().False()); }); - it("should reject NIL", [&]() { - ptr_uint64 p = ptr_uint64::NIL(); + it("should reject nil", [&]() { + ptr_uint64 p = ptr_uint64::nil(); AssertThat(p.is_true(), Is().False()); }); }); @@ -232,15 +232,15 @@ go_bandit([]() { describe("is_node", [&]() { it("should recognise Node Ptr (unflagged)", [&]() { - const ptr_uint64 p_node_max = ptr_uint64(ptr_uint64::MAX_LABEL, - ptr_uint64::MAX_ID); + const ptr_uint64 p_node_max = ptr_uint64(ptr_uint64::max_label, + ptr_uint64::max_id); AssertThat(p_node_max.is_node(), Is().True()); const ptr_uint64 p_node_min = ptr_uint64(0,0); AssertThat(p_node_min.is_node(), Is().True()); - const ptr_uint64 p_node_min_max = ptr_uint64(0, ptr_uint64::MAX_ID); + const ptr_uint64 p_node_min_max = ptr_uint64(0, ptr_uint64::max_id); AssertThat(p_node_min_max.is_node(), Is().True()); const ptr_uint64 p_node = ptr_uint64(42,18); @@ -248,15 +248,15 @@ go_bandit([]() { }); it("should recognise Node Ptr (flagged)", [&]() { - const ptr_uint64 p_node_max = flag(ptr_uint64(ptr_uint64::MAX_LABEL, - ptr_uint64::MAX_ID)); + const ptr_uint64 p_node_max = flag(ptr_uint64(ptr_uint64::max_label, + ptr_uint64::max_id)); AssertThat(p_node_max.is_node(), Is().True()); const ptr_uint64 p_node_min = flag(ptr_uint64(0,0)); AssertThat(p_node_min.is_node(), Is().True()); - const ptr_uint64 p_node_min_max = ptr_uint64(0, ptr_uint64::MAX_ID); + const ptr_uint64 p_node_min_max = ptr_uint64(0, ptr_uint64::max_id); AssertThat(p_node_min_max.is_node(), Is().True()); const ptr_uint64 p_node = flag(ptr_uint64(42,18)); @@ -272,17 +272,17 @@ go_bandit([]() { }); it("should not be confused with Nil (unflagged)", [&]() { - AssertThat(ptr_uint64::NIL().is_node(), Is().False()); + AssertThat(ptr_uint64::nil().is_node(), Is().False()); }); it("should not be confused with Nil (flagged)", [&]() { - AssertThat(flag(ptr_uint64::NIL()).is_node(), Is().False()); + AssertThat(flag(ptr_uint64::nil()).is_node(), Is().False()); }); }); describe("label", [&]() { it("should store and retrieve label for Ptr with maximal id (unflagged)", [&]() { - const ptr_uint64 p = ptr_uint64(12, ptr_uint64::MAX_ID); + const ptr_uint64 p = ptr_uint64(12, ptr_uint64::max_id); AssertThat(p.label(), Is().EqualTo(12u)); }); @@ -297,14 +297,14 @@ go_bandit([]() { }); it("should store and retrieve MAX label Ptr (unflagged)", [&]() { - const ptr_uint64 p = ptr_uint64(ptr_uint64::MAX_LABEL, - ptr_uint64::MAX_ID); + const ptr_uint64 p = ptr_uint64(ptr_uint64::max_label, + ptr_uint64::max_id); - AssertThat(p.label(), Is().EqualTo(ptr_uint64::MAX_LABEL)); + AssertThat(p.label(), Is().EqualTo(ptr_uint64::max_label)); }); it("should store and retrieve label for Ptr with maximal id (flagged)", [&]() { - const ptr_uint64 p = flag(ptr_uint64(12, ptr_uint64::MAX_ID)); + const ptr_uint64 p = flag(ptr_uint64(12, ptr_uint64::max_id)); AssertThat(p.label(), Is().EqualTo(12u)); }); @@ -319,10 +319,10 @@ go_bandit([]() { }); it("should store and retrieve MAX label Ptr (flagged)", [&]() { - const ptr_uint64 p = ptr_uint64(ptr_uint64::MAX_LABEL, - ptr_uint64::MAX_ID); + const ptr_uint64 p = ptr_uint64(ptr_uint64::max_label, + ptr_uint64::max_id); - AssertThat(p.label(), Is().EqualTo(ptr_uint64::MAX_LABEL)); + AssertThat(p.label(), Is().EqualTo(ptr_uint64::max_label)); }); }); @@ -338,10 +338,10 @@ go_bandit([]() { }); it("should store and retrieve MAX id (unflagged)", [&]() { - const ptr_uint64 p = ptr_uint64(ptr_uint64::MAX_LABEL, - ptr_uint64::MAX_ID); + const ptr_uint64 p = ptr_uint64(ptr_uint64::max_label, + ptr_uint64::max_id); - AssertThat(p.id(), Is().EqualTo(ptr_uint64::MAX_ID)); + AssertThat(p.id(), Is().EqualTo(ptr_uint64::max_id)); }); it("should store and retrieve 42 id (flagged)", [&]() { @@ -355,10 +355,10 @@ go_bandit([]() { }); it("should store and retrieve MAX id (flagged)", [&]() { - const ptr_uint64 p = ptr_uint64(ptr_uint64::MAX_LABEL, - ptr_uint64::MAX_ID); + const ptr_uint64 p = ptr_uint64(ptr_uint64::max_label, + ptr_uint64::max_id); - AssertThat(p.id(), Is().EqualTo(ptr_uint64::MAX_ID)); + AssertThat(p.id(), Is().EqualTo(ptr_uint64::max_id)); }); }); @@ -374,12 +374,12 @@ go_bandit([]() { }); it("has default value of 0 (max-id)", [&]() { - const ptr_uint64 p = flag(ptr_uint64(2,ptr_uint64::MAX_ID)); + const ptr_uint64 p = flag(ptr_uint64(2,ptr_uint64::max_id)); AssertThat(p.out_idx(), Is().EqualTo(0u)); }); it("has maximum out-index be 1", [&]() { - AssertThat(ptr_uint64::MAX_OUT_IDX, Is().EqualTo(1u)); + AssertThat(ptr_uint64::max_out_idx, Is().EqualTo(1u)); }); it("should store and retrieve 'false' out-index (unflagged)", [&]() { @@ -470,9 +470,9 @@ go_bandit([]() { it("should sort F terminal after (largest) internal node", [&]() { // Create a node pointer with the highest possible raw value - const ptr_uint64 p_node = flag(ptr_uint64(ptr_uint64::MAX_LABEL, - ptr_uint64::MAX_ID, - ptr_uint64::MAX_OUT_IDX)); + const ptr_uint64 p_node = flag(ptr_uint64(ptr_uint64::max_label, + ptr_uint64::max_id, + ptr_uint64::max_out_idx)); AssertThat(p_node < terminal_F, Is().True()); AssertThat(flag(p_node) < terminal_F, Is().True()); @@ -482,9 +482,9 @@ go_bandit([]() { it("should sort T terminal after (largest) internal node", [&]() { // Create a node pointer with the highest possible raw value - const ptr_uint64 p_node = ptr_uint64(ptr_uint64::MAX_LABEL, - ptr_uint64::MAX_ID, - ptr_uint64::MAX_OUT_IDX); + const ptr_uint64 p_node = ptr_uint64(ptr_uint64::max_label, + ptr_uint64::max_id, + ptr_uint64::max_out_idx); AssertThat(p_node < terminal_T, Is().True()); AssertThat(flag(p_node) < terminal_T, Is().True()); diff --git a/test/adiar/internal/data_types/test_request.cpp b/test/adiar/internal/data_types/test_request.cpp index 60762eed5..0452c6d50 100644 --- a/test/adiar/internal/data_types/test_request.cpp +++ b/test/adiar/internal/data_types/test_request.cpp @@ -29,74 +29,74 @@ go_bandit([]() { const auto node_carry_size = request<1>::node_carry_size; AssertThat(node_carry_size, Is().EqualTo(0u)); - const request<1> rec({ request<1>::ptr_t(0,0) }, {}); + const request<1> rec({ request<1>::pointer_type(0,0) }, {}); AssertThat(sizeof(rec), Is().EqualTo(1u * 8u)); }); describe(".level()", []() { it("returns the level of the target [1]", []() { - const request<1> req({request<1>::ptr_t(0u,0u)}, {}); + const request<1> req({request<1>::pointer_type(0u,0u)}, {}); AssertThat(req.level(), Is().EqualTo(0u)); }); it("returns the level of the target [2]", []() { - const request<1> req({request<1>::ptr_t(0u,1u)}, {}); + const request<1> req({request<1>::pointer_type(0u,1u)}, {}); AssertThat(req.level(), Is().EqualTo(0u)); }); it("returns the level of the target [3]", []() { - const request<1> req({request<1>::ptr_t(1u,0u)}, {}); + const request<1> req({request<1>::pointer_type(1u,0u)}, {}); AssertThat(req.level(), Is().EqualTo(1u)); }); it("returns the level of the target [4]", []() { - const request<1> req({request<1>::ptr_t(42u,21u)}, {}); + const request<1> req({request<1>::pointer_type(42u,21u)}, {}); AssertThat(req.level(), Is().EqualTo(42u)); }); }); describe(".nodes_carried()", []() { it("does not carry any nodes [1]", []() { - const request<1> req({request<1>::ptr_t(0u,0u)}, {}); + const request<1> req({request<1>::pointer_type(0u,0u)}, {}); AssertThat(req.nodes_carried(), Is().EqualTo(0u)); }); it("does not carry any nodes [2]", []() { - const request<1> req({request<1>::ptr_t(42u,21u)}, {}); + const request<1> req({request<1>::pointer_type(42u,21u)}, {}); AssertThat(req.nodes_carried(), Is().EqualTo(0u)); }); }); describe(".empty_carry()", []() { it("is true", []() { - const request<1> req(request<1>::ptr_t(0u,0u), {}); + const request<1> req(request<1>::pointer_type(0u,0u), {}); AssertThat(req.empty_carry(), Is().True()); }); }); describe(".targets()", []() { - it("is 0 for NIL target", []() { - const request<1> req(request<1>::ptr_t::NIL(), {}); + it("is 0 for nil target", []() { + const request<1> req(request<1>::pointer_type::nil(), {}); AssertThat(req.targets(), Is().EqualTo(0)); }); it("is 1 for (0,0) target", []() { - const request<1> req(request<1>::ptr_t(0,0), {}); + const request<1> req(request<1>::pointer_type(0,0), {}); AssertThat(req.targets(), Is().EqualTo(1)); }); it("is 1 for (MAX,MAX) target", []() { - const request<1> req(request<1>::ptr_t(request<1>::ptr_t::MAX_LABEL,request<1>::ptr_t::MAX_ID), {}); + const request<1> req(request<1>::pointer_type(request<1>::pointer_type::max_label,request<1>::pointer_type::max_id), {}); AssertThat(req.targets(), Is().EqualTo(1)); }); it("is 1 for F target", []() { - const request<1> req(request<1>::ptr_t(false), {}); + const request<1> req(request<1>::pointer_type(false), {}); AssertThat(req.targets(), Is().EqualTo(1)); }); it("is 1 for T target", []() { - const request<1> req(request<1>::ptr_t(true), {}); + const request<1> req(request<1>::pointer_type(true), {}); AssertThat(req.targets(), Is().EqualTo(1)); }); }); @@ -133,7 +133,7 @@ go_bandit([]() { const auto node_carry_size = request<2>::node_carry_size; AssertThat(node_carry_size, Is().EqualTo(0u)); - const request<2,0> rec({ request<2>::ptr_t(0,0), request<2>::ptr_t(0,0) }, { }); + const request<2,0> rec({ request<2>::pointer_type(0,0), request<2>::pointer_type(0,0) }, { }); AssertThat(sizeof(rec), Is().EqualTo(2u * 8u + 0u * 2u * 8u)); }); @@ -141,131 +141,131 @@ go_bandit([]() { const auto node_carry_size = request<2,1>::node_carry_size; AssertThat(node_carry_size, Is().EqualTo(1u)); - const request<2,1> rec({ request<2>::ptr_t(0,0), request<2>::ptr_t(0,0) }, - {{ {request<2>::ptr_t::NIL()} }}); + const request<2,1> rec({ request<2>::pointer_type(0,0), request<2>::pointer_type(0,0) }, + {{ {request<2>::pointer_type::nil()} }}); AssertThat(sizeof(rec), Is().EqualTo(2u * 8u + 1u * 2u * 8u)); }); describe(".level()", []() { it("returns the level of the first uid in target [1]", []() { - const request<2> req({request<2>::ptr_t(0u,1u), request<2>::ptr_t(1u,0u)}, {}); + const request<2> req({request<2>::pointer_type(0u,1u), request<2>::pointer_type(1u,0u)}, {}); AssertThat(req.level(), Is().EqualTo(0u)); }); it("returns the level of the first uid in target [2]", []() { - const request<2> req({request<2>::ptr_t(1u,0u), request<2>::ptr_t(0u,1u)}, {}); + const request<2> req({request<2>::pointer_type(1u,0u), request<2>::pointer_type(0u,1u)}, {}); AssertThat(req.level(), Is().EqualTo(0u)); }); it("returns the level of the first uid in target [3]", []() { - const request<2> req({request<2>::ptr_t(21u,11u), request<2>::ptr_t(42u,8u)}, {}); + const request<2> req({request<2>::pointer_type(21u,11u), request<2>::pointer_type(42u,8u)}, {}); AssertThat(req.level(), Is().EqualTo(21u)); }); it("returns the level of the first uid in target [4]", []() { - const request<2> req({request<2>::ptr_t(42u,11u), request<2>::ptr_t(21u,42u)}, {}); + const request<2> req({request<2>::pointer_type(42u,11u), request<2>::pointer_type(21u,42u)}, {}); AssertThat(req.level(), Is().EqualTo(21u)); }); }); describe(".nodes_carried()", []() { it("has no nodes when node_carry_size is 0", []() { - const request<2,0> req({request<2>::ptr_t(1u,1u), request<2>::ptr_t(1u,0u)}, {}); + const request<2,0> req({request<2>::pointer_type(1u,1u), request<2>::pointer_type(1u,0u)}, {}); AssertThat(req.nodes_carried(), Is().EqualTo(0u)); }); - it("has no nodes when node_carry_size is 1 with manually added NIL()", []() { - const request<2,1> req({request<2>::ptr_t(1u,1u), request<2>::ptr_t(1u,0u)}, - {{ request<2>::ptr_t::NIL() }}); + it("has no nodes when node_carry_size is 1 with manually added nil()", []() { + const request<2,1> req({request<2>::pointer_type(1u,1u), request<2>::pointer_type(1u,0u)}, + {{ request<2>::pointer_type::nil() }}); AssertThat(req.nodes_carried(), Is().EqualTo(0u)); }); it("has no nodes when node_carry_size is 1 with NO_CHILDREN()", []() { - const request<2,1> req({request<2>::ptr_t(1u,1u), request<2>::ptr_t(1u,0u)}, + const request<2,1> req({request<2>::pointer_type(1u,1u), request<2>::pointer_type(1u,0u)}, {{ request<2>::NO_CHILDREN() }}); AssertThat(req.nodes_carried(), Is().EqualTo(0u)); }); - it("has one nodes when node_carry_size is 1 with non-NIL content", []() { - const request<2,1> req({request<2>::ptr_t(1u,1u), request<2>::ptr_t(1u,0u)}, - {{ {request<2>::ptr_t(2u,1u), request<2>::ptr_t(2u,0u)} }}); + it("has one nodes when node_carry_size is 1 with non-nil content", []() { + const request<2,1> req({request<2>::pointer_type(1u,1u), request<2>::pointer_type(1u,0u)}, + {{ {request<2>::pointer_type(2u,1u), request<2>::pointer_type(2u,0u)} }}); AssertThat(req.nodes_carried(), Is().EqualTo(1u)); }); }); describe(".empty_carry()", []() { it("is true when node_carry_size is 0", []() { - const request<2,0> req({request<2>::ptr_t(1u,1u), request<2>::ptr_t(1u,0u)}, {}); + const request<2,0> req({request<2>::pointer_type(1u,1u), request<2>::pointer_type(1u,0u)}, {}); AssertThat(req.empty_carry(), Is().True()); }); - it("is true when node_carry_size is 1 with manually added NIL()", []() { - const request<2,1> req({request<2>::ptr_t(1u,1u), request<2>::ptr_t(1u,0u)}, - {{ request<2>::ptr_t::NIL() }}); + it("is true when node_carry_size is 1 with manually added nil()", []() { + const request<2,1> req({request<2>::pointer_type(1u,1u), request<2>::pointer_type(1u,0u)}, + {{ request<2>::pointer_type::nil() }}); AssertThat(req.empty_carry(), Is().True()); }); it("is true when node_carry_size is 1 with NO_CHILDREN()", []() { - const request<2,1> req({request<2>::ptr_t(1u,1u), request<2>::ptr_t(1u,0u)}, + const request<2,1> req({request<2>::pointer_type(1u,1u), request<2>::pointer_type(1u,0u)}, {{ request<2>::NO_CHILDREN() }}); AssertThat(req.empty_carry(), Is().True()); }); - it("is false when node_carry_size is 1 with non-NIL content", []() { - const request<2,1> req({request<2>::ptr_t(1u,1u), request<2>::ptr_t(1u,0u)}, - {{ {request<2>::ptr_t(2u,1u), request<2>::ptr_t(2u,0u)} }}); + it("is false when node_carry_size is 1 with non-nil content", []() { + const request<2,1> req({request<2>::pointer_type(1u,1u), request<2>::pointer_type(1u,0u)}, + {{ {request<2>::pointer_type(2u,1u), request<2>::pointer_type(2u,0u)} }}); AssertThat(req.empty_carry(), Is().False()); }); }); describe(".targets()", []() { - it("is 0 for {NIL, NIL} target [unsorted]", []() { - const request<2>req({request<2>::ptr_t::NIL(), request<2>::ptr_t::NIL()}, {}); + it("is 0 for {nil, nil} target [unsorted]", []() { + const request<2>req({request<2>::pointer_type::nil(), request<2>::pointer_type::nil()}, {}); AssertThat(req.targets(), Is().EqualTo(0)); }); - it("is 0 for {NIL, NIL} target [sorted]", []() { - const request<2,0,1> req({request<2>::ptr_t::NIL(), request<2>::ptr_t::NIL()}, {}); + it("is 0 for {nil, nil} target [sorted]", []() { + const request<2,0,1> req({request<2>::pointer_type::nil(), request<2>::pointer_type::nil()}, {}); AssertThat(req.targets(), Is().EqualTo(0)); }); - it("is 1 for {(0,0), NIL} target [unsorted]", []() { - const request<2> req({request<2>::ptr_t(0,0), request<2>::ptr_t::NIL()}, {}); + it("is 1 for {(0,0), nil} target [unsorted]", []() { + const request<2> req({request<2>::pointer_type(0,0), request<2>::pointer_type::nil()}, {}); AssertThat(req.targets(), Is().EqualTo(1)); }); - it("is 1 for {NIL, (0,0)} target [unsorted]", []() { - const request<2> req({request<2>::ptr_t(0,0), request<2>::ptr_t::NIL()}, {}); + it("is 1 for {nil, (0,0)} target [unsorted]", []() { + const request<2> req({request<2>::pointer_type(0,0), request<2>::pointer_type::nil()}, {}); AssertThat(req.targets(), Is().EqualTo(1)); }); - it("is 1 for {(0,0), NIL} target [sorted]", []() { - const request<2,0,1> req({request<2>::ptr_t(0,0), request<2>::ptr_t::NIL()}, {}); + it("is 1 for {(0,0), nil} target [sorted]", []() { + const request<2,0,1> req({request<2>::pointer_type(0,0), request<2>::pointer_type::nil()}, {}); AssertThat(req.targets(), Is().EqualTo(1)); }); - it("is 1 for {F, NIL} target [unsorted]", []() { - const request<2> req({request<2>::ptr_t(false), request<2>::ptr_t::NIL()}, {}); + it("is 1 for {F, nil} target [unsorted]", []() { + const request<2> req({request<2>::pointer_type(false), request<2>::pointer_type::nil()}, {}); AssertThat(req.targets(), Is().EqualTo(1)); }); - it("is 1 for {T, NIL} target [sorted]", []() { - const request<2,0,1> req({request<2>::ptr_t(true), request<2>::ptr_t::NIL()}, {}); + it("is 1 for {T, nil} target [sorted]", []() { + const request<2,0,1> req({request<2>::pointer_type(true), request<2>::pointer_type::nil()}, {}); AssertThat(req.targets(), Is().EqualTo(1)); }); it("is 2 for {(0,0), T} target [unsorted]", []() { - const request<2> req({request<2>::ptr_t(0,0), request<2>::ptr_t(true)}, {}); + const request<2> req({request<2>::pointer_type(0,0), request<2>::pointer_type(true)}, {}); AssertThat(req.targets(), Is().EqualTo(2)); }); it("is 2 for {F, (1,0)} target [unsorted]", []() { - const request<2> req({request<2>::ptr_t(false), request<2>::ptr_t(1,0)}, {}); + const request<2> req({request<2>::pointer_type(false), request<2>::pointer_type(1,0)}, {}); AssertThat(req.targets(), Is().EqualTo(2)); }); it("is 2 for {(0,0), T} target [sorted]", []() { - const request<2,0,1> req({request<2>::ptr_t(0,0), request<2>::ptr_t(true)}, {}); + const request<2,0,1> req({request<2>::pointer_type(0,0), request<2>::pointer_type(true)}, {}); AssertThat(req.targets(), Is().EqualTo(2)); }); }); @@ -302,7 +302,7 @@ go_bandit([]() { const auto node_carry_size = request<3>::node_carry_size; AssertThat(node_carry_size, Is().EqualTo(0u)); - const request<3,0> rec({ request<3>::ptr_t(0,0), request<3>::ptr_t(0,0), request<3>::ptr_t(0,0) }, + const request<3,0> rec({ request<3>::pointer_type(0,0), request<3>::pointer_type(0,0), request<3>::pointer_type(0,0) }, { }); AssertThat(sizeof(rec), Is().EqualTo(3u * 8u + 0u * 2u * 8u)); }); @@ -311,8 +311,8 @@ go_bandit([]() { const auto node_carry_size = request<3,1>::node_carry_size; AssertThat(node_carry_size, Is().EqualTo(1u)); - const request<3,1> rec({ request<3>::ptr_t(0,0), request<3>::ptr_t(0,0), request<3>::ptr_t(0,0) }, - {{ {request<3>::ptr_t::NIL()} }}); + const request<3,1> rec({ request<3>::pointer_type(0,0), request<3>::pointer_type(0,0), request<3>::pointer_type(0,0) }, + {{ {request<3>::pointer_type::nil()} }}); AssertThat(sizeof(rec), Is().EqualTo(3u * 8u + 1u * 2u * 8u)); }); @@ -320,192 +320,192 @@ go_bandit([]() { const auto node_carry_size = request<3,2>::node_carry_size; AssertThat(node_carry_size, Is().EqualTo(2u)); - const request<3,2> rec({ request<3>::ptr_t(0,0), request<3>::ptr_t(0,0), request<3>::ptr_t(0,0) }, - {{ {request<3>::ptr_t::NIL()}, - {request<3>::ptr_t::NIL()} }}); + const request<3,2> rec({ request<3>::pointer_type(0,0), request<3>::pointer_type(0,0), request<3>::pointer_type(0,0) }, + {{ {request<3>::pointer_type::nil()}, + {request<3>::pointer_type::nil()} }}); AssertThat(sizeof(rec), Is().EqualTo(3u * 8u + 2u * 2u * 8u)); }); describe(".level()", []() { it("returns the level of the first uid in target [1]", []() { - const request<3> req({request<3>::ptr_t(0u,2u), request<3>::ptr_t(1u,1u), request<3>::ptr_t(2u,0u)}, {}); + const request<3> req({request<3>::pointer_type(0u,2u), request<3>::pointer_type(1u,1u), request<3>::pointer_type(2u,0u)}, {}); AssertThat(req.level(), Is().EqualTo(0u)); }); it("returns the level of the first uid in target [2]", []() { - const request<3> req({request<3>::ptr_t(1u,1u), request<3>::ptr_t(0u,2u), request<3>::ptr_t(2u,0u)}, {}); + const request<3> req({request<3>::pointer_type(1u,1u), request<3>::pointer_type(0u,2u), request<3>::pointer_type(2u,0u)}, {}); AssertThat(req.level(), Is().EqualTo(0u)); }); it("returns the level of the first uid in target [3]", []() { - const request<3> req({request<3>::ptr_t(1u,1u), request<3>::ptr_t(2u,0u), request<3>::ptr_t(0u,2u)}, {}); + const request<3> req({request<3>::pointer_type(1u,1u), request<3>::pointer_type(2u,0u), request<3>::pointer_type(0u,2u)}, {}); AssertThat(req.level(), Is().EqualTo(0u)); }); it("returns the level of the first uid in target [4]", []() { - const request<3> req({request<3>::ptr_t(32u,0u), request<3>::ptr_t(21u,11u), request<3>::ptr_t(42u,8u)}, {}); + const request<3> req({request<3>::pointer_type(32u,0u), request<3>::pointer_type(21u,11u), request<3>::pointer_type(42u,8u)}, {}); AssertThat(req.level(), Is().EqualTo(21u)); }); it("returns the level of the first uid in target [4]", []() { - const request<3> req({request<3>::ptr_t(32u,0u), request<3>::ptr_t(42u,11u), request<3>::ptr_t(21u,42u)}, {}); + const request<3> req({request<3>::pointer_type(32u,0u), request<3>::pointer_type(42u,11u), request<3>::pointer_type(21u,42u)}, {}); AssertThat(req.level(), Is().EqualTo(21u)); }); }); describe(".nodes_carried()", []() { it("has no nodes when node_carry_size is 0", []() { - const request<3,0> req({request<3>::ptr_t(1u,1u), request<3>::ptr_t(1u,0u), request<3>::ptr_t(1u,2u)}, + const request<3,0> req({request<3>::pointer_type(1u,1u), request<3>::pointer_type(1u,0u), request<3>::pointer_type(1u,2u)}, {}); AssertThat(req.nodes_carried(), Is().EqualTo(0u)); }); - it("has no nodes when node_carry_size is 1 with manually added NIL()", []() { - const request<3,1> req({request<3>::ptr_t(1u,1u), request<3>::ptr_t(1u,0u), request<3>::ptr_t(1u,2u)}, - {{ {request<3>::ptr_t::NIL()} }}); + it("has no nodes when node_carry_size is 1 with manually added nil()", []() { + const request<3,1> req({request<3>::pointer_type(1u,1u), request<3>::pointer_type(1u,0u), request<3>::pointer_type(1u,2u)}, + {{ {request<3>::pointer_type::nil()} }}); AssertThat(req.nodes_carried(), Is().EqualTo(0u)); }); - it("has no nodes when node_carry_size is 2 with manually added NIL()", []() { - const request<3,2> req({request<3>::ptr_t(1u,1u), request<3>::ptr_t(1u,0u), request<3>::ptr_t(1u,2u)}, - {{ {request<3>::ptr_t::NIL()}, - {request<3>::ptr_t::NIL()} }}); + it("has no nodes when node_carry_size is 2 with manually added nil()", []() { + const request<3,2> req({request<3>::pointer_type(1u,1u), request<3>::pointer_type(1u,0u), request<3>::pointer_type(1u,2u)}, + {{ {request<3>::pointer_type::nil()}, + {request<3>::pointer_type::nil()} }}); AssertThat(req.nodes_carried(), Is().EqualTo(0u)); }); it("has no nodes when node_carry_size is 1 with NO_CHILDREN()", []() { - const request<3,1> req({request<3>::ptr_t(1u,1u), request<3>::ptr_t(1u,0u), request<3>::ptr_t(1u,2u)}, + const request<3,1> req({request<3>::pointer_type(1u,1u), request<3>::pointer_type(1u,0u), request<3>::pointer_type(1u,2u)}, {{ request<3>::NO_CHILDREN() }}); AssertThat(req.nodes_carried(), Is().EqualTo(0u)); }); it("has no nodes when node_carry_size is 2 with NO_CHILDREN()", []() { - const request<3,2> req({request<3>::ptr_t(1u,1u), request<3>::ptr_t(1u,0u), request<3>::ptr_t(1u,2u)}, + const request<3,2> req({request<3>::pointer_type(1u,1u), request<3>::pointer_type(1u,0u), request<3>::pointer_type(1u,2u)}, {{ request<3>::NO_CHILDREN(), request<3>::NO_CHILDREN() }}); AssertThat(req.nodes_carried(), Is().EqualTo(0u)); }); - it("has one nodes when node_carry_size is 1 with non-NIL content", []() { - const request<3,1> req({request<3>::ptr_t(1u,1u), request<3>::ptr_t(1u,0u), request<3>::ptr_t(1u,2u)}, - {{ {request<3>::ptr_t(2u,1u), request<3>::ptr_t(2u,0u)} }}); + it("has one nodes when node_carry_size is 1 with non-nil content", []() { + const request<3,1> req({request<3>::pointer_type(1u,1u), request<3>::pointer_type(1u,0u), request<3>::pointer_type(1u,2u)}, + {{ {request<3>::pointer_type(2u,1u), request<3>::pointer_type(2u,0u)} }}); AssertThat(req.nodes_carried(), Is().EqualTo(1u)); }); - it("has one nodes when node_carry_size is 2 with non-NIL and NIL content", []() { - const request<3,2> req({request<3>::ptr_t(1u,1u), request<3>::ptr_t(1u,0u), request<3>::ptr_t(1u,2u)}, - {{ {request<3>::ptr_t(2u,1u), request<3>::ptr_t(2u,0u)}, + it("has one nodes when node_carry_size is 2 with non-nil and nil content", []() { + const request<3,2> req({request<3>::pointer_type(1u,1u), request<3>::pointer_type(1u,0u), request<3>::pointer_type(1u,2u)}, + {{ {request<3>::pointer_type(2u,1u), request<3>::pointer_type(2u,0u)}, request<3>::NO_CHILDREN() }}); AssertThat(req.nodes_carried(), Is().EqualTo(1u)); }); - it("has two nodes when node_carry_size is 2 with non-NIL content", []() { - const request<3,2> req({request<3>::ptr_t(1u,1u), request<3>::ptr_t(1u,0u), request<3>::ptr_t(1u,2u)}, - {{ {request<3>::ptr_t(2u,1u), request<3>::ptr_t(2u,0u)}, - {request<3>::ptr_t(2u,1u), request<3>::ptr_t(2u,0u)} }}); + it("has two nodes when node_carry_size is 2 with non-nil content", []() { + const request<3,2> req({request<3>::pointer_type(1u,1u), request<3>::pointer_type(1u,0u), request<3>::pointer_type(1u,2u)}, + {{ {request<3>::pointer_type(2u,1u), request<3>::pointer_type(2u,0u)}, + {request<3>::pointer_type(2u,1u), request<3>::pointer_type(2u,0u)} }}); AssertThat(req.nodes_carried(), Is().EqualTo(2u)); }); }); describe(".empty_carry()", []() { it("is true when node_carry_size is 0", []() { - const request<3,0> req({request<3>::ptr_t(1u,1u), request<3>::ptr_t(1u,0u), request<3>::ptr_t(1u,2u)}, + const request<3,0> req({request<3>::pointer_type(1u,1u), request<3>::pointer_type(1u,0u), request<3>::pointer_type(1u,2u)}, {}); AssertThat(req.empty_carry(), Is().True()); }); it("is true when node_carry_size is 1 with NO_CHILDREN()", []() { - const request<3,1> req({request<3>::ptr_t(1u,1u), request<3>::ptr_t(1u,0u), request<3>::ptr_t(1u,2u)}, + const request<3,1> req({request<3>::pointer_type(1u,1u), request<3>::pointer_type(1u,0u), request<3>::pointer_type(1u,2u)}, { request<3>::NO_CHILDREN() }); AssertThat(req.empty_carry(), Is().True()); }); it("is true nodes when node_carry_size is 2 with NO_CHILDREN()", []() { - const request<3,2> req({request<3>::ptr_t(1u,1u), request<3>::ptr_t(1u,0u), request<3>::ptr_t(1u,2u)}, + const request<3,2> req({request<3>::pointer_type(1u,1u), request<3>::pointer_type(1u,0u), request<3>::pointer_type(1u,2u)}, {{ request<3>::NO_CHILDREN(), request<3>::NO_CHILDREN() }}); AssertThat(req.empty_carry(), Is().True()); }); - it("is false nodes when node_carry_size is 1 with non-NIL content", []() { - const request<3,1> req({request<3>::ptr_t(1u,1u), request<3>::ptr_t(1u,0u), request<3>::ptr_t(1u,2u)}, - {{ {request<3>::ptr_t(2u,1u), request<3>::ptr_t(2u,0u)} }}); + it("is false nodes when node_carry_size is 1 with non-nil content", []() { + const request<3,1> req({request<3>::pointer_type(1u,1u), request<3>::pointer_type(1u,0u), request<3>::pointer_type(1u,2u)}, + {{ {request<3>::pointer_type(2u,1u), request<3>::pointer_type(2u,0u)} }}); AssertThat(req.empty_carry(), Is().False()); }); - it("is false nodes when node_carry_size is 2 with non-NIL and NIL content", []() { - const request<3,2> req({request<3>::ptr_t(1u,1u), request<3>::ptr_t(1u,0u), request<3>::ptr_t(1u,2u)}, - {{ {request<3>::ptr_t(2u,1u), request<3>::ptr_t(2u,0u)}, + it("is false nodes when node_carry_size is 2 with non-nil and nil content", []() { + const request<3,2> req({request<3>::pointer_type(1u,1u), request<3>::pointer_type(1u,0u), request<3>::pointer_type(1u,2u)}, + {{ {request<3>::pointer_type(2u,1u), request<3>::pointer_type(2u,0u)}, request<3>::NO_CHILDREN() }}); AssertThat(req.empty_carry(), Is().False()); }); - it("is false nodes when node_carry_size is 2 with non-NIL content", []() { - const request<3,2> req({request<3>::ptr_t(1u,1u), request<3>::ptr_t(1u,0u), request<3>::ptr_t(1u,2u)}, - {{ {request<3>::ptr_t(2u,1u), request<3>::ptr_t(2u,0u)}, - {request<3>::ptr_t(2u,1u), request<3>::ptr_t(2u,0u)} }}); + it("is false nodes when node_carry_size is 2 with non-nil content", []() { + const request<3,2> req({request<3>::pointer_type(1u,1u), request<3>::pointer_type(1u,0u), request<3>::pointer_type(1u,2u)}, + {{ {request<3>::pointer_type(2u,1u), request<3>::pointer_type(2u,0u)}, + {request<3>::pointer_type(2u,1u), request<3>::pointer_type(2u,0u)} }}); AssertThat(req.empty_carry(), Is().False()); }); }); describe(".targets()", []() { - it("is 0 for {NIL, NIL, NIL} target [unsorted]", []() { - const request<3>req({request<3>::ptr_t::NIL(), request<3>::ptr_t::NIL(), request<3>::ptr_t::NIL()}, {}); + it("is 0 for {nil, nil, nil} target [unsorted]", []() { + const request<3>req({request<3>::pointer_type::nil(), request<3>::pointer_type::nil(), request<3>::pointer_type::nil()}, {}); AssertThat(req.targets(), Is().EqualTo(0)); }); - it("is 0 for {NIL, NIL, NIL} target [sorted]", []() { - const request<3,0,1> req({request<3>::ptr_t::NIL(), request<3>::ptr_t::NIL(), request<3>::ptr_t::NIL()}, {}); + it("is 0 for {nil, nil, nil} target [sorted]", []() { + const request<3,0,1> req({request<3>::pointer_type::nil(), request<3>::pointer_type::nil(), request<3>::pointer_type::nil()}, {}); AssertThat(req.targets(), Is().EqualTo(0)); }); - it("is 1 for {NIL, T, NIL} target [unsorted]", []() { - const request<3> req({request<3>::ptr_t::NIL(), request<3>::ptr_t(true), request<3>::ptr_t::NIL()}, {}); + it("is 1 for {nil, T, nil} target [unsorted]", []() { + const request<3> req({request<3>::pointer_type::nil(), request<3>::pointer_type(true), request<3>::pointer_type::nil()}, {}); AssertThat(req.targets(), Is().EqualTo(1)); }); - it("is 1 for {(1,0), NIL, NIL} target [unsorted]", []() { - const request<3> req({request<3>::ptr_t(1,0), request<3>::ptr_t::NIL(), request<3>::ptr_t::NIL()}, {}); + it("is 1 for {(1,0), nil, nil} target [unsorted]", []() { + const request<3> req({request<3>::pointer_type(1,0), request<3>::pointer_type::nil(), request<3>::pointer_type::nil()}, {}); AssertThat(req.targets(), Is().EqualTo(1)); }); - it("is 1 for {NIL, NIL, (0,0)} target [unsorted]", []() { - const request<3> req({request<3>::ptr_t::NIL(), request<3>::ptr_t::NIL(), request<3>::ptr_t(0,0)}, {}); + it("is 1 for {nil, nil, (0,0)} target [unsorted]", []() { + const request<3> req({request<3>::pointer_type::nil(), request<3>::pointer_type::nil(), request<3>::pointer_type(0,0)}, {}); AssertThat(req.targets(), Is().EqualTo(1)); }); - it("is 1 for {T, NIL, NIL} target [sorted]", []() { - const request<3,0,1> req({request<3>::ptr_t(true), request<3>::ptr_t::NIL(), request<3>::ptr_t::NIL()}, {}); + it("is 1 for {T, nil, nil} target [sorted]", []() { + const request<3,0,1> req({request<3>::pointer_type(true), request<3>::pointer_type::nil(), request<3>::pointer_type::nil()}, {}); AssertThat(req.targets(), Is().EqualTo(1)); }); - it("is 2 for {T, NIL, (0,0)} target [unsorted]", []() { - const request<3> req({request<3>::ptr_t(true), request<3>::ptr_t::NIL(), request<3>::ptr_t(0,0)}, {}); + it("is 2 for {T, nil, (0,0)} target [unsorted]", []() { + const request<3> req({request<3>::pointer_type(true), request<3>::pointer_type::nil(), request<3>::pointer_type(0,0)}, {}); AssertThat(req.targets(), Is().EqualTo(2)); }); - it("is 2 for {NIL, (42,0), (0,0)} target [unsorted]", []() { - const request<3> req({request<3>::ptr_t::NIL(), request<3>::ptr_t(42,0), request<3>::ptr_t(0,0)}, {}); + it("is 2 for {nil, (42,0), (0,0)} target [unsorted]", []() { + const request<3> req({request<3>::pointer_type::nil(), request<3>::pointer_type(42,0), request<3>::pointer_type(0,0)}, {}); AssertThat(req.targets(), Is().EqualTo(2)); }); - it("is 2 for {(42,0), (0,0), NIL} target [unsorted]", []() { - const request<3> req({request<3>::ptr_t(42,0), request<3>::ptr_t(0,0), request<3>::ptr_t::NIL()}, {}); + it("is 2 for {(42,0), (0,0), nil} target [unsorted]", []() { + const request<3> req({request<3>::pointer_type(42,0), request<3>::pointer_type(0,0), request<3>::pointer_type::nil()}, {}); AssertThat(req.targets(), Is().EqualTo(2)); }); - it("is 2 for {(2,8), F, NIL} target [sorted]", []() { - const request<3,0,1> req({request<3>::ptr_t(2,8), request<3>::ptr_t(false), request<3>::ptr_t::NIL()}, {}); + it("is 2 for {(2,8), F, nil} target [sorted]", []() { + const request<3,0,1> req({request<3>::pointer_type(2,8), request<3>::pointer_type(false), request<3>::pointer_type::nil()}, {}); AssertThat(req.targets(), Is().EqualTo(2)); }); it("is 3 for {(2,8), F, (3,0)} target [unsorted]", []() { - const request<3> req({request<3>::ptr_t(2,8), request<3>::ptr_t(false), request<3>::ptr_t(3,0)}, {}); + const request<3> req({request<3>::pointer_type(2,8), request<3>::pointer_type(false), request<3>::pointer_type(3,0)}, {}); AssertThat(req.targets(), Is().EqualTo(3)); }); it("is 3 for {(2,8), (3,0), T} target [sorted]", []() { - const request<3,0,1> req({request<3>::ptr_t(2,8), request<3>::ptr_t(3,0), request<3>::ptr_t(true)}, {}); + const request<3,0,1> req({request<3>::pointer_type(2,8), request<3>::pointer_type(3,0), request<3>::pointer_type(true)}, {}); AssertThat(req.targets(), Is().EqualTo(3)); }); }); diff --git a/test/adiar/internal/data_types/test_uid.cpp b/test/adiar/internal/data_types/test_uid.cpp index 6d9bdce27..d5cbb134f 100644 --- a/test/adiar/internal/data_types/test_uid.cpp +++ b/test/adiar/internal/data_types/test_uid.cpp @@ -83,7 +83,7 @@ go_bandit([]() { it("should take up 8 bytes of memory", [&]() { AssertThat(sizeof(uid_uint64(0,0)), Is().EqualTo(8u)); AssertThat(sizeof(uid_uint64(42,21)), Is().EqualTo(8u)); - AssertThat(sizeof(uid_uint64(uid_uint64::MAX_LABEL, uid_uint64::MAX_ID)), Is().EqualTo(8u)); + AssertThat(sizeof(uid_uint64(uid_uint64::max_label, uid_uint64::max_id)), Is().EqualTo(8u)); }); describe("is_node", []() { diff --git a/test/adiar/internal/io/test_arc_file.cpp b/test/adiar/internal/io/test_arc_file.cpp index b610b43b1..e14a31f1f 100644 --- a/test/adiar/internal/io/test_arc_file.cpp +++ b/test/adiar/internal/io/test_arc_file.cpp @@ -19,7 +19,7 @@ go_bandit([]() { // AssertThat(af.semi_transposed, Is().True()); - AssertThat(af.max_1level_cut, Is().EqualTo(MAX_CUT)); + AssertThat(af.max_1level_cut, Is().EqualTo(cut::max)); AssertThat(af.number_of_terminals[false], Is().EqualTo(0u)); AssertThat(af.number_of_terminals[true], Is().EqualTo(0u)); @@ -29,9 +29,9 @@ go_bandit([]() { levelized_file af; arc_writer aw(af); - aw.push_internal(arc(arc::ptr_t(0,0), false, arc::ptr_t(1,0))); - aw.push_internal(arc(arc::ptr_t(0,0), true, arc::ptr_t(1,0))); - aw.push_internal(arc(arc::ptr_t(1,0), false, arc::ptr_t(2,0))); + aw.push_internal(arc(arc::pointer_type(0,0), false, arc::pointer_type(1,0))); + aw.push_internal(arc(arc::pointer_type(0,0), true, arc::pointer_type(1,0))); + aw.push_internal(arc(arc::pointer_type(1,0), false, arc::pointer_type(2,0))); aw.detach(); AssertThat(af.size(), Is().EqualTo(3u)); @@ -43,7 +43,7 @@ go_bandit([]() { // AssertThat(af.semi_transposed, Is().True()); - AssertThat(af.max_1level_cut, Is().EqualTo(MAX_CUT)); + AssertThat(af.max_1level_cut, Is().EqualTo(cut::max)); AssertThat(af.number_of_terminals[false], Is().EqualTo(0u)); AssertThat(af.number_of_terminals[true], Is().EqualTo(0u)); @@ -53,8 +53,8 @@ go_bandit([]() { levelized_file af; arc_writer aw(af); - aw.push_terminal(arc(arc::ptr_t(0,0), false, arc::ptr_t(true))); - aw.push_terminal(arc(arc::ptr_t(0,0), true, arc::ptr_t(true))); + aw.push_terminal(arc(arc::pointer_type(0,0), false, arc::pointer_type(true))); + aw.push_terminal(arc(arc::pointer_type(0,0), true, arc::pointer_type(true))); aw.detach(); AssertThat(af.size(), Is().EqualTo(2u)); @@ -73,9 +73,9 @@ go_bandit([]() { AssertThat(lfs.can_pull<0>(), Is().False()); AssertThat(lfs.can_pull<1>(), Is().True()); - AssertThat(lfs.pull<1>(), Is().EqualTo(arc(arc::ptr_t(0,0), false, arc::ptr_t(true)))); + AssertThat(lfs.pull<1>(), Is().EqualTo(arc(arc::pointer_type(0,0), false, arc::pointer_type(true)))); AssertThat(lfs.can_pull<1>(), Is().True()); - AssertThat(lfs.pull<1>(), Is().EqualTo(arc(arc::ptr_t(0,0), true, arc::ptr_t(true)))); + AssertThat(lfs.pull<1>(), Is().EqualTo(arc(arc::pointer_type(0,0), true, arc::pointer_type(true)))); AssertThat(lfs.can_pull<1>(), Is().False()); AssertThat(lfs.can_pull<2>(), Is().False()); @@ -85,8 +85,8 @@ go_bandit([]() { levelized_file af; arc_writer aw(af); - aw.push_terminal(arc(arc::ptr_t(0,0), true, arc::ptr_t(true))); - aw.push_terminal(arc(arc::ptr_t(0,0), false, arc::ptr_t(false))); + aw.push_terminal(arc(arc::pointer_type(0,0), true, arc::pointer_type(true))); + aw.push_terminal(arc(arc::pointer_type(0,0), false, arc::pointer_type(false))); aw.detach(); AssertThat(af.size(), Is().EqualTo(2u)); @@ -103,11 +103,11 @@ go_bandit([]() { AssertThat(lfs.can_pull<0>(), Is().False()); AssertThat(lfs.can_pull<1>(), Is().True()); - AssertThat(lfs.pull<1>(), Is().EqualTo(arc(arc::ptr_t(0,0), true, arc::ptr_t(true)))); + AssertThat(lfs.pull<1>(), Is().EqualTo(arc(arc::pointer_type(0,0), true, arc::pointer_type(true)))); AssertThat(lfs.can_pull<1>(), Is().False()); AssertThat(lfs.can_pull<2>(), Is().True()); - AssertThat(lfs.pull<2>(), Is().EqualTo(arc(arc::ptr_t(0,0), false, arc::ptr_t(false)))); + AssertThat(lfs.pull<2>(), Is().EqualTo(arc(arc::pointer_type(0,0), false, arc::pointer_type(false)))); AssertThat(lfs.can_pull<2>(), Is().False()); }); @@ -116,14 +116,14 @@ go_bandit([]() { arc_writer aw(af); - aw << arc(arc::ptr_t(0,0), false, arc::ptr_t(1,0)) - << arc(arc::ptr_t(1,0), true, arc::ptr_t(true)) // <-- in-order - << arc(arc::ptr_t(1,1), false, arc::ptr_t(true)) // <-- in-order - << arc(arc::ptr_t(0,0), true, arc::ptr_t(1,1)) - << arc(arc::ptr_t(1,0), false, arc::ptr_t(2,0)) - << arc(arc::ptr_t(2,0), false, arc::ptr_t(false)) // <-- in-order - << arc(arc::ptr_t(2,0), true, arc::ptr_t(true)) // <-- in-order - << arc(arc::ptr_t(1,1), true, arc::ptr_t(true)); // <-- out-of-order + aw << arc(arc::pointer_type(0,0), false, arc::pointer_type(1,0)) + << arc(arc::pointer_type(1,0), true, arc::pointer_type(true)) // <-- in-order + << arc(arc::pointer_type(1,1), false, arc::pointer_type(true)) // <-- in-order + << arc(arc::pointer_type(0,0), true, arc::pointer_type(1,1)) + << arc(arc::pointer_type(1,0), false, arc::pointer_type(2,0)) + << arc(arc::pointer_type(2,0), false, arc::pointer_type(false)) // <-- in-order + << arc(arc::pointer_type(2,0), true, arc::pointer_type(true)) // <-- in-order + << arc(arc::pointer_type(1,1), true, arc::pointer_type(true)); // <-- out-of-order aw.detach(); @@ -139,25 +139,25 @@ go_bandit([]() { levelized_file_stream lfs(af); AssertThat(lfs.can_pull<0>(), Is().True()); - AssertThat(lfs.pull<0>(), Is().EqualTo(arc(arc::ptr_t(0,0), false, arc::ptr_t(1,0)))); + AssertThat(lfs.pull<0>(), Is().EqualTo(arc(arc::pointer_type(0,0), false, arc::pointer_type(1,0)))); AssertThat(lfs.can_pull<0>(), Is().True()); - AssertThat(lfs.pull<0>(), Is().EqualTo(arc(arc::ptr_t(0,0), true, arc::ptr_t(1,1)))); + AssertThat(lfs.pull<0>(), Is().EqualTo(arc(arc::pointer_type(0,0), true, arc::pointer_type(1,1)))); AssertThat(lfs.can_pull<0>(), Is().True()); - AssertThat(lfs.pull<0>(), Is().EqualTo(arc(arc::ptr_t(1,0), false, arc::ptr_t(2,0)))); + AssertThat(lfs.pull<0>(), Is().EqualTo(arc(arc::pointer_type(1,0), false, arc::pointer_type(2,0)))); AssertThat(lfs.can_pull<0>(), Is().False()); AssertThat(lfs.can_pull<1>(), Is().True()); - AssertThat(lfs.pull<1>(), Is().EqualTo(arc(arc::ptr_t(1,0), true, arc::ptr_t(true)))); + AssertThat(lfs.pull<1>(), Is().EqualTo(arc(arc::pointer_type(1,0), true, arc::pointer_type(true)))); AssertThat(lfs.can_pull<1>(), Is().True()); - AssertThat(lfs.pull<1>(), Is().EqualTo(arc(arc::ptr_t(1,1), false, arc::ptr_t(true)))); + AssertThat(lfs.pull<1>(), Is().EqualTo(arc(arc::pointer_type(1,1), false, arc::pointer_type(true)))); AssertThat(lfs.can_pull<1>(), Is().True()); - AssertThat(lfs.pull<1>(), Is().EqualTo(arc(arc::ptr_t(2,0), false, arc::ptr_t(false)))); + AssertThat(lfs.pull<1>(), Is().EqualTo(arc(arc::pointer_type(2,0), false, arc::pointer_type(false)))); AssertThat(lfs.can_pull<1>(), Is().True()); - AssertThat(lfs.pull<1>(), Is().EqualTo(arc(arc::ptr_t(2,0), true, arc::ptr_t(true)))); + AssertThat(lfs.pull<1>(), Is().EqualTo(arc(arc::pointer_type(2,0), true, arc::pointer_type(true)))); AssertThat(lfs.can_pull<1>(), Is().False()); AssertThat(lfs.can_pull<2>(), Is().True()); - AssertThat(lfs.pull<2>(), Is().EqualTo(arc(arc::ptr_t(1,1), true, arc::ptr_t(true)))); + AssertThat(lfs.pull<2>(), Is().EqualTo(arc(arc::pointer_type(1,1), true, arc::pointer_type(true)))); AssertThat(lfs.can_pull<2>(), Is().False()); }); }); @@ -175,29 +175,29 @@ go_bandit([]() { */ { arc_writer aw(af); - aw << arc(arc::ptr_t(0,0), false, arc::ptr_t(1,0)); - aw << arc(arc::ptr_t(1,0), true, arc::ptr_t(true)); // <-- in-order - aw << arc(arc::ptr_t(1,1), false, arc::ptr_t(true)); // <-- in-order - aw << arc(arc::ptr_t(0,0), true, arc::ptr_t(1,1)); - aw << arc(arc::ptr_t(1,0), false, arc::ptr_t(2,0)); - aw << arc(arc::ptr_t(2,0), false, arc::ptr_t(false)); // <-- in-order - aw << arc(arc::ptr_t(2,0), true, arc::ptr_t(true)); // <-- in-order - aw << arc(arc::ptr_t(1,1), true, arc::ptr_t(true)); // <-- out-of-order + aw << arc(arc::pointer_type(0,0), false, arc::pointer_type(1,0)); + aw << arc(arc::pointer_type(1,0), true, arc::pointer_type(true)); // <-- in-order + aw << arc(arc::pointer_type(1,1), false, arc::pointer_type(true)); // <-- in-order + aw << arc(arc::pointer_type(0,0), true, arc::pointer_type(1,1)); + aw << arc(arc::pointer_type(1,0), false, arc::pointer_type(2,0)); + aw << arc(arc::pointer_type(2,0), false, arc::pointer_type(false)); // <-- in-order + aw << arc(arc::pointer_type(2,0), true, arc::pointer_type(true)); // <-- in-order + aw << arc(arc::pointer_type(1,1), true, arc::pointer_type(true)); // <-- out-of-order } it("merges terminal arcs on 'pull' [default: backwards]", [&af]() { arc_stream<> as(af); AssertThat(as.can_pull_terminal(), Is().True()); - AssertThat(as.pull_terminal(), Is().EqualTo(arc(arc::ptr_t(2,0), true, arc::ptr_t(true)))); + AssertThat(as.pull_terminal(), Is().EqualTo(arc(arc::pointer_type(2,0), true, arc::pointer_type(true)))); AssertThat(as.can_pull_terminal(), Is().True()); - AssertThat(as.pull_terminal(), Is().EqualTo(arc(arc::ptr_t(2,0), false, arc::ptr_t(false)))); + AssertThat(as.pull_terminal(), Is().EqualTo(arc(arc::pointer_type(2,0), false, arc::pointer_type(false)))); AssertThat(as.can_pull_terminal(), Is().True()); - AssertThat(as.pull_terminal(), Is().EqualTo(arc(arc::ptr_t(1,1), true, arc::ptr_t(true)))); + AssertThat(as.pull_terminal(), Is().EqualTo(arc(arc::pointer_type(1,1), true, arc::pointer_type(true)))); AssertThat(as.can_pull_terminal(), Is().True()); - AssertThat(as.pull_terminal(), Is().EqualTo(arc(arc::ptr_t(1,1), false, arc::ptr_t(true)))); + AssertThat(as.pull_terminal(), Is().EqualTo(arc(arc::pointer_type(1,1), false, arc::pointer_type(true)))); AssertThat(as.can_pull_terminal(), Is().True()); - AssertThat(as.pull_terminal(), Is().EqualTo(arc(arc::ptr_t(1,0), true, arc::ptr_t(true)))); + AssertThat(as.pull_terminal(), Is().EqualTo(arc(arc::pointer_type(1,0), true, arc::pointer_type(true)))); AssertThat(as.can_pull_terminal(), Is().False()); }); @@ -205,15 +205,15 @@ go_bandit([]() { arc_stream as(af); AssertThat(as.can_pull_terminal(), Is().True()); - AssertThat(as.pull_terminal(), Is().EqualTo(arc(arc::ptr_t(1,0), true, arc::ptr_t(true)))); + AssertThat(as.pull_terminal(), Is().EqualTo(arc(arc::pointer_type(1,0), true, arc::pointer_type(true)))); AssertThat(as.can_pull_terminal(), Is().True()); - AssertThat(as.pull_terminal(), Is().EqualTo(arc(arc::ptr_t(1,1), false, arc::ptr_t(true)))); + AssertThat(as.pull_terminal(), Is().EqualTo(arc(arc::pointer_type(1,1), false, arc::pointer_type(true)))); AssertThat(as.can_pull_terminal(), Is().True()); - AssertThat(as.pull_terminal(), Is().EqualTo(arc(arc::ptr_t(1,1), true, arc::ptr_t(true)))); + AssertThat(as.pull_terminal(), Is().EqualTo(arc(arc::pointer_type(1,1), true, arc::pointer_type(true)))); AssertThat(as.can_pull_terminal(), Is().True()); - AssertThat(as.pull_terminal(), Is().EqualTo(arc(arc::ptr_t(2,0), false, arc::ptr_t(false)))); + AssertThat(as.pull_terminal(), Is().EqualTo(arc(arc::pointer_type(2,0), false, arc::pointer_type(false)))); AssertThat(as.can_pull_terminal(), Is().True()); - AssertThat(as.pull_terminal(), Is().EqualTo(arc(arc::ptr_t(2,0), true, arc::ptr_t(true)))); + AssertThat(as.pull_terminal(), Is().EqualTo(arc(arc::pointer_type(2,0), true, arc::pointer_type(true)))); AssertThat(as.can_pull_terminal(), Is().False()); }); @@ -221,15 +221,15 @@ go_bandit([]() { arc_stream<> as(af, true); AssertThat(as.can_pull_terminal(), Is().True()); - AssertThat(as.pull_terminal(), Is().EqualTo(arc(arc::ptr_t(2,0), true, arc::ptr_t(false)))); + AssertThat(as.pull_terminal(), Is().EqualTo(arc(arc::pointer_type(2,0), true, arc::pointer_type(false)))); AssertThat(as.can_pull_terminal(), Is().True()); - AssertThat(as.pull_terminal(), Is().EqualTo(arc(arc::ptr_t(2,0), false, arc::ptr_t(true)))); + AssertThat(as.pull_terminal(), Is().EqualTo(arc(arc::pointer_type(2,0), false, arc::pointer_type(true)))); AssertThat(as.can_pull_terminal(), Is().True()); - AssertThat(as.pull_terminal(), Is().EqualTo(arc(arc::ptr_t(1,1), true, arc::ptr_t(false)))); + AssertThat(as.pull_terminal(), Is().EqualTo(arc(arc::pointer_type(1,1), true, arc::pointer_type(false)))); AssertThat(as.can_pull_terminal(), Is().True()); - AssertThat(as.pull_terminal(), Is().EqualTo(arc(arc::ptr_t(1,1), false, arc::ptr_t(false)))); + AssertThat(as.pull_terminal(), Is().EqualTo(arc(arc::pointer_type(1,1), false, arc::pointer_type(false)))); AssertThat(as.can_pull_terminal(), Is().True()); - AssertThat(as.pull_terminal(), Is().EqualTo(arc(arc::ptr_t(1,0), true, arc::ptr_t(false)))); + AssertThat(as.pull_terminal(), Is().EqualTo(arc(arc::pointer_type(1,0), true, arc::pointer_type(false)))); AssertThat(as.can_pull_terminal(), Is().False()); }); @@ -237,11 +237,11 @@ go_bandit([]() { arc_stream<> as(af); AssertThat(as.can_pull_internal(), Is().True()); - AssertThat(as.pull_internal(), Is().EqualTo(arc(arc::ptr_t(1,0), false, arc::ptr_t(2,0)))); + AssertThat(as.pull_internal(), Is().EqualTo(arc(arc::pointer_type(1,0), false, arc::pointer_type(2,0)))); AssertThat(as.can_pull_internal(), Is().True()); - AssertThat(as.pull_internal(), Is().EqualTo(arc(arc::ptr_t(0,0), true, arc::ptr_t(1,1)))); + AssertThat(as.pull_internal(), Is().EqualTo(arc(arc::pointer_type(0,0), true, arc::pointer_type(1,1)))); AssertThat(as.can_pull_internal(), Is().True()); - AssertThat(as.pull_internal(), Is().EqualTo(arc(arc::ptr_t(0,0), false, arc::ptr_t(1,0)))); + AssertThat(as.pull_internal(), Is().EqualTo(arc(arc::pointer_type(0,0), false, arc::pointer_type(1,0)))); AssertThat(as.can_pull_internal(), Is().False()); }); @@ -338,8 +338,8 @@ go_bandit([]() { { arc_writer aw(af); - aw.push_terminal(arc(arc::ptr_t(0,0), false, arc::ptr_t(false))); - aw.push_terminal(arc(arc::ptr_t(0,0), true, arc::ptr_t(true))); + aw.push_terminal(arc(arc::pointer_type(0,0), false, arc::pointer_type(false))); + aw.push_terminal(arc(arc::pointer_type(0,0), true, arc::pointer_type(true))); aw.push(level_info(0,1)); aw.detach(); @@ -355,8 +355,8 @@ go_bandit([]() { { arc_writer aw(af); - aw.push_terminal(arc(arc::ptr_t(0,0), false, arc::ptr_t(false))); - aw.push_terminal(arc(arc::ptr_t(0,0), true, arc::ptr_t(true))); + aw.push_terminal(arc(arc::pointer_type(0,0), false, arc::pointer_type(false))); + aw.push_terminal(arc(arc::pointer_type(0,0), true, arc::pointer_type(true))); aw.push(level_info(0,1)); aw.detach(); @@ -365,7 +365,7 @@ go_bandit([]() { node_arc_stream ns(af); AssertThat(ns.can_pull(), Is().True()); - AssertThat(ns.pull(), Is().EqualTo(node(0,0, node::ptr_t(false), node::ptr_t(true)))); + AssertThat(ns.pull(), Is().EqualTo(node(0,0, node::pointer_type(false), node::pointer_type(true)))); AssertThat(ns.can_pull(), Is().False()); }); @@ -375,8 +375,8 @@ go_bandit([]() { { arc_writer aw(af); - aw.push_terminal(arc(arc::ptr_t(0,0), true, arc::ptr_t(true))); - aw.push_terminal(arc(arc::ptr_t(0,0), false, arc::ptr_t(false))); + aw.push_terminal(arc(arc::pointer_type(0,0), true, arc::pointer_type(true))); + aw.push_terminal(arc(arc::pointer_type(0,0), false, arc::pointer_type(false))); aw.push(level_info(0,1)); aw.detach(); @@ -385,7 +385,7 @@ go_bandit([]() { node_arc_stream ns(af); AssertThat(ns.can_pull(), Is().True()); - AssertThat(ns.pull(), Is().EqualTo(node(0,0, node::ptr_t(false), node::ptr_t(true)))); + AssertThat(ns.pull(), Is().EqualTo(node(0,0, node::pointer_type(false), node::pointer_type(true)))); AssertThat(ns.can_pull(), Is().False()); }); @@ -409,23 +409,23 @@ go_bandit([]() { aw.push(level_info(0,1)); - aw.push_internal(arc(arc::ptr_t(0,0), false, arc::ptr_t(1,0))); - aw.push_terminal(arc(arc::ptr_t(1,0), false, arc::ptr_t(false))); + aw.push_internal(arc(arc::pointer_type(0,0), false, arc::pointer_type(1,0))); + aw.push_terminal(arc(arc::pointer_type(1,0), false, arc::pointer_type(false))); aw.push(level_info(1,1)); - aw.push_internal(arc(arc::ptr_t(0,0), true, arc::ptr_t(2,0))); - aw.push_internal(arc(arc::ptr_t(1,0), true, arc::ptr_t(2,0))); + aw.push_internal(arc(arc::pointer_type(0,0), true, arc::pointer_type(2,0))); + aw.push_internal(arc(arc::pointer_type(1,0), true, arc::pointer_type(2,0))); aw.push(level_info(2,1)); - aw.push_internal(arc(arc::ptr_t(2,0), false, arc::ptr_t(3,0))); - aw.push_terminal(arc(arc::ptr_t(3,0), false, arc::ptr_t(false))); - aw.push_terminal(arc(arc::ptr_t(3,0), true, arc::ptr_t(true))); + aw.push_internal(arc(arc::pointer_type(2,0), false, arc::pointer_type(3,0))); + aw.push_terminal(arc(arc::pointer_type(3,0), false, arc::pointer_type(false))); + aw.push_terminal(arc(arc::pointer_type(3,0), true, arc::pointer_type(true))); - aw.push_internal(arc(arc::ptr_t(2,0), true, arc::ptr_t(3,1))); - aw.push_terminal(arc(arc::ptr_t(3,1), false, arc::ptr_t(true))); - aw.push_terminal(arc(arc::ptr_t(3,1), true, arc::ptr_t(false))); + aw.push_internal(arc(arc::pointer_type(2,0), true, arc::pointer_type(3,1))); + aw.push_terminal(arc(arc::pointer_type(3,1), false, arc::pointer_type(true))); + aw.push_terminal(arc(arc::pointer_type(3,1), true, arc::pointer_type(false))); aw.push(level_info(3,2)); @@ -435,19 +435,19 @@ go_bandit([]() { node_arc_stream ns(af); AssertThat(ns.can_pull(), Is().True()); - AssertThat(ns.pull(), Is().EqualTo(node(0,0, node::ptr_t(1,0), node::ptr_t(2,0)))); + AssertThat(ns.pull(), Is().EqualTo(node(0,0, node::pointer_type(1,0), node::pointer_type(2,0)))); AssertThat(ns.can_pull(), Is().True()); - AssertThat(ns.pull(), Is().EqualTo(node(1,0, node::ptr_t(false), node::ptr_t(2,0)))); + AssertThat(ns.pull(), Is().EqualTo(node(1,0, node::pointer_type(false), node::pointer_type(2,0)))); AssertThat(ns.can_pull(), Is().True()); - AssertThat(ns.pull(), Is().EqualTo(node(2,0, node::ptr_t(3,0), node::ptr_t(3,1)))); + AssertThat(ns.pull(), Is().EqualTo(node(2,0, node::pointer_type(3,0), node::pointer_type(3,1)))); AssertThat(ns.can_pull(), Is().True()); - AssertThat(ns.pull(), Is().EqualTo(node(3,0, node::ptr_t(false), node::ptr_t(true)))); + AssertThat(ns.pull(), Is().EqualTo(node(3,0, node::pointer_type(false), node::pointer_type(true)))); AssertThat(ns.can_pull(), Is().True()); - AssertThat(ns.pull(), Is().EqualTo(node(3,1, node::ptr_t(true), node::ptr_t(false)))); + AssertThat(ns.pull(), Is().EqualTo(node(3,1, node::pointer_type(true), node::pointer_type(false)))); AssertThat(ns.can_pull(), Is().False()); }); @@ -469,15 +469,15 @@ go_bandit([]() { aw.push(level_info(0,1)); - aw.push_internal(arc(arc::ptr_t(0,0), true, arc::ptr_t(1,0))); - aw.push_terminal(arc(arc::ptr_t(1,0), true, arc::ptr_t(true))); + aw.push_internal(arc(arc::pointer_type(0,0), true, arc::pointer_type(1,0))); + aw.push_terminal(arc(arc::pointer_type(1,0), true, arc::pointer_type(true))); aw.push(level_info(1,1)); - aw.push_internal(arc(arc::ptr_t(0,0), false, arc::ptr_t(2,0))); - aw.push_internal(arc(arc::ptr_t(1,0), false, arc::ptr_t(2,0))); - aw.push_terminal(arc(arc::ptr_t(2,0), false, arc::ptr_t(false))); - aw.push_terminal(arc(arc::ptr_t(2,0), true, arc::ptr_t(true))); + aw.push_internal(arc(arc::pointer_type(0,0), false, arc::pointer_type(2,0))); + aw.push_internal(arc(arc::pointer_type(1,0), false, arc::pointer_type(2,0))); + aw.push_terminal(arc(arc::pointer_type(2,0), false, arc::pointer_type(false))); + aw.push_terminal(arc(arc::pointer_type(2,0), true, arc::pointer_type(true))); aw.push(level_info(2,1)); @@ -487,13 +487,13 @@ go_bandit([]() { node_arc_stream ns(af); AssertThat(ns.can_pull(), Is().True()); - AssertThat(ns.pull(), Is().EqualTo(node(0,0, node::ptr_t(2,0), node::ptr_t(1,0)))); + AssertThat(ns.pull(), Is().EqualTo(node(0,0, node::pointer_type(2,0), node::pointer_type(1,0)))); AssertThat(ns.can_pull(), Is().True()); - AssertThat(ns.pull(), Is().EqualTo(node(1,0, node::ptr_t(2,0), node::ptr_t(true)))); + AssertThat(ns.pull(), Is().EqualTo(node(1,0, node::pointer_type(2,0), node::pointer_type(true)))); AssertThat(ns.can_pull(), Is().True()); - AssertThat(ns.pull(), Is().EqualTo(node(2,0, node::ptr_t(false), node::ptr_t(true)))); + AssertThat(ns.pull(), Is().EqualTo(node(2,0, node::pointer_type(false), node::pointer_type(true)))); AssertThat(ns.can_pull(), Is().False()); }); @@ -503,8 +503,8 @@ go_bandit([]() { { arc_writer aw(af); - aw.push_terminal(arc(arc::ptr_t(0,0), false, arc::ptr_t(false))); - aw.push_terminal(arc(arc::ptr_t(0,0), true, arc::ptr_t(true))); + aw.push_terminal(arc(arc::pointer_type(0,0), false, arc::pointer_type(false))); + aw.push_terminal(arc(arc::pointer_type(0,0), true, arc::pointer_type(true))); aw.push(level_info(0,1)); aw.detach(); @@ -513,7 +513,7 @@ go_bandit([]() { node_arc_stream ns(af, true); AssertThat(ns.can_pull(), Is().True()); - AssertThat(ns.pull(), Is().EqualTo(node(0,0, node::ptr_t(true), node::ptr_t(false)))); + AssertThat(ns.pull(), Is().EqualTo(node(0,0, node::pointer_type(true), node::pointer_type(false)))); AssertThat(ns.can_pull(), Is().False()); }); @@ -523,8 +523,8 @@ go_bandit([]() { { arc_writer aw(af); - aw.push_terminal(arc(arc::ptr_t(0,0), false, arc::ptr_t(false))); - aw.push_terminal(arc(arc::ptr_t(0,0), true, arc::ptr_t(true))); + aw.push_terminal(arc(arc::pointer_type(0,0), false, arc::pointer_type(false))); + aw.push_terminal(arc(arc::pointer_type(0,0), true, arc::pointer_type(true))); aw.push(level_info(0,1)); aw.detach(); @@ -533,7 +533,7 @@ go_bandit([]() { node_arc_stream ns(af); AssertThat(ns.can_pull(), Is().True()); - AssertThat(ns.pull(), Is().EqualTo(node(0,0, node::ptr_t(false), node::ptr_t(true)))); + AssertThat(ns.pull(), Is().EqualTo(node(0,0, node::pointer_type(false), node::pointer_type(true)))); AssertThat(ns.can_pull(), Is().False()); }); @@ -557,24 +557,24 @@ go_bandit([]() { aw.push(level_info(0,1)); - aw.push_internal(arc(arc::ptr_t(0,0), true, arc::ptr_t(1,0))); - aw.push_terminal(arc(arc::ptr_t(1,0), false, arc::ptr_t(false))); + aw.push_internal(arc(arc::pointer_type(0,0), true, arc::pointer_type(1,0))); + aw.push_terminal(arc(arc::pointer_type(1,0), false, arc::pointer_type(false))); aw.push(level_info(1,1)); - aw.push_internal(arc(arc::ptr_t(0,0), false, arc::ptr_t(2,0))); - aw.push_terminal(arc(arc::ptr_t(2,0), false, arc::ptr_t(false))); + aw.push_internal(arc(arc::pointer_type(0,0), false, arc::pointer_type(2,0))); + aw.push_terminal(arc(arc::pointer_type(2,0), false, arc::pointer_type(false))); - aw.push_internal(arc(arc::ptr_t(1,0), true, arc::ptr_t(2,1))); - aw.push_terminal(arc(arc::ptr_t(2,1), true, arc::ptr_t(true))); + aw.push_internal(arc(arc::pointer_type(1,0), true, arc::pointer_type(2,1))); + aw.push_terminal(arc(arc::pointer_type(2,1), true, arc::pointer_type(true))); aw.push(level_info(2,2)); - aw.push_internal(arc(arc::ptr_t(2,0), true, arc::ptr_t(3,0))); - aw.push_internal(arc(arc::ptr_t(2,1), false, arc::ptr_t(3,0))); + aw.push_internal(arc(arc::pointer_type(2,0), true, arc::pointer_type(3,0))); + aw.push_internal(arc(arc::pointer_type(2,1), false, arc::pointer_type(3,0))); - aw.push_terminal(arc(arc::ptr_t(3,0), false, arc::ptr_t(false))); - aw.push_terminal(arc(arc::ptr_t(3,0), true, arc::ptr_t(true))); + aw.push_terminal(arc(arc::pointer_type(3,0), false, arc::pointer_type(false))); + aw.push_terminal(arc(arc::pointer_type(3,0), true, arc::pointer_type(true))); aw.detach(); } @@ -582,19 +582,19 @@ go_bandit([]() { node_arc_stream ns(af, true); AssertThat(ns.can_pull(), Is().True()); - AssertThat(ns.pull(), Is().EqualTo(node(3,0, node::ptr_t(true), node::ptr_t(false)))); + AssertThat(ns.pull(), Is().EqualTo(node(3,0, node::pointer_type(true), node::pointer_type(false)))); AssertThat(ns.can_pull(), Is().True()); - AssertThat(ns.pull(), Is().EqualTo(node(2,1, node::ptr_t(3,0), node::ptr_t(false)))); + AssertThat(ns.pull(), Is().EqualTo(node(2,1, node::pointer_type(3,0), node::pointer_type(false)))); AssertThat(ns.can_pull(), Is().True()); - AssertThat(ns.pull(), Is().EqualTo(node(2,0, node::ptr_t(true), node::ptr_t(3,0)))); + AssertThat(ns.pull(), Is().EqualTo(node(2,0, node::pointer_type(true), node::pointer_type(3,0)))); AssertThat(ns.can_pull(), Is().True()); - AssertThat(ns.pull(), Is().EqualTo(node(1,0, node::ptr_t(true), node::ptr_t(2,1)))); + AssertThat(ns.pull(), Is().EqualTo(node(1,0, node::pointer_type(true), node::pointer_type(2,1)))); AssertThat(ns.can_pull(), Is().True()); - AssertThat(ns.pull(), Is().EqualTo(node(0,0, node::ptr_t(2,0), node::ptr_t(1,0)))); + AssertThat(ns.pull(), Is().EqualTo(node(0,0, node::pointer_type(2,0), node::pointer_type(1,0)))); AssertThat(ns.can_pull(), Is().False()); }); @@ -604,8 +604,8 @@ go_bandit([]() { { arc_writer aw(af); - aw.push_terminal(arc(arc::ptr_t(0,0), false, arc::ptr_t(false))); - aw.push_terminal(arc(arc::ptr_t(0,0), true, arc::ptr_t(true))); + aw.push_terminal(arc(arc::pointer_type(0,0), false, arc::pointer_type(false))); + aw.push_terminal(arc(arc::pointer_type(0,0), true, arc::pointer_type(true))); aw.push(level_info(0,1)); aw.detach(); @@ -615,7 +615,7 @@ go_bandit([]() { node_arc_stream ns(af); AssertThat(ns.can_pull(), Is().True()); - AssertThat(ns.pull(), Is().EqualTo(node(0,0, node::ptr_t(false), node::ptr_t(true)))); + AssertThat(ns.pull(), Is().EqualTo(node(0,0, node::pointer_type(false), node::pointer_type(true)))); AssertThat(ns.can_pull(), Is().False()); } @@ -624,7 +624,7 @@ go_bandit([]() { node_arc_stream ns(af); AssertThat(ns.can_pull(), Is().True()); - AssertThat(ns.pull(), Is().EqualTo(node(0,0, node::ptr_t(false), node::ptr_t(true)))); + AssertThat(ns.pull(), Is().EqualTo(node(0,0, node::pointer_type(false), node::pointer_type(true)))); AssertThat(ns.can_pull(), Is().False()); } diff --git a/test/adiar/internal/io/test_node_file.cpp b/test/adiar/internal/io/test_node_file.cpp index db68e7448..c0d8e52f5 100644 --- a/test/adiar/internal/io/test_node_file.cpp +++ b/test/adiar/internal/io/test_node_file.cpp @@ -42,7 +42,7 @@ go_bandit([]() { levelized_file nf_42; { node_writer nw(nf_42); - nw << node(42, node::MAX_ID, node::ptr_t(false), node::ptr_t(true)); + nw << node(42, node::max_id, node::pointer_type(false), node::pointer_type(true)); } /* @@ -53,7 +53,7 @@ go_bandit([]() { levelized_file nf_not42; { node_writer nw(nf_not42); - nw << node(42, node::MAX_ID, node::ptr_t(false), node::ptr_t(true)); + nw << node(42, node::max_id, node::pointer_type(false), node::pointer_type(true)); } /* @@ -64,7 +64,7 @@ go_bandit([]() { levelized_file nf_42andnot42; { node_writer nw(nf_42andnot42); - nw << node(42, node::MAX_ID, node::ptr_t(true), node::ptr_t(true)); + nw << node(42, node::max_id, node::pointer_type(true), node::pointer_type(true)); } @@ -78,8 +78,8 @@ go_bandit([]() { levelized_file nf_0and1; { node_writer nw(nf_0and1); - nw << node(1, node::MAX_ID, node::ptr_t(false), node::ptr_t(true)) - << node(0, node::MAX_ID, node::ptr_t(false), node::ptr_t(1, node::ptr_t::MAX_ID)); + nw << node(1, node::max_id, node::pointer_type(false), node::pointer_type(true)) + << node(0, node::max_id, node::pointer_type(false), node::pointer_type(1, node::pointer_type::max_id)); } /* @@ -94,9 +94,9 @@ go_bandit([]() { levelized_file nf_0and1and2; { node_writer nw(nf_0and1and2); - nw << node(2, node::MAX_ID, node::ptr_t(false), node::ptr_t(true)) - << node(1, node::MAX_ID, node::ptr_t(false), node::ptr_t(2, node::ptr_t::MAX_ID)) - << node(0, node::MAX_ID, node::ptr_t(false), node::ptr_t(1, node::ptr_t::MAX_ID)); + nw << node(2, node::max_id, node::pointer_type(false), node::pointer_type(true)) + << node(1, node::max_id, node::pointer_type(false), node::pointer_type(2, node::pointer_type::max_id)) + << node(0, node::max_id, node::pointer_type(false), node::pointer_type(1, node::pointer_type::max_id)); } /* @@ -111,9 +111,9 @@ go_bandit([]() { levelized_file nf_0and1_or_2; { node_writer nw(nf_0and1_or_2); - nw << node(2, node::MAX_ID, node::ptr_t(false), node::ptr_t(true)) - << node(1, node::MAX_ID, node::ptr_t(2, node::ptr_t::MAX_ID), node::ptr_t(true)) - << node(0, node::MAX_ID, node::ptr_t(2, node::ptr_t::MAX_ID), node::ptr_t(1, node::ptr_t::MAX_ID)); + nw << node(2, node::max_id, node::pointer_type(false), node::pointer_type(true)) + << node(1, node::max_id, node::pointer_type(2, node::pointer_type::max_id), node::pointer_type(true)) + << node(0, node::max_id, node::pointer_type(2, node::pointer_type::max_id), node::pointer_type(1, node::pointer_type::max_id)); } /* @@ -126,9 +126,9 @@ go_bandit([]() { levelized_file nf_21xor42; { node_writer nw(nf_21xor42); - nw << node(42, node::MAX_ID, node::ptr_t(false), node::ptr_t(true)) - << node(42, node::MAX_ID-1, node::ptr_t(true), node::ptr_t(false)) - << node(21, node::MAX_ID, node::ptr_t(42, node::ptr_t::MAX_ID), node::ptr_t(42, node::ptr_t::MAX_ID-1)); + nw << node(42, node::max_id, node::pointer_type(false), node::pointer_type(true)) + << node(42, node::max_id-1, node::pointer_type(true), node::pointer_type(false)) + << node(21, node::max_id, node::pointer_type(42, node::pointer_type::max_id), node::pointer_type(42, node::pointer_type::max_id-1)); } /* @@ -143,10 +143,10 @@ go_bandit([]() { levelized_file nf_0xnor1_or_2; { node_writer nw(nf_0xnor1_or_2); - nw << node(2, node::MAX_ID, node::ptr_t(false), node::ptr_t(true)) - << node(1, node::MAX_ID, node::ptr_t(2, node::ptr_t::MAX_ID), node::ptr_t(true)) - << node(1, node::MAX_ID-1, node::ptr_t(true), node::ptr_t(2, node::ptr_t::MAX_ID)) - << node(0, node::MAX_ID, node::ptr_t(1, node::ptr_t::MAX_ID-1), node::ptr_t(1, node::ptr_t::MAX_ID)); + nw << node(2, node::max_id, node::pointer_type(false), node::pointer_type(true)) + << node(1, node::max_id, node::pointer_type(2, node::pointer_type::max_id), node::pointer_type(true)) + << node(1, node::max_id-1, node::pointer_type(true), node::pointer_type(2, node::pointer_type::max_id)) + << node(0, node::max_id, node::pointer_type(1, node::pointer_type::max_id-1), node::pointer_type(1, node::pointer_type::max_id)); } /* @@ -161,10 +161,10 @@ go_bandit([]() { levelized_file nf_0xor1_or_2; { node_writer nw(nf_0xor1_or_2); - nw << node(2, node::MAX_ID, node::ptr_t(false), node::ptr_t(true)) - << node(1, node::MAX_ID, node::ptr_t(2, node::ptr_t::MAX_ID), node::ptr_t(true)) - << node(1, node::MAX_ID-1, node::ptr_t(true), node::ptr_t(2, node::ptr_t::MAX_ID)) - << node(0, node::MAX_ID, node::ptr_t(1, node::ptr_t::MAX_ID), node::ptr_t(1, node::ptr_t::MAX_ID-1)); + nw << node(2, node::max_id, node::pointer_type(false), node::pointer_type(true)) + << node(1, node::max_id, node::pointer_type(2, node::pointer_type::max_id), node::pointer_type(true)) + << node(1, node::max_id-1, node::pointer_type(true), node::pointer_type(2, node::pointer_type::max_id)) + << node(0, node::max_id, node::pointer_type(1, node::pointer_type::max_id), node::pointer_type(1, node::pointer_type::max_id-1)); } /* @@ -185,15 +185,15 @@ go_bandit([]() { // In comments, we provide the sum (mod 2) before adding the // respective variable. node_writer nw(nf_sum01234_mod2); - nw << node(4, node::MAX_ID, node::ptr_t(false), node::ptr_t(true)) // 0 - << node(4, node::MAX_ID-1, node::ptr_t(true), node::ptr_t(false)) // 1 - << node(3, node::MAX_ID, node::ptr_t(4, node::ptr_t::MAX_ID-1), node::ptr_t(4, node::ptr_t::MAX_ID)) // 1 - << node(3, node::MAX_ID-1, node::ptr_t(4, node::ptr_t::MAX_ID), node::ptr_t(4, node::ptr_t::MAX_ID-1)) // 0 - << node(2, node::MAX_ID, node::ptr_t(3, node::ptr_t::MAX_ID-1), node::ptr_t(3, node::ptr_t::MAX_ID)) // 0 - << node(2, node::MAX_ID-1, node::ptr_t(3, node::ptr_t::MAX_ID), node::ptr_t(3, node::ptr_t::MAX_ID-1)) // 1 - << node(1, node::MAX_ID, node::ptr_t(2, node::ptr_t::MAX_ID-1), node::ptr_t(2, node::ptr_t::MAX_ID)) // 1 - << node(1, node::MAX_ID-1, node::ptr_t(2, node::ptr_t::MAX_ID), node::ptr_t(2, node::ptr_t::MAX_ID-1)) // 0 - << node(0, node::MAX_ID, node::ptr_t(1, node::ptr_t::MAX_ID-1), node::ptr_t(1, node::ptr_t::MAX_ID)); // 0 + nw << node(4, node::max_id, node::pointer_type(false), node::pointer_type(true)) // 0 + << node(4, node::max_id-1, node::pointer_type(true), node::pointer_type(false)) // 1 + << node(3, node::max_id, node::pointer_type(4, node::pointer_type::max_id-1), node::pointer_type(4, node::pointer_type::max_id)) // 1 + << node(3, node::max_id-1, node::pointer_type(4, node::pointer_type::max_id), node::pointer_type(4, node::pointer_type::max_id-1)) // 0 + << node(2, node::max_id, node::pointer_type(3, node::pointer_type::max_id-1), node::pointer_type(3, node::pointer_type::max_id)) // 0 + << node(2, node::max_id-1, node::pointer_type(3, node::pointer_type::max_id), node::pointer_type(3, node::pointer_type::max_id-1)) // 1 + << node(1, node::max_id, node::pointer_type(2, node::pointer_type::max_id-1), node::pointer_type(2, node::pointer_type::max_id)) // 1 + << node(1, node::max_id-1, node::pointer_type(2, node::pointer_type::max_id), node::pointer_type(2, node::pointer_type::max_id-1)) // 0 + << node(0, node::max_id, node::pointer_type(1, node::pointer_type::max_id-1), node::pointer_type(1, node::pointer_type::max_id)); // 0 } // ------------------------------------------------------------------- @@ -218,13 +218,13 @@ go_bandit([]() { levelized_file nf_larger_2level_cut_A; { node_writer nw(nf_larger_2level_cut_A); - nw << node(3, node::MAX_ID, node::ptr_t(false), node::ptr_t(true)) - << node(3, node::MAX_ID-1, node::ptr_t(true), node::ptr_t(false)) - << node(2, node::MAX_ID, node::ptr_t(3, node::ptr_t::MAX_ID), node::ptr_t(true)) - << node(2, node::MAX_ID-1, node::ptr_t(3, node::ptr_t::MAX_ID-1), node::ptr_t(3, node::ptr_t::MAX_ID)) - << node(1, node::MAX_ID, node::ptr_t(2, node::ptr_t::MAX_ID-1), node::ptr_t(true)) - << node(1, node::MAX_ID-1, node::ptr_t(2, node::ptr_t::MAX_ID-1), node::ptr_t(2, node::ptr_t::MAX_ID)) - << node(0, node::MAX_ID, node::ptr_t(1, node::ptr_t::MAX_ID-1), node::ptr_t(1, node::ptr_t::MAX_ID)); + nw << node(3, node::max_id, node::pointer_type(false), node::pointer_type(true)) + << node(3, node::max_id-1, node::pointer_type(true), node::pointer_type(false)) + << node(2, node::max_id, node::pointer_type(3, node::pointer_type::max_id), node::pointer_type(true)) + << node(2, node::max_id-1, node::pointer_type(3, node::pointer_type::max_id-1), node::pointer_type(3, node::pointer_type::max_id)) + << node(1, node::max_id, node::pointer_type(2, node::pointer_type::max_id-1), node::pointer_type(true)) + << node(1, node::max_id-1, node::pointer_type(2, node::pointer_type::max_id-1), node::pointer_type(2, node::pointer_type::max_id)) + << node(0, node::max_id, node::pointer_type(1, node::pointer_type::max_id-1), node::pointer_type(1, node::pointer_type::max_id)); } /* @@ -245,11 +245,11 @@ go_bandit([]() { levelized_file nf_larger_2level_cut_B; { node_writer nw(nf_larger_2level_cut_B); - nw << node(3, node::MAX_ID, node::ptr_t(false), node::ptr_t(true)) - << node(2, node::MAX_ID, node::ptr_t(false), node::ptr_t(true)) - << node(2, node::MAX_ID-1, node::ptr_t(3, node::ptr_t::MAX_ID), node::ptr_t(3, node::ptr_t::MAX_ID)) - << node(1, node::MAX_ID, node::ptr_t(2, node::ptr_t::MAX_ID), node::ptr_t(2, node::ptr_t::MAX_ID-1)) - << node(0, node::MAX_ID, node::ptr_t(1, node::ptr_t::MAX_ID), node::ptr_t(3, node::ptr_t::MAX_ID)); + nw << node(3, node::max_id, node::pointer_type(false), node::pointer_type(true)) + << node(2, node::max_id, node::pointer_type(false), node::pointer_type(true)) + << node(2, node::max_id-1, node::pointer_type(3, node::pointer_type::max_id), node::pointer_type(3, node::pointer_type::max_id)) + << node(1, node::max_id, node::pointer_type(2, node::pointer_type::max_id), node::pointer_type(2, node::pointer_type::max_id-1)) + << node(0, node::max_id, node::pointer_type(1, node::pointer_type::max_id), node::pointer_type(3, node::pointer_type::max_id)); } describe("canonicity", [&]() { @@ -273,7 +273,7 @@ go_bandit([]() { levelized_file nf; { node_writer nw(nf); - nw << node(21, 42, node::ptr_t(false), node::ptr_t(true)); + nw << node(21, 42, node::pointer_type(false), node::pointer_type(true)); } AssertThat(nf.canonical, Is().False()); @@ -287,9 +287,9 @@ go_bandit([]() { levelized_file nf; { node_writer nw(nf); - nw << node(42, node::MAX_ID, node::ptr_t(true), node::ptr_t(false)) - << node(42, node::MAX_ID-1, node::ptr_t(false), node::ptr_t(true)) - << node(21, node::MAX_ID, node::ptr_t(42, node::ptr_t::MAX_ID), node::ptr_t(42, node::ptr_t::MAX_ID-1)); + nw << node(42, node::max_id, node::pointer_type(true), node::pointer_type(false)) + << node(42, node::max_id-1, node::pointer_type(false), node::pointer_type(true)) + << node(21, node::max_id, node::pointer_type(42, node::pointer_type::max_id), node::pointer_type(42, node::pointer_type::max_id-1)); } AssertThat(nf.canonical, Is().False()); @@ -299,9 +299,9 @@ go_bandit([]() { levelized_file nf; { node_writer nw(nf); - nw << node(42, node::MAX_ID, node::ptr_t(false), node::ptr_t(true)) - << node(42, node::MAX_ID-1, node::ptr_t(true), node::ptr_t(false)) - << node(21, node::MAX_ID-2, node::ptr_t(42, node::ptr_t::MAX_ID), node::ptr_t(42, node::ptr_t::MAX_ID-1)); + nw << node(42, node::max_id, node::pointer_type(false), node::pointer_type(true)) + << node(42, node::max_id-1, node::pointer_type(true), node::pointer_type(false)) + << node(21, node::max_id-2, node::pointer_type(42, node::pointer_type::max_id), node::pointer_type(42, node::pointer_type::max_id-1)); } AssertThat(nf.canonical, Is().False()); @@ -311,9 +311,9 @@ go_bandit([]() { levelized_file nf; { node_writer nw(nf); - nw << node(42, node::MAX_ID, node::ptr_t(false), node::ptr_t(true)) - << node(42, node::MAX_ID-2, node::ptr_t(true), node::ptr_t(false)) - << node(21, node::MAX_ID, node::ptr_t(42, node::ptr_t::MAX_ID), node::ptr_t(42, node::ptr_t::MAX_ID-2)); + nw << node(42, node::max_id, node::pointer_type(false), node::pointer_type(true)) + << node(42, node::max_id-2, node::pointer_type(true), node::pointer_type(false)) + << node(21, node::max_id, node::pointer_type(42, node::pointer_type::max_id), node::pointer_type(42, node::pointer_type::max_id-2)); } AssertThat(nf.canonical, Is().False()); @@ -331,10 +331,10 @@ go_bandit([]() { levelized_file nf; { node_writer nw(nf); - nw << node(2, node::MAX_ID, node::ptr_t(false), node::ptr_t(true)) - << node(1, node::MAX_ID, node::ptr_t(true), node::ptr_t(2, node::ptr_t::MAX_ID)) - << node(1, node::MAX_ID-1, node::ptr_t(2, node::ptr_t::MAX_ID), node::ptr_t(false)) - << node(0, node::MAX_ID, node::ptr_t(1, node::ptr_t::MAX_ID), node::ptr_t(1, node::ptr_t::MAX_ID-1)); + nw << node(2, node::max_id, node::pointer_type(false), node::pointer_type(true)) + << node(1, node::max_id, node::pointer_type(true), node::pointer_type(2, node::pointer_type::max_id)) + << node(1, node::max_id-1, node::pointer_type(2, node::pointer_type::max_id), node::pointer_type(false)) + << node(0, node::max_id, node::pointer_type(1, node::pointer_type::max_id), node::pointer_type(1, node::pointer_type::max_id-1)); } AssertThat(nf.canonical, Is().False()); @@ -344,12 +344,12 @@ go_bandit([]() { levelized_file nf; { node_writer nw(nf); - nw << node(3, node::MAX_ID, node::ptr_t(false), node::ptr_t(true)) - << node(2, node::MAX_ID, node::ptr_t(false), node::ptr_t(true)) - << node(2, node::MAX_ID-1, node::ptr_t(true), node::ptr_t(3, node::ptr_t::MAX_ID)) - << node(1, node::MAX_ID, node::ptr_t(2, node::ptr_t::MAX_ID-1), node::ptr_t(2, node::ptr_t::MAX_ID)) - << node(1, node::MAX_ID-1, node::ptr_t(2, node::ptr_t::MAX_ID), node::ptr_t(2, node::ptr_t::MAX_ID)) - << node(0, node::MAX_ID, node::ptr_t(1, node::ptr_t::MAX_ID), node::ptr_t(1, node::ptr_t::MAX_ID-1)); + nw << node(3, node::max_id, node::pointer_type(false), node::pointer_type(true)) + << node(2, node::max_id, node::pointer_type(false), node::pointer_type(true)) + << node(2, node::max_id-1, node::pointer_type(true), node::pointer_type(3, node::pointer_type::max_id)) + << node(1, node::max_id, node::pointer_type(2, node::pointer_type::max_id-1), node::pointer_type(2, node::pointer_type::max_id)) + << node(1, node::max_id-1, node::pointer_type(2, node::pointer_type::max_id), node::pointer_type(2, node::pointer_type::max_id)) + << node(0, node::max_id, node::pointer_type(1, node::pointer_type::max_id), node::pointer_type(1, node::pointer_type::max_id-1)); } AssertThat(nf.canonical, Is().False()); @@ -359,12 +359,12 @@ go_bandit([]() { levelized_file nf; { node_writer nw(nf); - nw << node(3, node::MAX_ID, node::ptr_t(false), node::ptr_t(true)) - << node(2, node::MAX_ID, node::ptr_t(false), node::ptr_t(true)) - << node(2, node::MAX_ID-1, node::ptr_t(true), node::ptr_t(3, node::ptr_t::MAX_ID)) - << node(1, node::MAX_ID, node::ptr_t(2, node::ptr_t::MAX_ID-1), node::ptr_t(2, node::ptr_t::MAX_ID-1)) - << node(1, node::MAX_ID-1, node::ptr_t(2, node::ptr_t::MAX_ID-1), node::ptr_t(2, node::ptr_t::MAX_ID)) - << node(0, node::MAX_ID, node::ptr_t(1, node::ptr_t::MAX_ID), node::ptr_t(1, node::ptr_t::MAX_ID-1)); + nw << node(3, node::max_id, node::pointer_type(false), node::pointer_type(true)) + << node(2, node::max_id, node::pointer_type(false), node::pointer_type(true)) + << node(2, node::max_id-1, node::pointer_type(true), node::pointer_type(3, node::pointer_type::max_id)) + << node(1, node::max_id, node::pointer_type(2, node::pointer_type::max_id-1), node::pointer_type(2, node::pointer_type::max_id-1)) + << node(1, node::max_id-1, node::pointer_type(2, node::pointer_type::max_id-1), node::pointer_type(2, node::pointer_type::max_id)) + << node(0, node::max_id, node::pointer_type(1, node::pointer_type::max_id), node::pointer_type(1, node::pointer_type::max_id-1)); } AssertThat(nf.canonical, Is().False()); @@ -419,12 +419,12 @@ go_bandit([]() { levelized_file nf; { node_writer nw(nf); - nw << node(3, node::MAX_ID, node::ptr_t(false), node::ptr_t(true)) // n6 - << node(2, node::MAX_ID, node::ptr_t(true), node::ptr_t(false)) // n5 (non-canonical) - << node(2, node::MAX_ID-1, node::ptr_t(false), node::ptr_t(true)) // n4 (non-canonical) - << node(2, node::MAX_ID-2, node::ptr_t(false), node::ptr_t(3, node::MAX_ID)) // n3 - << node(1, node::MAX_ID, node::ptr_t(2, node::MAX_ID-2), node::ptr_t(2, node::MAX_ID-1)) // n2 - << node(0, node::MAX_ID, node::ptr_t(1, node::MAX_ID), node::ptr_t(2, node::MAX_ID)); // n1 + nw << node(3, node::max_id, node::pointer_type(false), node::pointer_type(true)) // n6 + << node(2, node::max_id, node::pointer_type(true), node::pointer_type(false)) // n5 (non-canonical) + << node(2, node::max_id-1, node::pointer_type(false), node::pointer_type(true)) // n4 (non-canonical) + << node(2, node::max_id-2, node::pointer_type(false), node::pointer_type(3, node::max_id)) // n3 + << node(1, node::max_id, node::pointer_type(2, node::max_id-2), node::pointer_type(2, node::max_id-1)) // n2 + << node(0, node::max_id, node::pointer_type(1, node::max_id), node::pointer_type(2, node::max_id)); // n1 } AssertThat(nf.width, Is().EqualTo(3u)); @@ -471,174 +471,174 @@ go_bandit([]() { describe("max 1-level cut", [&]() { it("is exact for F", [&]() { - AssertThat(nf_F.max_1level_cut[cut_type::INTERNAL], Is().EqualTo(0u)); - AssertThat(nf_F.max_1level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(1u)); - AssertThat(nf_F.max_1level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(0u)); - AssertThat(nf_F.max_1level_cut[cut_type::ALL], Is().EqualTo(1u)); + AssertThat(nf_F.max_1level_cut[cut::Internal], Is().EqualTo(0u)); + AssertThat(nf_F.max_1level_cut[cut::Internal_False], Is().EqualTo(1u)); + AssertThat(nf_F.max_1level_cut[cut::Internal_True], Is().EqualTo(0u)); + AssertThat(nf_F.max_1level_cut[cut::All], Is().EqualTo(1u)); }); it("is exact for T", [&]() { - AssertThat(nf_T.max_1level_cut[cut_type::INTERNAL], Is().EqualTo(0u)); - AssertThat(nf_T.max_1level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(0u)); - AssertThat(nf_T.max_1level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(1u)); - AssertThat(nf_T.max_1level_cut[cut_type::ALL], Is().EqualTo(1u)); + AssertThat(nf_T.max_1level_cut[cut::Internal], Is().EqualTo(0u)); + AssertThat(nf_T.max_1level_cut[cut::Internal_False], Is().EqualTo(0u)); + AssertThat(nf_T.max_1level_cut[cut::Internal_True], Is().EqualTo(1u)); + AssertThat(nf_T.max_1level_cut[cut::All], Is().EqualTo(1u)); }); it("is exact for x42", [&]() { - AssertThat(nf_42.max_1level_cut[cut_type::INTERNAL], Is().EqualTo(1u)); - AssertThat(nf_42.max_1level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(1u)); - AssertThat(nf_42.max_1level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(1u)); - AssertThat(nf_42.max_1level_cut[cut_type::ALL], Is().EqualTo(2u)); + AssertThat(nf_42.max_1level_cut[cut::Internal], Is().EqualTo(1u)); + AssertThat(nf_42.max_1level_cut[cut::Internal_False], Is().EqualTo(1u)); + AssertThat(nf_42.max_1level_cut[cut::Internal_True], Is().EqualTo(1u)); + AssertThat(nf_42.max_1level_cut[cut::All], Is().EqualTo(2u)); }); it("is exact for ~x42", [&]() { - AssertThat(nf_not42.max_1level_cut[cut_type::INTERNAL], Is().EqualTo(1u)); - AssertThat(nf_not42.max_1level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(1u)); - AssertThat(nf_not42.max_1level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(1u)); - AssertThat(nf_not42.max_1level_cut[cut_type::ALL], Is().EqualTo(2u)); + AssertThat(nf_not42.max_1level_cut[cut::Internal], Is().EqualTo(1u)); + AssertThat(nf_not42.max_1level_cut[cut::Internal_False], Is().EqualTo(1u)); + AssertThat(nf_not42.max_1level_cut[cut::Internal_True], Is().EqualTo(1u)); + AssertThat(nf_not42.max_1level_cut[cut::All], Is().EqualTo(2u)); }); it("is exact for x0 & x1", [&]() { - AssertThat(nf_0and1.max_1level_cut[cut_type::INTERNAL], Is().EqualTo(1u)); - AssertThat(nf_0and1.max_1level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(2u)); - AssertThat(nf_0and1.max_1level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(1u)); - AssertThat(nf_0and1.max_1level_cut[cut_type::ALL], Is().EqualTo(3u)); + AssertThat(nf_0and1.max_1level_cut[cut::Internal], Is().EqualTo(1u)); + AssertThat(nf_0and1.max_1level_cut[cut::Internal_False], Is().EqualTo(2u)); + AssertThat(nf_0and1.max_1level_cut[cut::Internal_True], Is().EqualTo(1u)); + AssertThat(nf_0and1.max_1level_cut[cut::All], Is().EqualTo(3u)); }); it("is exact for x0 & x1 & 2", [&]() { - AssertThat(nf_0and1and2.max_1level_cut[cut_type::INTERNAL], Is().EqualTo(1u)); - AssertThat(nf_0and1and2.max_1level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(3u)); - AssertThat(nf_0and1and2.max_1level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(1u)); - AssertThat(nf_0and1and2.max_1level_cut[cut_type::ALL], Is().EqualTo(4u)); + AssertThat(nf_0and1and2.max_1level_cut[cut::Internal], Is().EqualTo(1u)); + AssertThat(nf_0and1and2.max_1level_cut[cut::Internal_False], Is().EqualTo(3u)); + AssertThat(nf_0and1and2.max_1level_cut[cut::Internal_True], Is().EqualTo(1u)); + AssertThat(nf_0and1and2.max_1level_cut[cut::All], Is().EqualTo(4u)); }); it("is exact for x0 & x1 | c2", [&]() { - AssertThat(nf_0and1_or_2.max_1level_cut[cut_type::INTERNAL], Is().EqualTo(2u)); - AssertThat(nf_0and1_or_2.max_1level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(2u)); - AssertThat(nf_0and1_or_2.max_1level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(3u)); - AssertThat(nf_0and1_or_2.max_1level_cut[cut_type::ALL], Is().EqualTo(3u)); + AssertThat(nf_0and1_or_2.max_1level_cut[cut::Internal], Is().EqualTo(2u)); + AssertThat(nf_0and1_or_2.max_1level_cut[cut::Internal_False], Is().EqualTo(2u)); + AssertThat(nf_0and1_or_2.max_1level_cut[cut::Internal_True], Is().EqualTo(3u)); + AssertThat(nf_0and1_or_2.max_1level_cut[cut::All], Is().EqualTo(3u)); }); it("is exact for x21 ^ x42", [&]() { - AssertThat(nf_21xor42.max_1level_cut[cut_type::INTERNAL], Is().EqualTo(2u)); - AssertThat(nf_21xor42.max_1level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(2u)); - AssertThat(nf_21xor42.max_1level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(2u)); - AssertThat(nf_21xor42.max_1level_cut[cut_type::ALL], Is().EqualTo(4u)); + AssertThat(nf_21xor42.max_1level_cut[cut::Internal], Is().EqualTo(2u)); + AssertThat(nf_21xor42.max_1level_cut[cut::Internal_False], Is().EqualTo(2u)); + AssertThat(nf_21xor42.max_1level_cut[cut::Internal_True], Is().EqualTo(2u)); + AssertThat(nf_21xor42.max_1level_cut[cut::All], Is().EqualTo(4u)); }); it("is exact for (x0 + x1 + x2 + x3) mod 2", [&]() { - AssertThat(nf_sum01234_mod2.max_1level_cut[cut_type::INTERNAL], Is().EqualTo(4u)); - AssertThat(nf_sum01234_mod2.max_1level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(4u)); - AssertThat(nf_sum01234_mod2.max_1level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(4u)); - AssertThat(nf_sum01234_mod2.max_1level_cut[cut_type::ALL], Is().EqualTo(4u)); + AssertThat(nf_sum01234_mod2.max_1level_cut[cut::Internal], Is().EqualTo(4u)); + AssertThat(nf_sum01234_mod2.max_1level_cut[cut::Internal_False], Is().EqualTo(4u)); + AssertThat(nf_sum01234_mod2.max_1level_cut[cut::Internal_True], Is().EqualTo(4u)); + AssertThat(nf_sum01234_mod2.max_1level_cut[cut::All], Is().EqualTo(4u)); }); }); describe("2-level cut", [&]() { it("is exact for F", [&]() { - AssertThat(nf_F.max_2level_cut[cut_type::INTERNAL], Is().EqualTo(0u)); - AssertThat(nf_F.max_2level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(1u)); - AssertThat(nf_F.max_2level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(0u)); - AssertThat(nf_F.max_2level_cut[cut_type::ALL], Is().EqualTo(1u)); + AssertThat(nf_F.max_2level_cut[cut::Internal], Is().EqualTo(0u)); + AssertThat(nf_F.max_2level_cut[cut::Internal_False], Is().EqualTo(1u)); + AssertThat(nf_F.max_2level_cut[cut::Internal_True], Is().EqualTo(0u)); + AssertThat(nf_F.max_2level_cut[cut::All], Is().EqualTo(1u)); }); it("is exact for T", [&]() { - AssertThat(nf_T.max_2level_cut[cut_type::INTERNAL], Is().EqualTo(0u)); - AssertThat(nf_T.max_2level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(0u)); - AssertThat(nf_T.max_2level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(1u)); - AssertThat(nf_T.max_2level_cut[cut_type::ALL], Is().EqualTo(1u)); + AssertThat(nf_T.max_2level_cut[cut::Internal], Is().EqualTo(0u)); + AssertThat(nf_T.max_2level_cut[cut::Internal_False], Is().EqualTo(0u)); + AssertThat(nf_T.max_2level_cut[cut::Internal_True], Is().EqualTo(1u)); + AssertThat(nf_T.max_2level_cut[cut::All], Is().EqualTo(1u)); }); it("is exact for x42", [&]() { - AssertThat(nf_42.max_2level_cut[cut_type::INTERNAL], Is().EqualTo(1u)); - AssertThat(nf_42.max_2level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(1u)); - AssertThat(nf_42.max_2level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(1u)); - AssertThat(nf_42.max_2level_cut[cut_type::ALL], Is().EqualTo(2u)); + AssertThat(nf_42.max_2level_cut[cut::Internal], Is().EqualTo(1u)); + AssertThat(nf_42.max_2level_cut[cut::Internal_False], Is().EqualTo(1u)); + AssertThat(nf_42.max_2level_cut[cut::Internal_True], Is().EqualTo(1u)); + AssertThat(nf_42.max_2level_cut[cut::All], Is().EqualTo(2u)); }); it("is exact for ~x42", [&]() { - AssertThat(nf_not42.max_2level_cut[cut_type::INTERNAL], Is().EqualTo(1u)); - AssertThat(nf_not42.max_2level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(1u)); - AssertThat(nf_not42.max_2level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(1u)); - AssertThat(nf_not42.max_2level_cut[cut_type::ALL], Is().EqualTo(2u)); + AssertThat(nf_not42.max_2level_cut[cut::Internal], Is().EqualTo(1u)); + AssertThat(nf_not42.max_2level_cut[cut::Internal_False], Is().EqualTo(1u)); + AssertThat(nf_not42.max_2level_cut[cut::Internal_True], Is().EqualTo(1u)); + AssertThat(nf_not42.max_2level_cut[cut::All], Is().EqualTo(2u)); }); // The maximum 1-level and maximum 2-level cuts are the same. it("is copy of 1-level for x0 & x1", [&]() { - AssertThat(nf_0and1.max_2level_cut[cut_type::INTERNAL], Is().EqualTo(1u)); - AssertThat(nf_0and1.max_2level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(2u)); - AssertThat(nf_0and1.max_2level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(1u)); - AssertThat(nf_0and1.max_2level_cut[cut_type::ALL], Is().EqualTo(3u)); + AssertThat(nf_0and1.max_2level_cut[cut::Internal], Is().EqualTo(1u)); + AssertThat(nf_0and1.max_2level_cut[cut::Internal_False], Is().EqualTo(2u)); + AssertThat(nf_0and1.max_2level_cut[cut::Internal_True], Is().EqualTo(1u)); + AssertThat(nf_0and1.max_2level_cut[cut::All], Is().EqualTo(3u)); }); it("is copy of 1-level for x0 & x1 & 2", [&]() { - AssertThat(nf_0and1and2.max_2level_cut[cut_type::INTERNAL], Is().EqualTo(1u)); - AssertThat(nf_0and1and2.max_2level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(3u)); - AssertThat(nf_0and1and2.max_2level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(1u)); - AssertThat(nf_0and1and2.max_2level_cut[cut_type::ALL], Is().EqualTo(4u)); + AssertThat(nf_0and1and2.max_2level_cut[cut::Internal], Is().EqualTo(1u)); + AssertThat(nf_0and1and2.max_2level_cut[cut::Internal_False], Is().EqualTo(3u)); + AssertThat(nf_0and1and2.max_2level_cut[cut::Internal_True], Is().EqualTo(1u)); + AssertThat(nf_0and1and2.max_2level_cut[cut::All], Is().EqualTo(4u)); }); it("is copy of 1-level for x0 & x1 | c2", [&]() { - AssertThat(nf_0and1_or_2.max_2level_cut[cut_type::INTERNAL], Is().EqualTo(2u)); - AssertThat(nf_0and1_or_2.max_2level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(2u)); - AssertThat(nf_0and1_or_2.max_2level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(3u)); - AssertThat(nf_0and1_or_2.max_2level_cut[cut_type::ALL], Is().EqualTo(3u)); + AssertThat(nf_0and1_or_2.max_2level_cut[cut::Internal], Is().EqualTo(2u)); + AssertThat(nf_0and1_or_2.max_2level_cut[cut::Internal_False], Is().EqualTo(2u)); + AssertThat(nf_0and1_or_2.max_2level_cut[cut::Internal_True], Is().EqualTo(3u)); + AssertThat(nf_0and1_or_2.max_2level_cut[cut::All], Is().EqualTo(3u)); }); it("is soundly upper bounded for x21 ^ x42", [&]() { - AssertThat(nf_21xor42.max_2level_cut[cut_type::INTERNAL], Is().EqualTo(2u)); + AssertThat(nf_21xor42.max_2level_cut[cut::Internal], Is().EqualTo(2u)); - AssertThat(nf_21xor42.max_2level_cut[cut_type::INTERNAL_FALSE], Is().GreaterThanOrEqualTo(2u)); - AssertThat(nf_21xor42.max_2level_cut[cut_type::INTERNAL_FALSE], Is().LessThanOrEqualTo(4u)); + AssertThat(nf_21xor42.max_2level_cut[cut::Internal_False], Is().GreaterThanOrEqualTo(2u)); + AssertThat(nf_21xor42.max_2level_cut[cut::Internal_False], Is().LessThanOrEqualTo(4u)); - AssertThat(nf_21xor42.max_2level_cut[cut_type::INTERNAL_TRUE], Is().GreaterThanOrEqualTo(2u)); - AssertThat(nf_21xor42.max_2level_cut[cut_type::INTERNAL_TRUE], Is().LessThanOrEqualTo(4u)); + AssertThat(nf_21xor42.max_2level_cut[cut::Internal_True], Is().GreaterThanOrEqualTo(2u)); + AssertThat(nf_21xor42.max_2level_cut[cut::Internal_True], Is().LessThanOrEqualTo(4u)); - AssertThat(nf_21xor42.max_2level_cut[cut_type::ALL], Is().EqualTo(4u)); + AssertThat(nf_21xor42.max_2level_cut[cut::All], Is().EqualTo(4u)); }); it("is soundly upper bounded for (x0 + x1 + x2 + x3 + x4) mod 2", [&]() { // Uses upper bounds derived from 1-level cut. - AssertThat(nf_sum01234_mod2.max_2level_cut[cut_type::INTERNAL], Is().GreaterThanOrEqualTo(4u)); - AssertThat(nf_sum01234_mod2.max_2level_cut[cut_type::INTERNAL], Is().LessThanOrEqualTo(6u)); + AssertThat(nf_sum01234_mod2.max_2level_cut[cut::Internal], Is().GreaterThanOrEqualTo(4u)); + AssertThat(nf_sum01234_mod2.max_2level_cut[cut::Internal], Is().LessThanOrEqualTo(6u)); - AssertThat(nf_sum01234_mod2.max_2level_cut[cut_type::INTERNAL_FALSE], Is().GreaterThanOrEqualTo(4u)); - AssertThat(nf_sum01234_mod2.max_2level_cut[cut_type::INTERNAL_FALSE], Is().LessThanOrEqualTo(8u)); + AssertThat(nf_sum01234_mod2.max_2level_cut[cut::Internal_False], Is().GreaterThanOrEqualTo(4u)); + AssertThat(nf_sum01234_mod2.max_2level_cut[cut::Internal_False], Is().LessThanOrEqualTo(8u)); - AssertThat(nf_sum01234_mod2.max_2level_cut[cut_type::INTERNAL_TRUE], Is().GreaterThanOrEqualTo(4u)); - AssertThat(nf_sum01234_mod2.max_2level_cut[cut_type::INTERNAL_TRUE], Is().LessThanOrEqualTo(8u)); + AssertThat(nf_sum01234_mod2.max_2level_cut[cut::Internal_True], Is().GreaterThanOrEqualTo(4u)); + AssertThat(nf_sum01234_mod2.max_2level_cut[cut::Internal_True], Is().LessThanOrEqualTo(8u)); - AssertThat(nf_sum01234_mod2.max_2level_cut[cut_type::ALL], Is().GreaterThanOrEqualTo(4u)); - AssertThat(nf_sum01234_mod2.max_2level_cut[cut_type::ALL], Is().LessThanOrEqualTo(8u)); + AssertThat(nf_sum01234_mod2.max_2level_cut[cut::All], Is().GreaterThanOrEqualTo(4u)); + AssertThat(nf_sum01234_mod2.max_2level_cut[cut::All], Is().LessThanOrEqualTo(8u)); }); // The maximum 2-level cut greater than the maximum 1-level cut. it("is soundly upper bounded when 2-level cut > 1-level cut [A]", [&]() { - AssertThat(nf_larger_2level_cut_A.max_2level_cut[cut_type::INTERNAL], Is().GreaterThanOrEqualTo(4u)); - AssertThat(nf_larger_2level_cut_A.max_2level_cut[cut_type::INTERNAL], Is().LessThanOrEqualTo(6u)); + AssertThat(nf_larger_2level_cut_A.max_2level_cut[cut::Internal], Is().GreaterThanOrEqualTo(4u)); + AssertThat(nf_larger_2level_cut_A.max_2level_cut[cut::Internal], Is().LessThanOrEqualTo(6u)); - AssertThat(nf_larger_2level_cut_A.max_2level_cut[cut_type::INTERNAL_FALSE], Is().GreaterThanOrEqualTo(4u)); - AssertThat(nf_larger_2level_cut_A.max_2level_cut[cut_type::INTERNAL_FALSE], Is().LessThanOrEqualTo(6u)); + AssertThat(nf_larger_2level_cut_A.max_2level_cut[cut::Internal_False], Is().GreaterThanOrEqualTo(4u)); + AssertThat(nf_larger_2level_cut_A.max_2level_cut[cut::Internal_False], Is().LessThanOrEqualTo(6u)); - AssertThat(nf_larger_2level_cut_A.max_2level_cut[cut_type::INTERNAL_TRUE], Is().GreaterThanOrEqualTo(5u)); - AssertThat(nf_larger_2level_cut_A.max_2level_cut[cut_type::INTERNAL_TRUE], Is().LessThanOrEqualTo(8u)); + AssertThat(nf_larger_2level_cut_A.max_2level_cut[cut::Internal_True], Is().GreaterThanOrEqualTo(5u)); + AssertThat(nf_larger_2level_cut_A.max_2level_cut[cut::Internal_True], Is().LessThanOrEqualTo(8u)); - AssertThat(nf_larger_2level_cut_A.max_2level_cut[cut_type::ALL], Is().GreaterThanOrEqualTo(5u)); - AssertThat(nf_larger_2level_cut_A.max_2level_cut[cut_type::ALL], Is().LessThanOrEqualTo(8u)); + AssertThat(nf_larger_2level_cut_A.max_2level_cut[cut::All], Is().GreaterThanOrEqualTo(5u)); + AssertThat(nf_larger_2level_cut_A.max_2level_cut[cut::All], Is().LessThanOrEqualTo(8u)); }); it("is soundly upper bounded when 2-level cut > 1-level cut [B]", [&]() { - AssertThat(nf_larger_2level_cut_B.max_2level_cut[cut_type::INTERNAL], Is().GreaterThanOrEqualTo(4u)); - AssertThat(nf_larger_2level_cut_B.max_2level_cut[cut_type::INTERNAL], Is().LessThanOrEqualTo(6u)); + AssertThat(nf_larger_2level_cut_B.max_2level_cut[cut::Internal], Is().GreaterThanOrEqualTo(4u)); + AssertThat(nf_larger_2level_cut_B.max_2level_cut[cut::Internal], Is().LessThanOrEqualTo(6u)); - AssertThat(nf_larger_2level_cut_B.max_2level_cut[cut_type::INTERNAL_FALSE], Is().GreaterThanOrEqualTo(4u)); - AssertThat(nf_larger_2level_cut_B.max_2level_cut[cut_type::INTERNAL_FALSE], Is().LessThanOrEqualTo(7u)); + AssertThat(nf_larger_2level_cut_B.max_2level_cut[cut::Internal_False], Is().GreaterThanOrEqualTo(4u)); + AssertThat(nf_larger_2level_cut_B.max_2level_cut[cut::Internal_False], Is().LessThanOrEqualTo(7u)); - AssertThat(nf_larger_2level_cut_B.max_2level_cut[cut_type::INTERNAL_TRUE], Is().GreaterThanOrEqualTo(4u)); - AssertThat(nf_larger_2level_cut_B.max_2level_cut[cut_type::INTERNAL_TRUE], Is().LessThanOrEqualTo(7u)); + AssertThat(nf_larger_2level_cut_B.max_2level_cut[cut::Internal_True], Is().GreaterThanOrEqualTo(4u)); + AssertThat(nf_larger_2level_cut_B.max_2level_cut[cut::Internal_True], Is().LessThanOrEqualTo(7u)); - AssertThat(nf_larger_2level_cut_B.max_2level_cut[cut_type::ALL], Is().GreaterThanOrEqualTo(5u)); - AssertThat(nf_larger_2level_cut_B.max_2level_cut[cut_type::ALL], Is().LessThanOrEqualTo(8u)); + AssertThat(nf_larger_2level_cut_B.max_2level_cut[cut::All], Is().GreaterThanOrEqualTo(5u)); + AssertThat(nf_larger_2level_cut_B.max_2level_cut[cut::All], Is().LessThanOrEqualTo(8u)); }); }); }); @@ -683,7 +683,7 @@ go_bandit([]() { levelized_file nf; { node_writer nw(nf); - nw << node(1,0, node::ptr_t(false), node::ptr_t(true)); + nw << node(1,0, node::pointer_type(false), node::pointer_type(true)); } AssertThat(nf.is_terminal(), Is().False()); @@ -695,8 +695,8 @@ go_bandit([]() { levelized_file nf; { node_writer nw(nf); - nw << node(1,0, node::ptr_t(false), node::ptr_t(true)) - << node(0,0, node::ptr_t(1,0), node::ptr_t(false)); + nw << node(1,0, node::pointer_type(false), node::pointer_type(true)) + << node(0,0, node::pointer_type(1,0), node::pointer_type(false)); } AssertThat(nf.is_terminal(), Is().False()); @@ -709,7 +709,7 @@ go_bandit([]() { // TODO: stream: reads backwards by default // TODO: stream: reads forwards if desired - describe(".seek(const node::uid_t &u)", []() { + describe(".seek(const node::uid_type &u)", []() { it("can seek in False sink", [&]() { levelized_file nf; { @@ -719,10 +719,10 @@ go_bandit([]() { node_stream<> ns(nf); - AssertThat(ns.seek(node::uid_t(0,0)), Is().EqualTo(node(false))); - AssertThat(ns.seek(node::uid_t(1,0)), Is().EqualTo(node(false))); - AssertThat(ns.seek(node::uid_t(1,1)), Is().EqualTo(node(false))); - AssertThat(ns.seek(node::uid_t(node::MAX_LABEL, node::MAX_ID)), Is().EqualTo(node(false))); + AssertThat(ns.seek(node::uid_type(0,0)), Is().EqualTo(node(false))); + AssertThat(ns.seek(node::uid_type(1,0)), Is().EqualTo(node(false))); + AssertThat(ns.seek(node::uid_type(1,1)), Is().EqualTo(node(false))); + AssertThat(ns.seek(node::uid_type(node::max_label, node::max_id)), Is().EqualTo(node(false))); }); it("can seek in True sink", [&]() { @@ -734,78 +734,78 @@ go_bandit([]() { node_stream<> ns(nf); - AssertThat(ns.seek(node::uid_t(0,0)), Is().EqualTo(node(true))); - AssertThat(ns.seek(node::uid_t(1,0)), Is().EqualTo(node(true))); - AssertThat(ns.seek(node::uid_t(1,1)), Is().EqualTo(node(true))); - AssertThat(ns.seek(node::uid_t(node::MAX_LABEL, node::MAX_ID)), Is().EqualTo(node(true))); + AssertThat(ns.seek(node::uid_type(0,0)), Is().EqualTo(node(true))); + AssertThat(ns.seek(node::uid_type(1,0)), Is().EqualTo(node(true))); + AssertThat(ns.seek(node::uid_type(1,1)), Is().EqualTo(node(true))); + AssertThat(ns.seek(node::uid_type(node::max_label, node::max_id)), Is().EqualTo(node(true))); }); it("can seek existing elements", [&]() { levelized_file nf; { node_writer nw(nf); - nw << node(1,1, node::ptr_t(false), node::ptr_t(true)) - << node(1,0, node::ptr_t(true), node::ptr_t(false)) - << node(0,0, node::uid_t(1,0), node::uid_t(1,1)) + nw << node(1,1, node::pointer_type(false), node::pointer_type(true)) + << node(1,0, node::pointer_type(true), node::pointer_type(false)) + << node(0,0, node::uid_type(1,0), node::uid_type(1,1)) ; } node_stream<> ns(nf); - AssertThat(ns.seek(node::uid_t(0,0)), Is().EqualTo(node(0,0, node::uid_t(1,0), node::uid_t(1,1)))); - AssertThat(ns.seek(node::uid_t(1,1)), Is().EqualTo(node(1,1, node::ptr_t(false), node::ptr_t(true)))); + AssertThat(ns.seek(node::uid_type(0,0)), Is().EqualTo(node(0,0, node::uid_type(1,0), node::uid_type(1,1)))); + AssertThat(ns.seek(node::uid_type(1,1)), Is().EqualTo(node(1,1, node::pointer_type(false), node::pointer_type(true)))); }); it("can seek non-existing element in the middle ", [&]() { levelized_file nf; { node_writer nw(nf); - nw << node(2,1, node::ptr_t(false), node::ptr_t(true)) - << node(2,0, node::ptr_t(true), node::ptr_t(false)) - << node(0,0, node::ptr_t(1,0), node::ptr_t(1,1)) + nw << node(2,1, node::pointer_type(false), node::pointer_type(true)) + << node(2,0, node::pointer_type(true), node::pointer_type(false)) + << node(0,0, node::pointer_type(1,0), node::pointer_type(1,1)) ; } node_stream<> ns(nf); - AssertThat(ns.seek(node::uid_t(0,0)), Is().EqualTo(node(0,0, node::ptr_t(1,0), node::ptr_t(1,1)))); - AssertThat(ns.seek(node::uid_t(1,1)), Is().EqualTo(node(2,0, node::ptr_t(true), node::ptr_t(false)))); - AssertThat(ns.seek(node::uid_t(1,2)), Is().EqualTo(node(2,0, node::ptr_t(true), node::ptr_t(false)))); - AssertThat(ns.seek(node::uid_t(2,0)), Is().EqualTo(node(2,0, node::ptr_t(true), node::ptr_t(false)))); - AssertThat(ns.seek(node::uid_t(2,1)), Is().EqualTo(node(2,1, node::ptr_t(false), node::ptr_t(true)))); + AssertThat(ns.seek(node::uid_type(0,0)), Is().EqualTo(node(0,0, node::pointer_type(1,0), node::pointer_type(1,1)))); + AssertThat(ns.seek(node::uid_type(1,1)), Is().EqualTo(node(2,0, node::pointer_type(true), node::pointer_type(false)))); + AssertThat(ns.seek(node::uid_type(1,2)), Is().EqualTo(node(2,0, node::pointer_type(true), node::pointer_type(false)))); + AssertThat(ns.seek(node::uid_type(2,0)), Is().EqualTo(node(2,0, node::pointer_type(true), node::pointer_type(false)))); + AssertThat(ns.seek(node::uid_type(2,1)), Is().EqualTo(node(2,1, node::pointer_type(false), node::pointer_type(true)))); }); it("can seek past end [1]", [&]() { levelized_file nf; { node_writer nw(nf); - nw << node(1,1, node::ptr_t(false), node::ptr_t(true)) - << node(1,0, node::ptr_t(true), node::ptr_t(false)) - << node(0,0, node::ptr_t(1,0), node::ptr_t(1,1)) + nw << node(1,1, node::pointer_type(false), node::pointer_type(true)) + << node(1,0, node::pointer_type(true), node::pointer_type(false)) + << node(0,0, node::pointer_type(1,0), node::pointer_type(1,1)) ; } node_stream<> ns(nf); - AssertThat(ns.seek(node::uid_t(node::MAX_LABEL, node::MAX_ID)), - Is().EqualTo(node(1,1, node::ptr_t(false), node::ptr_t(true)))); + AssertThat(ns.seek(node::uid_type(node::max_label, node::max_id)), + Is().EqualTo(node(1,1, node::pointer_type(false), node::pointer_type(true)))); }); it("can seek past end [2]", [&]() { levelized_file nf; { node_writer nw(nf); - nw << node(1,1, node::ptr_t(false), node::ptr_t(true)) - << node(1,0, node::ptr_t(true), node::ptr_t(false)) - << node(0,0, node::ptr_t(1,0), node::ptr_t(1,1)) + nw << node(1,1, node::pointer_type(false), node::pointer_type(true)) + << node(1,0, node::pointer_type(true), node::pointer_type(false)) + << node(0,0, node::pointer_type(1,0), node::pointer_type(1,1)) ; } node_stream<> ns(nf); - AssertThat(ns.seek(node::uid_t(0,0)), Is().EqualTo(node(0,0, node::ptr_t(1,0), node::ptr_t(1,1)))); - AssertThat(ns.seek(node::uid_t(1,1)), Is().EqualTo(node(1,1, node::ptr_t(false), node::ptr_t(true)))); - AssertThat(ns.seek(node::uid_t(2,0)), Is().EqualTo(node(1,1, node::ptr_t(false), node::ptr_t(true)))); + AssertThat(ns.seek(node::uid_type(0,0)), Is().EqualTo(node(0,0, node::pointer_type(1,0), node::pointer_type(1,1)))); + AssertThat(ns.seek(node::uid_type(1,1)), Is().EqualTo(node(1,1, node::pointer_type(false), node::pointer_type(true)))); + AssertThat(ns.seek(node::uid_type(2,0)), Is().EqualTo(node(1,1, node::pointer_type(false), node::pointer_type(true)))); }); // TODO: reversed @@ -817,7 +817,7 @@ go_bandit([]() { // / \ // F T */ - const node A_n1 = node(1, node::MAX_ID, node::ptr_t(false), node::ptr_t(true)); + const node A_n1 = node(1, node::max_id, node::pointer_type(false), node::pointer_type(true)); levelized_file nf_A; { @@ -836,13 +836,13 @@ go_bandit([]() { // / \ / \ // T F F T */ - const node B_n7 = node(4, node::MAX_ID, node::ptr_t(false), node::ptr_t(true)); - const node B_n6 = node(4, node::MAX_ID-1, node::ptr_t(true), node::ptr_t(false)); - const node B_n5 = node(2, node::MAX_ID, B_n7.uid(), node::ptr_t(true)); - const node B_n4 = node(2, node::MAX_ID-1, B_n6.uid(), B_n7.uid()); - const node B_n3 = node(2, node::MAX_ID-2, node::ptr_t(false), B_n6.uid()); - const node B_n2 = node(1, node::MAX_ID, B_n3.uid(), B_n4.uid()); - const node B_n1 = node(0, node::MAX_ID, B_n2.uid(), B_n5.uid()); + const node B_n7 = node(4, node::max_id, node::pointer_type(false), node::pointer_type(true)); + const node B_n6 = node(4, node::max_id-1, node::pointer_type(true), node::pointer_type(false)); + const node B_n5 = node(2, node::max_id, B_n7.uid(), node::pointer_type(true)); + const node B_n4 = node(2, node::max_id-1, B_n6.uid(), B_n7.uid()); + const node B_n3 = node(2, node::max_id-2, node::pointer_type(false), B_n6.uid()); + const node B_n2 = node(1, node::max_id, B_n3.uid(), B_n4.uid()); + const node B_n1 = node(0, node::max_id, B_n2.uid(), B_n5.uid()); levelized_file nf_B; { @@ -1204,7 +1204,7 @@ go_bandit([]() { node_random_access nra(nf); - AssertThat(nra.root(), Is().EqualTo(node::ptr_t(false))); + AssertThat(nra.root(), Is().EqualTo(node::pointer_type(false))); }); it("provides root for 'T' terminal", []() { @@ -1216,7 +1216,7 @@ go_bandit([]() { node_random_access nra(nf); - AssertThat(nra.root(), Is().EqualTo(node::ptr_t(true))); + AssertThat(nra.root(), Is().EqualTo(node::pointer_type(true))); }); it("provides root before accessing anything", [&]() { diff --git a/test/adiar/internal/test_dd_func.cpp b/test/adiar/internal/test_dd_func.cpp index 8e31a6dc6..fc3dd4837 100644 --- a/test/adiar/internal/test_dd_func.cpp +++ b/test/adiar/internal/test_dd_func.cpp @@ -20,30 +20,30 @@ go_bandit([]() { shared_levelized_file x0; { node_writer writer(x0); - writer << node(0, node::MAX_ID, false_ptr, true_ptr); + writer << node(0, node::max_id, false_ptr, true_ptr); } shared_levelized_file x42; { node_writer writer(x42); - writer << node(42, node::MAX_ID, false_ptr, true_ptr); + writer << node(42, node::max_id, false_ptr, true_ptr); } - shared_levelized_file bdd_file; + shared_levelized_file bdd_file; { - node n3 = node(4, node::MAX_ID, true_ptr, false_ptr); - node n2 = node(3, node::MAX_ID, n3.uid(), false_ptr); - node n1 = node(1, node::MAX_ID, n3.uid(), n2.uid()); + node n3 = node(4, node::max_id, true_ptr, false_ptr); + node n2 = node(3, node::max_id, n3.uid(), false_ptr); + node n1 = node(1, node::max_id, n3.uid(), n2.uid()); node_writer writer(bdd_file); writer << n3 << n2 << n1; } - shared_levelized_file zdd_file; + shared_levelized_file zdd_file; { - node n4 = node(2, node::MAX_ID, true_ptr, true_ptr); - node n3 = node(2, node::MAX_ID-1, false_ptr, true_ptr); - node n2 = node(1, node::MAX_ID, n4.uid(), n4.uid()); - node n1 = node(0, node::MAX_ID, n3.uid(), n4.uid()); + node n4 = node(2, node::max_id, true_ptr, true_ptr); + node n3 = node(2, node::max_id-1, false_ptr, true_ptr); + node n2 = node(1, node::max_id, n4.uid(), n4.uid()); + node n1 = node(0, node::max_id, n3.uid(), n4.uid()); node_writer writer(zdd_file); writer << n4 << n3 << n2 << n1; } @@ -146,160 +146,184 @@ go_bandit([]() { }); }); - describe("terminal predicates", [&]() { - describe("is_terminal", [&]() { + describe("canonicity, i.e. sorted & indexable", [&]() { + // TODO + }); + + describe("terminal predicates [dd_...]", [&]() { + describe("dd::is_terminal()", [&]() { + // TODO + }); + + describe("dd_isterminal(...)", [&]() { it("rejects x0 as a BDD terminal file", [&]() { - AssertThat(is_terminal(bdd(x0)), Is().False()); + AssertThat(bdd_isterminal(x0), Is().False()); }); it("rejects x0 as a ZDD terminal file", [&]() { - AssertThat(is_terminal(zdd(x0)), Is().False()); + AssertThat(zdd_isterminal(x0), Is().False()); }); it("rejects larger BDD as being a terminal", [&]() { - AssertThat(is_terminal(bdd(bdd_file)), Is().False()); + AssertThat(bdd_isterminal(bdd_file), Is().False()); }); it("rejects larger ZDD as being a terminal", [&]() { - AssertThat(is_terminal(zdd(zdd_file)), Is().False()); + AssertThat(zdd_isterminal(zdd_file), Is().False()); }); it("accepts a BDD true terminal", [&]() { - AssertThat(is_terminal(bdd(terminal_T)), Is().True()); + AssertThat(bdd_isterminal(terminal_T), Is().True()); }); it("accepts a ZDD true terminal", [&]() { - AssertThat(is_terminal(zdd(terminal_T)), Is().True()); + AssertThat(zdd_isterminal(terminal_T), Is().True()); }); it("accepts a BDD false terminal", [&]() { - AssertThat(is_terminal(bdd(terminal_F)), Is().True()); + AssertThat(bdd_isterminal(terminal_F), Is().True()); }); it("accepts a ZDD false terminal", [&]() { - AssertThat(is_terminal(zdd(terminal_F)), Is().True()); + AssertThat(zdd_isterminal(terminal_F), Is().True()); }); }); - describe("value_of", [&]() { + describe("dd::value()", [&]() { + // TODO + }); + + describe("dd_valueof(...)", [&]() { it("extracts from a true BDD terminal", [&]() { - AssertThat(value_of(bdd(terminal_T)), Is().True()); + AssertThat(dd_valueof(bdd(terminal_T)), Is().True()); }); it("extracts from a negation of a true BDD terminal", [&]() { - AssertThat(value_of(~ bdd(terminal_T)), Is().False()); + AssertThat(dd_valueof(~ bdd(terminal_T)), Is().False()); }); it("extracts from a true ZDD terminal", [&]() { - AssertThat(value_of(zdd(terminal_T)), Is().True()); + AssertThat(dd_valueof(zdd(terminal_T)), Is().True()); }); it("extracts from a false BDD terminal", [&]() { - AssertThat(value_of(bdd(terminal_F)), Is().False()); + AssertThat(dd_valueof(bdd(terminal_F)), Is().False()); }); it("extracts from a negation of a false BDD terminal", [&]() { - AssertThat(value_of(~ bdd(terminal_F)), Is().True()); + AssertThat(dd_valueof(~ bdd(terminal_F)), Is().True()); }); it("extracts from a false ZDD terminal", [&]() { - AssertThat(value_of(zdd(terminal_F)), Is().False()); + AssertThat(dd_valueof(zdd(terminal_F)), Is().False()); }); }); - describe("is_false / is_empty", [&]() { + describe("dd::is_false()", [&]() { + // TODO + }); + + describe("bdd_isfalse / zdd_isfalse / zdd_isempty", [&]() { it("rejects x0 [BDD]", [&]() { - AssertThat(is_false(bdd(x0)), Is().False()); + AssertThat(bdd_isfalse(x0), Is().False()); }); it("rejects x0 [ZDD]", [&]() { - AssertThat(is_false(zdd(x0)), Is().False()); - AssertThat(is_empty(zdd(x0)), Is().False()); + AssertThat(zdd_isfalse(x0), Is().False()); + AssertThat(zdd_isempty(x0), Is().False()); }); it("rejects x42 [BDD]", [&]() { - AssertThat(is_false(bdd(x42)), Is().False()); + AssertThat(bdd_isfalse(x42), Is().False()); }); it("rejects x42 [ZDD]", [&]() { - AssertThat(is_false(zdd(x42)), Is().False()); - AssertThat(is_empty(zdd(x42)), Is().False()); + AssertThat(zdd_isfalse(x42), Is().False()); + AssertThat(zdd_isempty(x42), Is().False()); }); it("rejects larger decision diagram [BDD]", [&]() { - AssertThat(is_false(bdd(bdd_file)), Is().False()); + AssertThat(bdd_isfalse(bdd_file), Is().False()); }); it("rejects larger decision diagram [ZDD]", [&]() { - AssertThat(is_false(zdd(zdd_file)), Is().False()); - AssertThat(is_empty(zdd(zdd_file)), Is().False()); + AssertThat(zdd_isfalse(zdd_file), Is().False()); + AssertThat(zdd_isempty(zdd_file), Is().False()); }); it("rejects true terminal [BDD]", [&]() { - AssertThat(is_false(bdd(terminal_T)), Is().False()); + AssertThat(bdd_isfalse(terminal_T), Is().False()); }); it("rejects true terminal [ZDD]", [&]() { - AssertThat(is_false(zdd(terminal_T)), Is().False()); - AssertThat(is_empty(zdd(terminal_T)), Is().False()); + AssertThat(zdd_isfalse(terminal_T), Is().False()); + AssertThat(zdd_isempty(terminal_T), Is().False()); }); it("accepts false terminal [BDD]", [&]() { - AssertThat(is_false(bdd(terminal_F)), Is().True()); + AssertThat(bdd_isfalse(terminal_F), Is().True()); }); it("accepts false terminal [ZDD]", [&]() { - AssertThat(is_false(zdd(terminal_F)), Is().True()); - AssertThat(is_empty(zdd(terminal_F)), Is().True()); + AssertThat(zdd_isfalse(terminal_F), Is().True()); + AssertThat(zdd_isempty(terminal_F), Is().True()); }); }); - describe("is_true / is_null", [&]() { + describe("dd::is_true()", [&]() { + // TODO + }); + + describe("bdd_istrue / zdd_istrue / zdd_isnull", [&]() { it("rejects x0 [BDD]", [&]() { - AssertThat(is_true(bdd(x0)), Is().False()); + AssertThat(bdd_istrue(x0), Is().False()); }); it("rejects x0 [ZDD]", [&]() { - AssertThat(is_true(zdd(x0)), Is().False()); - AssertThat(is_null(zdd(x0)), Is().False()); + AssertThat(zdd_istrue(x0), Is().False()); + AssertThat(zdd_isnull(x0), Is().False()); }); it("rejects x42 [BDD]", [&]() { - AssertThat(is_true(bdd(x42)), Is().False()); + AssertThat(bdd_istrue(x42), Is().False()); }); it("rejects x42 [ZDD]", [&]() { - AssertThat(is_true(zdd(x42)), Is().False()); - AssertThat(is_null(zdd(x42)), Is().False()); + AssertThat(zdd_istrue(x42), Is().False()); + AssertThat(zdd_isnull(x42), Is().False()); }); it("rejects larger decision diagram [BDD]", [&]() { - AssertThat(is_true(bdd(bdd_file)), Is().False()); + AssertThat(bdd_istrue(bdd_file), Is().False()); }); it("rejects larger decision diagram [ZDD]", [&]() { - AssertThat(is_true(zdd(zdd_file)), Is().False()); - AssertThat(is_null(zdd(zdd_file)), Is().False()); + AssertThat(zdd_istrue(zdd_file), Is().False()); + AssertThat(zdd_isnull(zdd_file), Is().False()); }); it("rejects false terminal [BDD]", [&]() { - AssertThat(is_true(bdd(terminal_F)), Is().False()); + AssertThat(bdd_istrue(terminal_F), Is().False()); }); it("rejects false terminal [ZDD]", [&]() { - AssertThat(is_true(zdd(terminal_F)), Is().False()); - AssertThat(is_null(zdd(terminal_F)), Is().False()); + AssertThat(zdd_istrue(terminal_F), Is().False()); + AssertThat(zdd_isnull(terminal_F), Is().False()); }); it("accepts a true terminal [BDD]", [&]() { - AssertThat(is_true(bdd(terminal_T)), Is().True()); + AssertThat(bdd_istrue(terminal_T), Is().True()); }); it("accepts a true terminal [ZDD]", [&]() { - AssertThat(is_true(zdd(terminal_T)), Is().True()); - AssertThat(is_null(zdd(terminal_T)), Is().True()); + AssertThat(zdd_istrue(terminal_T), Is().True()); + AssertThat(zdd_isnull(terminal_T), Is().True()); }); }); }); + + describe("top and bottom-most variables", [&]() { + // TODO + }); }); }); diff --git a/test/adiar/internal/test_dot.cpp b/test/adiar/internal/test_dot.cpp index ac2d9d9f5..17974563b 100644 --- a/test/adiar/internal/test_dot.cpp +++ b/test/adiar/internal/test_dot.cpp @@ -14,7 +14,7 @@ go_bandit([]() { }); it("can output .dot for a BDD with internal nodes", [&]() { - shared_levelized_file reduced_bdd; + shared_levelized_file reduced_bdd; { // Garbage collect writer early node_writer rw(reduced_bdd); @@ -55,7 +55,7 @@ go_bandit([]() { }); it("can output .dot for a ZDD with internal nodes", [&]() { - shared_levelized_file reduced_zdd; + shared_levelized_file reduced_zdd; { // Garbage collect writer early node_writer rw(reduced_zdd); @@ -103,7 +103,7 @@ go_bandit([]() { uw.push_internal({ flag(ptr_uint64(1,1)), ptr_uint64(2,0) }); } - output_dot(unreduced_bdd, "dot_test_unreduced.dot"); + print_dot(unreduced_bdd, "dot_test_unreduced.dot"); int exit_value = system("dot -O -Tpng dot_test_unreduced.dot"); AssertThat(exit_value, Is().EqualTo(0)); }); diff --git a/test/adiar/internal/test_util.cpp b/test/adiar/internal/test_util.cpp index d910de78f..42eeeac14 100644 --- a/test/adiar/internal/test_util.cpp +++ b/test/adiar/internal/test_util.cpp @@ -17,11 +17,11 @@ go_bandit([]() { // F T */ - const node n3 = node(2, node::MAX_ID, false_ptr, true_ptr); - const node n2 = node(1, node::MAX_ID, true_ptr, n3.uid()); - const node n1 = node(0, node::MAX_ID, n2.uid(), n3.uid()); + const node n3 = node(2, node::max_id, false_ptr, true_ptr); + const node n2 = node(1, node::max_id, true_ptr, n3.uid()); + const node n1 = node(0, node::max_id, n2.uid(), n3.uid()); - shared_levelized_file in; + shared_levelized_file in; { node_writer writer(in); writer << n3 << n2 << n1; @@ -68,7 +68,7 @@ go_bandit([]() { AssertThat(levels.can_pull(), Is().False()); - AssertThat(out->max_1level_cut, Is().EqualTo(in->max_1level_cut[cut_type::INTERNAL])); + AssertThat(out->max_1level_cut, Is().EqualTo(in->max_1level_cut[cut::Internal])); AssertThat(out->number_of_terminals[false], Is().EqualTo(in->number_of_terminals[false])); AssertThat(out->number_of_terminals[true], Is().EqualTo(in->number_of_terminals[true])); }); @@ -86,13 +86,13 @@ go_bandit([]() { // F T */ - const node n5 = node(3, node::MAX_ID, false_ptr, true_ptr); - const node n4 = node(2, node::MAX_ID, n5.uid(), true_ptr); - const node n3 = node(2, node::MAX_ID-1, false_ptr, n5.uid()); - const node n2 = node(1, node::MAX_ID, n3.uid(), n4.uid()); - const node n1 = node(0, node::MAX_ID, n3.uid(), n2.uid()); + const node n5 = node(3, node::max_id, false_ptr, true_ptr); + const node n4 = node(2, node::max_id, n5.uid(), true_ptr); + const node n3 = node(2, node::max_id-1, false_ptr, n5.uid()); + const node n2 = node(1, node::max_id, n3.uid(), n4.uid()); + const node n1 = node(0, node::max_id, n3.uid(), n2.uid()); - shared_levelized_file in; + shared_levelized_file in; { node_writer writer(in); writer << n5 << n4 << n3 << n2 << n1; @@ -153,7 +153,7 @@ go_bandit([]() { AssertThat(levels.can_pull(), Is().False()); - AssertThat(out->max_1level_cut, Is().EqualTo(in->max_1level_cut[cut_type::INTERNAL])); + AssertThat(out->max_1level_cut, Is().EqualTo(in->max_1level_cut[cut::Internal])); AssertThat(out->number_of_terminals[false], Is().EqualTo(in->number_of_terminals[false])); AssertThat(out->number_of_terminals[true], Is().EqualTo(in->number_of_terminals[true])); }); @@ -172,13 +172,13 @@ go_bandit([]() { // F T T T */ - const node n5 = node(2, node::MAX_ID, true_ptr, true_ptr); - const node n4 = node(2, node::MAX_ID-1, false_ptr, true_ptr); - const node n3 = node(1, node::MAX_ID, n4.uid(), n4.uid()); - const node n2 = node(1, node::MAX_ID-1, false_ptr, n5.uid()); - const node n1 = node(0, node::MAX_ID, n2.uid(), n3.uid()); + const node n5 = node(2, node::max_id, true_ptr, true_ptr); + const node n4 = node(2, node::max_id-1, false_ptr, true_ptr); + const node n3 = node(1, node::max_id, n4.uid(), n4.uid()); + const node n2 = node(1, node::max_id-1, false_ptr, n5.uid()); + const node n1 = node(0, node::max_id, n2.uid(), n3.uid()); - shared_levelized_file in; + shared_levelized_file in; { node_writer writer(in); writer << n5 << n4 << n3 << n2 << n1; @@ -236,7 +236,7 @@ go_bandit([]() { AssertThat(levels.can_pull(), Is().False()); - AssertThat(out->max_1level_cut, Is().EqualTo(in->max_1level_cut[cut_type::INTERNAL])); + AssertThat(out->max_1level_cut, Is().EqualTo(in->max_1level_cut[cut::Internal])); AssertThat(out->number_of_terminals[false], Is().EqualTo(in->number_of_terminals[false])); AssertThat(out->number_of_terminals[true], Is().EqualTo(in->number_of_terminals[true])); }); diff --git a/test/adiar/test_bool_op.cpp b/test/adiar/test_bool_op.cpp index e74842daf..d03f74dc3 100644 --- a/test/adiar/test_bool_op.cpp +++ b/test/adiar/test_bool_op.cpp @@ -1,215 +1,217 @@ #include "../test.h" +#include + go_bandit([]() { - describe("adiar/bool_op.h", []() { - const ptr_uint64 terminal_F = ptr_uint64(false); - const ptr_uint64 terminal_T = ptr_uint64(true); - - it("and_op", [&]() { - AssertThat(and_op(terminal_T, terminal_T), Is().EqualTo(terminal_T)); - AssertThat(and_op(terminal_T, terminal_F), Is().EqualTo(terminal_F)); - AssertThat(and_op(terminal_F, terminal_T), Is().EqualTo(terminal_F)); - AssertThat(and_op(terminal_F, terminal_F), Is().EqualTo(terminal_F)); - }); - - it("nand_op", [&]() { - AssertThat(nand_op(terminal_T, terminal_T), Is().EqualTo(terminal_F)); - AssertThat(nand_op(terminal_T, terminal_F), Is().EqualTo(terminal_T)); - AssertThat(nand_op(terminal_F, terminal_T), Is().EqualTo(terminal_T)); - AssertThat(nand_op(terminal_F, terminal_F), Is().EqualTo(terminal_T)); - }); - - it("or_op", [&]() { - AssertThat(or_op(terminal_T, terminal_T), Is().EqualTo(terminal_T)); - AssertThat(or_op(terminal_T, terminal_F), Is().EqualTo(terminal_T)); - AssertThat(or_op(terminal_F, terminal_T), Is().EqualTo(terminal_T)); - AssertThat(or_op(terminal_F, terminal_F), Is().EqualTo(terminal_F)); - }); - - it("nor_op", [&]() { - AssertThat(nor_op(terminal_T, terminal_T), Is().EqualTo(terminal_F)); - AssertThat(nor_op(terminal_T, terminal_F), Is().EqualTo(terminal_F)); - AssertThat(nor_op(terminal_F, terminal_T), Is().EqualTo(terminal_F)); - AssertThat(nor_op(terminal_F, terminal_F), Is().EqualTo(terminal_T)); - }); - - it("xor_op", [&]() { - AssertThat(xor_op(terminal_T, terminal_T), Is().EqualTo(terminal_F)); - AssertThat(xor_op(terminal_T, terminal_F), Is().EqualTo(terminal_T)); - AssertThat(xor_op(terminal_F, terminal_T), Is().EqualTo(terminal_T)); - AssertThat(xor_op(terminal_F, terminal_F), Is().EqualTo(terminal_F)); - }); - - it("xnor_op", [&]() { - AssertThat(xnor_op(terminal_T, terminal_T), Is().EqualTo(terminal_T)); - AssertThat(xnor_op(terminal_T, terminal_F), Is().EqualTo(terminal_F)); - AssertThat(xnor_op(terminal_F, terminal_T), Is().EqualTo(terminal_F)); - AssertThat(xnor_op(terminal_F, terminal_F), Is().EqualTo(terminal_T)); - }); - - it("imp_op", [&]() { - AssertThat(imp_op(terminal_T, terminal_T), Is().EqualTo(terminal_T)); - AssertThat(imp_op(terminal_T, terminal_F), Is().EqualTo(terminal_F)); - AssertThat(imp_op(terminal_F, terminal_T), Is().EqualTo(terminal_T)); - AssertThat(imp_op(terminal_F, terminal_F), Is().EqualTo(terminal_T)); - }); - - it("invimp_op", [&]() { - AssertThat(invimp_op(terminal_T, terminal_T), Is().EqualTo(terminal_T)); - AssertThat(invimp_op(terminal_T, terminal_F), Is().EqualTo(terminal_T)); - AssertThat(invimp_op(terminal_F, terminal_T), Is().EqualTo(terminal_F)); - AssertThat(invimp_op(terminal_F, terminal_F), Is().EqualTo(terminal_T)); - }); - - it("equiv_op", [&]() { - AssertThat(equiv_op(terminal_T, terminal_T), Is().EqualTo(terminal_T)); - AssertThat(equiv_op(terminal_T, terminal_F), Is().EqualTo(terminal_F)); - AssertThat(equiv_op(terminal_F, terminal_T), Is().EqualTo(terminal_F)); - AssertThat(equiv_op(terminal_F, terminal_F), Is().EqualTo(terminal_T)); - }); - - it("equiv_op (flags)", [&]() { - AssertThat(equiv_op(flag(terminal_T), terminal_T), Is().EqualTo(terminal_T)); - AssertThat(equiv_op(terminal_T, flag(terminal_F)), Is().EqualTo(terminal_F)); - AssertThat(equiv_op(flag(terminal_F), terminal_T), Is().EqualTo(terminal_F)); - AssertThat(equiv_op(terminal_F, flag(terminal_F)), Is().EqualTo(terminal_T)); - }); - - it("diff_op", [&]() { - AssertThat(diff_op(terminal_T, terminal_T), Is().EqualTo(terminal_F)); - AssertThat(diff_op(terminal_T, terminal_F), Is().EqualTo(terminal_T)); - AssertThat(diff_op(terminal_F, terminal_T), Is().EqualTo(terminal_F)); - AssertThat(diff_op(terminal_F, terminal_F), Is().EqualTo(terminal_F)); - }); - - it("less_op", [&]() { - AssertThat(less_op(terminal_T, terminal_T), Is().EqualTo(terminal_F)); - AssertThat(less_op(terminal_T, terminal_F), Is().EqualTo(terminal_F)); - AssertThat(less_op(terminal_F, terminal_T), Is().EqualTo(terminal_T)); - AssertThat(less_op(terminal_F, terminal_F), Is().EqualTo(terminal_F)); - }); - - describe("can_shortcut", [&]() { - it("can check on T terminal on the left", [&]() { - AssertThat(can_left_shortcut(and_op, terminal_T), Is().False()); - AssertThat(can_left_shortcut(or_op, terminal_T), Is().True()); - AssertThat(can_left_shortcut(xor_op, terminal_T), Is().False()); - AssertThat(can_left_shortcut(imp_op, terminal_T), Is().False()); - }); - - it("can check on F terminal on the left", [&]() { - AssertThat(can_left_shortcut(and_op, terminal_F), Is().True()); - AssertThat(can_left_shortcut(or_op, terminal_F), Is().False()); - AssertThat(can_left_shortcut(xor_op, terminal_F), Is().False()); - AssertThat(can_left_shortcut(imp_op, terminal_F), Is().True()); - }); - - it("can check on T terminal on the right", [&]() { - AssertThat(can_right_shortcut(and_op, terminal_T), Is().False()); - AssertThat(can_right_shortcut(or_op, terminal_T), Is().True()); - AssertThat(can_right_shortcut(xor_op, terminal_T), Is().False()); - AssertThat(can_right_shortcut(imp_op, terminal_T), Is().True()); - }); - - it("can check on F terminal on the right", [&]() { - AssertThat(can_right_shortcut(and_op, terminal_F), Is().True()); - AssertThat(can_right_shortcut(or_op, terminal_F), Is().False()); - AssertThat(can_right_shortcut(xor_op, terminal_F), Is().False()); - AssertThat(can_right_shortcut(imp_op, terminal_F), Is().False()); - }); - }); - - describe("is_irrelevant", [&]() { - it("can check on T terminal on the left", [&]() { - AssertThat(is_left_irrelevant(and_op, terminal_T), Is().True()); - AssertThat(is_left_irrelevant(or_op, terminal_T), Is().False()); - AssertThat(is_left_irrelevant(xor_op, terminal_T), Is().False()); - AssertThat(is_left_irrelevant(imp_op, terminal_T), Is().True()); - }); - - it("can check on F terminal on the left", [&]() { - AssertThat(is_left_irrelevant(and_op, terminal_F), Is().False()); - AssertThat(is_left_irrelevant(or_op, terminal_F), Is().True()); - AssertThat(is_left_irrelevant(xor_op, terminal_F), Is().True()); - AssertThat(is_left_irrelevant(imp_op, terminal_F), Is().False()); - }); - - it("can check on T terminal on the right", [&]() { - AssertThat(is_right_irrelevant(and_op, terminal_T), Is().True()); - AssertThat(is_right_irrelevant(or_op, terminal_T), Is().False()); - AssertThat(is_right_irrelevant(xor_op, terminal_T), Is().False()); - AssertThat(is_right_irrelevant(imp_op, terminal_T), Is().False()); - }); - - it("can check on F terminal on the right", [&]() { - AssertThat(is_right_irrelevant(and_op, terminal_F), Is().False()); - AssertThat(is_right_irrelevant(or_op, terminal_F), Is().True()); - AssertThat(is_right_irrelevant(xor_op, terminal_F), Is().True()); - AssertThat(is_right_irrelevant(imp_op, terminal_F), Is().False()); - }); - }); - - describe("is_negating", [&]() { - it("can check on T terminal on the left", [&]() { - AssertThat(is_left_negating(and_op, terminal_T), Is().False()); - AssertThat(is_left_negating(or_op, terminal_T), Is().False()); - AssertThat(is_left_negating(xor_op, terminal_T), Is().True()); - AssertThat(is_left_negating(imp_op, terminal_T), Is().False()); - }); - - it("can check on F terminal on the left", [&]() { - AssertThat(is_left_negating(and_op, terminal_F), Is().False()); - AssertThat(is_left_negating(or_op, terminal_F), Is().False()); - AssertThat(is_left_negating(xor_op, terminal_F), Is().False()); - AssertThat(is_left_negating(imp_op, terminal_F), Is().False()); - }); - - it("can check on T terminal on the right", [&]() { - AssertThat(is_right_negating(and_op, terminal_T), Is().False()); - AssertThat(is_right_negating(or_op, terminal_T), Is().False()); - AssertThat(is_right_negating(xor_op, terminal_T), Is().True()); - AssertThat(is_right_negating(imp_op, terminal_T), Is().False()); - }); - - it("can check on F terminal on the right", [&]() { - AssertThat(is_right_negating(and_op, terminal_F), Is().False()); - AssertThat(is_right_negating(or_op, terminal_F), Is().False()); - AssertThat(is_right_negating(xor_op, terminal_F), Is().False()); - AssertThat(is_right_negating(imp_op, terminal_F), Is().False()); - }); - }); - - it("can check the operators for being commutative", []() { - AssertThat(is_commutative(and_op), Is().True()); - AssertThat(is_commutative(nand_op), Is().True()); - AssertThat(is_commutative(or_op), Is().True()); - AssertThat(is_commutative(nor_op), Is().True()); - AssertThat(is_commutative(xor_op), Is().True()); - AssertThat(is_commutative(imp_op), Is().False()); - AssertThat(is_commutative(invimp_op), Is().False()); - AssertThat(is_commutative(equiv_op), Is().True()); - AssertThat(is_commutative(diff_op), Is().False()); - AssertThat(is_commutative(diff_op), Is().False()); - }); - - describe("flip operator", [&]() { - it("resolves commutative operator (and)", [&]() { - const bool_op &flip_and_op = flip(and_op); - - AssertThat(flip_and_op(terminal_T, terminal_T), Is().EqualTo(terminal_T)); - AssertThat(flip_and_op(terminal_T, terminal_F), Is().EqualTo(terminal_F)); - AssertThat(flip_and_op(terminal_F, terminal_T), Is().EqualTo(terminal_F)); - AssertThat(flip_and_op(terminal_F, terminal_F), Is().EqualTo(terminal_F)); - }); - - it("resolves non-commutative operator (imp)", [&]() { - const bool_op &flip_imp_op = flip(imp_op); - - AssertThat(flip_imp_op(terminal_T, terminal_T), Is().EqualTo(terminal_T)); - AssertThat(flip_imp_op(terminal_T, terminal_F), Is().EqualTo(terminal_T)); - AssertThat(flip_imp_op(terminal_F, terminal_T), Is().EqualTo(terminal_F)); - AssertThat(flip_imp_op(terminal_F, terminal_F), Is().EqualTo(terminal_T)); - }); - }); + describe("adiar/bool_op.h / adiar/internal/bool_op.h", []() { + const ptr_uint64 terminal_F = ptr_uint64(false); + const ptr_uint64 terminal_T = ptr_uint64(true); + + it("and_op", [&]() { + AssertThat(and_op(terminal_T, terminal_T), Is().EqualTo(terminal_T)); + AssertThat(and_op(terminal_T, terminal_F), Is().EqualTo(terminal_F)); + AssertThat(and_op(terminal_F, terminal_T), Is().EqualTo(terminal_F)); + AssertThat(and_op(terminal_F, terminal_F), Is().EqualTo(terminal_F)); + }); + + it("nand_op", [&]() { + AssertThat(nand_op(terminal_T, terminal_T), Is().EqualTo(terminal_F)); + AssertThat(nand_op(terminal_T, terminal_F), Is().EqualTo(terminal_T)); + AssertThat(nand_op(terminal_F, terminal_T), Is().EqualTo(terminal_T)); + AssertThat(nand_op(terminal_F, terminal_F), Is().EqualTo(terminal_T)); + }); + + it("or_op", [&]() { + AssertThat(or_op(terminal_T, terminal_T), Is().EqualTo(terminal_T)); + AssertThat(or_op(terminal_T, terminal_F), Is().EqualTo(terminal_T)); + AssertThat(or_op(terminal_F, terminal_T), Is().EqualTo(terminal_T)); + AssertThat(or_op(terminal_F, terminal_F), Is().EqualTo(terminal_F)); + }); + + it("nor_op", [&]() { + AssertThat(nor_op(terminal_T, terminal_T), Is().EqualTo(terminal_F)); + AssertThat(nor_op(terminal_T, terminal_F), Is().EqualTo(terminal_F)); + AssertThat(nor_op(terminal_F, terminal_T), Is().EqualTo(terminal_F)); + AssertThat(nor_op(terminal_F, terminal_F), Is().EqualTo(terminal_T)); + }); + + it("xor_op", [&]() { + AssertThat(xor_op(terminal_T, terminal_T), Is().EqualTo(terminal_F)); + AssertThat(xor_op(terminal_T, terminal_F), Is().EqualTo(terminal_T)); + AssertThat(xor_op(terminal_F, terminal_T), Is().EqualTo(terminal_T)); + AssertThat(xor_op(terminal_F, terminal_F), Is().EqualTo(terminal_F)); + }); + + it("xnor_op", [&]() { + AssertThat(xnor_op(terminal_T, terminal_T), Is().EqualTo(terminal_T)); + AssertThat(xnor_op(terminal_T, terminal_F), Is().EqualTo(terminal_F)); + AssertThat(xnor_op(terminal_F, terminal_T), Is().EqualTo(terminal_F)); + AssertThat(xnor_op(terminal_F, terminal_F), Is().EqualTo(terminal_T)); + }); + + it("imp_op", [&]() { + AssertThat(imp_op(terminal_T, terminal_T), Is().EqualTo(terminal_T)); + AssertThat(imp_op(terminal_T, terminal_F), Is().EqualTo(terminal_F)); + AssertThat(imp_op(terminal_F, terminal_T), Is().EqualTo(terminal_T)); + AssertThat(imp_op(terminal_F, terminal_F), Is().EqualTo(terminal_T)); + }); + + it("invimp_op", [&]() { + AssertThat(invimp_op(terminal_T, terminal_T), Is().EqualTo(terminal_T)); + AssertThat(invimp_op(terminal_T, terminal_F), Is().EqualTo(terminal_T)); + AssertThat(invimp_op(terminal_F, terminal_T), Is().EqualTo(terminal_F)); + AssertThat(invimp_op(terminal_F, terminal_F), Is().EqualTo(terminal_T)); + }); + + it("equiv_op", [&]() { + AssertThat(equiv_op(terminal_T, terminal_T), Is().EqualTo(terminal_T)); + AssertThat(equiv_op(terminal_T, terminal_F), Is().EqualTo(terminal_F)); + AssertThat(equiv_op(terminal_F, terminal_T), Is().EqualTo(terminal_F)); + AssertThat(equiv_op(terminal_F, terminal_F), Is().EqualTo(terminal_T)); + }); + + it("equiv_op (flags)", [&]() { + AssertThat(equiv_op(flag(terminal_T), terminal_T), Is().EqualTo(terminal_T)); + AssertThat(equiv_op(terminal_T, flag(terminal_F)), Is().EqualTo(terminal_F)); + AssertThat(equiv_op(flag(terminal_F), terminal_T), Is().EqualTo(terminal_F)); + AssertThat(equiv_op(terminal_F, flag(terminal_F)), Is().EqualTo(terminal_T)); + }); + + it("diff_op", [&]() { + AssertThat(diff_op(terminal_T, terminal_T), Is().EqualTo(terminal_F)); + AssertThat(diff_op(terminal_T, terminal_F), Is().EqualTo(terminal_T)); + AssertThat(diff_op(terminal_F, terminal_T), Is().EqualTo(terminal_F)); + AssertThat(diff_op(terminal_F, terminal_F), Is().EqualTo(terminal_F)); + }); + + it("less_op", [&]() { + AssertThat(less_op(terminal_T, terminal_T), Is().EqualTo(terminal_F)); + AssertThat(less_op(terminal_T, terminal_F), Is().EqualTo(terminal_F)); + AssertThat(less_op(terminal_F, terminal_T), Is().EqualTo(terminal_T)); + AssertThat(less_op(terminal_F, terminal_F), Is().EqualTo(terminal_F)); + }); + + describe("can_shortcut", [&]() { + it("can check on T terminal on the left", [&]() { + AssertThat(can_left_shortcut(and_op, terminal_T), Is().False()); + AssertThat(can_left_shortcut(or_op, terminal_T), Is().True()); + AssertThat(can_left_shortcut(xor_op, terminal_T), Is().False()); + AssertThat(can_left_shortcut(imp_op, terminal_T), Is().False()); + }); + + it("can check on F terminal on the left", [&]() { + AssertThat(can_left_shortcut(and_op, terminal_F), Is().True()); + AssertThat(can_left_shortcut(or_op, terminal_F), Is().False()); + AssertThat(can_left_shortcut(xor_op, terminal_F), Is().False()); + AssertThat(can_left_shortcut(imp_op, terminal_F), Is().True()); + }); + + it("can check on T terminal on the right", [&]() { + AssertThat(can_right_shortcut(and_op, terminal_T), Is().False()); + AssertThat(can_right_shortcut(or_op, terminal_T), Is().True()); + AssertThat(can_right_shortcut(xor_op, terminal_T), Is().False()); + AssertThat(can_right_shortcut(imp_op, terminal_T), Is().True()); + }); + + it("can check on F terminal on the right", [&]() { + AssertThat(can_right_shortcut(and_op, terminal_F), Is().True()); + AssertThat(can_right_shortcut(or_op, terminal_F), Is().False()); + AssertThat(can_right_shortcut(xor_op, terminal_F), Is().False()); + AssertThat(can_right_shortcut(imp_op, terminal_F), Is().False()); + }); + }); + + describe("is_irrelevant", [&]() { + it("can check on T terminal on the left", [&]() { + AssertThat(is_left_irrelevant(and_op, terminal_T), Is().True()); + AssertThat(is_left_irrelevant(or_op, terminal_T), Is().False()); + AssertThat(is_left_irrelevant(xor_op, terminal_T), Is().False()); + AssertThat(is_left_irrelevant(imp_op, terminal_T), Is().True()); + }); + + it("can check on F terminal on the left", [&]() { + AssertThat(is_left_irrelevant(and_op, terminal_F), Is().False()); + AssertThat(is_left_irrelevant(or_op, terminal_F), Is().True()); + AssertThat(is_left_irrelevant(xor_op, terminal_F), Is().True()); + AssertThat(is_left_irrelevant(imp_op, terminal_F), Is().False()); + }); + + it("can check on T terminal on the right", [&]() { + AssertThat(is_right_irrelevant(and_op, terminal_T), Is().True()); + AssertThat(is_right_irrelevant(or_op, terminal_T), Is().False()); + AssertThat(is_right_irrelevant(xor_op, terminal_T), Is().False()); + AssertThat(is_right_irrelevant(imp_op, terminal_T), Is().False()); + }); + + it("can check on F terminal on the right", [&]() { + AssertThat(is_right_irrelevant(and_op, terminal_F), Is().False()); + AssertThat(is_right_irrelevant(or_op, terminal_F), Is().True()); + AssertThat(is_right_irrelevant(xor_op, terminal_F), Is().True()); + AssertThat(is_right_irrelevant(imp_op, terminal_F), Is().False()); + }); + }); + + describe("is_negating", [&]() { + it("can check on T terminal on the left", [&]() { + AssertThat(is_left_negating(and_op, terminal_T), Is().False()); + AssertThat(is_left_negating(or_op, terminal_T), Is().False()); + AssertThat(is_left_negating(xor_op, terminal_T), Is().True()); + AssertThat(is_left_negating(imp_op, terminal_T), Is().False()); + }); + + it("can check on F terminal on the left", [&]() { + AssertThat(is_left_negating(and_op, terminal_F), Is().False()); + AssertThat(is_left_negating(or_op, terminal_F), Is().False()); + AssertThat(is_left_negating(xor_op, terminal_F), Is().False()); + AssertThat(is_left_negating(imp_op, terminal_F), Is().False()); + }); + + it("can check on T terminal on the right", [&]() { + AssertThat(is_right_negating(and_op, terminal_T), Is().False()); + AssertThat(is_right_negating(or_op, terminal_T), Is().False()); + AssertThat(is_right_negating(xor_op, terminal_T), Is().True()); + AssertThat(is_right_negating(imp_op, terminal_T), Is().False()); + }); + + it("can check on F terminal on the right", [&]() { + AssertThat(is_right_negating(and_op, terminal_F), Is().False()); + AssertThat(is_right_negating(or_op, terminal_F), Is().False()); + AssertThat(is_right_negating(xor_op, terminal_F), Is().False()); + AssertThat(is_right_negating(imp_op, terminal_F), Is().False()); + }); + }); + + it("can check the operators for being commutative", []() { + AssertThat(is_commutative(and_op), Is().True()); + AssertThat(is_commutative(nand_op), Is().True()); + AssertThat(is_commutative(or_op), Is().True()); + AssertThat(is_commutative(nor_op), Is().True()); + AssertThat(is_commutative(xor_op), Is().True()); + AssertThat(is_commutative(imp_op), Is().False()); + AssertThat(is_commutative(invimp_op), Is().False()); + AssertThat(is_commutative(equiv_op), Is().True()); + AssertThat(is_commutative(diff_op), Is().False()); + AssertThat(is_commutative(diff_op), Is().False()); + }); + + describe("flip operator", [&]() { + it("resolves commutative operator (and)", [&]() { + const bool_op &flip_and_op = flip(and_op); + + AssertThat(flip_and_op(terminal_T, terminal_T), Is().EqualTo(terminal_T)); + AssertThat(flip_and_op(terminal_T, terminal_F), Is().EqualTo(terminal_F)); + AssertThat(flip_and_op(terminal_F, terminal_T), Is().EqualTo(terminal_F)); + AssertThat(flip_and_op(terminal_F, terminal_F), Is().EqualTo(terminal_F)); + }); + + it("resolves non-commutative operator (imp)", [&]() { + const bool_op &flip_imp_op = flip(imp_op); + + AssertThat(flip_imp_op(terminal_T, terminal_T), Is().EqualTo(terminal_T)); + AssertThat(flip_imp_op(terminal_T, terminal_F), Is().EqualTo(terminal_T)); + AssertThat(flip_imp_op(terminal_F, terminal_T), Is().EqualTo(terminal_F)); + AssertThat(flip_imp_op(terminal_F, terminal_F), Is().EqualTo(terminal_T)); }); + }); }); + }); diff --git a/test/adiar/test_builder.cpp b/test/adiar/test_builder.cpp index 85723e48d..62f617f64 100644 --- a/test/adiar/test_builder.cpp +++ b/test/adiar/test_builder.cpp @@ -19,14 +19,14 @@ go_bandit([]() { AssertThat(out_nodes.can_pull(), Is().True()); - AssertThat(out_nodes.pull(), Is().EqualTo(node(1, node::MAX_ID, + AssertThat(out_nodes.pull(), Is().EqualTo(node(1, node::max_id, terminal_F, terminal_T))); AssertThat(out_nodes.can_pull(), Is().True()); - AssertThat(out_nodes.pull(), Is().EqualTo(node(0, node::MAX_ID, - ptr_uint64(1, ptr_uint64::MAX_ID), + AssertThat(out_nodes.pull(), Is().EqualTo(node(0, node::max_id, + ptr_uint64(1, ptr_uint64::max_id), terminal_T))); AssertThat(out_nodes.can_pull(), Is().False()); @@ -42,14 +42,14 @@ go_bandit([]() { AssertThat(out_nodes.can_pull(), Is().True()); - AssertThat(out_nodes.pull(), Is().EqualTo(node(1, node::MAX_ID, + AssertThat(out_nodes.pull(), Is().EqualTo(node(1, node::max_id, terminal_F, terminal_T))); AssertThat(out_nodes.can_pull(), Is().True()); - AssertThat(out_nodes.pull(), Is().EqualTo(node(0, node::MAX_ID, - ptr_uint64(1, ptr_uint64::MAX_ID), + AssertThat(out_nodes.pull(), Is().EqualTo(node(0, node::max_id, + ptr_uint64(1, ptr_uint64::max_id), terminal_T))); AssertThat(out_nodes.can_pull(), Is().False()); @@ -77,15 +77,15 @@ go_bandit([]() { AssertThat(out->width, Is().EqualTo(0u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL], Is().EqualTo(0u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(1u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(0u)); - AssertThat(out->max_1level_cut[cut_type::ALL], Is().EqualTo(1u)); + AssertThat(out->max_1level_cut[cut::Internal], Is().EqualTo(0u)); + AssertThat(out->max_1level_cut[cut::Internal_False], Is().EqualTo(1u)); + AssertThat(out->max_1level_cut[cut::Internal_True], Is().EqualTo(0u)); + AssertThat(out->max_1level_cut[cut::All], Is().EqualTo(1u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL], Is().EqualTo(0u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(1u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(0u)); - AssertThat(out->max_2level_cut[cut_type::ALL], Is().EqualTo(1u)); + AssertThat(out->max_2level_cut[cut::Internal], Is().EqualTo(0u)); + AssertThat(out->max_2level_cut[cut::Internal_False], Is().EqualTo(1u)); + AssertThat(out->max_2level_cut[cut::Internal_True], Is().EqualTo(0u)); + AssertThat(out->max_2level_cut[cut::All], Is().EqualTo(1u)); AssertThat(out->number_of_terminals[false], Is().EqualTo(1u)); AssertThat(out->number_of_terminals[true], Is().EqualTo(0u)); @@ -110,15 +110,15 @@ go_bandit([]() { AssertThat(out_meta.can_pull(), Is().False()); - AssertThat(out->max_1level_cut[cut_type::INTERNAL], Is().EqualTo(0u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(0u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(1u)); - AssertThat(out->max_1level_cut[cut_type::ALL], Is().EqualTo(1u)); + AssertThat(out->max_1level_cut[cut::Internal], Is().EqualTo(0u)); + AssertThat(out->max_1level_cut[cut::Internal_False], Is().EqualTo(0u)); + AssertThat(out->max_1level_cut[cut::Internal_True], Is().EqualTo(1u)); + AssertThat(out->max_1level_cut[cut::All], Is().EqualTo(1u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL], Is().EqualTo(0u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(0u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(1u)); - AssertThat(out->max_2level_cut[cut_type::ALL], Is().EqualTo(1u)); + AssertThat(out->max_2level_cut[cut::Internal], Is().EqualTo(0u)); + AssertThat(out->max_2level_cut[cut::Internal_False], Is().EqualTo(0u)); + AssertThat(out->max_2level_cut[cut::Internal_True], Is().EqualTo(1u)); + AssertThat(out->max_2level_cut[cut::All], Is().EqualTo(1u)); AssertThat(out->number_of_terminals[false], Is().EqualTo(0u)); AssertThat(out->number_of_terminals[true], Is().EqualTo(1u)); @@ -147,15 +147,15 @@ go_bandit([]() { AssertThat(out->width, Is().EqualTo(0u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL], Is().EqualTo(0u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(1u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(0u)); - AssertThat(out->max_1level_cut[cut_type::ALL], Is().EqualTo(1u)); + AssertThat(out->max_1level_cut[cut::Internal], Is().EqualTo(0u)); + AssertThat(out->max_1level_cut[cut::Internal_False], Is().EqualTo(1u)); + AssertThat(out->max_1level_cut[cut::Internal_True], Is().EqualTo(0u)); + AssertThat(out->max_1level_cut[cut::All], Is().EqualTo(1u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL], Is().EqualTo(0u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(1u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(0u)); - AssertThat(out->max_2level_cut[cut_type::ALL], Is().EqualTo(1u)); + AssertThat(out->max_2level_cut[cut::Internal], Is().EqualTo(0u)); + AssertThat(out->max_2level_cut[cut::Internal_False], Is().EqualTo(1u)); + AssertThat(out->max_2level_cut[cut::Internal_True], Is().EqualTo(0u)); + AssertThat(out->max_2level_cut[cut::All], Is().EqualTo(1u)); AssertThat(out->number_of_terminals[false], Is().EqualTo(1u)); AssertThat(out->number_of_terminals[true], Is().EqualTo(0u)); @@ -194,7 +194,7 @@ go_bandit([]() { AssertThat(out_nodes.can_pull(), Is().True()); - AssertThat(out_nodes.pull(), Is().EqualTo(node(0, node::MAX_ID, + AssertThat(out_nodes.pull(), Is().EqualTo(node(0, node::max_id, terminal_F, terminal_T))); AssertThat(out_nodes.can_pull(), Is().False()); @@ -208,19 +208,19 @@ go_bandit([]() { AssertThat(out->width, Is().EqualTo(1u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL], Is().EqualTo(1u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(1u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(1u)); - AssertThat(out->max_1level_cut[cut_type::ALL], Is().EqualTo(2u)); + AssertThat(out->max_1level_cut[cut::Internal], Is().EqualTo(1u)); + AssertThat(out->max_1level_cut[cut::Internal_False], Is().EqualTo(1u)); + AssertThat(out->max_1level_cut[cut::Internal_True], Is().EqualTo(1u)); + AssertThat(out->max_1level_cut[cut::All], Is().EqualTo(2u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL], Is().GreaterThanOrEqualTo(1u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL], Is().LessThanOrEqualTo(2u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_FALSE], Is().GreaterThanOrEqualTo(1u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_FALSE], Is().LessThanOrEqualTo(2u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_TRUE], Is().GreaterThanOrEqualTo(1u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_TRUE], Is().LessThanOrEqualTo(2u)); - AssertThat(out->max_2level_cut[cut_type::ALL], Is().GreaterThanOrEqualTo(2u)); - AssertThat(out->max_2level_cut[cut_type::ALL], Is().LessThanOrEqualTo(3u)); + AssertThat(out->max_2level_cut[cut::Internal], Is().GreaterThanOrEqualTo(1u)); + AssertThat(out->max_2level_cut[cut::Internal], Is().LessThanOrEqualTo(2u)); + AssertThat(out->max_2level_cut[cut::Internal_False], Is().GreaterThanOrEqualTo(1u)); + AssertThat(out->max_2level_cut[cut::Internal_False], Is().LessThanOrEqualTo(2u)); + AssertThat(out->max_2level_cut[cut::Internal_True], Is().GreaterThanOrEqualTo(1u)); + AssertThat(out->max_2level_cut[cut::Internal_True], Is().LessThanOrEqualTo(2u)); + AssertThat(out->max_2level_cut[cut::All], Is().GreaterThanOrEqualTo(2u)); + AssertThat(out->max_2level_cut[cut::All], Is().LessThanOrEqualTo(3u)); AssertThat(out->number_of_terminals[false], Is().EqualTo(1u)); AssertThat(out->number_of_terminals[true], Is().EqualTo(1u)); @@ -262,10 +262,10 @@ go_bandit([]() { AssertThrows(invalid_argument, b.add_node(0,p,false)); }); - it("throws an exception when label > MAX_LABEL", [&]() { + it("throws an exception when label > max_label", [&]() { bdd_builder b; - AssertThrows(invalid_argument, b.add_node(node::MAX_LABEL + 1,false,true)); + AssertThrows(invalid_argument, b.add_node(node::max_label + 1,false,true)); }); it("throws an exception when label > last label", [&]() { @@ -333,21 +333,21 @@ go_bandit([]() { AssertThat(out_nodes.can_pull(), Is().True()); // n3 - AssertThat(out_nodes.pull(), Is().EqualTo(node(2, node::MAX_ID, + AssertThat(out_nodes.pull(), Is().EqualTo(node(2, node::max_id, terminal_F, terminal_T))); AssertThat(out_nodes.can_pull(), Is().True()); // n2 - AssertThat(out_nodes.pull(), Is().EqualTo(node(1, node::MAX_ID, - ptr_uint64(2, ptr_uint64::MAX_ID), + AssertThat(out_nodes.pull(), Is().EqualTo(node(1, node::max_id, + ptr_uint64(2, ptr_uint64::max_id), terminal_T))); AssertThat(out_nodes.can_pull(), Is().True()); // n1 - AssertThat(out_nodes.pull(), Is().EqualTo(node(0, node::MAX_ID, - ptr_uint64(2, ptr_uint64::MAX_ID), - ptr_uint64(1, ptr_uint64::MAX_ID)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(0, node::max_id, + ptr_uint64(2, ptr_uint64::max_id), + ptr_uint64(1, ptr_uint64::max_id)))); AssertThat(out_nodes.can_pull(), Is().False()); level_info_test_stream out_meta(out); @@ -365,19 +365,19 @@ go_bandit([]() { AssertThat(out->width, Is().EqualTo(1u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL], Is().EqualTo(2u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(2u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(3u)); - AssertThat(out->max_1level_cut[cut_type::ALL], Is().EqualTo(3u)); + AssertThat(out->max_1level_cut[cut::Internal], Is().EqualTo(2u)); + AssertThat(out->max_1level_cut[cut::Internal_False], Is().EqualTo(2u)); + AssertThat(out->max_1level_cut[cut::Internal_True], Is().EqualTo(3u)); + AssertThat(out->max_1level_cut[cut::All], Is().EqualTo(3u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL], Is().GreaterThanOrEqualTo(2u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL], Is().LessThanOrEqualTo(3u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_FALSE], Is().GreaterThanOrEqualTo(2u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_FALSE], Is().LessThanOrEqualTo(3u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_TRUE], Is().GreaterThanOrEqualTo(3u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_TRUE], Is().LessThanOrEqualTo(5u)); - AssertThat(out->max_2level_cut[cut_type::ALL], Is().GreaterThanOrEqualTo(3u)); - AssertThat(out->max_2level_cut[cut_type::ALL], Is().LessThanOrEqualTo(5u)); + AssertThat(out->max_2level_cut[cut::Internal], Is().GreaterThanOrEqualTo(2u)); + AssertThat(out->max_2level_cut[cut::Internal], Is().LessThanOrEqualTo(3u)); + AssertThat(out->max_2level_cut[cut::Internal_False], Is().GreaterThanOrEqualTo(2u)); + AssertThat(out->max_2level_cut[cut::Internal_False], Is().LessThanOrEqualTo(3u)); + AssertThat(out->max_2level_cut[cut::Internal_True], Is().GreaterThanOrEqualTo(3u)); + AssertThat(out->max_2level_cut[cut::Internal_True], Is().LessThanOrEqualTo(5u)); + AssertThat(out->max_2level_cut[cut::All], Is().GreaterThanOrEqualTo(3u)); + AssertThat(out->max_2level_cut[cut::All], Is().LessThanOrEqualTo(5u)); AssertThat(out->number_of_terminals[false], Is().EqualTo(1u)); AssertThat(out->number_of_terminals[true], Is().EqualTo(2u)); @@ -410,29 +410,29 @@ go_bandit([]() { AssertThat(out_nodes.can_pull(), Is().True()); // n5 - AssertThat(out_nodes.pull(), Is().EqualTo(node(2, node::MAX_ID, terminal_T, terminal_F))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(2, node::max_id, terminal_T, terminal_F))); AssertThat(out_nodes.can_pull(), Is().True()); // n4 - AssertThat(out_nodes.pull(), Is().EqualTo(node(2, node::MAX_ID-1, terminal_F, terminal_T))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(2, node::max_id-1, terminal_F, terminal_T))); AssertThat(out_nodes.can_pull(), Is().True()); // n3 - AssertThat(out_nodes.pull(), Is().EqualTo(node(1, node::MAX_ID, - ptr_uint64(2, ptr_uint64::MAX_ID), + AssertThat(out_nodes.pull(), Is().EqualTo(node(1, node::max_id, + ptr_uint64(2, ptr_uint64::max_id), terminal_T))); AssertThat(out_nodes.can_pull(), Is().True()); // n2 - AssertThat(out_nodes.pull(), Is().EqualTo(node(1, node::MAX_ID-1, - ptr_uint64(2, ptr_uint64::MAX_ID-1), - ptr_uint64(2, ptr_uint64::MAX_ID)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(1, node::max_id-1, + ptr_uint64(2, ptr_uint64::max_id-1), + ptr_uint64(2, ptr_uint64::max_id)))); AssertThat(out_nodes.can_pull(), Is().True()); // n1 - AssertThat(out_nodes.pull(), Is().EqualTo(node(0, node::MAX_ID, - ptr_uint64(1, ptr_uint64::MAX_ID-1), - ptr_uint64(1, ptr_uint64::MAX_ID)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(0, node::max_id, + ptr_uint64(1, ptr_uint64::max_id-1), + ptr_uint64(1, ptr_uint64::max_id)))); AssertThat(out_nodes.can_pull(), Is().False()); @@ -451,19 +451,19 @@ go_bandit([]() { AssertThat(out->width, Is().EqualTo(2u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL], Is().EqualTo(3u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(3u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(4u)); - AssertThat(out->max_1level_cut[cut_type::ALL], Is().EqualTo(5u)); + AssertThat(out->max_1level_cut[cut::Internal], Is().EqualTo(3u)); + AssertThat(out->max_1level_cut[cut::Internal_False], Is().EqualTo(3u)); + AssertThat(out->max_1level_cut[cut::Internal_True], Is().EqualTo(4u)); + AssertThat(out->max_1level_cut[cut::All], Is().EqualTo(5u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL], Is().GreaterThanOrEqualTo(3u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL], Is().LessThanOrEqualTo(5u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_FALSE], Is().GreaterThanOrEqualTo(3u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_FALSE], Is().LessThanOrEqualTo(5u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_TRUE], Is().GreaterThanOrEqualTo(4u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_TRUE], Is().LessThanOrEqualTo(6u)); - AssertThat(out->max_2level_cut[cut_type::ALL], Is().GreaterThanOrEqualTo(5u)); - AssertThat(out->max_2level_cut[cut_type::ALL], Is().LessThanOrEqualTo(8u)); + AssertThat(out->max_2level_cut[cut::Internal], Is().GreaterThanOrEqualTo(3u)); + AssertThat(out->max_2level_cut[cut::Internal], Is().LessThanOrEqualTo(5u)); + AssertThat(out->max_2level_cut[cut::Internal_False], Is().GreaterThanOrEqualTo(3u)); + AssertThat(out->max_2level_cut[cut::Internal_False], Is().LessThanOrEqualTo(5u)); + AssertThat(out->max_2level_cut[cut::Internal_True], Is().GreaterThanOrEqualTo(4u)); + AssertThat(out->max_2level_cut[cut::Internal_True], Is().LessThanOrEqualTo(6u)); + AssertThat(out->max_2level_cut[cut::All], Is().GreaterThanOrEqualTo(5u)); + AssertThat(out->max_2level_cut[cut::All], Is().LessThanOrEqualTo(8u)); AssertThat(out->number_of_terminals[false], Is().EqualTo(2u)); AssertThat(out->number_of_terminals[true], Is().EqualTo(3u)); @@ -485,7 +485,7 @@ go_bandit([]() { AssertThat(out_nodes.can_pull(), Is().True()); - AssertThat(out_nodes.pull(), Is().EqualTo(node(1, node::MAX_ID, + AssertThat(out_nodes.pull(), Is().EqualTo(node(1, node::max_id, terminal_T, terminal_F))); AssertThat(out_nodes.can_pull(), Is().False()); @@ -499,19 +499,19 @@ go_bandit([]() { AssertThat(out->width, Is().EqualTo(1u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL], Is().EqualTo(1u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(1u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(1u)); - AssertThat(out->max_1level_cut[cut_type::ALL], Is().EqualTo(2u)); + AssertThat(out->max_1level_cut[cut::Internal], Is().EqualTo(1u)); + AssertThat(out->max_1level_cut[cut::Internal_False], Is().EqualTo(1u)); + AssertThat(out->max_1level_cut[cut::Internal_True], Is().EqualTo(1u)); + AssertThat(out->max_1level_cut[cut::All], Is().EqualTo(2u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL], Is().GreaterThanOrEqualTo(1u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL], Is().LessThanOrEqualTo(2u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_FALSE], Is().GreaterThanOrEqualTo(1u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_FALSE], Is().LessThanOrEqualTo(2u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_TRUE], Is().GreaterThanOrEqualTo(1u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_TRUE], Is().LessThanOrEqualTo(2u)); - AssertThat(out->max_2level_cut[cut_type::ALL], Is().GreaterThanOrEqualTo(2u)); - AssertThat(out->max_2level_cut[cut_type::ALL], Is().LessThanOrEqualTo(3u)); + AssertThat(out->max_2level_cut[cut::Internal], Is().GreaterThanOrEqualTo(1u)); + AssertThat(out->max_2level_cut[cut::Internal], Is().LessThanOrEqualTo(2u)); + AssertThat(out->max_2level_cut[cut::Internal_False], Is().GreaterThanOrEqualTo(1u)); + AssertThat(out->max_2level_cut[cut::Internal_False], Is().LessThanOrEqualTo(2u)); + AssertThat(out->max_2level_cut[cut::Internal_True], Is().GreaterThanOrEqualTo(1u)); + AssertThat(out->max_2level_cut[cut::Internal_True], Is().LessThanOrEqualTo(2u)); + AssertThat(out->max_2level_cut[cut::All], Is().GreaterThanOrEqualTo(2u)); + AssertThat(out->max_2level_cut[cut::All], Is().LessThanOrEqualTo(3u)); AssertThat(out->number_of_terminals[false], Is().EqualTo(1u)); AssertThat(out->number_of_terminals[true], Is().EqualTo(1u)); @@ -539,7 +539,7 @@ go_bandit([]() { AssertThat(out_nodes.can_pull(), Is().True()); - AssertThat(out_nodes.pull(), Is().EqualTo(node(0, node::MAX_ID, + AssertThat(out_nodes.pull(), Is().EqualTo(node(0, node::max_id, terminal_F, terminal_T))); AssertThat(out_nodes.can_pull(), Is().False()); @@ -553,19 +553,19 @@ go_bandit([]() { AssertThat(out->width, Is().EqualTo(1u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL], Is().EqualTo(1u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(1u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(1u)); - AssertThat(out->max_1level_cut[cut_type::ALL], Is().EqualTo(2u)); + AssertThat(out->max_1level_cut[cut::Internal], Is().EqualTo(1u)); + AssertThat(out->max_1level_cut[cut::Internal_False], Is().EqualTo(1u)); + AssertThat(out->max_1level_cut[cut::Internal_True], Is().EqualTo(1u)); + AssertThat(out->max_1level_cut[cut::All], Is().EqualTo(2u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL], Is().GreaterThanOrEqualTo(1u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL], Is().LessThanOrEqualTo(2u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_FALSE], Is().GreaterThanOrEqualTo(1u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_FALSE], Is().LessThanOrEqualTo(2u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_TRUE], Is().GreaterThanOrEqualTo(1u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_TRUE], Is().LessThanOrEqualTo(2u)); - AssertThat(out->max_2level_cut[cut_type::ALL], Is().GreaterThanOrEqualTo(2u)); - AssertThat(out->max_2level_cut[cut_type::ALL], Is().LessThanOrEqualTo(3u)); + AssertThat(out->max_2level_cut[cut::Internal], Is().GreaterThanOrEqualTo(1u)); + AssertThat(out->max_2level_cut[cut::Internal], Is().LessThanOrEqualTo(2u)); + AssertThat(out->max_2level_cut[cut::Internal_False], Is().GreaterThanOrEqualTo(1u)); + AssertThat(out->max_2level_cut[cut::Internal_False], Is().LessThanOrEqualTo(2u)); + AssertThat(out->max_2level_cut[cut::Internal_True], Is().GreaterThanOrEqualTo(1u)); + AssertThat(out->max_2level_cut[cut::Internal_True], Is().LessThanOrEqualTo(2u)); + AssertThat(out->max_2level_cut[cut::All], Is().GreaterThanOrEqualTo(2u)); + AssertThat(out->max_2level_cut[cut::All], Is().LessThanOrEqualTo(3u)); AssertThat(out->number_of_terminals[false], Is().EqualTo(1u)); AssertThat(out->number_of_terminals[true], Is().EqualTo(1u)); @@ -581,7 +581,7 @@ go_bandit([]() { AssertThat(out_nodes.can_pull(), Is().True()); - AssertThat(out_nodes.pull(), Is().EqualTo(node(1, node::MAX_ID, + AssertThat(out_nodes.pull(), Is().EqualTo(node(1, node::max_id, terminal_T, terminal_F))); AssertThat(out_nodes.can_pull(), Is().False()); @@ -595,19 +595,19 @@ go_bandit([]() { AssertThat(out->width, Is().EqualTo(1u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL], Is().EqualTo(1u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(1u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(1u)); - AssertThat(out->max_1level_cut[cut_type::ALL], Is().EqualTo(2u)); + AssertThat(out->max_1level_cut[cut::Internal], Is().EqualTo(1u)); + AssertThat(out->max_1level_cut[cut::Internal_False], Is().EqualTo(1u)); + AssertThat(out->max_1level_cut[cut::Internal_True], Is().EqualTo(1u)); + AssertThat(out->max_1level_cut[cut::All], Is().EqualTo(2u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL], Is().GreaterThanOrEqualTo(1u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL], Is().LessThanOrEqualTo(2u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_FALSE], Is().GreaterThanOrEqualTo(1u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_FALSE], Is().LessThanOrEqualTo(2u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_TRUE], Is().GreaterThanOrEqualTo(1u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_TRUE], Is().LessThanOrEqualTo(2u)); - AssertThat(out->max_2level_cut[cut_type::ALL], Is().GreaterThanOrEqualTo(2u)); - AssertThat(out->max_2level_cut[cut_type::ALL], Is().LessThanOrEqualTo(3u)); + AssertThat(out->max_2level_cut[cut::Internal], Is().GreaterThanOrEqualTo(1u)); + AssertThat(out->max_2level_cut[cut::Internal], Is().LessThanOrEqualTo(2u)); + AssertThat(out->max_2level_cut[cut::Internal_False], Is().GreaterThanOrEqualTo(1u)); + AssertThat(out->max_2level_cut[cut::Internal_False], Is().LessThanOrEqualTo(2u)); + AssertThat(out->max_2level_cut[cut::Internal_True], Is().GreaterThanOrEqualTo(1u)); + AssertThat(out->max_2level_cut[cut::Internal_True], Is().LessThanOrEqualTo(2u)); + AssertThat(out->max_2level_cut[cut::All], Is().GreaterThanOrEqualTo(2u)); + AssertThat(out->max_2level_cut[cut::All], Is().LessThanOrEqualTo(3u)); AssertThat(out->number_of_terminals[false], Is().EqualTo(1u)); AssertThat(out->number_of_terminals[true], Is().EqualTo(1u)); @@ -671,23 +671,23 @@ go_bandit([]() { AssertThat(out_nodes.can_pull(), Is().True()); // n5 - AssertThat(out_nodes.pull(), Is().EqualTo(node(5, node::MAX_ID, terminal_T, terminal_F))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(5, node::max_id, terminal_T, terminal_F))); AssertThat(out_nodes.can_pull(), Is().True()); // n4 - AssertThat(out_nodes.pull(), Is().EqualTo(node(4, node::MAX_ID, terminal_T, terminal_F))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(4, node::max_id, terminal_T, terminal_F))); AssertThat(out_nodes.can_pull(), Is().True()); // n3 - AssertThat(out_nodes.pull(), Is().EqualTo(node(4, node::MAX_ID-1, - ptr_uint64(5, ptr_uint64::MAX_ID), + AssertThat(out_nodes.pull(), Is().EqualTo(node(4, node::max_id-1, + ptr_uint64(5, ptr_uint64::max_id), terminal_T))); AssertThat(out_nodes.can_pull(), Is().True()); // n1 - AssertThat(out_nodes.pull(), Is().EqualTo(node(2, node::MAX_ID, - ptr_uint64(4, ptr_uint64::MAX_ID-1), - ptr_uint64(4, ptr_uint64::MAX_ID)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(2, node::max_id, + ptr_uint64(4, ptr_uint64::max_id-1), + ptr_uint64(4, ptr_uint64::max_id)))); AssertThat(out_nodes.can_pull(), Is().False()); level_info_test_stream out_meta(out); @@ -705,19 +705,19 @@ go_bandit([]() { AssertThat(out_meta.can_pull(), Is().False()); - AssertThat(out->max_1level_cut[cut_type::INTERNAL], Is().EqualTo(2u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(3u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(4u)); - AssertThat(out->max_1level_cut[cut_type::ALL], Is().EqualTo(5u)); + AssertThat(out->max_1level_cut[cut::Internal], Is().EqualTo(2u)); + AssertThat(out->max_1level_cut[cut::Internal_False], Is().EqualTo(3u)); + AssertThat(out->max_1level_cut[cut::Internal_True], Is().EqualTo(4u)); + AssertThat(out->max_1level_cut[cut::All], Is().EqualTo(5u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL], Is().GreaterThanOrEqualTo(2u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL], Is().LessThanOrEqualTo(3u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_FALSE], Is().GreaterThanOrEqualTo(3u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_FALSE], Is().LessThanOrEqualTo(5u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_TRUE], Is().GreaterThanOrEqualTo(4u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_TRUE], Is().LessThanOrEqualTo(6u)); - AssertThat(out->max_2level_cut[cut_type::ALL], Is().GreaterThanOrEqualTo(5u)); - AssertThat(out->max_2level_cut[cut_type::ALL], Is().LessThanOrEqualTo(8u)); + AssertThat(out->max_2level_cut[cut::Internal], Is().GreaterThanOrEqualTo(2u)); + AssertThat(out->max_2level_cut[cut::Internal], Is().LessThanOrEqualTo(3u)); + AssertThat(out->max_2level_cut[cut::Internal_False], Is().GreaterThanOrEqualTo(3u)); + AssertThat(out->max_2level_cut[cut::Internal_False], Is().LessThanOrEqualTo(5u)); + AssertThat(out->max_2level_cut[cut::Internal_True], Is().GreaterThanOrEqualTo(4u)); + AssertThat(out->max_2level_cut[cut::Internal_True], Is().LessThanOrEqualTo(6u)); + AssertThat(out->max_2level_cut[cut::All], Is().GreaterThanOrEqualTo(5u)); + AssertThat(out->max_2level_cut[cut::All], Is().LessThanOrEqualTo(8u)); AssertThat(out->number_of_terminals[false], Is().EqualTo(2u)); AssertThat(out->number_of_terminals[true], Is().EqualTo(3u)); @@ -738,7 +738,7 @@ go_bandit([]() { AssertThat(out_nodes.can_pull(), Is().True()); - AssertThat(out_nodes.pull(), Is().EqualTo(node(1, node::MAX_ID, + AssertThat(out_nodes.pull(), Is().EqualTo(node(1, node::max_id, terminal_F, terminal_T))); AssertThat(out_nodes.can_pull(), Is().False()); @@ -752,19 +752,19 @@ go_bandit([]() { AssertThat(out->width, Is().EqualTo(1u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL], Is().EqualTo(1u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(1u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(1u)); - AssertThat(out->max_1level_cut[cut_type::ALL], Is().EqualTo(2u)); + AssertThat(out->max_1level_cut[cut::Internal], Is().EqualTo(1u)); + AssertThat(out->max_1level_cut[cut::Internal_False], Is().EqualTo(1u)); + AssertThat(out->max_1level_cut[cut::Internal_True], Is().EqualTo(1u)); + AssertThat(out->max_1level_cut[cut::All], Is().EqualTo(2u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL], Is().GreaterThanOrEqualTo(1u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL], Is().LessThanOrEqualTo(2u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_FALSE], Is().GreaterThanOrEqualTo(1u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_FALSE], Is().LessThanOrEqualTo(2u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_TRUE], Is().GreaterThanOrEqualTo(1u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_TRUE], Is().LessThanOrEqualTo(2u)); - AssertThat(out->max_2level_cut[cut_type::ALL], Is().GreaterThanOrEqualTo(2u)); - AssertThat(out->max_2level_cut[cut_type::ALL], Is().LessThanOrEqualTo(3u)); + AssertThat(out->max_2level_cut[cut::Internal], Is().GreaterThanOrEqualTo(1u)); + AssertThat(out->max_2level_cut[cut::Internal], Is().LessThanOrEqualTo(2u)); + AssertThat(out->max_2level_cut[cut::Internal_False], Is().GreaterThanOrEqualTo(1u)); + AssertThat(out->max_2level_cut[cut::Internal_False], Is().LessThanOrEqualTo(2u)); + AssertThat(out->max_2level_cut[cut::Internal_True], Is().GreaterThanOrEqualTo(1u)); + AssertThat(out->max_2level_cut[cut::Internal_True], Is().LessThanOrEqualTo(2u)); + AssertThat(out->max_2level_cut[cut::All], Is().GreaterThanOrEqualTo(2u)); + AssertThat(out->max_2level_cut[cut::All], Is().LessThanOrEqualTo(3u)); AssertThat(out->number_of_terminals[false], Is().EqualTo(1u)); AssertThat(out->number_of_terminals[true], Is().EqualTo(1u)); @@ -792,15 +792,15 @@ go_bandit([]() { AssertThat(out->width, Is().EqualTo(0u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL], Is().EqualTo(0u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(1u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(0u)); - AssertThat(out->max_1level_cut[cut_type::ALL], Is().EqualTo(1u)); + AssertThat(out->max_1level_cut[cut::Internal], Is().EqualTo(0u)); + AssertThat(out->max_1level_cut[cut::Internal_False], Is().EqualTo(1u)); + AssertThat(out->max_1level_cut[cut::Internal_True], Is().EqualTo(0u)); + AssertThat(out->max_1level_cut[cut::All], Is().EqualTo(1u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL], Is().EqualTo(0u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(1u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(0u)); - AssertThat(out->max_2level_cut[cut_type::ALL], Is().EqualTo(1u)); + AssertThat(out->max_2level_cut[cut::Internal], Is().EqualTo(0u)); + AssertThat(out->max_2level_cut[cut::Internal_False], Is().EqualTo(1u)); + AssertThat(out->max_2level_cut[cut::Internal_True], Is().EqualTo(0u)); + AssertThat(out->max_2level_cut[cut::All], Is().EqualTo(1u)); AssertThat(out->number_of_terminals[false], Is().EqualTo(1u)); AssertThat(out->number_of_terminals[true], Is().EqualTo(0u)); @@ -828,15 +828,15 @@ go_bandit([]() { AssertThat(out->width, Is().EqualTo(0u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL], Is().EqualTo(0u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(0u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(1u)); - AssertThat(out->max_1level_cut[cut_type::ALL], Is().EqualTo(1u)); + AssertThat(out->max_1level_cut[cut::Internal], Is().EqualTo(0u)); + AssertThat(out->max_1level_cut[cut::Internal_False], Is().EqualTo(0u)); + AssertThat(out->max_1level_cut[cut::Internal_True], Is().EqualTo(1u)); + AssertThat(out->max_1level_cut[cut::All], Is().EqualTo(1u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL], Is().EqualTo(0u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(0u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(1u)); - AssertThat(out->max_2level_cut[cut_type::ALL], Is().EqualTo(1u)); + AssertThat(out->max_2level_cut[cut::Internal], Is().EqualTo(0u)); + AssertThat(out->max_2level_cut[cut::Internal_False], Is().EqualTo(0u)); + AssertThat(out->max_2level_cut[cut::Internal_True], Is().EqualTo(1u)); + AssertThat(out->max_2level_cut[cut::All], Is().EqualTo(1u)); AssertThat(out->number_of_terminals[false], Is().EqualTo(0u)); AssertThat(out->number_of_terminals[true], Is().EqualTo(1u)); @@ -864,15 +864,15 @@ go_bandit([]() { AssertThat(out->width, Is().EqualTo(0u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL], Is().EqualTo(0u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(0u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(1u)); - AssertThat(out->max_1level_cut[cut_type::ALL], Is().EqualTo(1u)); + AssertThat(out->max_1level_cut[cut::Internal], Is().EqualTo(0u)); + AssertThat(out->max_1level_cut[cut::Internal_False], Is().EqualTo(0u)); + AssertThat(out->max_1level_cut[cut::Internal_True], Is().EqualTo(1u)); + AssertThat(out->max_1level_cut[cut::All], Is().EqualTo(1u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL], Is().EqualTo(0u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(0u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(1u)); - AssertThat(out->max_2level_cut[cut_type::ALL], Is().EqualTo(1u)); + AssertThat(out->max_2level_cut[cut::Internal], Is().EqualTo(0u)); + AssertThat(out->max_2level_cut[cut::Internal_False], Is().EqualTo(0u)); + AssertThat(out->max_2level_cut[cut::Internal_True], Is().EqualTo(1u)); + AssertThat(out->max_2level_cut[cut::All], Is().EqualTo(1u)); AssertThat(out->number_of_terminals[false], Is().EqualTo(0u)); AssertThat(out->number_of_terminals[true], Is().EqualTo(1u)); @@ -902,21 +902,21 @@ go_bandit([]() { AssertThat(out_nodes.can_pull(), Is().True()); - AssertThat(out_nodes.pull(), Is().EqualTo(node(2, node::MAX_ID, + AssertThat(out_nodes.pull(), Is().EqualTo(node(2, node::max_id, terminal_F, terminal_T))); AssertThat(out_nodes.can_pull(), Is().True()); - AssertThat(out_nodes.pull(), Is().EqualTo(node(1, node::MAX_ID, + AssertThat(out_nodes.pull(), Is().EqualTo(node(1, node::max_id, terminal_F, - ptr_uint64(2, ptr_uint64::MAX_ID)))); + ptr_uint64(2, ptr_uint64::max_id)))); AssertThat(out_nodes.can_pull(), Is().True()); - AssertThat(out_nodes.pull(), Is().EqualTo(node(0, node::MAX_ID, - ptr_uint64(2, ptr_uint64::MAX_ID), - ptr_uint64(1, ptr_uint64::MAX_ID)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(0, node::max_id, + ptr_uint64(2, ptr_uint64::max_id), + ptr_uint64(1, ptr_uint64::max_id)))); AssertThat(out_nodes.can_pull(), Is().False()); @@ -935,19 +935,19 @@ go_bandit([]() { AssertThat(out->width, Is().EqualTo(1u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL], Is().EqualTo(2u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_FALSE], Is().GreaterThanOrEqualTo(2u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_FALSE], Is().LessThanOrEqualTo(3u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(2u)); - AssertThat(out->max_1level_cut[cut_type::ALL], Is().EqualTo(3u)); + AssertThat(out->max_1level_cut[cut::Internal], Is().EqualTo(2u)); + AssertThat(out->max_1level_cut[cut::Internal_False], Is().GreaterThanOrEqualTo(2u)); + AssertThat(out->max_1level_cut[cut::Internal_False], Is().LessThanOrEqualTo(3u)); + AssertThat(out->max_1level_cut[cut::Internal_True], Is().EqualTo(2u)); + AssertThat(out->max_1level_cut[cut::All], Is().EqualTo(3u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL], Is().GreaterThanOrEqualTo(2u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL], Is().LessThanOrEqualTo(3u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_FALSE], Is().GreaterThanOrEqualTo(2u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_FALSE], Is().LessThanOrEqualTo(3u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(2u)); - AssertThat(out->max_2level_cut[cut_type::ALL], Is().GreaterThanOrEqualTo(3u)); - AssertThat(out->max_2level_cut[cut_type::ALL], Is().LessThanOrEqualTo(4u)); + AssertThat(out->max_2level_cut[cut::Internal], Is().GreaterThanOrEqualTo(2u)); + AssertThat(out->max_2level_cut[cut::Internal], Is().LessThanOrEqualTo(3u)); + AssertThat(out->max_2level_cut[cut::Internal_False], Is().GreaterThanOrEqualTo(2u)); + AssertThat(out->max_2level_cut[cut::Internal_False], Is().LessThanOrEqualTo(3u)); + AssertThat(out->max_2level_cut[cut::Internal_True], Is().EqualTo(2u)); + AssertThat(out->max_2level_cut[cut::All], Is().GreaterThanOrEqualTo(3u)); + AssertThat(out->max_2level_cut[cut::All], Is().LessThanOrEqualTo(4u)); AssertThat(out->number_of_terminals[false], Is().EqualTo(2u)); AssertThat(out->number_of_terminals[true], Is().EqualTo(1u)); @@ -968,7 +968,7 @@ go_bandit([]() { AssertThat(out_nodes.can_pull(), Is().True()); - AssertThat(out_nodes.pull(), Is().EqualTo(node(1, node::MAX_ID, + AssertThat(out_nodes.pull(), Is().EqualTo(node(1, node::max_id, terminal_F, terminal_T))); AssertThat(out_nodes.can_pull(), Is().False()); @@ -982,19 +982,19 @@ go_bandit([]() { AssertThat(out->width, Is().EqualTo(1u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL], Is().EqualTo(1u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(1u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(1u)); - AssertThat(out->max_1level_cut[cut_type::ALL], Is().EqualTo(2u)); + AssertThat(out->max_1level_cut[cut::Internal], Is().EqualTo(1u)); + AssertThat(out->max_1level_cut[cut::Internal_False], Is().EqualTo(1u)); + AssertThat(out->max_1level_cut[cut::Internal_True], Is().EqualTo(1u)); + AssertThat(out->max_1level_cut[cut::All], Is().EqualTo(2u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL], Is().GreaterThanOrEqualTo(1u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL], Is().LessThanOrEqualTo(2u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_FALSE], Is().GreaterThanOrEqualTo(1u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_FALSE], Is().LessThanOrEqualTo(2u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_TRUE], Is().GreaterThanOrEqualTo(1u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_TRUE], Is().LessThanOrEqualTo(2u)); - AssertThat(out->max_2level_cut[cut_type::ALL], Is().GreaterThanOrEqualTo(2u)); - AssertThat(out->max_2level_cut[cut_type::ALL], Is().LessThanOrEqualTo(3u)); + AssertThat(out->max_2level_cut[cut::Internal], Is().GreaterThanOrEqualTo(1u)); + AssertThat(out->max_2level_cut[cut::Internal], Is().LessThanOrEqualTo(2u)); + AssertThat(out->max_2level_cut[cut::Internal_False], Is().GreaterThanOrEqualTo(1u)); + AssertThat(out->max_2level_cut[cut::Internal_False], Is().LessThanOrEqualTo(2u)); + AssertThat(out->max_2level_cut[cut::Internal_True], Is().GreaterThanOrEqualTo(1u)); + AssertThat(out->max_2level_cut[cut::Internal_True], Is().LessThanOrEqualTo(2u)); + AssertThat(out->max_2level_cut[cut::All], Is().GreaterThanOrEqualTo(2u)); + AssertThat(out->max_2level_cut[cut::All], Is().LessThanOrEqualTo(3u)); AssertThat(out->number_of_terminals[false], Is().EqualTo(1u)); AssertThat(out->number_of_terminals[true], Is().EqualTo(1u)); @@ -1028,7 +1028,7 @@ go_bandit([]() { AssertThat(out_nodes.can_pull(), Is().True()); - AssertThat(out_nodes.pull(), Is().EqualTo(node(1, node::MAX_ID, + AssertThat(out_nodes.pull(), Is().EqualTo(node(1, node::max_id, terminal_F, terminal_T))); AssertThat(out_nodes.can_pull(), Is().False()); @@ -1042,19 +1042,19 @@ go_bandit([]() { AssertThat(out->width, Is().EqualTo(1u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL], Is().EqualTo(1u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(1u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(1u)); - AssertThat(out->max_1level_cut[cut_type::ALL], Is().EqualTo(2u)); + AssertThat(out->max_1level_cut[cut::Internal], Is().EqualTo(1u)); + AssertThat(out->max_1level_cut[cut::Internal_False], Is().EqualTo(1u)); + AssertThat(out->max_1level_cut[cut::Internal_True], Is().EqualTo(1u)); + AssertThat(out->max_1level_cut[cut::All], Is().EqualTo(2u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL], Is().GreaterThanOrEqualTo(1u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL], Is().LessThanOrEqualTo(2u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_FALSE], Is().GreaterThanOrEqualTo(1u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_FALSE], Is().LessThanOrEqualTo(2u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_TRUE], Is().GreaterThanOrEqualTo(1u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_TRUE], Is().LessThanOrEqualTo(2u)); - AssertThat(out->max_2level_cut[cut_type::ALL], Is().GreaterThanOrEqualTo(2u)); - AssertThat(out->max_2level_cut[cut_type::ALL], Is().LessThanOrEqualTo(3u)); + AssertThat(out->max_2level_cut[cut::Internal], Is().GreaterThanOrEqualTo(1u)); + AssertThat(out->max_2level_cut[cut::Internal], Is().LessThanOrEqualTo(2u)); + AssertThat(out->max_2level_cut[cut::Internal_False], Is().GreaterThanOrEqualTo(1u)); + AssertThat(out->max_2level_cut[cut::Internal_False], Is().LessThanOrEqualTo(2u)); + AssertThat(out->max_2level_cut[cut::Internal_True], Is().GreaterThanOrEqualTo(1u)); + AssertThat(out->max_2level_cut[cut::Internal_True], Is().LessThanOrEqualTo(2u)); + AssertThat(out->max_2level_cut[cut::All], Is().GreaterThanOrEqualTo(2u)); + AssertThat(out->max_2level_cut[cut::All], Is().LessThanOrEqualTo(3u)); AssertThat(out->number_of_terminals[false], Is().EqualTo(1u)); AssertThat(out->number_of_terminals[true], Is().EqualTo(1u)); @@ -1082,15 +1082,15 @@ go_bandit([]() { AssertThat(out->width, Is().EqualTo(0u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL], Is().EqualTo(0u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(1u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(0u)); - AssertThat(out->max_1level_cut[cut_type::ALL], Is().EqualTo(1u)); + AssertThat(out->max_1level_cut[cut::Internal], Is().EqualTo(0u)); + AssertThat(out->max_1level_cut[cut::Internal_False], Is().EqualTo(1u)); + AssertThat(out->max_1level_cut[cut::Internal_True], Is().EqualTo(0u)); + AssertThat(out->max_1level_cut[cut::All], Is().EqualTo(1u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL], Is().EqualTo(0u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(1u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(0u)); - AssertThat(out->max_2level_cut[cut_type::ALL], Is().EqualTo(1u)); + AssertThat(out->max_2level_cut[cut::Internal], Is().EqualTo(0u)); + AssertThat(out->max_2level_cut[cut::Internal_False], Is().EqualTo(1u)); + AssertThat(out->max_2level_cut[cut::Internal_True], Is().EqualTo(0u)); + AssertThat(out->max_2level_cut[cut::All], Is().EqualTo(1u)); AssertThat(out->number_of_terminals[false], Is().EqualTo(1u)); AssertThat(out->number_of_terminals[true], Is().EqualTo(0u)); @@ -1118,15 +1118,15 @@ go_bandit([]() { AssertThat(out->width, Is().EqualTo(0u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL], Is().EqualTo(0u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(0u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(1u)); - AssertThat(out->max_1level_cut[cut_type::ALL], Is().EqualTo(1u)); + AssertThat(out->max_1level_cut[cut::Internal], Is().EqualTo(0u)); + AssertThat(out->max_1level_cut[cut::Internal_False], Is().EqualTo(0u)); + AssertThat(out->max_1level_cut[cut::Internal_True], Is().EqualTo(1u)); + AssertThat(out->max_1level_cut[cut::All], Is().EqualTo(1u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL], Is().EqualTo(0u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(0u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(1u)); - AssertThat(out->max_2level_cut[cut_type::ALL], Is().EqualTo(1u)); + AssertThat(out->max_2level_cut[cut::Internal], Is().EqualTo(0u)); + AssertThat(out->max_2level_cut[cut::Internal_False], Is().EqualTo(0u)); + AssertThat(out->max_2level_cut[cut::Internal_True], Is().EqualTo(1u)); + AssertThat(out->max_2level_cut[cut::All], Is().EqualTo(1u)); AssertThat(out->number_of_terminals[false], Is().EqualTo(0u)); AssertThat(out->number_of_terminals[true], Is().EqualTo(1u)); @@ -1156,21 +1156,21 @@ go_bandit([]() { AssertThat(out_nodes.can_pull(), Is().True()); - AssertThat(out_nodes.pull(), Is().EqualTo(node(2, node::MAX_ID, + AssertThat(out_nodes.pull(), Is().EqualTo(node(2, node::max_id, terminal_F, terminal_T))); AssertThat(out_nodes.can_pull(), Is().True()); - AssertThat(out_nodes.pull(), Is().EqualTo(node(1, node::MAX_ID, - ptr_uint64(2, ptr_uint64::MAX_ID), - ptr_uint64(2, ptr_uint64::MAX_ID)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(1, node::max_id, + ptr_uint64(2, ptr_uint64::max_id), + ptr_uint64(2, ptr_uint64::max_id)))); AssertThat(out_nodes.can_pull(), Is().True()); - AssertThat(out_nodes.pull(), Is().EqualTo(node(0, node::MAX_ID, - ptr_uint64(2, ptr_uint64::MAX_ID), - ptr_uint64(1, ptr_uint64::MAX_ID)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(0, node::max_id, + ptr_uint64(2, ptr_uint64::max_id), + ptr_uint64(1, ptr_uint64::max_id)))); AssertThat(out_nodes.can_pull(), Is().False()); @@ -1189,19 +1189,19 @@ go_bandit([]() { AssertThat(out->width, Is().EqualTo(1u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL], Is().EqualTo(3u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(3u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(3u)); - AssertThat(out->max_1level_cut[cut_type::ALL], Is().EqualTo(3u)); - - AssertThat(out->max_2level_cut[cut_type::INTERNAL], Is().GreaterThanOrEqualTo(3u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL], Is().LessThanOrEqualTo(4u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_FALSE], Is().GreaterThanOrEqualTo(3u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_FALSE], Is().LessThanOrEqualTo(4u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_TRUE], Is().GreaterThanOrEqualTo(3u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_TRUE], Is().LessThanOrEqualTo(4u)); - AssertThat(out->max_2level_cut[cut_type::ALL], Is().GreaterThanOrEqualTo(3u)); - AssertThat(out->max_2level_cut[cut_type::ALL], Is().LessThanOrEqualTo(4u)); + AssertThat(out->max_1level_cut[cut::Internal], Is().EqualTo(3u)); + AssertThat(out->max_1level_cut[cut::Internal_False], Is().EqualTo(3u)); + AssertThat(out->max_1level_cut[cut::Internal_True], Is().EqualTo(3u)); + AssertThat(out->max_1level_cut[cut::All], Is().EqualTo(3u)); + + AssertThat(out->max_2level_cut[cut::Internal], Is().GreaterThanOrEqualTo(3u)); + AssertThat(out->max_2level_cut[cut::Internal], Is().LessThanOrEqualTo(4u)); + AssertThat(out->max_2level_cut[cut::Internal_False], Is().GreaterThanOrEqualTo(3u)); + AssertThat(out->max_2level_cut[cut::Internal_False], Is().LessThanOrEqualTo(4u)); + AssertThat(out->max_2level_cut[cut::Internal_True], Is().GreaterThanOrEqualTo(3u)); + AssertThat(out->max_2level_cut[cut::Internal_True], Is().LessThanOrEqualTo(4u)); + AssertThat(out->max_2level_cut[cut::All], Is().GreaterThanOrEqualTo(3u)); + AssertThat(out->max_2level_cut[cut::All], Is().LessThanOrEqualTo(4u)); AssertThat(out->number_of_terminals[false], Is().EqualTo(1u)); AssertThat(out->number_of_terminals[true], Is().EqualTo(1u)); diff --git a/test/adiar/test_domain.cpp b/test/adiar/test_domain.cpp index 44811b951..e248a8752 100644 --- a/test/adiar/test_domain.cpp +++ b/test/adiar/test_domain.cpp @@ -1,68 +1,68 @@ #include "../test.h" go_bandit([]() { - adiar_unset_domain(); + domain_unset(); describe("adiar/domain.h", []() { - describe("adiar_has_domain(), adiar_get_domain()", []() { + describe("domain_isset(), domain_get()", []() { it("throws exception when getting missing domain", []() { - AssertThat(adiar_has_domain(), Is().False()); - AssertThrows(domain_error, adiar_get_domain()); + AssertThat(domain_isset(), Is().False()); + AssertThrows(domain_error, domain_get()); }); }); - describe("adiar_has_domain(), adiar_set_domain(...), adiar_unset_domain()", []() { - it("has domain after 'adiar_set_domain(file)'", []() { - adiar::shared_file dom; + describe("domain_isset(), domain_set(...), domain_unset()", []() { + it("has domain after 'domain_set(file)'", []() { + adiar::shared_file dom; { // Garbage collect writer to free write-lock label_writer lw(dom); lw << 1 << 2 << 3; } - AssertThat(adiar_has_domain(), Is().False()); - adiar_set_domain(dom); - AssertThat(adiar_has_domain(), Is().True()); + AssertThat(domain_isset(), Is().False()); + domain_set(dom); + AssertThat(domain_isset(), Is().True()); }); it("can remove prior domain", []() { - AssertThat(adiar_has_domain(), Is().True()); - adiar_unset_domain(); - AssertThat(adiar_has_domain(), Is().False()); + AssertThat(domain_isset(), Is().True()); + domain_unset(); + AssertThat(domain_isset(), Is().False()); }); it("can remove with no prior domain", []() { - AssertThat(adiar_has_domain(), Is().False()); - adiar_unset_domain(); - AssertThat(adiar_has_domain(), Is().False()); + AssertThat(domain_isset(), Is().False()); + domain_unset(); + AssertThat(domain_isset(), Is().False()); }); - it("has domain after 'adiar_set_domain(varcount)'", []() { - AssertThat(adiar_has_domain(), Is().False()); - adiar_set_domain(42); - AssertThat(adiar_has_domain(), Is().True()); + it("has domain after 'domain_set(varcount)'", []() { + AssertThat(domain_isset(), Is().False()); + domain_set(42); + AssertThat(domain_isset(), Is().True()); }); }); - describe("adiar_has_domain(), adiar_get_domain(), adiar_set_domain(...)", []() { + describe("domain_isset(), domain_get(), domain_set(...)", []() { it("gives back domain with varcount [0]", []() { - adiar_unset_domain(); - adiar_set_domain(0); + domain_unset(); + domain_set(0); - AssertThat(adiar_has_domain(), Is().True()); + AssertThat(domain_isset(), Is().True()); - adiar::file_stream ls(adiar_get_domain()); + adiar::file_stream ls(domain_get()); AssertThat(ls.can_pull(), Is().False()); }); it("gives back domain with varcount [1]", []() { - adiar_unset_domain(); - adiar_set_domain(1); + domain_unset(); + domain_set(1); - AssertThat(adiar_has_domain(), Is().True()); + AssertThat(domain_isset(), Is().True()); - adiar::file_stream ls(adiar_get_domain()); + adiar::file_stream ls(domain_get()); AssertThat(ls.can_pull(), Is().True()); AssertThat(ls.pull(), Is().EqualTo(0u)); @@ -71,12 +71,12 @@ go_bandit([]() { }); it("gives back domain with varcount [7]", []() { - adiar_unset_domain(); - adiar_set_domain(7); + domain_unset(); + domain_set(7); - AssertThat(adiar_has_domain(), Is().True()); + AssertThat(domain_isset(), Is().True()); - adiar::file_stream ls(adiar_get_domain()); + adiar::file_stream ls(domain_get()); AssertThat(ls.can_pull(), Is().True()); AssertThat(ls.pull(), Is().EqualTo(0u)); @@ -103,13 +103,13 @@ go_bandit([]() { }); it("can overwrite with new varcount [2,3]", []() { - adiar_unset_domain(); + domain_unset(); - adiar_set_domain(3); + domain_set(3); { - AssertThat(adiar_has_domain(), Is().True()); + AssertThat(domain_isset(), Is().True()); - adiar::file_stream ls(adiar_get_domain()); + adiar::file_stream ls(domain_get()); AssertThat(ls.can_pull(), Is().True()); AssertThat(ls.pull(), Is().EqualTo(0u)); @@ -123,11 +123,11 @@ go_bandit([]() { AssertThat(ls.can_pull(), Is().False()); } - adiar_set_domain(2); + domain_set(2); { - AssertThat(adiar_has_domain(), Is().True()); + AssertThat(domain_isset(), Is().True()); - adiar::file_stream ls(adiar_get_domain()); + adiar::file_stream ls(domain_get()); AssertThat(ls.can_pull(), Is().True()); AssertThat(ls.pull(), Is().EqualTo(0u)); @@ -140,23 +140,23 @@ go_bandit([]() { }); it("can copy the Fibonacci numbers from a generator", []() { - adiar_unset_domain(); + domain_unset(); - domain_var_t x = 1; - domain_var_t y = 1; + domain_var x = 1; + domain_var y = 1; const auto gen = [&x, &y]() { - const domain_var_t z = x + y; + const domain_var z = x + y; x = y; y = z; - return x > 13 ? MAX_DOMAIN_VAR+1 : x; + return x > 13 ? domain_max+1 : x; }; - adiar_set_domain(gen); - AssertThat(adiar_has_domain(), Is().True()); + domain_set(gen); + AssertThat(domain_isset(), Is().True()); - adiar::file_stream ls(adiar_get_domain()); + adiar::file_stream ls(domain_get()); AssertThat(ls.can_pull(), Is().True()); AssertThat(ls.pull(), Is().EqualTo(1u)); @@ -180,15 +180,15 @@ go_bandit([]() { }); it("can copy from an iterator", []() { - adiar_unset_domain(); + domain_unset(); std::vector xs = { 0, 1, 3, 5, 42 }; - adiar_set_domain(xs.begin(), xs.end()); + domain_set(xs.begin(), xs.end()); - AssertThat(adiar_has_domain(), Is().True()); + AssertThat(domain_isset(), Is().True()); - adiar::file_stream ls(adiar_get_domain()); + adiar::file_stream ls(domain_get()); AssertThat(ls.can_pull(), Is().True()); AssertThat(ls.pull(), Is().EqualTo(0u)); @@ -209,15 +209,15 @@ go_bandit([]() { }); it("can overwrite with another iterator", []() { - adiar_unset_domain(); + domain_unset(); std::vector xs = { 2, 4, 5 }; - adiar_set_domain(xs.begin(), xs.end()); + domain_set(xs.begin(), xs.end()); { // Check for xs - AssertThat(adiar_has_domain(), Is().True()); + AssertThat(domain_isset(), Is().True()); - adiar::file_stream ls(adiar_get_domain()); + adiar::file_stream ls(domain_get()); AssertThat(ls.can_pull(), Is().True()); AssertThat(ls.pull(), Is().EqualTo(2u)); @@ -233,11 +233,11 @@ go_bandit([]() { std::vector ys = { 0, 3 }; - adiar_set_domain(ys.begin(), ys.end()); + domain_set(ys.begin(), ys.end()); { // Check for ys - AssertThat(adiar_has_domain(), Is().True()); + AssertThat(domain_isset(), Is().True()); - adiar::file_stream ls(adiar_get_domain()); + adiar::file_stream ls(domain_get()); AssertThat(ls.can_pull(), Is().True()); AssertThat(ls.pull(), Is().EqualTo(0u)); @@ -250,47 +250,47 @@ go_bandit([]() { }); it("gives back the given domain file", []() { - adiar_unset_domain(); + domain_unset(); - adiar::shared_file dom; + adiar::shared_file dom; { // Garbage collect writer to free write-lock label_writer lw(dom); lw << 1 << 2 << 3; } - adiar_set_domain(dom); + domain_set(dom); - AssertThat(adiar_has_domain(), Is().True()); - AssertThat(adiar_get_domain(), Is().EqualTo(dom)); + AssertThat(domain_isset(), Is().True()); + AssertThat(domain_get(), Is().EqualTo(dom)); }); it("can overwrite with another domain file", []() { - adiar_unset_domain(); + domain_unset(); - adiar::shared_file dom1; + adiar::shared_file dom1; { // Garbage collect writer to free write-lock label_writer lw(dom1); lw << 1 << 2 << 3; } - adiar_set_domain(dom1); + domain_set(dom1); - AssertThat(adiar_has_domain(), Is().True()); - AssertThat(adiar_get_domain(), Is().EqualTo(dom1)); + AssertThat(domain_isset(), Is().True()); + AssertThat(domain_get(), Is().EqualTo(dom1)); - adiar::shared_file dom2; + adiar::shared_file dom2; { // Garbage collect writer to free write-lock label_writer lw(dom2); lw << 4 << 9 << 35; } - adiar_set_domain(dom2); + domain_set(dom2); - AssertThat(adiar_has_domain(), Is().True()); - AssertThat(adiar_get_domain(), Is().EqualTo(dom2)); + AssertThat(domain_isset(), Is().True()); + AssertThat(domain_get(), Is().EqualTo(dom2)); }); }); diff --git a/test/adiar/test_map.cpp b/test/adiar/test_map.cpp index 2021dfaf9..6c8ebf3f7 100644 --- a/test/adiar/test_map.cpp +++ b/test/adiar/test_map.cpp @@ -4,8 +4,8 @@ enum class test_map_value { False = 0, True = 1, - OTHER_1 = 2, - OTHER_2 = 4, + Other_1 = 2, + Other_2 = 4, }; using test_map_pair = map_pair; @@ -13,7 +13,7 @@ using test_map_pair = map_pair; go_bandit([]() { describe("adiar/map.h", []() { describe("map_pair", []() { - describe("var_mapping<...>(label_t, enum), .key(), .value(), .raw_value()", []() { + describe("var_mapping<...>(label_type, enum), .key(), .value(), .raw_value()", []() { it("provides access to variable [42]", []() { test_map_pair a(42, test_map_value::False); AssertThat(a.key(), Is().EqualTo(42)); @@ -35,13 +35,13 @@ go_bandit([]() { }); it("provides access to value [2]", []() { - test_map_pair a(42, test_map_value::OTHER_1); - AssertThat(a.value(), Is().EqualTo(test_map_value::OTHER_1)); + test_map_pair a(42, test_map_value::Other_1); + AssertThat(a.value(), Is().EqualTo(test_map_value::Other_1)); }); it("provides access to value [4]", []() { - test_map_pair a(42, test_map_value::OTHER_2); - AssertThat(a.value(), Is().EqualTo(test_map_value::OTHER_2)); + test_map_pair a(42, test_map_value::Other_2); + AssertThat(a.value(), Is().EqualTo(test_map_value::Other_2)); }); it("provides access to raw value [0]", []() { @@ -55,12 +55,12 @@ go_bandit([]() { }); it("provides access to raw value [2]", []() { - test_map_pair a(42, test_map_value::OTHER_1); + test_map_pair a(42, test_map_value::Other_1); AssertThat(a.raw_value(), Is().EqualTo(2)); }); it("provides access to raw value [4]", []() { - test_map_pair a(42, test_map_value::OTHER_2); + test_map_pair a(42, test_map_value::Other_2); AssertThat(a.raw_value(), Is().EqualTo(4)); }); }); @@ -77,10 +77,10 @@ go_bandit([]() { }); it("is false for other", []() { - test_map_pair a1(0, test_map_value::OTHER_1); + test_map_pair a1(0, test_map_value::Other_1); AssertThat(a1.is_false(), Is().False()); - test_map_pair a2(0, test_map_value::OTHER_2); + test_map_pair a2(0, test_map_value::Other_2); AssertThat(a2.is_false(), Is().False()); }); @@ -98,15 +98,15 @@ go_bandit([]() { }); it("is false for other", []() { - test_map_pair a1(0, test_map_value::OTHER_1); + test_map_pair a1(0, test_map_value::Other_1); AssertThat(a1.is_true(), Is().False()); - test_map_pair a2(0, test_map_value::OTHER_1); + test_map_pair a2(0, test_map_value::Other_1); AssertThat(a2.is_true(), Is().False()); }); }); - describe("test_map_pair(label_t, bool)", []() { + describe("test_map_pair(label_type, bool)", []() { it("converts correctly from boolean value [0]", []() { test_map_pair a(42, false); AssertThat(a.key(), Is().EqualTo(42)); @@ -141,37 +141,37 @@ go_bandit([]() { it("sorts based on the variable order [1], [<]", []() { AssertThat(test_map_pair(21, test_map_value::True), - Is().LessThan(test_map_pair(42, test_map_value::OTHER_1))); - AssertThat(test_map_pair(42, test_map_value::OTHER_1), + Is().LessThan(test_map_pair(42, test_map_value::Other_1))); + AssertThat(test_map_pair(42, test_map_value::Other_1), Is().Not().LessThan(test_map_pair(21, test_map_value::True))); }); it("sorts based on the variable order [1], [>]", []() { - AssertThat(test_map_pair(42, test_map_value::OTHER_1), + AssertThat(test_map_pair(42, test_map_value::Other_1), Is().GreaterThan(test_map_pair(21, test_map_value::True))); AssertThat(test_map_pair(21, test_map_value::True), - Is().Not().GreaterThan(test_map_pair(42, test_map_value::OTHER_1))); + Is().Not().GreaterThan(test_map_pair(42, test_map_value::Other_1))); }); it("sorts based on the variable order [2], [<]", []() { AssertThat(test_map_pair(20, test_map_value::False), - Is().LessThan(test_map_pair(21, test_map_value::OTHER_1))); - AssertThat(test_map_pair(21, test_map_value::OTHER_1), + Is().LessThan(test_map_pair(21, test_map_value::Other_1))); + AssertThat(test_map_pair(21, test_map_value::Other_1), Is().Not().LessThan(test_map_pair(20, test_map_value::False))); }); it("sorts based on the variable order [2], [>]", []() { - AssertThat(test_map_pair(21, test_map_value::OTHER_1), + AssertThat(test_map_pair(21, test_map_value::Other_1), Is().GreaterThan(test_map_pair(20, test_map_value::False))); AssertThat(test_map_pair(20, test_map_value::False), - Is().Not().GreaterThan(test_map_pair(21, test_map_value::OTHER_1))); + Is().Not().GreaterThan(test_map_pair(21, test_map_value::Other_1))); }); }); describe("equality '=='", []() { it("is true when both variable and value match [1]", [&]() { - AssertThat(test_map_pair(1, test_map_value::OTHER_1), - Is().EqualTo(test_map_pair(1, test_map_value::OTHER_1))); + AssertThat(test_map_pair(1, test_map_value::Other_1), + Is().EqualTo(test_map_pair(1, test_map_value::Other_1))); }); it("is true when both variable and value match [2]", [&]() { @@ -195,22 +195,22 @@ go_bandit([]() { }); it("is false when the value mismatches [1]", [&]() { - AssertThat(test_map_pair(42, test_map_value::OTHER_1), + AssertThat(test_map_pair(42, test_map_value::Other_1), Is().Not().EqualTo(test_map_pair(42, test_map_value::False))); - AssertThat(test_map_pair(42, test_map_value::OTHER_1), + AssertThat(test_map_pair(42, test_map_value::Other_1), Is().Not().EqualTo(test_map_pair(42, test_map_value::True))); }); it("is false when the value mismatches [2]", [&]() { AssertThat(test_map_pair(8, test_map_value::False), - Is().Not().EqualTo(test_map_pair(8, test_map_value::OTHER_1))); + Is().Not().EqualTo(test_map_pair(8, test_map_value::Other_1))); AssertThat(test_map_pair(8, test_map_value::False), Is().Not().EqualTo(test_map_pair(8, test_map_value::True))); }); it("is false when the value mismatches [3]", [&]() { AssertThat(test_map_pair(8, test_map_value::True), - Is().Not().EqualTo(test_map_pair(8, test_map_value::OTHER_1))); + Is().Not().EqualTo(test_map_pair(8, test_map_value::Other_1))); AssertThat(test_map_pair(13, test_map_value::True), Is().Not().EqualTo(test_map_pair(13, test_map_value::False))); }); @@ -238,13 +238,13 @@ go_bandit([]() { }); it("keeps 'None' as-is [1]", [&]() { - AssertThat(~test_map_pair(5, test_map_value::OTHER_1), - Is().EqualTo(test_map_pair(5, test_map_value::OTHER_1))); + AssertThat(~test_map_pair(5, test_map_value::Other_1), + Is().EqualTo(test_map_pair(5, test_map_value::Other_1))); }); it("keeps 'None' as-is [2]", [&]() { - AssertThat(~test_map_pair(6, test_map_value::OTHER_1), - Is().EqualTo(test_map_pair(6, test_map_value::OTHER_1))); + AssertThat(~test_map_pair(6, test_map_value::Other_1), + Is().EqualTo(test_map_pair(6, test_map_value::Other_1))); }); }); }); diff --git a/test/adiar/zdd/test_binop.cpp b/test/adiar/zdd/test_binop.cpp index a9366c964..03fcaf26f 100644 --- a/test/adiar/zdd/test_binop.cpp +++ b/test/adiar/zdd/test_binop.cpp @@ -3,8 +3,8 @@ go_bandit([]() { describe("adiar/zdd/binop.cpp", []() { // Setup shared zdd's - shared_levelized_file zdd_F; - shared_levelized_file zdd_T; + shared_levelized_file zdd_F; + shared_levelized_file zdd_T; { // Garbage collect writers to free write-lock node_writer nw_F(zdd_F); @@ -17,37 +17,37 @@ go_bandit([]() { ptr_uint64 terminal_T = ptr_uint64(true); ptr_uint64 terminal_F = ptr_uint64(false); - shared_levelized_file zdd_x0; - shared_levelized_file zdd_x1; + shared_levelized_file zdd_x0; + shared_levelized_file zdd_x1; { // Garbage collect writers early node_writer nw_x0(zdd_x0); - nw_x0 << node(0, node::MAX_ID, terminal_F, terminal_T); + nw_x0 << node(0, node::max_id, terminal_F, terminal_T); node_writer nw_x1(zdd_x1); - nw_x1 << node(1, node::MAX_ID, terminal_F, terminal_T); + nw_x1 << node(1, node::max_id, terminal_F, terminal_T); } describe("simple cases without access mode requirements", [&]() { describe("zdd_union", [&]() { it("should shortcut Ø on same file", [&]() { __zdd out = zdd_union(zdd_F, zdd_F); - AssertThat(out.get>(), Is().EqualTo(zdd_F)); + AssertThat(out.get>(), Is().EqualTo(zdd_F)); }); it("should shortcut { Ø } on same file", [&]() { __zdd out = zdd_union(zdd_T, zdd_T); - AssertThat(out.get>(), Is().EqualTo(zdd_T)); + AssertThat(out.get>(), Is().EqualTo(zdd_T)); }); it("should shortcut { {0} } on same file", [&]() { __zdd out = zdd_union(zdd_x0, zdd_x0); - AssertThat(out.get>(), Is().EqualTo(zdd_x0)); + AssertThat(out.get>(), Is().EqualTo(zdd_x0)); }); it("should shortcut { {1} } on same file", [&]() { __zdd out = zdd_union(zdd_x1, zdd_x1); - AssertThat(out.get>(), Is().EqualTo(zdd_x1)); + AssertThat(out.get>(), Is().EqualTo(zdd_x1)); }); it("computes Ø U { {Ø} }", [&]() { @@ -62,13 +62,13 @@ go_bandit([]() { level_info_test_stream ms(out); AssertThat(ms.can_pull(), Is().False()); - AssertThat(out.get>()->max_1level_cut[cut_type::INTERNAL], Is().EqualTo(0u)); - AssertThat(out.get>()->max_1level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(0u)); - AssertThat(out.get>()->max_1level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(1u)); - AssertThat(out.get>()->max_1level_cut[cut_type::ALL], Is().EqualTo(1u)); + AssertThat(out.get>()->max_1level_cut[cut::Internal], Is().EqualTo(0u)); + AssertThat(out.get>()->max_1level_cut[cut::Internal_False], Is().EqualTo(0u)); + AssertThat(out.get>()->max_1level_cut[cut::Internal_True], Is().EqualTo(1u)); + AssertThat(out.get>()->max_1level_cut[cut::All], Is().EqualTo(1u)); - AssertThat(out.get>()->number_of_terminals[false], Is().EqualTo(0u)); - AssertThat(out.get>()->number_of_terminals[true], Is().EqualTo(1u)); + AssertThat(out.get>()->number_of_terminals[false], Is().EqualTo(0u)); + AssertThat(out.get>()->number_of_terminals[true], Is().EqualTo(1u)); }); it("computes { Ø } U Ø", [&]() { @@ -83,13 +83,13 @@ go_bandit([]() { level_info_test_stream ms(out); AssertThat(ms.can_pull(), Is().False()); - AssertThat(out.get>()->max_1level_cut[cut_type::INTERNAL], Is().EqualTo(0u)); - AssertThat(out.get>()->max_1level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(0u)); - AssertThat(out.get>()->max_1level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(1u)); - AssertThat(out.get>()->max_1level_cut[cut_type::ALL], Is().EqualTo(1u)); + AssertThat(out.get>()->max_1level_cut[cut::Internal], Is().EqualTo(0u)); + AssertThat(out.get>()->max_1level_cut[cut::Internal_False], Is().EqualTo(0u)); + AssertThat(out.get>()->max_1level_cut[cut::Internal_True], Is().EqualTo(1u)); + AssertThat(out.get>()->max_1level_cut[cut::All], Is().EqualTo(1u)); - AssertThat(out.get>()->number_of_terminals[false], Is().EqualTo(0u)); - AssertThat(out.get>()->number_of_terminals[true], Is().EqualTo(1u)); + AssertThat(out.get>()->number_of_terminals[false], Is().EqualTo(0u)); + AssertThat(out.get>()->number_of_terminals[true], Is().EqualTo(1u)); }); it("should shortcut on irrelevance for { {0} } U Ø", [&]() { @@ -100,20 +100,20 @@ go_bandit([]() { */ __zdd out_1 = zdd_union(zdd_x0, zdd_F); - AssertThat(out_1.get>(), Is().EqualTo(zdd_x0)); + AssertThat(out_1.get>(), Is().EqualTo(zdd_x0)); __zdd out_2 = zdd_union(zdd_F, zdd_x0); - AssertThat(out_2.get>(), Is().EqualTo(zdd_x0)); + AssertThat(out_2.get>(), Is().EqualTo(zdd_x0)); }); }); describe("zdd_intsec", [&]() { it("should shortcut on same file", [&]() { __zdd out_1 = zdd_intsec(zdd_x0, zdd_x0); - AssertThat(out_1.get>(), Is().EqualTo(zdd_x0)); + AssertThat(out_1.get>(), Is().EqualTo(zdd_x0)); __zdd out_2 = zdd_intsec(zdd_x1, zdd_x1); - AssertThat(out_2.get>(), Is().EqualTo(zdd_x1)); + AssertThat(out_2.get>(), Is().EqualTo(zdd_x1)); }); it("computes Ø ∩ { {Ø} }", [&]() { @@ -125,15 +125,15 @@ go_bandit([]() { AssertThat(out_nodes.can_pull(), Is().False()); - AssertThat(out.get>()->levels(), Is().EqualTo(0u)); + AssertThat(out.get>()->levels(), Is().EqualTo(0u)); - AssertThat(out.get>()->max_1level_cut[cut_type::INTERNAL], Is().EqualTo(0u)); - AssertThat(out.get>()->max_1level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(1u)); - AssertThat(out.get>()->max_1level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(0u)); - AssertThat(out.get>()->max_1level_cut[cut_type::ALL], Is().EqualTo(1u)); + AssertThat(out.get>()->max_1level_cut[cut::Internal], Is().EqualTo(0u)); + AssertThat(out.get>()->max_1level_cut[cut::Internal_False], Is().EqualTo(1u)); + AssertThat(out.get>()->max_1level_cut[cut::Internal_True], Is().EqualTo(0u)); + AssertThat(out.get>()->max_1level_cut[cut::All], Is().EqualTo(1u)); - AssertThat(out.get>()->number_of_terminals[false], Is().EqualTo(1u)); - AssertThat(out.get>()->number_of_terminals[true], Is().EqualTo(0u)); + AssertThat(out.get>()->number_of_terminals[false], Is().EqualTo(1u)); + AssertThat(out.get>()->number_of_terminals[true], Is().EqualTo(0u)); }); it("computes { Ø } ∩ Ø", [&]() { @@ -145,15 +145,15 @@ go_bandit([]() { AssertThat(out_nodes.can_pull(), Is().False()); - AssertThat(out.get>()->levels(), Is().EqualTo(0u)); + AssertThat(out.get>()->levels(), Is().EqualTo(0u)); - AssertThat(out.get>()->max_1level_cut[cut_type::INTERNAL], Is().EqualTo(0u)); - AssertThat(out.get>()->max_1level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(1u)); - AssertThat(out.get>()->max_1level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(0u)); - AssertThat(out.get>()->max_1level_cut[cut_type::ALL], Is().EqualTo(1u)); + AssertThat(out.get>()->max_1level_cut[cut::Internal], Is().EqualTo(0u)); + AssertThat(out.get>()->max_1level_cut[cut::Internal_False], Is().EqualTo(1u)); + AssertThat(out.get>()->max_1level_cut[cut::Internal_True], Is().EqualTo(0u)); + AssertThat(out.get>()->max_1level_cut[cut::All], Is().EqualTo(1u)); - AssertThat(out.get>()->number_of_terminals[false], Is().EqualTo(1u)); - AssertThat(out.get>()->number_of_terminals[true], Is().EqualTo(0u)); + AssertThat(out.get>()->number_of_terminals[false], Is().EqualTo(1u)); + AssertThat(out.get>()->number_of_terminals[true], Is().EqualTo(0u)); }); it("computes (and shortcut) { {0} } ∩ Ø", [&]() { @@ -172,15 +172,15 @@ go_bandit([]() { AssertThat(out_nodes.can_pull(), Is().False()); - AssertThat(out.get>()->levels(), Is().EqualTo(0u)); + AssertThat(out.get>()->levels(), Is().EqualTo(0u)); - AssertThat(out.get>()->max_1level_cut[cut_type::INTERNAL], Is().EqualTo(0u)); - AssertThat(out.get>()->max_1level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(1u)); - AssertThat(out.get>()->max_1level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(0u)); - AssertThat(out.get>()->max_1level_cut[cut_type::ALL], Is().EqualTo(1u)); + AssertThat(out.get>()->max_1level_cut[cut::Internal], Is().EqualTo(0u)); + AssertThat(out.get>()->max_1level_cut[cut::Internal_False], Is().EqualTo(1u)); + AssertThat(out.get>()->max_1level_cut[cut::Internal_True], Is().EqualTo(0u)); + AssertThat(out.get>()->max_1level_cut[cut::All], Is().EqualTo(1u)); - AssertThat(out.get>()->number_of_terminals[false], Is().EqualTo(1u)); - AssertThat(out.get>()->number_of_terminals[true], Is().EqualTo(0u)); + AssertThat(out.get>()->number_of_terminals[false], Is().EqualTo(1u)); + AssertThat(out.get>()->number_of_terminals[true], Is().EqualTo(0u)); }); it("computes (and shortcut) Ø ∩ { {0} }", [&]() { @@ -193,15 +193,15 @@ go_bandit([]() { AssertThat(out_nodes.can_pull(), Is().False()); - AssertThat(out.get>()->levels(), Is().EqualTo(0u)); + AssertThat(out.get>()->levels(), Is().EqualTo(0u)); - AssertThat(out.get>()->max_1level_cut[cut_type::INTERNAL], Is().EqualTo(0u)); - AssertThat(out.get>()->max_1level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(1u)); - AssertThat(out.get>()->max_1level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(0u)); - AssertThat(out.get>()->max_1level_cut[cut_type::ALL], Is().EqualTo(1u)); + AssertThat(out.get>()->max_1level_cut[cut::Internal], Is().EqualTo(0u)); + AssertThat(out.get>()->max_1level_cut[cut::Internal_False], Is().EqualTo(1u)); + AssertThat(out.get>()->max_1level_cut[cut::Internal_True], Is().EqualTo(0u)); + AssertThat(out.get>()->max_1level_cut[cut::All], Is().EqualTo(1u)); - AssertThat(out.get>()->number_of_terminals[false], Is().EqualTo(1u)); - AssertThat(out.get>()->number_of_terminals[true], Is().EqualTo(0u)); + AssertThat(out.get>()->number_of_terminals[false], Is().EqualTo(1u)); + AssertThat(out.get>()->number_of_terminals[true], Is().EqualTo(0u)); }); }); @@ -215,15 +215,15 @@ go_bandit([]() { AssertThat(out_nodes.can_pull(), Is().False()); - AssertThat(out.get>()->levels(), Is().EqualTo(0u)); + AssertThat(out.get>()->levels(), Is().EqualTo(0u)); - AssertThat(out.get>()->max_1level_cut[cut_type::INTERNAL], Is().EqualTo(0u)); - AssertThat(out.get>()->max_1level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(1u)); - AssertThat(out.get>()->max_1level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(0u)); - AssertThat(out.get>()->max_1level_cut[cut_type::ALL], Is().EqualTo(1u)); + AssertThat(out.get>()->max_1level_cut[cut::Internal], Is().EqualTo(0u)); + AssertThat(out.get>()->max_1level_cut[cut::Internal_False], Is().EqualTo(1u)); + AssertThat(out.get>()->max_1level_cut[cut::Internal_True], Is().EqualTo(0u)); + AssertThat(out.get>()->max_1level_cut[cut::All], Is().EqualTo(1u)); - AssertThat(out.get>()->number_of_terminals[false], Is().EqualTo(1u)); - AssertThat(out.get>()->number_of_terminals[true], Is().EqualTo(0u)); + AssertThat(out.get>()->number_of_terminals[false], Is().EqualTo(1u)); + AssertThat(out.get>()->number_of_terminals[true], Is().EqualTo(0u)); }); it("should shortcut to Ø on same file for { {x1} }", [&]() { @@ -235,15 +235,15 @@ go_bandit([]() { AssertThat(out_nodes.can_pull(), Is().False()); - AssertThat(out.get>()->levels(), Is().EqualTo(0u)); + AssertThat(out.get>()->levels(), Is().EqualTo(0u)); - AssertThat(out.get>()->max_1level_cut[cut_type::INTERNAL], Is().EqualTo(0u)); - AssertThat(out.get>()->max_1level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(1u)); - AssertThat(out.get>()->max_1level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(0u)); - AssertThat(out.get>()->max_1level_cut[cut_type::ALL], Is().EqualTo(1u)); + AssertThat(out.get>()->max_1level_cut[cut::Internal], Is().EqualTo(0u)); + AssertThat(out.get>()->max_1level_cut[cut::Internal_False], Is().EqualTo(1u)); + AssertThat(out.get>()->max_1level_cut[cut::Internal_True], Is().EqualTo(0u)); + AssertThat(out.get>()->max_1level_cut[cut::All], Is().EqualTo(1u)); - AssertThat(out.get>()->number_of_terminals[false], Is().EqualTo(1u)); - AssertThat(out.get>()->number_of_terminals[true], Is().EqualTo(0u)); + AssertThat(out.get>()->number_of_terminals[false], Is().EqualTo(1u)); + AssertThat(out.get>()->number_of_terminals[true], Is().EqualTo(0u)); }); it("computes { Ø } \\ Ø", [&]() { @@ -255,15 +255,15 @@ go_bandit([]() { AssertThat(out_nodes.can_pull(), Is().False()); - AssertThat(out.get>()->levels(), Is().EqualTo(0u)); + AssertThat(out.get>()->levels(), Is().EqualTo(0u)); - AssertThat(out.get>()->max_1level_cut[cut_type::INTERNAL], Is().EqualTo(0u)); - AssertThat(out.get>()->max_1level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(0u)); - AssertThat(out.get>()->max_1level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(1u)); - AssertThat(out.get>()->max_1level_cut[cut_type::ALL], Is().EqualTo(1u)); + AssertThat(out.get>()->max_1level_cut[cut::Internal], Is().EqualTo(0u)); + AssertThat(out.get>()->max_1level_cut[cut::Internal_False], Is().EqualTo(0u)); + AssertThat(out.get>()->max_1level_cut[cut::Internal_True], Is().EqualTo(1u)); + AssertThat(out.get>()->max_1level_cut[cut::All], Is().EqualTo(1u)); - AssertThat(out.get>()->number_of_terminals[false], Is().EqualTo(0u)); - AssertThat(out.get>()->number_of_terminals[true], Is().EqualTo(1u)); + AssertThat(out.get>()->number_of_terminals[false], Is().EqualTo(0u)); + AssertThat(out.get>()->number_of_terminals[true], Is().EqualTo(1u)); }); it("computes Ø \\ { Ø }", [&]() { @@ -275,25 +275,25 @@ go_bandit([]() { AssertThat(out_nodes.can_pull(), Is().False()); - AssertThat(out.get>()->levels(), Is().EqualTo(0u)); + AssertThat(out.get>()->levels(), Is().EqualTo(0u)); - AssertThat(out.get>()->max_1level_cut[cut_type::INTERNAL], Is().EqualTo(0u)); - AssertThat(out.get>()->max_1level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(1u)); - AssertThat(out.get>()->max_1level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(0u)); - AssertThat(out.get>()->max_1level_cut[cut_type::ALL], Is().EqualTo(1u)); + AssertThat(out.get>()->max_1level_cut[cut::Internal], Is().EqualTo(0u)); + AssertThat(out.get>()->max_1level_cut[cut::Internal_False], Is().EqualTo(1u)); + AssertThat(out.get>()->max_1level_cut[cut::Internal_True], Is().EqualTo(0u)); + AssertThat(out.get>()->max_1level_cut[cut::All], Is().EqualTo(1u)); - AssertThat(out.get>()->number_of_terminals[false], Is().EqualTo(1u)); - AssertThat(out.get>()->number_of_terminals[true], Is().EqualTo(0u)); + AssertThat(out.get>()->number_of_terminals[false], Is().EqualTo(1u)); + AssertThat(out.get>()->number_of_terminals[true], Is().EqualTo(0u)); }); it("should shortcut on irrelevance on { {x0} } \\ Ø", [&]() { __zdd out_1 = zdd_diff(zdd_x0, zdd_F); - AssertThat(out_1.get>(), Is().EqualTo(zdd_x0)); + AssertThat(out_1.get>(), Is().EqualTo(zdd_x0)); }); it("should shortcut on irrelevance on { {x1} } \\ Ø", [&]() { __zdd out_2 = zdd_diff(zdd_x1, zdd_F); - AssertThat(out_2.get>(), Is().EqualTo(zdd_x1)); + AssertThat(out_2.get>(), Is().EqualTo(zdd_x1)); }); it("computes (and shortcut) Ø \\ { {0} }", [&]() { @@ -306,22 +306,22 @@ go_bandit([]() { AssertThat(out_nodes.can_pull(), Is().False()); - AssertThat(out.get>()->levels(), Is().EqualTo(0u)); + AssertThat(out.get>()->levels(), Is().EqualTo(0u)); - AssertThat(out.get>()->max_1level_cut[cut_type::INTERNAL], Is().EqualTo(0u)); - AssertThat(out.get>()->max_1level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(1u)); - AssertThat(out.get>()->max_1level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(0u)); - AssertThat(out.get>()->max_1level_cut[cut_type::ALL], Is().EqualTo(1u)); + AssertThat(out.get>()->max_1level_cut[cut::Internal], Is().EqualTo(0u)); + AssertThat(out.get>()->max_1level_cut[cut::Internal_False], Is().EqualTo(1u)); + AssertThat(out.get>()->max_1level_cut[cut::Internal_True], Is().EqualTo(0u)); + AssertThat(out.get>()->max_1level_cut[cut::All], Is().EqualTo(1u)); - AssertThat(out.get>()->number_of_terminals[false], Is().EqualTo(1u)); - AssertThat(out.get>()->number_of_terminals[true], Is().EqualTo(0u)); + AssertThat(out.get>()->number_of_terminals[false], Is().EqualTo(1u)); + AssertThat(out.get>()->number_of_terminals[true], Is().EqualTo(0u)); }); }); }); describe("access mode: priority queues", [&]() { // Set access mode to priority queues for this batch of tests - access_mode = access_mode_t::PQ; + access_mode = access_mode_t::Priority_Queue; describe("zdd_union", [&]() { it("computes { {0} } U { Ø }", [&]() { @@ -351,10 +351,10 @@ go_bandit([]() { AssertThat(levels.can_pull(), Is().False()); - AssertThat(out.get<__zdd::shared_arcs_t>()->max_1level_cut, Is().GreaterThanOrEqualTo(0u)); + AssertThat(out.get<__zdd::shared_arc_file_type>()->max_1level_cut, Is().GreaterThanOrEqualTo(0u)); - AssertThat(out.get<__zdd::shared_arcs_t>()->number_of_terminals[false], Is().EqualTo(0u)); - AssertThat(out.get<__zdd::shared_arcs_t>()->number_of_terminals[true], Is().EqualTo(2u)); + AssertThat(out.get<__zdd::shared_arc_file_type>()->number_of_terminals[false], Is().EqualTo(0u)); + AssertThat(out.get<__zdd::shared_arc_file_type>()->number_of_terminals[true], Is().EqualTo(2u)); }); it("computes { {0} } U { {1} }", [&]() { @@ -396,10 +396,10 @@ go_bandit([]() { AssertThat(levels.can_pull(), Is().False()); - AssertThat(out.get<__zdd::shared_arcs_t>()->max_1level_cut, Is().GreaterThanOrEqualTo(1u)); + AssertThat(out.get<__zdd::shared_arc_file_type>()->max_1level_cut, Is().GreaterThanOrEqualTo(1u)); - AssertThat(out.get<__zdd::shared_arcs_t>()->number_of_terminals[false], Is().EqualTo(1u)); - AssertThat(out.get<__zdd::shared_arcs_t>()->number_of_terminals[true], Is().EqualTo(2u)); + AssertThat(out.get<__zdd::shared_arc_file_type>()->number_of_terminals[false], Is().EqualTo(1u)); + AssertThat(out.get<__zdd::shared_arc_file_type>()->number_of_terminals[true], Is().EqualTo(2u)); }); it("computes { {0,1}, {0,3} } U { {0,2}, {2} }", [&]() { @@ -414,19 +414,19 @@ go_bandit([]() { // / \ / \ // F T F T */ - shared_levelized_file zdd_a; - shared_levelized_file zdd_b; + shared_levelized_file zdd_a; + shared_levelized_file zdd_b; { // Garbage collect writers early node_writer nw_a(zdd_a); - nw_a << node(3, node::MAX_ID, terminal_F, terminal_T) - << node(1, node::MAX_ID, ptr_uint64(3, ptr_uint64::MAX_ID), terminal_T) - << node(0, node::MAX_ID, terminal_F, ptr_uint64(1, ptr_uint64::MAX_ID)) + nw_a << node(3, node::max_id, terminal_F, terminal_T) + << node(1, node::max_id, ptr_uint64(3, ptr_uint64::max_id), terminal_T) + << node(0, node::max_id, terminal_F, ptr_uint64(1, ptr_uint64::max_id)) ; node_writer nw_b(zdd_b); - nw_b << node(2, node::MAX_ID, terminal_F, terminal_T) - << node(0, node::MAX_ID, ptr_uint64(2, ptr_uint64::MAX_ID), ptr_uint64(2, ptr_uint64::MAX_ID)) + nw_b << node(2, node::max_id, terminal_F, terminal_T) + << node(0, node::max_id, ptr_uint64(2, ptr_uint64::max_id), ptr_uint64(2, ptr_uint64::max_id)) ; } @@ -484,10 +484,10 @@ go_bandit([]() { AssertThat(levels.can_pull(), Is().False()); - AssertThat(out.get<__zdd::shared_arcs_t>()->max_1level_cut, Is().GreaterThanOrEqualTo(2u)); + AssertThat(out.get<__zdd::shared_arc_file_type>()->max_1level_cut, Is().GreaterThanOrEqualTo(2u)); - AssertThat(out.get<__zdd::shared_arcs_t>()->number_of_terminals[false], Is().EqualTo(2u)); - AssertThat(out.get<__zdd::shared_arcs_t>()->number_of_terminals[true], Is().EqualTo(4u)); + AssertThat(out.get<__zdd::shared_arc_file_type>()->number_of_terminals[false], Is().EqualTo(2u)); + AssertThat(out.get<__zdd::shared_arc_file_type>()->number_of_terminals[true], Is().EqualTo(4u)); }); it("computes { {0,1}, {1} } U { {0,2}, {2} }", [&]() { @@ -500,18 +500,18 @@ go_bandit([]() { // / \ / \ // F T F T */ - shared_levelized_file zdd_a; - shared_levelized_file zdd_b; + shared_levelized_file zdd_a; + shared_levelized_file zdd_b; { // Garbage collect writers early node_writer nw_a(zdd_a); - nw_a << node(1, node::MAX_ID, terminal_F, terminal_T) - << node(0, node::MAX_ID, ptr_uint64(1, ptr_uint64::MAX_ID), ptr_uint64(1, ptr_uint64::MAX_ID)) + nw_a << node(1, node::max_id, terminal_F, terminal_T) + << node(0, node::max_id, ptr_uint64(1, ptr_uint64::max_id), ptr_uint64(1, ptr_uint64::max_id)) ; node_writer nw_b(zdd_b); - nw_b << node(2, node::MAX_ID, terminal_F, terminal_T) - << node(0, node::MAX_ID, ptr_uint64(2, ptr_uint64::MAX_ID), ptr_uint64(2, ptr_uint64::MAX_ID)) + nw_b << node(2, node::max_id, terminal_F, terminal_T) + << node(0, node::max_id, ptr_uint64(2, ptr_uint64::max_id), ptr_uint64(2, ptr_uint64::max_id)) ; } @@ -554,10 +554,10 @@ go_bandit([]() { AssertThat(levels.can_pull(), Is().False()); - AssertThat(out.get<__zdd::shared_arcs_t>()->max_1level_cut, Is().GreaterThanOrEqualTo(2u)); + AssertThat(out.get<__zdd::shared_arc_file_type>()->max_1level_cut, Is().GreaterThanOrEqualTo(2u)); - AssertThat(out.get<__zdd::shared_arcs_t>()->number_of_terminals[false], Is().EqualTo(1u)); - AssertThat(out.get<__zdd::shared_arcs_t>()->number_of_terminals[true], Is().EqualTo(2u)); + AssertThat(out.get<__zdd::shared_arc_file_type>()->number_of_terminals[false], Is().EqualTo(1u)); + AssertThat(out.get<__zdd::shared_arc_file_type>()->number_of_terminals[true], Is().EqualTo(2u)); }); it("computes { {0}, {1,3}, {2,3}, {1} } U { {0,3}, {3} }", [&]() { @@ -575,20 +575,20 @@ go_bandit([]() { // The high arc on (2) and (3) on the left is shortcutting the // second ZDD, to compensate for the omitted nodes. */ - shared_levelized_file zdd_a; - shared_levelized_file zdd_b; + shared_levelized_file zdd_a; + shared_levelized_file zdd_b; { // Garbage collect writers early node_writer nw_a(zdd_a); - nw_a << node(3, node::MAX_ID, terminal_F, terminal_T) - << node(2, node::MAX_ID, ptr_uint64(3, ptr_uint64::MAX_ID), ptr_uint64(3, ptr_uint64::MAX_ID)) - << node(1, node::MAX_ID, ptr_uint64(2, ptr_uint64::MAX_ID), ptr_uint64(3, ptr_uint64::MAX_ID)) - << node(0, node::MAX_ID, ptr_uint64(1, ptr_uint64::MAX_ID), terminal_T) + nw_a << node(3, node::max_id, terminal_F, terminal_T) + << node(2, node::max_id, ptr_uint64(3, ptr_uint64::max_id), ptr_uint64(3, ptr_uint64::max_id)) + << node(1, node::max_id, ptr_uint64(2, ptr_uint64::max_id), ptr_uint64(3, ptr_uint64::max_id)) + << node(0, node::max_id, ptr_uint64(1, ptr_uint64::max_id), terminal_T) ; node_writer nw_b(zdd_b); - nw_b << node(3, node::MAX_ID, terminal_F, terminal_T) - << node(0, node::MAX_ID, ptr_uint64(3, ptr_uint64::MAX_ID), ptr_uint64(3, ptr_uint64::MAX_ID)) + nw_b << node(3, node::max_id, terminal_F, terminal_T) + << node(0, node::max_id, ptr_uint64(3, ptr_uint64::max_id), ptr_uint64(3, ptr_uint64::max_id)) ; } @@ -649,10 +649,10 @@ go_bandit([]() { AssertThat(levels.can_pull(), Is().False()); - AssertThat(out.get<__zdd::shared_arcs_t>()->max_1level_cut, Is().GreaterThanOrEqualTo(4u)); + AssertThat(out.get<__zdd::shared_arc_file_type>()->max_1level_cut, Is().GreaterThanOrEqualTo(4u)); - AssertThat(out.get<__zdd::shared_arcs_t>()->number_of_terminals[false], Is().EqualTo(2u)); - AssertThat(out.get<__zdd::shared_arcs_t>()->number_of_terminals[true], Is().EqualTo(4u)); + AssertThat(out.get<__zdd::shared_arc_file_type>()->number_of_terminals[false], Is().EqualTo(2u)); + AssertThat(out.get<__zdd::shared_arc_file_type>()->number_of_terminals[true], Is().EqualTo(4u)); }); }); @@ -673,15 +673,15 @@ go_bandit([]() { AssertThat(out_nodes.can_pull(), Is().False()); - AssertThat(out.get>()->levels(), Is().EqualTo(0u)); + AssertThat(out.get>()->levels(), Is().EqualTo(0u)); - AssertThat(out.get>()->max_1level_cut[cut_type::INTERNAL], Is().EqualTo(0u)); - AssertThat(out.get>()->max_1level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(1u)); - AssertThat(out.get>()->max_1level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(0u)); - AssertThat(out.get>()->max_1level_cut[cut_type::ALL], Is().EqualTo(1u)); + AssertThat(out.get>()->max_1level_cut[cut::Internal], Is().EqualTo(0u)); + AssertThat(out.get>()->max_1level_cut[cut::Internal_False], Is().EqualTo(1u)); + AssertThat(out.get>()->max_1level_cut[cut::Internal_True], Is().EqualTo(0u)); + AssertThat(out.get>()->max_1level_cut[cut::All], Is().EqualTo(1u)); - AssertThat(out.get>()->number_of_terminals[false], Is().EqualTo(1u)); - AssertThat(out.get>()->number_of_terminals[true], Is().EqualTo(0u)); + AssertThat(out.get>()->number_of_terminals[false], Is().EqualTo(1u)); + AssertThat(out.get>()->number_of_terminals[true], Is().EqualTo(0u)); }); it("computes { Ø, {0} } ∩ { Ø }", [&]() { @@ -690,11 +690,11 @@ go_bandit([]() { // / \ ==> // T T */ - shared_levelized_file zdd_a; + shared_levelized_file zdd_a; { // Garbage collect writers early node_writer nw_a(zdd_a); - nw_a << node(0, node::MAX_ID, terminal_T, terminal_T); + nw_a << node(0, node::max_id, terminal_T, terminal_T); } __zdd out = zdd_intsec(zdd_a, zdd_T); @@ -706,15 +706,15 @@ go_bandit([]() { AssertThat(out_nodes.can_pull(), Is().False()); - AssertThat(out.get>()->levels(), Is().EqualTo(0u)); + AssertThat(out.get>()->levels(), Is().EqualTo(0u)); - AssertThat(out.get>()->max_1level_cut[cut_type::INTERNAL], Is().EqualTo(0u)); - AssertThat(out.get>()->max_1level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(0u)); - AssertThat(out.get>()->max_1level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(1u)); - AssertThat(out.get>()->max_1level_cut[cut_type::ALL], Is().EqualTo(1u)); + AssertThat(out.get>()->max_1level_cut[cut::Internal], Is().EqualTo(0u)); + AssertThat(out.get>()->max_1level_cut[cut::Internal_False], Is().EqualTo(0u)); + AssertThat(out.get>()->max_1level_cut[cut::Internal_True], Is().EqualTo(1u)); + AssertThat(out.get>()->max_1level_cut[cut::All], Is().EqualTo(1u)); - AssertThat(out.get>()->number_of_terminals[false], Is().EqualTo(0u)); - AssertThat(out.get>()->number_of_terminals[true], Is().EqualTo(1u)); + AssertThat(out.get>()->number_of_terminals[false], Is().EqualTo(0u)); + AssertThat(out.get>()->number_of_terminals[true], Is().EqualTo(1u)); }); it("computes { {0}, {1} } ∩ { Ø }", [&]() { @@ -726,12 +726,12 @@ go_bandit([]() { // F T */ - shared_levelized_file zdd_a; + shared_levelized_file zdd_a; { // Garbage collect writers early node_writer nw_a(zdd_a); - nw_a << node(1, node::MAX_ID, terminal_F, terminal_T) - << node(0, node::MAX_ID, ptr_uint64(1, ptr_uint64::MAX_ID), terminal_T) + nw_a << node(1, node::max_id, terminal_F, terminal_T) + << node(0, node::max_id, ptr_uint64(1, ptr_uint64::max_id), terminal_T) ; } @@ -744,15 +744,15 @@ go_bandit([]() { AssertThat(out_nodes.can_pull(), Is().False()); - AssertThat(out.get>()->levels(), Is().EqualTo(0u)); + AssertThat(out.get>()->levels(), Is().EqualTo(0u)); - AssertThat(out.get>()->max_1level_cut[cut_type::INTERNAL], Is().EqualTo(0u)); - AssertThat(out.get>()->max_1level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(1u)); - AssertThat(out.get>()->max_1level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(0u)); - AssertThat(out.get>()->max_1level_cut[cut_type::ALL], Is().EqualTo(1u)); + AssertThat(out.get>()->max_1level_cut[cut::Internal], Is().EqualTo(0u)); + AssertThat(out.get>()->max_1level_cut[cut::Internal_False], Is().EqualTo(1u)); + AssertThat(out.get>()->max_1level_cut[cut::Internal_True], Is().EqualTo(0u)); + AssertThat(out.get>()->max_1level_cut[cut::All], Is().EqualTo(1u)); - AssertThat(out.get>()->number_of_terminals[false], Is().EqualTo(1u)); - AssertThat(out.get>()->number_of_terminals[true], Is().EqualTo(0u)); + AssertThat(out.get>()->number_of_terminals[false], Is().EqualTo(1u)); + AssertThat(out.get>()->number_of_terminals[true], Is().EqualTo(0u)); }); it("computes (and shortcut) { {0,1}, {1} } ∩ { {0,1} }", [&]() { @@ -764,19 +764,19 @@ go_bandit([]() { // T T F T F T F T */ - shared_levelized_file zdd_a; - shared_levelized_file zdd_b; + shared_levelized_file zdd_a; + shared_levelized_file zdd_b; { // Garbage collect writers early node_writer nw_a(zdd_a); - nw_a << node(1, node::MAX_ID, terminal_F, terminal_T) - << node(1, node::MAX_ID-1, terminal_T, terminal_T) - << node(0, node::MAX_ID, ptr_uint64(1, ptr_uint64::MAX_ID-1), ptr_uint64(1, ptr_uint64::MAX_ID)) + nw_a << node(1, node::max_id, terminal_F, terminal_T) + << node(1, node::max_id-1, terminal_T, terminal_T) + << node(0, node::max_id, ptr_uint64(1, ptr_uint64::max_id-1), ptr_uint64(1, ptr_uint64::max_id)) ; node_writer nw_b(zdd_b); - nw_b << node(1, node::MAX_ID, terminal_F, terminal_T) - << node(0, node::MAX_ID, terminal_F, ptr_uint64(1, ptr_uint64::MAX_ID)) + nw_b << node(1, node::max_id, terminal_F, terminal_T) + << node(0, node::max_id, terminal_F, ptr_uint64(1, ptr_uint64::max_id)) ; } @@ -809,10 +809,10 @@ go_bandit([]() { AssertThat(levels.can_pull(), Is().False()); - AssertThat(out.get<__zdd::shared_arcs_t>()->max_1level_cut, Is().GreaterThanOrEqualTo(1u)); + AssertThat(out.get<__zdd::shared_arc_file_type>()->max_1level_cut, Is().GreaterThanOrEqualTo(1u)); - AssertThat(out.get<__zdd::shared_arcs_t>()->number_of_terminals[false], Is().EqualTo(2u)); - AssertThat(out.get<__zdd::shared_arcs_t>()->number_of_terminals[true], Is().EqualTo(1u)); + AssertThat(out.get<__zdd::shared_arc_file_type>()->number_of_terminals[false], Is().EqualTo(2u)); + AssertThat(out.get<__zdd::shared_arc_file_type>()->number_of_terminals[true], Is().EqualTo(1u)); }); it("computes (and skip to terminal) { {0}, {1}, {0,1} } ∩ { Ø }", [&]() { @@ -825,12 +825,12 @@ go_bandit([]() { // F T */ - shared_levelized_file zdd_a; + shared_levelized_file zdd_a; { // Garbage collect writers early node_writer nw_a(zdd_a); - nw_a << node(1, node::MAX_ID, terminal_F, terminal_T) - << node(0, node::MAX_ID, ptr_uint64(1, ptr_uint64::MAX_ID), ptr_uint64(1, ptr_uint64::MAX_ID)) + nw_a << node(1, node::max_id, terminal_F, terminal_T) + << node(0, node::max_id, ptr_uint64(1, ptr_uint64::max_id), ptr_uint64(1, ptr_uint64::max_id)) ; } @@ -843,15 +843,15 @@ go_bandit([]() { AssertThat(out_nodes.can_pull(), Is().False()); - AssertThat(out.get>()->levels(), Is().EqualTo(0u)); + AssertThat(out.get>()->levels(), Is().EqualTo(0u)); - AssertThat(out.get>()->max_1level_cut[cut_type::INTERNAL], Is().EqualTo(0u)); - AssertThat(out.get>()->max_1level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(1u)); - AssertThat(out.get>()->max_1level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(0u)); - AssertThat(out.get>()->max_1level_cut[cut_type::ALL], Is().EqualTo(1u)); + AssertThat(out.get>()->max_1level_cut[cut::Internal], Is().EqualTo(0u)); + AssertThat(out.get>()->max_1level_cut[cut::Internal_False], Is().EqualTo(1u)); + AssertThat(out.get>()->max_1level_cut[cut::Internal_True], Is().EqualTo(0u)); + AssertThat(out.get>()->max_1level_cut[cut::All], Is().EqualTo(1u)); - AssertThat(out.get>()->number_of_terminals[false], Is().EqualTo(1u)); - AssertThat(out.get>()->number_of_terminals[true], Is().EqualTo(0u)); + AssertThat(out.get>()->number_of_terminals[false], Is().EqualTo(1u)); + AssertThat(out.get>()->number_of_terminals[true], Is().EqualTo(0u)); }); it("computes (and skip to terminal) { {0,2}, {0}, {2} } \\ { {1}, {2}, Ø }", [&]() { @@ -870,23 +870,23 @@ go_bandit([]() { // prod_pq_1.peek() throwing an error on being empty. */ - shared_levelized_file zdd_a; + shared_levelized_file zdd_a; { // Garbage collect writers early node_writer nw_a(zdd_a); - nw_a << node(2, node::MAX_ID, terminal_T, terminal_T) - << node(2, node::MAX_ID-1, terminal_F, terminal_T) - << node(0, node::MAX_ID, ptr_uint64(2, ptr_uint64::MAX_ID-1), ptr_uint64(2, ptr_uint64::MAX_ID)) + nw_a << node(2, node::max_id, terminal_T, terminal_T) + << node(2, node::max_id-1, terminal_F, terminal_T) + << node(0, node::max_id, ptr_uint64(2, ptr_uint64::max_id-1), ptr_uint64(2, ptr_uint64::max_id)) ; } - shared_levelized_file zdd_b; + shared_levelized_file zdd_b; { // Garbage collect writers early node_writer nw_b(zdd_b); - nw_b << node(2, node::MAX_ID, terminal_T, terminal_F) - << node(2, node::MAX_ID-1, terminal_F, terminal_T) - << node(1, node::MAX_ID, ptr_uint64(2, ptr_uint64::MAX_ID), ptr_uint64(2, ptr_uint64::MAX_ID-1)) + nw_b << node(2, node::max_id, terminal_T, terminal_F) + << node(2, node::max_id-1, terminal_F, terminal_T) + << node(1, node::max_id, ptr_uint64(2, ptr_uint64::max_id), ptr_uint64(2, ptr_uint64::max_id-1)) ; } @@ -899,15 +899,15 @@ go_bandit([]() { AssertThat(out_nodes.can_pull(), Is().False()); - AssertThat(out.get>()->levels(), Is().EqualTo(0u)); + AssertThat(out.get>()->levels(), Is().EqualTo(0u)); - AssertThat(out.get>()->max_1level_cut[cut_type::INTERNAL], Is().EqualTo(0u)); - AssertThat(out.get>()->max_1level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(1u)); - AssertThat(out.get>()->max_1level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(0u)); - AssertThat(out.get>()->max_1level_cut[cut_type::ALL], Is().EqualTo(1u)); + AssertThat(out.get>()->max_1level_cut[cut::Internal], Is().EqualTo(0u)); + AssertThat(out.get>()->max_1level_cut[cut::Internal_False], Is().EqualTo(1u)); + AssertThat(out.get>()->max_1level_cut[cut::Internal_True], Is().EqualTo(0u)); + AssertThat(out.get>()->max_1level_cut[cut::All], Is().EqualTo(1u)); - AssertThat(out.get>()->number_of_terminals[false], Is().EqualTo(1u)); - AssertThat(out.get>()->number_of_terminals[true], Is().EqualTo(0u)); + AssertThat(out.get>()->number_of_terminals[false], Is().EqualTo(1u)); + AssertThat(out.get>()->number_of_terminals[true], Is().EqualTo(0u)); }); it("computes (and skips in) { {0,1,2}, {0,2}, {0}, {2} } } ∩ { {0,2}, {0}, {1}, {2} }", [&]() { @@ -926,25 +926,25 @@ go_bandit([]() { // // so (3,3) is forwarded while (3,4) is not and hence (3,3) is output first. */ - shared_levelized_file zdd_a; + shared_levelized_file zdd_a; { // Garbage collect writers early node_writer nw_a(zdd_a); - nw_a << node(2, node::MAX_ID, terminal_T, terminal_T) - << node(2, node::MAX_ID-1, terminal_F, terminal_T) - << node(1, node::MAX_ID, ptr_uint64(2, ptr_uint64::MAX_ID), ptr_uint64(2, ptr_uint64::MAX_ID-1)) - << node(0, node::MAX_ID, ptr_uint64(2, ptr_uint64::MAX_ID), ptr_uint64(1, ptr_uint64::MAX_ID)) + nw_a << node(2, node::max_id, terminal_T, terminal_T) + << node(2, node::max_id-1, terminal_F, terminal_T) + << node(1, node::max_id, ptr_uint64(2, ptr_uint64::max_id), ptr_uint64(2, ptr_uint64::max_id-1)) + << node(0, node::max_id, ptr_uint64(2, ptr_uint64::max_id), ptr_uint64(1, ptr_uint64::max_id)) ; } - shared_levelized_file zdd_b; + shared_levelized_file zdd_b; { // Garbage collect writers early node_writer nw_b(zdd_b); - nw_b << node(2, node::MAX_ID, terminal_T, terminal_T) - << node(2, node::MAX_ID-1, terminal_F, terminal_T) - << node(1, node::MAX_ID, ptr_uint64(2, ptr_uint64::MAX_ID-1), terminal_T) - << node(0, node::MAX_ID, ptr_uint64(1, ptr_uint64::MAX_ID), ptr_uint64(2, ptr_uint64::MAX_ID)) + nw_b << node(2, node::max_id, terminal_T, terminal_T) + << node(2, node::max_id-1, terminal_F, terminal_T) + << node(1, node::max_id, ptr_uint64(2, ptr_uint64::max_id-1), terminal_T) + << node(0, node::max_id, ptr_uint64(1, ptr_uint64::max_id), ptr_uint64(2, ptr_uint64::max_id)) ; } @@ -982,10 +982,10 @@ go_bandit([]() { AssertThat(levels.can_pull(), Is().False()); - AssertThat(out.get<__zdd::shared_arcs_t>()->max_1level_cut, Is().GreaterThanOrEqualTo(2u)); + AssertThat(out.get<__zdd::shared_arc_file_type>()->max_1level_cut, Is().GreaterThanOrEqualTo(2u)); - AssertThat(out.get<__zdd::shared_arcs_t>()->number_of_terminals[false], Is().EqualTo(1u)); - AssertThat(out.get<__zdd::shared_arcs_t>()->number_of_terminals[true], Is().EqualTo(3u)); + AssertThat(out.get<__zdd::shared_arc_file_type>()->number_of_terminals[false], Is().EqualTo(1u)); + AssertThat(out.get<__zdd::shared_arc_file_type>()->number_of_terminals[true], Is().EqualTo(3u)); }); it("computes (and skip) { {0}, {1} } ∩ { {0,1} }", [&]() { @@ -997,18 +997,18 @@ go_bandit([]() { // F T F T */ - shared_levelized_file zdd_a; - shared_levelized_file zdd_b; + shared_levelized_file zdd_a; + shared_levelized_file zdd_b; { // Garbage collect writers early node_writer nw_a(zdd_a); - nw_a << node(1, node::MAX_ID, terminal_F, terminal_T) - << node(0, node::MAX_ID, ptr_uint64(1, ptr_uint64::MAX_ID), terminal_T) + nw_a << node(1, node::max_id, terminal_F, terminal_T) + << node(0, node::max_id, ptr_uint64(1, ptr_uint64::max_id), terminal_T) ; node_writer nw_b(zdd_b); - nw_b << node(1, node::MAX_ID, terminal_F, terminal_T) - << node(0, node::MAX_ID, terminal_F, ptr_uint64(1, ptr_uint64::MAX_ID)) + nw_b << node(1, node::max_id, terminal_F, terminal_T) + << node(0, node::max_id, terminal_F, ptr_uint64(1, ptr_uint64::max_id)) ; } @@ -1032,10 +1032,10 @@ go_bandit([]() { AssertThat(levels.can_pull(), Is().False()); - AssertThat(out.get<__zdd::shared_arcs_t>()->max_1level_cut, Is().GreaterThanOrEqualTo(0u)); + AssertThat(out.get<__zdd::shared_arc_file_type>()->max_1level_cut, Is().GreaterThanOrEqualTo(0u)); - AssertThat(out.get<__zdd::shared_arcs_t>()->number_of_terminals[false], Is().EqualTo(2u)); - AssertThat(out.get<__zdd::shared_arcs_t>()->number_of_terminals[true], Is().EqualTo(0u)); + AssertThat(out.get<__zdd::shared_arc_file_type>()->number_of_terminals[false], Is().EqualTo(2u)); + AssertThat(out.get<__zdd::shared_arc_file_type>()->number_of_terminals[true], Is().EqualTo(0u)); }); it("computes (and skip) { {0}, {1}, {2}, {1,2}, {0,2} } ∩ { {0}, {2}, {0,2}, {0,1,2} }", [&]() { @@ -1051,22 +1051,22 @@ go_bandit([]() { // Notice, how (2,3) and (4,2) was skipped on the low and high of (1,1) */ - shared_levelized_file zdd_a; - shared_levelized_file zdd_b; + shared_levelized_file zdd_a; + shared_levelized_file zdd_b; { // Garbage collect writers early node_writer nw_a(zdd_a); - nw_a << node(2, node::MAX_ID, terminal_T, terminal_T) - << node(2, node::MAX_ID-1, terminal_F, terminal_T) - << node(1, node::MAX_ID, ptr_uint64(2, ptr_uint64::MAX_ID-1), ptr_uint64(2, ptr_uint64::MAX_ID)) - << node(0, node::MAX_ID, ptr_uint64(1, ptr_uint64::MAX_ID), ptr_uint64(2, ptr_uint64::MAX_ID)) + nw_a << node(2, node::max_id, terminal_T, terminal_T) + << node(2, node::max_id-1, terminal_F, terminal_T) + << node(1, node::max_id, ptr_uint64(2, ptr_uint64::max_id-1), ptr_uint64(2, ptr_uint64::max_id)) + << node(0, node::max_id, ptr_uint64(1, ptr_uint64::max_id), ptr_uint64(2, ptr_uint64::max_id)) ; node_writer nw_b(zdd_b); - nw_b << node(2, node::MAX_ID, terminal_T, terminal_T) - << node(2, node::MAX_ID-1, terminal_F, terminal_T) - << node(1, node::MAX_ID, ptr_uint64(2, ptr_uint64::MAX_ID-1), ptr_uint64(2, ptr_uint64::MAX_ID)) - << node(0, node::MAX_ID, ptr_uint64(2, ptr_uint64::MAX_ID-1), ptr_uint64(1, ptr_uint64::MAX_ID)) + nw_b << node(2, node::max_id, terminal_T, terminal_T) + << node(2, node::max_id-1, terminal_F, terminal_T) + << node(1, node::max_id, ptr_uint64(2, ptr_uint64::max_id-1), ptr_uint64(2, ptr_uint64::max_id)) + << node(0, node::max_id, ptr_uint64(2, ptr_uint64::max_id-1), ptr_uint64(1, ptr_uint64::max_id)) ; } @@ -1104,10 +1104,10 @@ go_bandit([]() { AssertThat(levels.can_pull(), Is().False()); - AssertThat(out.get<__zdd::shared_arcs_t>()->max_1level_cut, Is().GreaterThanOrEqualTo(2u)); + AssertThat(out.get<__zdd::shared_arc_file_type>()->max_1level_cut, Is().GreaterThanOrEqualTo(2u)); - AssertThat(out.get<__zdd::shared_arcs_t>()->number_of_terminals[false], Is().EqualTo(2u)); - AssertThat(out.get<__zdd::shared_arcs_t>()->number_of_terminals[true], Is().EqualTo(2u)); + AssertThat(out.get<__zdd::shared_arc_file_type>()->number_of_terminals[false], Is().EqualTo(2u)); + AssertThat(out.get<__zdd::shared_arc_file_type>()->number_of_terminals[true], Is().EqualTo(2u)); }); it("computes (and skip) { {0}, {1} } ∩ { {1}, {0,2} }", [&]() { @@ -1121,19 +1121,19 @@ go_bandit([]() { // F T */ - shared_levelized_file zdd_a; - shared_levelized_file zdd_b; + shared_levelized_file zdd_a; + shared_levelized_file zdd_b; { // Garbage collect writers early node_writer nw_a(zdd_a); - nw_a << node(1, node::MAX_ID, terminal_F, terminal_T) - << node(0, node::MAX_ID, ptr_uint64(1, ptr_uint64::MAX_ID), terminal_T) + nw_a << node(1, node::max_id, terminal_F, terminal_T) + << node(0, node::max_id, ptr_uint64(1, ptr_uint64::max_id), terminal_T) ; node_writer nw_b(zdd_b); - nw_b << node(2, node::MAX_ID, terminal_F, terminal_T) - << node(1, node::MAX_ID, terminal_F, terminal_T) - << node(0, node::MAX_ID, ptr_uint64(1, ptr_uint64::MAX_ID), ptr_uint64(2, ptr_uint64::MAX_ID)) + nw_b << node(2, node::max_id, terminal_F, terminal_T) + << node(1, node::max_id, terminal_F, terminal_T) + << node(0, node::max_id, ptr_uint64(1, ptr_uint64::max_id), ptr_uint64(2, ptr_uint64::max_id)) ; } @@ -1167,10 +1167,10 @@ go_bandit([]() { AssertThat(levels.can_pull(), Is().False()); - AssertThat(out.get<__zdd::shared_arcs_t>()->max_1level_cut, Is().GreaterThanOrEqualTo(1u)); + AssertThat(out.get<__zdd::shared_arc_file_type>()->max_1level_cut, Is().GreaterThanOrEqualTo(1u)); - AssertThat(out.get<__zdd::shared_arcs_t>()->number_of_terminals[false], Is().EqualTo(2u)); - AssertThat(out.get<__zdd::shared_arcs_t>()->number_of_terminals[true], Is().EqualTo(1u)); + AssertThat(out.get<__zdd::shared_arc_file_type>()->number_of_terminals[false], Is().EqualTo(2u)); + AssertThat(out.get<__zdd::shared_arc_file_type>()->number_of_terminals[true], Is().EqualTo(1u)); }); it("computes (and skip) { {0,2}, {1,2}, Ø } ∩ { {0,1}, {0}, {1} }", [&]() { @@ -1186,19 +1186,19 @@ go_bandit([]() { // This shortcuts the (3,T) tuple twice. */ - shared_levelized_file zdd_a; - shared_levelized_file zdd_b; + shared_levelized_file zdd_a; + shared_levelized_file zdd_b; { // Garbage collect writers early node_writer nw_a(zdd_a); - nw_a << node(2, node::MAX_ID, terminal_F, terminal_T) - << node(1, node::MAX_ID, terminal_T, ptr_uint64(2, ptr_uint64::MAX_ID)) - << node(0, node::MAX_ID, ptr_uint64(1, ptr_uint64::MAX_ID), ptr_uint64(2, ptr_uint64::MAX_ID)) + nw_a << node(2, node::max_id, terminal_F, terminal_T) + << node(1, node::max_id, terminal_T, ptr_uint64(2, ptr_uint64::max_id)) + << node(0, node::max_id, ptr_uint64(1, ptr_uint64::max_id), ptr_uint64(2, ptr_uint64::max_id)) ; node_writer nw_b(zdd_b); - nw_b << node(1, node::MAX_ID, terminal_T, terminal_T) - << node(0, node::MAX_ID, ptr_uint64(1, ptr_uint64::MAX_ID), terminal_T) + nw_b << node(1, node::max_id, terminal_T, terminal_T) + << node(0, node::max_id, ptr_uint64(1, ptr_uint64::max_id), terminal_T) ; } @@ -1232,10 +1232,10 @@ go_bandit([]() { AssertThat(levels.can_pull(), Is().False()); - AssertThat(out.get<__zdd::shared_arcs_t>()->max_1level_cut, Is().GreaterThanOrEqualTo(1u)); + AssertThat(out.get<__zdd::shared_arc_file_type>()->max_1level_cut, Is().GreaterThanOrEqualTo(1u)); - AssertThat(out.get<__zdd::shared_arcs_t>()->number_of_terminals[false], Is().EqualTo(2u)); - AssertThat(out.get<__zdd::shared_arcs_t>()->number_of_terminals[true], Is().EqualTo(1u)); + AssertThat(out.get<__zdd::shared_arc_file_type>()->number_of_terminals[false], Is().EqualTo(2u)); + AssertThat(out.get<__zdd::shared_arc_file_type>()->number_of_terminals[true], Is().EqualTo(1u)); }); it("computes (and shortcut) { {0,2}, {1,2}, Ø } ∩ { {0,2}, {0} }", [&]() { @@ -1251,19 +1251,19 @@ go_bandit([]() { // This shortcuts the (3,T) tuple twice. */ - shared_levelized_file zdd_a; - shared_levelized_file zdd_b; + shared_levelized_file zdd_a; + shared_levelized_file zdd_b; { // Garbage collect writers early node_writer nw_a(zdd_a); - nw_a << node(2, node::MAX_ID, terminal_F, terminal_T) - << node(1, node::MAX_ID, terminal_T, ptr_uint64(2, ptr_uint64::MAX_ID)) - << node(0, node::MAX_ID, ptr_uint64(1, ptr_uint64::MAX_ID), ptr_uint64(2, ptr_uint64::MAX_ID)) + nw_a << node(2, node::max_id, terminal_F, terminal_T) + << node(1, node::max_id, terminal_T, ptr_uint64(2, ptr_uint64::max_id)) + << node(0, node::max_id, ptr_uint64(1, ptr_uint64::max_id), ptr_uint64(2, ptr_uint64::max_id)) ; node_writer nw_b(zdd_b); - nw_b << node(2, node::MAX_ID, terminal_T, terminal_T) - << node(0, node::MAX_ID, terminal_F, ptr_uint64(2, ptr_uint64::MAX_ID)) + nw_b << node(2, node::max_id, terminal_T, terminal_T) + << node(0, node::max_id, terminal_F, ptr_uint64(2, ptr_uint64::max_id)) ; } @@ -1296,10 +1296,10 @@ go_bandit([]() { AssertThat(levels.can_pull(), Is().False()); - AssertThat(out.get<__zdd::shared_arcs_t>()->max_1level_cut, Is().GreaterThanOrEqualTo(1u)); + AssertThat(out.get<__zdd::shared_arc_file_type>()->max_1level_cut, Is().GreaterThanOrEqualTo(1u)); - AssertThat(out.get<__zdd::shared_arcs_t>()->number_of_terminals[false], Is().EqualTo(2u)); - AssertThat(out.get<__zdd::shared_arcs_t>()->number_of_terminals[true], Is().EqualTo(1u)); + AssertThat(out.get<__zdd::shared_arc_file_type>()->number_of_terminals[false], Is().EqualTo(2u)); + AssertThat(out.get<__zdd::shared_arc_file_type>()->number_of_terminals[true], Is().EqualTo(1u)); }); }); @@ -1314,15 +1314,15 @@ go_bandit([]() { AssertThat(out_nodes.can_pull(), Is().False()); - AssertThat(out.get>()->levels(), Is().EqualTo(0u)); + AssertThat(out.get>()->levels(), Is().EqualTo(0u)); - AssertThat(out.get>()->max_1level_cut[cut_type::INTERNAL], Is().EqualTo(0u)); - AssertThat(out.get>()->max_1level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(0u)); - AssertThat(out.get>()->max_1level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(1u)); - AssertThat(out.get>()->max_1level_cut[cut_type::ALL], Is().EqualTo(1u)); + AssertThat(out.get>()->max_1level_cut[cut::Internal], Is().EqualTo(0u)); + AssertThat(out.get>()->max_1level_cut[cut::Internal_False], Is().EqualTo(0u)); + AssertThat(out.get>()->max_1level_cut[cut::Internal_True], Is().EqualTo(1u)); + AssertThat(out.get>()->max_1level_cut[cut::All], Is().EqualTo(1u)); - AssertThat(out.get>()->number_of_terminals[false], Is().EqualTo(0u)); - AssertThat(out.get>()->number_of_terminals[true], Is().EqualTo(1u)); + AssertThat(out.get>()->number_of_terminals[false], Is().EqualTo(0u)); + AssertThat(out.get>()->number_of_terminals[true], Is().EqualTo(1u)); }); it("computes { {0} } \\ { Ø }", [&]() { @@ -1351,10 +1351,10 @@ go_bandit([]() { AssertThat(levels.can_pull(), Is().False()); - AssertThat(out.get<__zdd::shared_arcs_t>()->max_1level_cut, Is().GreaterThanOrEqualTo(0u)); + AssertThat(out.get<__zdd::shared_arc_file_type>()->max_1level_cut, Is().GreaterThanOrEqualTo(0u)); - AssertThat(out.get<__zdd::shared_arcs_t>()->number_of_terminals[false], Is().EqualTo(1u)); - AssertThat(out.get<__zdd::shared_arcs_t>()->number_of_terminals[true], Is().EqualTo(1u)); + AssertThat(out.get<__zdd::shared_arc_file_type>()->number_of_terminals[false], Is().EqualTo(1u)); + AssertThat(out.get<__zdd::shared_arc_file_type>()->number_of_terminals[true], Is().EqualTo(1u)); }); it("computes { {0}, Ø } \\ { Ø }", [&]() { @@ -1363,11 +1363,11 @@ go_bandit([]() { // / \ ==> / \ // T T F T */ - shared_levelized_file zdd_a; + shared_levelized_file zdd_a; { // Garbage collect writers early node_writer nw_a(zdd_a); - nw_a << node(0, node::MAX_ID, terminal_T, terminal_T); + nw_a << node(0, node::max_id, terminal_T, terminal_T); } __zdd out = zdd_diff(zdd_a, zdd_T); @@ -1390,10 +1390,10 @@ go_bandit([]() { AssertThat(levels.can_pull(), Is().False()); - AssertThat(out.get<__zdd::shared_arcs_t>()->max_1level_cut, Is().GreaterThanOrEqualTo(0u)); + AssertThat(out.get<__zdd::shared_arc_file_type>()->max_1level_cut, Is().GreaterThanOrEqualTo(0u)); - AssertThat(out.get<__zdd::shared_arcs_t>()->number_of_terminals[false], Is().EqualTo(1u)); - AssertThat(out.get<__zdd::shared_arcs_t>()->number_of_terminals[true], Is().EqualTo(1u)); + AssertThat(out.get<__zdd::shared_arc_file_type>()->number_of_terminals[false], Is().EqualTo(1u)); + AssertThat(out.get<__zdd::shared_arc_file_type>()->number_of_terminals[true], Is().EqualTo(1u)); }); it("computes (and skip) { {0,1}, {1} } \\ { {1}, Ø }", [&]() { @@ -1404,17 +1404,17 @@ go_bandit([]() { // / \ / \ / \ // F T T T F F */ - shared_levelized_file zdd_a; - shared_levelized_file zdd_b; + shared_levelized_file zdd_a; + shared_levelized_file zdd_b; { // Garbage collect writers early node_writer nw_a(zdd_a); - nw_a << node(1, node::MAX_ID, terminal_F, terminal_T) - << node(0, node::MAX_ID, ptr_uint64(1, ptr_uint64::MAX_ID), ptr_uint64(1, ptr_uint64::MAX_ID)) + nw_a << node(1, node::max_id, terminal_F, terminal_T) + << node(0, node::max_id, ptr_uint64(1, ptr_uint64::max_id), ptr_uint64(1, ptr_uint64::max_id)) ; node_writer nw_b(zdd_b); - nw_b << node(1, node::MAX_ID, terminal_T, terminal_T); + nw_b << node(1, node::max_id, terminal_T, terminal_T); } __zdd out = zdd_diff(zdd_a, zdd_b); @@ -1446,10 +1446,10 @@ go_bandit([]() { AssertThat(levels.can_pull(), Is().False()); - AssertThat(out.get<__zdd::shared_arcs_t>()->max_1level_cut, Is().GreaterThanOrEqualTo(1u)); + AssertThat(out.get<__zdd::shared_arc_file_type>()->max_1level_cut, Is().GreaterThanOrEqualTo(1u)); - AssertThat(out.get<__zdd::shared_arcs_t>()->number_of_terminals[false], Is().EqualTo(2u)); - AssertThat(out.get<__zdd::shared_arcs_t>()->number_of_terminals[true], Is().EqualTo(1u)); + AssertThat(out.get<__zdd::shared_arc_file_type>()->number_of_terminals[false], Is().EqualTo(2u)); + AssertThat(out.get<__zdd::shared_arc_file_type>()->number_of_terminals[true], Is().EqualTo(1u)); }); it("computes { {0,1}, {1,2}, {1} } \\ { {1}, Ø }", [&]() { @@ -1462,19 +1462,19 @@ go_bandit([]() { // / \ / \ // T T F T */ - shared_levelized_file zdd_a; - shared_levelized_file zdd_b; + shared_levelized_file zdd_a; + shared_levelized_file zdd_b; { // Garbage collect writers early node_writer nw_a(zdd_a); - nw_a << node(2, node::MAX_ID, terminal_T, terminal_T) - << node(1, node::MAX_ID, terminal_F, terminal_T) - << node(1, node::MAX_ID-1, terminal_F, ptr_uint64(2, ptr_uint64::MAX_ID)) - << node(0, node::MAX_ID, ptr_uint64(1, ptr_uint64::MAX_ID-1), ptr_uint64(1, ptr_uint64::MAX_ID)) + nw_a << node(2, node::max_id, terminal_T, terminal_T) + << node(1, node::max_id, terminal_F, terminal_T) + << node(1, node::max_id-1, terminal_F, ptr_uint64(2, ptr_uint64::max_id)) + << node(0, node::max_id, ptr_uint64(1, ptr_uint64::max_id-1), ptr_uint64(1, ptr_uint64::max_id)) ; node_writer nw_b(zdd_b); - nw_b << node(1, node::MAX_ID, terminal_T, terminal_T); + nw_b << node(1, node::max_id, terminal_T, terminal_T); } __zdd out = zdd_diff(zdd_a, zdd_b); @@ -1520,24 +1520,24 @@ go_bandit([]() { AssertThat(levels.can_pull(), Is().False()); - AssertThat(out.get<__zdd::shared_arcs_t>()->max_1level_cut, Is().GreaterThanOrEqualTo(2u)); + AssertThat(out.get<__zdd::shared_arc_file_type>()->max_1level_cut, Is().GreaterThanOrEqualTo(2u)); - AssertThat(out.get<__zdd::shared_arcs_t>()->number_of_terminals[false], Is().EqualTo(3u)); - AssertThat(out.get<__zdd::shared_arcs_t>()->number_of_terminals[true], Is().EqualTo(2u)); + AssertThat(out.get<__zdd::shared_arc_file_type>()->number_of_terminals[false], Is().EqualTo(3u)); + AssertThat(out.get<__zdd::shared_arc_file_type>()->number_of_terminals[true], Is().EqualTo(2u)); }); }); // Reset access mode - access_mode = access_mode_t::AUTO; + access_mode = access_mode_t::Auto; }); describe("access mode: random access", [&]() { // Set access mode to random access for this batch of tests - access_mode = access_mode_t::RA; + access_mode = access_mode_t::Random_Access; describe("zdd_union", [&]() { it("computes { {0} } U { Ø, {0} } (same level)", [&]() { - shared_levelized_file zdd_maybe_x0; + shared_levelized_file zdd_maybe_x0; /* // { Ø, {0} } // @@ -1548,7 +1548,7 @@ go_bandit([]() { { // Garbage collect early and free write-lock node_writer nw_m(zdd_maybe_x0); - nw_m << node(0, node::MAX_ID, terminal_T, terminal_T); + nw_m << node(0, node::max_id, terminal_T, terminal_T); } /* @@ -1625,10 +1625,10 @@ go_bandit([]() { AssertThat(levels.can_pull(), Is().False()); - AssertThat(out.get<__zdd::shared_arcs_t>()->max_1level_cut, Is().GreaterThanOrEqualTo(1u)); + AssertThat(out.get<__zdd::shared_arc_file_type>()->max_1level_cut, Is().GreaterThanOrEqualTo(1u)); - AssertThat(out.get<__zdd::shared_arcs_t>()->number_of_terminals[false], Is().EqualTo(1u)); - AssertThat(out.get<__zdd::shared_arcs_t>()->number_of_terminals[true], Is().EqualTo(2u)); + AssertThat(out.get<__zdd::shared_arc_file_type>()->number_of_terminals[false], Is().EqualTo(1u)); + AssertThat(out.get<__zdd::shared_arc_file_type>()->number_of_terminals[true], Is().EqualTo(2u)); }); it("computes { {1} } U { {0} } (different levels, random access for second level)", [&]() { @@ -1670,13 +1670,13 @@ go_bandit([]() { AssertThat(levels.can_pull(), Is().False()); - AssertThat(out.get<__zdd::shared_arcs_t>()->max_1level_cut, Is().GreaterThanOrEqualTo(1u)); + AssertThat(out.get<__zdd::shared_arc_file_type>()->max_1level_cut, Is().GreaterThanOrEqualTo(1u)); - AssertThat(out.get<__zdd::shared_arcs_t>()->number_of_terminals[false], Is().EqualTo(1u)); - AssertThat(out.get<__zdd::shared_arcs_t>()->number_of_terminals[true], Is().EqualTo(2u)); + AssertThat(out.get<__zdd::shared_arc_file_type>()->number_of_terminals[false], Is().EqualTo(1u)); + AssertThat(out.get<__zdd::shared_arc_file_type>()->number_of_terminals[true], Is().EqualTo(2u)); }); - shared_levelized_file zdd_thin; + shared_levelized_file zdd_thin; /* // { {2}, {0, 1}, {0, 2}, {0, 1, 2} } // @@ -1691,11 +1691,11 @@ go_bandit([]() { // F T T T */ - node nt_5 = node(2, node::MAX_ID, terminal_T, terminal_T); - node nt_4 = node(2, node::MAX_ID - 1, terminal_F, terminal_T); - node nt_3 = node(1, node::MAX_ID, nt_4, nt_5); - node nt_2 = node(1, node::MAX_ID - 1, nt_5, nt_4); - node nt_1 = node(0, node::MAX_ID, nt_2, nt_3); + node nt_5 = node(2, node::max_id, terminal_T, terminal_T); + node nt_4 = node(2, node::max_id - 1, terminal_F, terminal_T); + node nt_3 = node(1, node::max_id, nt_4, nt_5); + node nt_2 = node(1, node::max_id - 1, nt_5, nt_4); + node nt_1 = node(0, node::max_id, nt_2, nt_3); { // Garbage collect early and free write-lock node_writer nw_t(zdd_thin); @@ -1705,7 +1705,7 @@ go_bandit([]() { // zdd_thin->canonical == true // zdd_thin->width == 2u - shared_levelized_file zdd_wide; + shared_levelized_file zdd_wide; /* // { {0}, {2}, {0, 3}, {0, 1, 2}, {1, 2, 3} } // @@ -1721,13 +1721,13 @@ go_bandit([]() { // F T */ - node nw_7 = node(3, node::MAX_ID, terminal_F, terminal_T); - node nw_6 = node(2, node::MAX_ID, terminal_T, terminal_T); - node nw_5 = node(2, node::MAX_ID - 1, terminal_F, terminal_T); - node nw_4 = node(2, node::MAX_ID - 2, terminal_F, nw_7); - node nw_3 = node(1, node::MAX_ID, nw_6, nw_5); - node nw_2 = node(1, node::MAX_ID - 1, nw_5, nw_4); - node nw_1 = node(0, node::MAX_ID, nw_2, nw_3); + node nw_7 = node(3, node::max_id, terminal_F, terminal_T); + node nw_6 = node(2, node::max_id, terminal_T, terminal_T); + node nw_5 = node(2, node::max_id - 1, terminal_F, terminal_T); + node nw_4 = node(2, node::max_id - 2, terminal_F, nw_7); + node nw_3 = node(1, node::max_id, nw_6, nw_5); + node nw_2 = node(1, node::max_id - 1, nw_5, nw_4); + node nw_1 = node(0, node::max_id, nw_2, nw_3); { // Garbage collect early and free write-lock node_writer nw_w(zdd_wide); @@ -1898,7 +1898,7 @@ go_bandit([]() { AssertThat(out.get>()->number_of_terminals[true], Is().EqualTo(6u)); }); - shared_levelized_file zdd_canon; + shared_levelized_file zdd_canon; /* // { {0, 1}, {1, 2}, {2, 3}, {0, 1, 2}, {0, 2, 3} } // @@ -1914,15 +1914,15 @@ go_bandit([]() { // F T T T */ - node nc_9 = node(3, node::MAX_ID, terminal_T, terminal_T); - node nc_8 = node(3, node::MAX_ID - 1, terminal_F, terminal_T); - node nc_7 = node(2, node::MAX_ID, terminal_T, terminal_T); - node nc_6 = node(2, node::MAX_ID - 1, terminal_F, terminal_T); - node nc_5 = node(2, node::MAX_ID - 2, terminal_F, nc_9); - node nc_4 = node(2, node::MAX_ID - 3, terminal_F, nc_8); - node nc_3 = node(1, node::MAX_ID, nc_5, nc_7); - node nc_2 = node(1, node::MAX_ID - 1, nc_4, nc_6); - node nc_1 = node(0, node::MAX_ID, nc_2, nc_3); + node nc_9 = node(3, node::max_id, terminal_T, terminal_T); + node nc_8 = node(3, node::max_id - 1, terminal_F, terminal_T); + node nc_7 = node(2, node::max_id, terminal_T, terminal_T); + node nc_6 = node(2, node::max_id - 1, terminal_F, terminal_T); + node nc_5 = node(2, node::max_id - 2, terminal_F, nc_9); + node nc_4 = node(2, node::max_id - 3, terminal_F, nc_8); + node nc_3 = node(1, node::max_id, nc_5, nc_7); + node nc_2 = node(1, node::max_id - 1, nc_4, nc_6); + node nc_1 = node(0, node::max_id, nc_2, nc_3); { // Garbage collect early and free write-lock node_writer nw_c(zdd_canon); @@ -1932,7 +1932,7 @@ go_bandit([]() { // zdd_canon->canonical == true // zdd_canon->width == 4u - shared_levelized_file zdd_non_canon; + shared_levelized_file zdd_non_canon; /* // { {0}, {2}, {0, 2}, {1, 3}, {1, 2}, {0, 1, 2} } // @@ -1948,13 +1948,13 @@ go_bandit([]() { // F T */ - node nn_7 = node(3, node::MAX_ID, terminal_F, terminal_T); - node nn_6 = node(2, node::MAX_ID, terminal_T, terminal_T); - node nn_5 = node(2, node::MAX_ID - 1, nn_7, terminal_T); - node nn_4 = node(2, node::MAX_ID - 2, terminal_F, terminal_T); - node nn_3 = node(1, node::MAX_ID, nn_6, nn_4); - node nn_2 = node(1, node::MAX_ID - 1, nn_4, nn_5); - node nn_1 = node(0, node::MAX_ID, nn_2, nn_3); + node nn_7 = node(3, node::max_id, terminal_F, terminal_T); + node nn_6 = node(2, node::max_id, terminal_T, terminal_T); + node nn_5 = node(2, node::max_id - 1, nn_7, terminal_T); + node nn_4 = node(2, node::max_id - 2, terminal_F, terminal_T); + node nn_3 = node(1, node::max_id, nn_6, nn_4); + node nn_2 = node(1, node::max_id - 1, nn_4, nn_5); + node nn_1 = node(0, node::max_id, nn_2, nn_3); { // Garbage collect early and free write-lock node_writer nw_n(zdd_non_canon); @@ -2182,20 +2182,20 @@ go_bandit([]() { - shared_levelized_file zdd_a; - shared_levelized_file zdd_b; + shared_levelized_file zdd_a; + shared_levelized_file zdd_b; { // Garbage collect writers early node_writer nw_a(zdd_a); - nw_a << node(3, node::MAX_ID, terminal_F, terminal_T) - << node(2, node::MAX_ID, ptr_uint64(3, ptr_uint64::MAX_ID), ptr_uint64(3, ptr_uint64::MAX_ID)) - << node(1, node::MAX_ID, ptr_uint64(2, ptr_uint64::MAX_ID), ptr_uint64(3, ptr_uint64::MAX_ID)) - << node(0, node::MAX_ID, ptr_uint64(1, ptr_uint64::MAX_ID), terminal_T) + nw_a << node(3, node::max_id, terminal_F, terminal_T) + << node(2, node::max_id, ptr_uint64(3, ptr_uint64::max_id), ptr_uint64(3, ptr_uint64::max_id)) + << node(1, node::max_id, ptr_uint64(2, ptr_uint64::max_id), ptr_uint64(3, ptr_uint64::max_id)) + << node(0, node::max_id, ptr_uint64(1, ptr_uint64::max_id), terminal_T) ; node_writer nw_b(zdd_b); - nw_b << node(3, node::MAX_ID, terminal_F, terminal_T) - << node(0, node::MAX_ID, ptr_uint64(3, ptr_uint64::MAX_ID), ptr_uint64(3, ptr_uint64::MAX_ID)) + nw_b << node(3, node::max_id, terminal_F, terminal_T) + << node(0, node::max_id, ptr_uint64(3, ptr_uint64::max_id), ptr_uint64(3, ptr_uint64::max_id)) ; } @@ -2262,14 +2262,14 @@ go_bandit([]() { AssertThat(levels.can_pull(), Is().False()); - AssertThat(out.get<__zdd::shared_arcs_t>()->max_1level_cut, Is().GreaterThanOrEqualTo(4u)); + AssertThat(out.get<__zdd::shared_arc_file_type>()->max_1level_cut, Is().GreaterThanOrEqualTo(4u)); - AssertThat(out.get<__zdd::shared_arcs_t>()->number_of_terminals[false], Is().EqualTo(2u)); - AssertThat(out.get<__zdd::shared_arcs_t>()->number_of_terminals[true], Is().EqualTo(4u)); + AssertThat(out.get<__zdd::shared_arc_file_type>()->number_of_terminals[false], Is().EqualTo(2u)); + AssertThat(out.get<__zdd::shared_arc_file_type>()->number_of_terminals[true], Is().EqualTo(4u)); }); it("should correctly generate missing nodes (bottom layers)", [&]() { - shared_levelized_file zdd_a; + shared_levelized_file zdd_a; /* // { {0}, {1} } // @@ -2280,8 +2280,8 @@ go_bandit([]() { // F T */ - node na_2 = node(1, node::MAX_ID, terminal_F, terminal_T); - node na_1 = node(0, node::MAX_ID, na_2, terminal_T); + node na_2 = node(1, node::max_id, terminal_F, terminal_T); + node na_1 = node(0, node::max_id, na_2, terminal_T); { // Garbage collect writers early node_writer nw_a(zdd_a); @@ -2291,7 +2291,7 @@ go_bandit([]() { // zdd_a->width == 1u // zdd_a->canonical == true - shared_levelized_file zdd_b; + shared_levelized_file zdd_b; /* // { {0}, {1}, {0, 1} } // @@ -2302,9 +2302,9 @@ go_bandit([]() { // F T T */ - node nb_3 = node(1, node::MAX_ID, terminal_T, terminal_T); - node nb_2 = node(1, node::MAX_ID - 1, terminal_F, terminal_T); - node nb_1 = node(0, node::MAX_ID, nb_2, nb_3); + node nb_3 = node(1, node::max_id, terminal_T, terminal_T); + node nb_2 = node(1, node::max_id - 1, terminal_F, terminal_T); + node nb_1 = node(0, node::max_id, nb_2, nb_3); { // Garbage collect writers early node_writer nw_b(zdd_b); @@ -2360,14 +2360,14 @@ go_bandit([]() { AssertThat(levels.can_pull(), Is().False()); - AssertThat(out.get<__zdd::shared_arcs_t>()->max_1level_cut, Is().EqualTo(2u)); + AssertThat(out.get<__zdd::shared_arc_file_type>()->max_1level_cut, Is().EqualTo(2u)); - AssertThat(out.get<__zdd::shared_arcs_t>()->number_of_terminals[false], Is().EqualTo(1u)); - AssertThat(out.get<__zdd::shared_arcs_t>()->number_of_terminals[true], Is().EqualTo(3u)); + AssertThat(out.get<__zdd::shared_arc_file_type>()->number_of_terminals[false], Is().EqualTo(1u)); + AssertThat(out.get<__zdd::shared_arc_file_type>()->number_of_terminals[true], Is().EqualTo(3u)); }); it("should correctly generate missing nodes (intermediate layers)", [&]() { - shared_levelized_file zdd_a; + shared_levelized_file zdd_a; /* // { {0}, {1}, {0, 3} } // @@ -2380,9 +2380,9 @@ go_bandit([]() { // T T */ - node na_3 = node(2, node::MAX_ID, terminal_T, terminal_T); - node na_2 = node(1, node::MAX_ID, terminal_F, terminal_T); - node na_1 = node(0, node::MAX_ID, na_2, na_3); + node na_3 = node(2, node::max_id, terminal_T, terminal_T); + node na_2 = node(1, node::max_id, terminal_F, terminal_T); + node na_1 = node(0, node::max_id, na_2, na_3); { // Garbage collect writers early node_writer nw_a(zdd_a); @@ -2392,7 +2392,7 @@ go_bandit([]() { // zdd_a->width == 1u // zdd_a->canonical == true - shared_levelized_file zdd_b; + shared_levelized_file zdd_b; /* // { {0}, {1}, {0, 1} } // @@ -2403,9 +2403,9 @@ go_bandit([]() { // F T T */ - node nb_3 = node(1, node::MAX_ID, terminal_T, terminal_T); - node nb_2 = node(1, node::MAX_ID - 1, terminal_F, terminal_T); - node nb_1 = node(0, node::MAX_ID, nb_2, nb_3); + node nb_3 = node(1, node::max_id, terminal_T, terminal_T); + node nb_2 = node(1, node::max_id - 1, terminal_F, terminal_T); + node nb_1 = node(0, node::max_id, nb_2, nb_3); { // Garbage collect writers early node_writer nw_b(zdd_b); @@ -2473,16 +2473,16 @@ go_bandit([]() { AssertThat(levels.can_pull(), Is().False()); - AssertThat(out.get<__zdd::shared_arcs_t>()->max_1level_cut, Is().EqualTo(2u)); + AssertThat(out.get<__zdd::shared_arc_file_type>()->max_1level_cut, Is().EqualTo(2u)); - AssertThat(out.get<__zdd::shared_arcs_t>()->number_of_terminals[false], Is().EqualTo(1u)); - AssertThat(out.get<__zdd::shared_arcs_t>()->number_of_terminals[true], Is().EqualTo(4u)); + AssertThat(out.get<__zdd::shared_arc_file_type>()->number_of_terminals[false], Is().EqualTo(1u)); + AssertThat(out.get<__zdd::shared_arc_file_type>()->number_of_terminals[true], Is().EqualTo(4u)); }); }); describe("zdd_intsec", [&]() { it("should shortcircuit intermediate nodes", [&]() { - shared_levelized_file zdd_a; + shared_levelized_file zdd_a; /* // { {0, 1}, {0, 2}, {0, 1, 2} } // @@ -2495,10 +2495,10 @@ go_bandit([]() { // F T T T */ - node na_4 = node(2, node::MAX_ID, terminal_T, terminal_T); - node na_3 = node(2, node::MAX_ID - 1, terminal_F, terminal_T); - node na_2 = node(1, node::MAX_ID, na_3, na_4); - node na_1 = node(0, node::MAX_ID, terminal_F, na_2); + node na_4 = node(2, node::max_id, terminal_T, terminal_T); + node na_3 = node(2, node::max_id - 1, terminal_F, terminal_T); + node na_2 = node(1, node::max_id, na_3, na_4); + node na_1 = node(0, node::max_id, terminal_F, na_2); { // Garbage collect early and free write-lock node_writer nw_a(zdd_a); @@ -2508,7 +2508,7 @@ go_bandit([]() { // zdd_a->canonical == true // zdd_a->width == 2u - shared_levelized_file zdd_b; + shared_levelized_file zdd_b; /* // { {1, 2}, {0, 1, 2} } // @@ -2521,9 +2521,9 @@ go_bandit([]() { // F T */ - node nb_3 = node(2, node::MAX_ID, terminal_F, terminal_T); - node nb_2 = node(1, node::MAX_ID, terminal_F, nb_3); - node nb_1 = node(0, node::MAX_ID, nb_2, nb_2); + node nb_3 = node(2, node::max_id, terminal_F, terminal_T); + node nb_2 = node(1, node::max_id, terminal_F, nb_3); + node nb_1 = node(0, node::max_id, nb_2, nb_2); { // Garbage collect early and free write-lock node_writer nw_b(zdd_b); @@ -2593,7 +2593,7 @@ go_bandit([]() { }); it("should suppress nodes", [&]() { - shared_levelized_file zdd_a; + shared_levelized_file zdd_a; /* // { {0}, {1} } // @@ -2604,8 +2604,8 @@ go_bandit([]() { // F T */ - node na_2 = node(1, node::MAX_ID, terminal_F, terminal_T); - node na_1 = node(0, node::MAX_ID, na_2, terminal_T); + node na_2 = node(1, node::max_id, terminal_F, terminal_T); + node na_1 = node(0, node::max_id, na_2, terminal_T); { // Garbage collect early and free write-lock node_writer nw_a(zdd_a); @@ -2615,7 +2615,7 @@ go_bandit([]() { // zdd_a->canonical == true // zdd_a->width == 1u - shared_levelized_file zdd_b; + shared_levelized_file zdd_b; /* // { Ø, {0} } // @@ -2624,7 +2624,7 @@ go_bandit([]() { // T */ - node nb_1 = node(0, node::MAX_ID, terminal_T, terminal_T); + node nb_1 = node(0, node::max_id, terminal_T, terminal_T); { // Garbage collect early and free write-lock node_writer nw_b(zdd_b); @@ -2684,7 +2684,7 @@ go_bandit([]() { // Therefore the operator should be flipped to achieve the same behavior // This can be seen, as difference is a non-commutative operator - shared_levelized_file zdd_a; + shared_levelized_file zdd_a; /* // { Ø, {1}, {0, 1} } // @@ -2695,9 +2695,9 @@ go_bandit([]() { // T T F T */ - node na_3 = node(1, node::MAX_ID, terminal_F, terminal_T); - node na_2 = node(1, node::MAX_ID - 1, terminal_T, terminal_T); - node na_1 = node(0, node::MAX_ID, na_2, na_3); + node na_3 = node(1, node::max_id, terminal_F, terminal_T); + node na_2 = node(1, node::max_id - 1, terminal_T, terminal_T); + node na_1 = node(0, node::max_id, na_2, na_3); { // Garbage collect early and free write-lock node_writer nw_a(zdd_a); @@ -2707,7 +2707,7 @@ go_bandit([]() { // zdd_a->canonical == false // zdd_a->width == 2u - shared_levelized_file zdd_b; + shared_levelized_file zdd_b; /* // { {0}, {1}, {0, 1} } // @@ -2718,9 +2718,9 @@ go_bandit([]() { // F T T T */ - node nb_3 = node(1, node::MAX_ID, terminal_T, terminal_T); - node nb_2 = node(1, node::MAX_ID - 1, terminal_F, terminal_T); - node nb_1 = node(0, node::MAX_ID, nb_2, nb_3); + node nb_3 = node(1, node::max_id, terminal_T, terminal_T); + node nb_2 = node(1, node::max_id - 1, terminal_F, terminal_T); + node nb_1 = node(0, node::max_id, nb_2, nb_3); { // Garbage collect early and free write-lock node_writer nw_b(zdd_b); @@ -2776,7 +2776,7 @@ go_bandit([]() { }); // Reset access mode - access_mode = access_mode_t::AUTO; + access_mode = access_mode_t::Auto; }); }); }); diff --git a/test/adiar/zdd/test_build.cpp b/test/adiar/zdd/test_build.cpp index a719ebca8..d3126eb4b 100644 --- a/test/adiar/zdd/test_build.cpp +++ b/test/adiar/zdd/test_build.cpp @@ -19,15 +19,15 @@ go_bandit([]() { AssertThat(res->width, Is().EqualTo(0u)); - AssertThat(res->max_1level_cut[cut_type::INTERNAL], Is().EqualTo(0u)); - AssertThat(res->max_1level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(0u)); - AssertThat(res->max_1level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(1u)); - AssertThat(res->max_1level_cut[cut_type::ALL], Is().EqualTo(1u)); + AssertThat(res->max_1level_cut[cut::Internal], Is().EqualTo(0u)); + AssertThat(res->max_1level_cut[cut::Internal_False], Is().EqualTo(0u)); + AssertThat(res->max_1level_cut[cut::Internal_True], Is().EqualTo(1u)); + AssertThat(res->max_1level_cut[cut::All], Is().EqualTo(1u)); - AssertThat(res->max_2level_cut[cut_type::INTERNAL], Is().EqualTo(0u)); - AssertThat(res->max_2level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(0u)); - AssertThat(res->max_2level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(1u)); - AssertThat(res->max_2level_cut[cut_type::ALL], Is().EqualTo(1u)); + AssertThat(res->max_2level_cut[cut::Internal], Is().EqualTo(0u)); + AssertThat(res->max_2level_cut[cut::Internal_False], Is().EqualTo(0u)); + AssertThat(res->max_2level_cut[cut::Internal_True], Is().EqualTo(1u)); + AssertThat(res->max_2level_cut[cut::All], Is().EqualTo(1u)); AssertThat(res->canonical, Is().True()); @@ -48,17 +48,17 @@ go_bandit([]() { AssertThat(res->width, Is().EqualTo(0u)); - AssertThat(res->max_1level_cut[cut_type::INTERNAL], Is().EqualTo(0u)); - AssertThat(res->max_1level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(0u)); - AssertThat(res->max_1level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(1u)); - AssertThat(res->max_1level_cut[cut_type::ALL], Is().EqualTo(1u)); + AssertThat(res->max_1level_cut[cut::Internal], Is().EqualTo(0u)); + AssertThat(res->max_1level_cut[cut::Internal_False], Is().EqualTo(0u)); + AssertThat(res->max_1level_cut[cut::Internal_True], Is().EqualTo(1u)); + AssertThat(res->max_1level_cut[cut::All], Is().EqualTo(1u)); - AssertThat(res->max_2level_cut[cut_type::INTERNAL], Is().EqualTo(0u)); - AssertThat(res->max_2level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(0u)); - AssertThat(res->max_2level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(1u)); - AssertThat(res->max_2level_cut[cut_type::ALL], Is().EqualTo(1u)); + AssertThat(res->max_2level_cut[cut::Internal], Is().EqualTo(0u)); + AssertThat(res->max_2level_cut[cut::Internal_False], Is().EqualTo(0u)); + AssertThat(res->max_2level_cut[cut::Internal_True], Is().EqualTo(1u)); + AssertThat(res->max_2level_cut[cut::All], Is().EqualTo(1u)); - AssertThat(adiar::is_canonical(res), Is().True()); + AssertThat(zdd_iscanonical(res), Is().True()); AssertThat(res->number_of_terminals[false], Is().EqualTo(0u)); AssertThat(res->number_of_terminals[true], Is().EqualTo(1u)); @@ -77,17 +77,17 @@ go_bandit([]() { AssertThat(res->width, Is().EqualTo(0u)); - AssertThat(res->max_1level_cut[cut_type::INTERNAL], Is().EqualTo(0u)); - AssertThat(res->max_1level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(1u)); - AssertThat(res->max_1level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(0u)); - AssertThat(res->max_1level_cut[cut_type::ALL], Is().EqualTo(1u)); + AssertThat(res->max_1level_cut[cut::Internal], Is().EqualTo(0u)); + AssertThat(res->max_1level_cut[cut::Internal_False], Is().EqualTo(1u)); + AssertThat(res->max_1level_cut[cut::Internal_True], Is().EqualTo(0u)); + AssertThat(res->max_1level_cut[cut::All], Is().EqualTo(1u)); - AssertThat(res->max_2level_cut[cut_type::INTERNAL], Is().EqualTo(0u)); - AssertThat(res->max_2level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(1u)); - AssertThat(res->max_2level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(0u)); - AssertThat(res->max_2level_cut[cut_type::ALL], Is().EqualTo(1u)); + AssertThat(res->max_2level_cut[cut::Internal], Is().EqualTo(0u)); + AssertThat(res->max_2level_cut[cut::Internal_False], Is().EqualTo(1u)); + AssertThat(res->max_2level_cut[cut::Internal_True], Is().EqualTo(0u)); + AssertThat(res->max_2level_cut[cut::All], Is().EqualTo(1u)); - AssertThat(adiar::is_canonical(res), Is().True()); + AssertThat(zdd_iscanonical(res), Is().True()); AssertThat(res->number_of_terminals[false], Is().EqualTo(1u)); AssertThat(res->number_of_terminals[true], Is().EqualTo(0u)); @@ -106,17 +106,17 @@ go_bandit([]() { AssertThat(res->width, Is().EqualTo(0u)); - AssertThat(res->max_1level_cut[cut_type::INTERNAL], Is().EqualTo(0u)); - AssertThat(res->max_1level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(1u)); - AssertThat(res->max_1level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(0u)); - AssertThat(res->max_1level_cut[cut_type::ALL], Is().EqualTo(1u)); + AssertThat(res->max_1level_cut[cut::Internal], Is().EqualTo(0u)); + AssertThat(res->max_1level_cut[cut::Internal_False], Is().EqualTo(1u)); + AssertThat(res->max_1level_cut[cut::Internal_True], Is().EqualTo(0u)); + AssertThat(res->max_1level_cut[cut::All], Is().EqualTo(1u)); - AssertThat(res->max_2level_cut[cut_type::INTERNAL], Is().EqualTo(0u)); - AssertThat(res->max_2level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(1u)); - AssertThat(res->max_2level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(0u)); - AssertThat(res->max_2level_cut[cut_type::ALL], Is().EqualTo(1u)); + AssertThat(res->max_2level_cut[cut::Internal], Is().EqualTo(0u)); + AssertThat(res->max_2level_cut[cut::Internal_False], Is().EqualTo(1u)); + AssertThat(res->max_2level_cut[cut::Internal_True], Is().EqualTo(0u)); + AssertThat(res->max_2level_cut[cut::All], Is().EqualTo(1u)); - AssertThat(adiar::is_canonical(res), Is().True()); + AssertThat(zdd_iscanonical(res), Is().True()); AssertThat(res->number_of_terminals[false], Is().EqualTo(1u)); AssertThat(res->number_of_terminals[true], Is().EqualTo(0u)); @@ -145,17 +145,17 @@ go_bandit([]() { AssertThat(res->width, Is().EqualTo(0u)); - AssertThat(res->max_1level_cut[cut_type::INTERNAL], Is().EqualTo(0u)); - AssertThat(res->max_1level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(1u)); - AssertThat(res->max_1level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(0u)); - AssertThat(res->max_1level_cut[cut_type::ALL], Is().EqualTo(1u)); + AssertThat(res->max_1level_cut[cut::Internal], Is().EqualTo(0u)); + AssertThat(res->max_1level_cut[cut::Internal_False], Is().EqualTo(1u)); + AssertThat(res->max_1level_cut[cut::Internal_True], Is().EqualTo(0u)); + AssertThat(res->max_1level_cut[cut::All], Is().EqualTo(1u)); - AssertThat(res->max_2level_cut[cut_type::INTERNAL], Is().EqualTo(0u)); - AssertThat(res->max_2level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(1u)); - AssertThat(res->max_2level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(0u)); - AssertThat(res->max_2level_cut[cut_type::ALL], Is().EqualTo(1u)); + AssertThat(res->max_2level_cut[cut::Internal], Is().EqualTo(0u)); + AssertThat(res->max_2level_cut[cut::Internal_False], Is().EqualTo(1u)); + AssertThat(res->max_2level_cut[cut::Internal_True], Is().EqualTo(0u)); + AssertThat(res->max_2level_cut[cut::All], Is().EqualTo(1u)); - AssertThat(adiar::is_canonical(res), Is().True()); + AssertThat(zdd_iscanonical(res), Is().True()); AssertThat(res->number_of_terminals[false], Is().EqualTo(1u)); AssertThat(res->number_of_terminals[true], Is().EqualTo(0u)); @@ -169,9 +169,9 @@ go_bandit([]() { node_test_stream ns(res); AssertThat(ns.can_pull(), Is().True()); - AssertThat(ns.pull(), Is().EqualTo(node(42, node::MAX_ID, - node::ptr_t(false), - node::ptr_t(true)))); + AssertThat(ns.pull(), Is().EqualTo(node(42, node::max_id, + node::pointer_type(false), + node::pointer_type(true)))); AssertThat(ns.can_pull(), Is().False()); level_info_test_stream ms(res); @@ -183,17 +183,17 @@ go_bandit([]() { AssertThat(res->width, Is().EqualTo(1u)); - AssertThat(res->max_1level_cut[cut_type::INTERNAL], Is().EqualTo(1u)); - AssertThat(res->max_1level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(1u)); - AssertThat(res->max_1level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(1u)); - AssertThat(res->max_1level_cut[cut_type::ALL], Is().EqualTo(2u)); + AssertThat(res->max_1level_cut[cut::Internal], Is().EqualTo(1u)); + AssertThat(res->max_1level_cut[cut::Internal_False], Is().EqualTo(1u)); + AssertThat(res->max_1level_cut[cut::Internal_True], Is().EqualTo(1u)); + AssertThat(res->max_1level_cut[cut::All], Is().EqualTo(2u)); - AssertThat(res->max_2level_cut[cut_type::INTERNAL], Is().EqualTo(1u)); - AssertThat(res->max_2level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(1u)); - AssertThat(res->max_2level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(1u)); - AssertThat(res->max_2level_cut[cut_type::ALL], Is().EqualTo(2u)); + AssertThat(res->max_2level_cut[cut::Internal], Is().EqualTo(1u)); + AssertThat(res->max_2level_cut[cut::Internal_False], Is().EqualTo(1u)); + AssertThat(res->max_2level_cut[cut::Internal_True], Is().EqualTo(1u)); + AssertThat(res->max_2level_cut[cut::All], Is().EqualTo(2u)); - AssertThat(adiar::is_canonical(res), Is().True()); + AssertThat(zdd_iscanonical(res), Is().True()); AssertThat(res->number_of_terminals[false], Is().EqualTo(1u)); AssertThat(res->number_of_terminals[true], Is().EqualTo(1u)); @@ -207,9 +207,9 @@ go_bandit([]() { node_test_stream ns(res); AssertThat(ns.can_pull(), Is().True()); - AssertThat(ns.pull(), Is().EqualTo(node(7, node::MAX_ID, - node::ptr_t(false), - node::ptr_t(true)))); + AssertThat(ns.pull(), Is().EqualTo(node(7, node::max_id, + node::pointer_type(false), + node::pointer_type(true)))); AssertThat(ns.can_pull(), Is().False()); level_info_test_stream ms(res); @@ -221,17 +221,17 @@ go_bandit([]() { AssertThat(res->width, Is().EqualTo(1u)); - AssertThat(res->max_1level_cut[cut_type::INTERNAL], Is().EqualTo(1u)); - AssertThat(res->max_1level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(1u)); - AssertThat(res->max_1level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(1u)); - AssertThat(res->max_1level_cut[cut_type::ALL], Is().EqualTo(2u)); + AssertThat(res->max_1level_cut[cut::Internal], Is().EqualTo(1u)); + AssertThat(res->max_1level_cut[cut::Internal_False], Is().EqualTo(1u)); + AssertThat(res->max_1level_cut[cut::Internal_True], Is().EqualTo(1u)); + AssertThat(res->max_1level_cut[cut::All], Is().EqualTo(2u)); - AssertThat(res->max_2level_cut[cut_type::INTERNAL], Is().EqualTo(1u)); - AssertThat(res->max_2level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(1u)); - AssertThat(res->max_2level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(1u)); - AssertThat(res->max_2level_cut[cut_type::ALL], Is().EqualTo(2u)); + AssertThat(res->max_2level_cut[cut::Internal], Is().EqualTo(1u)); + AssertThat(res->max_2level_cut[cut::Internal_False], Is().EqualTo(1u)); + AssertThat(res->max_2level_cut[cut::Internal_True], Is().EqualTo(1u)); + AssertThat(res->max_2level_cut[cut::All], Is().EqualTo(2u)); - AssertThat(adiar::is_canonical(res), Is().True()); + AssertThat(zdd_iscanonical(res), Is().True()); AssertThat(res->number_of_terminals[false], Is().EqualTo(1u)); AssertThat(res->number_of_terminals[true], Is().EqualTo(1u)); @@ -245,14 +245,14 @@ go_bandit([]() { node_test_stream ns(res); AssertThat(ns.can_pull(), Is().True()); - AssertThat(ns.pull(), Is().EqualTo(node(42, node::MAX_ID, - node::ptr_t(true), - node::ptr_t(true)))); + AssertThat(ns.pull(), Is().EqualTo(node(42, node::max_id, + node::pointer_type(true), + node::pointer_type(true)))); AssertThat(ns.can_pull(), Is().True()); - AssertThat(ns.pull(), Is().EqualTo(node(21, node::MAX_ID, - node::ptr_t(false), - node::ptr_t(42, node::MAX_ID)))); + AssertThat(ns.pull(), Is().EqualTo(node(21, node::max_id, + node::pointer_type(false), + node::pointer_type(42, node::max_id)))); AssertThat(ns.can_pull(), Is().False()); @@ -267,17 +267,17 @@ go_bandit([]() { AssertThat(res->width, Is().EqualTo(1u)); - AssertThat(res->max_1level_cut[cut_type::INTERNAL], Is().EqualTo(1u)); - AssertThat(res->max_1level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(2u)); - AssertThat(res->max_1level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(2u)); - AssertThat(res->max_1level_cut[cut_type::ALL], Is().EqualTo(3u)); + AssertThat(res->max_1level_cut[cut::Internal], Is().EqualTo(1u)); + AssertThat(res->max_1level_cut[cut::Internal_False], Is().EqualTo(2u)); + AssertThat(res->max_1level_cut[cut::Internal_True], Is().EqualTo(2u)); + AssertThat(res->max_1level_cut[cut::All], Is().EqualTo(3u)); - AssertThat(res->max_2level_cut[cut_type::INTERNAL], Is().EqualTo(1u)); - AssertThat(res->max_2level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(2u)); - AssertThat(res->max_2level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(2u)); - AssertThat(res->max_2level_cut[cut_type::ALL], Is().EqualTo(3u)); + AssertThat(res->max_2level_cut[cut::Internal], Is().EqualTo(1u)); + AssertThat(res->max_2level_cut[cut::Internal_False], Is().EqualTo(2u)); + AssertThat(res->max_2level_cut[cut::Internal_True], Is().EqualTo(2u)); + AssertThat(res->max_2level_cut[cut::All], Is().EqualTo(3u)); - AssertThat(adiar::is_canonical(res), Is().True()); + AssertThat(zdd_iscanonical(res), Is().True()); AssertThat(res->number_of_terminals[false], Is().EqualTo(1u)); AssertThat(res->number_of_terminals[true], Is().EqualTo(2u)); @@ -291,14 +291,14 @@ go_bandit([]() { node_test_stream ns(res); AssertThat(ns.can_pull(), Is().True()); - AssertThat(ns.pull(), Is().EqualTo(node(42, node::MAX_ID, - node::ptr_t(false), - node::ptr_t(true)))); + AssertThat(ns.pull(), Is().EqualTo(node(42, node::max_id, + node::pointer_type(false), + node::pointer_type(true)))); AssertThat(ns.can_pull(), Is().True()); - AssertThat(ns.pull(), Is().EqualTo(node(21, node::MAX_ID, - node::ptr_t(42, node::MAX_ID), - node::ptr_t(42, node::MAX_ID)))); + AssertThat(ns.pull(), Is().EqualTo(node(21, node::max_id, + node::pointer_type(42, node::max_id), + node::pointer_type(42, node::max_id)))); AssertThat(ns.can_pull(), Is().False()); @@ -312,17 +312,17 @@ go_bandit([]() { AssertThat(res->width, Is().EqualTo(1u)); - AssertThat(res->max_1level_cut[cut_type::INTERNAL], Is().EqualTo(2u)); - AssertThat(res->max_1level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(2u)); - AssertThat(res->max_1level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(2u)); - AssertThat(res->max_1level_cut[cut_type::ALL], Is().EqualTo(2u)); + AssertThat(res->max_1level_cut[cut::Internal], Is().EqualTo(2u)); + AssertThat(res->max_1level_cut[cut::Internal_False], Is().EqualTo(2u)); + AssertThat(res->max_1level_cut[cut::Internal_True], Is().EqualTo(2u)); + AssertThat(res->max_1level_cut[cut::All], Is().EqualTo(2u)); - AssertThat(res->max_2level_cut[cut_type::INTERNAL], Is().EqualTo(2u)); - AssertThat(res->max_2level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(2u)); - AssertThat(res->max_2level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(2u)); - AssertThat(res->max_2level_cut[cut_type::ALL], Is().EqualTo(2u)); + AssertThat(res->max_2level_cut[cut::Internal], Is().EqualTo(2u)); + AssertThat(res->max_2level_cut[cut::Internal_False], Is().EqualTo(2u)); + AssertThat(res->max_2level_cut[cut::Internal_True], Is().EqualTo(2u)); + AssertThat(res->max_2level_cut[cut::All], Is().EqualTo(2u)); - AssertThat(adiar::is_canonical(res), Is().True()); + AssertThat(zdd_iscanonical(res), Is().True()); AssertThat(res->number_of_terminals[false], Is().EqualTo(1u)); AssertThat(res->number_of_terminals[true], Is().EqualTo(1u)); @@ -336,19 +336,19 @@ go_bandit([]() { node_test_stream ns(res); AssertThat(ns.can_pull(), Is().True()); - AssertThat(ns.pull(), Is().EqualTo(node(42, node::MAX_ID, - node::ptr_t(true), - node::ptr_t(true)))); + AssertThat(ns.pull(), Is().EqualTo(node(42, node::max_id, + node::pointer_type(true), + node::pointer_type(true)))); AssertThat(ns.can_pull(), Is().True()); - AssertThat(ns.pull(), Is().EqualTo(node(21, node::MAX_ID, - node::ptr_t(false), - node::ptr_t(42, node::MAX_ID)))); + AssertThat(ns.pull(), Is().EqualTo(node(21, node::max_id, + node::pointer_type(false), + node::pointer_type(42, node::max_id)))); AssertThat(ns.can_pull(), Is().True()); - AssertThat(ns.pull(), Is().EqualTo(node(10, node::MAX_ID, - node::ptr_t(21, node::MAX_ID), - node::ptr_t(21, node::MAX_ID)))); + AssertThat(ns.pull(), Is().EqualTo(node(10, node::max_id, + node::pointer_type(21, node::max_id), + node::pointer_type(21, node::max_id)))); AssertThat(ns.can_pull(), Is().False()); @@ -364,17 +364,17 @@ go_bandit([]() { AssertThat(res->width, Is().EqualTo(1u)); - AssertThat(res->max_1level_cut[cut_type::INTERNAL], Is().EqualTo(2u)); - AssertThat(res->max_1level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(2u)); - AssertThat(res->max_1level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(2u)); - AssertThat(res->max_1level_cut[cut_type::ALL], Is().EqualTo(3u)); + AssertThat(res->max_1level_cut[cut::Internal], Is().EqualTo(2u)); + AssertThat(res->max_1level_cut[cut::Internal_False], Is().EqualTo(2u)); + AssertThat(res->max_1level_cut[cut::Internal_True], Is().EqualTo(2u)); + AssertThat(res->max_1level_cut[cut::All], Is().EqualTo(3u)); - AssertThat(res->max_2level_cut[cut_type::INTERNAL], Is().EqualTo(2u)); - AssertThat(res->max_2level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(2u)); - AssertThat(res->max_2level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(2u)); - AssertThat(res->max_2level_cut[cut_type::ALL], Is().EqualTo(3u)); + AssertThat(res->max_2level_cut[cut::Internal], Is().EqualTo(2u)); + AssertThat(res->max_2level_cut[cut::Internal_False], Is().EqualTo(2u)); + AssertThat(res->max_2level_cut[cut::Internal_True], Is().EqualTo(2u)); + AssertThat(res->max_2level_cut[cut::All], Is().EqualTo(3u)); - AssertThat(adiar::is_canonical(res), Is().True()); + AssertThat(zdd_iscanonical(res), Is().True()); AssertThat(res->number_of_terminals[false], Is().EqualTo(1u)); AssertThat(res->number_of_terminals[true], Is().EqualTo(2u)); @@ -389,7 +389,7 @@ go_bandit([]() { describe("zdd_ithvar(i)", [&]() { { std::vector dom = { 0, 1, 2, 3 }; - adiar_set_domain(dom.begin(), dom.end()); + domain_set(dom.begin(), dom.end()); } it("constructs chain for i = 1 global dom = {0,1,2,3}", [&]() { @@ -398,25 +398,25 @@ go_bandit([]() { node_test_stream ns(res); AssertThat(ns.can_pull(), Is().True()); - AssertThat(ns.pull(), Is().EqualTo(node(3, node::MAX_ID, - node::ptr_t(true), - node::ptr_t(true)))); + AssertThat(ns.pull(), Is().EqualTo(node(3, node::max_id, + node::pointer_type(true), + node::pointer_type(true)))); AssertThat(ns.can_pull(), Is().True()); - AssertThat(ns.pull(), Is().EqualTo(node(2, node::MAX_ID, - node::ptr_t(3, node::MAX_ID), - node::ptr_t(3, node::MAX_ID)))); + AssertThat(ns.pull(), Is().EqualTo(node(2, node::max_id, + node::pointer_type(3, node::max_id), + node::pointer_type(3, node::max_id)))); AssertThat(ns.can_pull(), Is().True()); - AssertThat(ns.pull(), Is().EqualTo(node(1, node::MAX_ID, - node::ptr_t(false), - node::ptr_t(2, node::MAX_ID)))); + AssertThat(ns.pull(), Is().EqualTo(node(1, node::max_id, + node::pointer_type(false), + node::pointer_type(2, node::max_id)))); AssertThat(ns.can_pull(), Is().True()); - AssertThat(ns.pull(), Is().EqualTo(node(0, node::MAX_ID, - node::ptr_t(1, node::MAX_ID), - node::ptr_t(1, node::MAX_ID)))); + AssertThat(ns.pull(), Is().EqualTo(node(0, node::max_id, + node::pointer_type(1, node::max_id), + node::pointer_type(1, node::max_id)))); AssertThat(ns.can_pull(), Is().False()); @@ -434,17 +434,17 @@ go_bandit([]() { AssertThat(res->width, Is().EqualTo(1u)); - AssertThat(res->max_1level_cut[cut_type::INTERNAL], Is().EqualTo(2u)); - AssertThat(res->max_1level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(2u)); - AssertThat(res->max_1level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(2u)); - AssertThat(res->max_1level_cut[cut_type::ALL], Is().EqualTo(3u)); + AssertThat(res->max_1level_cut[cut::Internal], Is().EqualTo(2u)); + AssertThat(res->max_1level_cut[cut::Internal_False], Is().EqualTo(2u)); + AssertThat(res->max_1level_cut[cut::Internal_True], Is().EqualTo(2u)); + AssertThat(res->max_1level_cut[cut::All], Is().EqualTo(3u)); - AssertThat(res->max_2level_cut[cut_type::INTERNAL], Is().EqualTo(2u)); - AssertThat(res->max_2level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(2u)); - AssertThat(res->max_2level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(2u)); - AssertThat(res->max_2level_cut[cut_type::ALL], Is().EqualTo(3u)); + AssertThat(res->max_2level_cut[cut::Internal], Is().EqualTo(2u)); + AssertThat(res->max_2level_cut[cut::Internal_False], Is().EqualTo(2u)); + AssertThat(res->max_2level_cut[cut::Internal_True], Is().EqualTo(2u)); + AssertThat(res->max_2level_cut[cut::All], Is().EqualTo(3u)); - AssertThat(adiar::is_canonical(res), Is().True()); + AssertThat(zdd_iscanonical(res), Is().True()); AssertThat(res->number_of_terminals[false], Is().EqualTo(1u)); AssertThat(res->number_of_terminals[true], Is().EqualTo(2u)); @@ -473,17 +473,17 @@ go_bandit([]() { AssertThat(res->width, Is().EqualTo(0u)); - AssertThat(res->max_1level_cut[cut_type::INTERNAL], Is().EqualTo(0u)); - AssertThat(res->max_1level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(0u)); - AssertThat(res->max_1level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(1u)); - AssertThat(res->max_1level_cut[cut_type::ALL], Is().EqualTo(1u)); + AssertThat(res->max_1level_cut[cut::Internal], Is().EqualTo(0u)); + AssertThat(res->max_1level_cut[cut::Internal_False], Is().EqualTo(0u)); + AssertThat(res->max_1level_cut[cut::Internal_True], Is().EqualTo(1u)); + AssertThat(res->max_1level_cut[cut::All], Is().EqualTo(1u)); - AssertThat(res->max_2level_cut[cut_type::INTERNAL], Is().EqualTo(0u)); - AssertThat(res->max_2level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(0u)); - AssertThat(res->max_2level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(1u)); - AssertThat(res->max_2level_cut[cut_type::ALL], Is().EqualTo(1u)); + AssertThat(res->max_2level_cut[cut::Internal], Is().EqualTo(0u)); + AssertThat(res->max_2level_cut[cut::Internal_False], Is().EqualTo(0u)); + AssertThat(res->max_2level_cut[cut::Internal_True], Is().EqualTo(1u)); + AssertThat(res->max_2level_cut[cut::All], Is().EqualTo(1u)); - AssertThat(adiar::is_canonical(res), Is().True()); + AssertThat(zdd_iscanonical(res), Is().True()); AssertThat(res->number_of_terminals[false], Is().EqualTo(0u)); AssertThat(res->number_of_terminals[true], Is().EqualTo(1u)); @@ -506,17 +506,17 @@ go_bandit([]() { AssertThat(res->width, Is().EqualTo(0u)); - AssertThat(res->max_1level_cut[cut_type::INTERNAL], Is().EqualTo(0u)); - AssertThat(res->max_1level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(0u)); - AssertThat(res->max_1level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(1u)); - AssertThat(res->max_1level_cut[cut_type::ALL], Is().EqualTo(1u)); + AssertThat(res->max_1level_cut[cut::Internal], Is().EqualTo(0u)); + AssertThat(res->max_1level_cut[cut::Internal_False], Is().EqualTo(0u)); + AssertThat(res->max_1level_cut[cut::Internal_True], Is().EqualTo(1u)); + AssertThat(res->max_1level_cut[cut::All], Is().EqualTo(1u)); - AssertThat(res->max_2level_cut[cut_type::INTERNAL], Is().EqualTo(0u)); - AssertThat(res->max_2level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(0u)); - AssertThat(res->max_2level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(1u)); - AssertThat(res->max_2level_cut[cut_type::ALL], Is().EqualTo(1u)); + AssertThat(res->max_2level_cut[cut::Internal], Is().EqualTo(0u)); + AssertThat(res->max_2level_cut[cut::Internal_False], Is().EqualTo(0u)); + AssertThat(res->max_2level_cut[cut::Internal_True], Is().EqualTo(1u)); + AssertThat(res->max_2level_cut[cut::All], Is().EqualTo(1u)); - AssertThat(adiar::is_canonical(res), Is().True()); + AssertThat(zdd_iscanonical(res), Is().True()); AssertThat(res->number_of_terminals[false], Is().EqualTo(0u)); AssertThat(res->number_of_terminals[true], Is().EqualTo(1u)); @@ -530,9 +530,9 @@ go_bandit([]() { node_test_stream ns(res); AssertThat(ns.can_pull(), Is().True()); - AssertThat(ns.pull(), Is().EqualTo(node(21, zdd::MAX_ID, - node::ptr_t(true), - node::ptr_t(true)))); + AssertThat(ns.pull(), Is().EqualTo(node(21, zdd::max_id, + node::pointer_type(true), + node::pointer_type(true)))); AssertThat(ns.can_pull(), Is().False()); @@ -543,17 +543,17 @@ go_bandit([]() { AssertThat(res->width, Is().EqualTo(1u)); - AssertThat(res->max_1level_cut[cut_type::INTERNAL], Is().EqualTo(1u)); - AssertThat(res->max_1level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(1u)); - AssertThat(res->max_1level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(2u)); - AssertThat(res->max_1level_cut[cut_type::ALL], Is().EqualTo(2u)); + AssertThat(res->max_1level_cut[cut::Internal], Is().EqualTo(1u)); + AssertThat(res->max_1level_cut[cut::Internal_False], Is().EqualTo(1u)); + AssertThat(res->max_1level_cut[cut::Internal_True], Is().EqualTo(2u)); + AssertThat(res->max_1level_cut[cut::All], Is().EqualTo(2u)); - AssertThat(res->max_2level_cut[cut_type::INTERNAL], Is().EqualTo(1u)); - AssertThat(res->max_2level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(1u)); - AssertThat(res->max_2level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(2u)); - AssertThat(res->max_2level_cut[cut_type::ALL], Is().EqualTo(2u)); + AssertThat(res->max_2level_cut[cut::Internal], Is().EqualTo(1u)); + AssertThat(res->max_2level_cut[cut::Internal_False], Is().EqualTo(1u)); + AssertThat(res->max_2level_cut[cut::Internal_True], Is().EqualTo(2u)); + AssertThat(res->max_2level_cut[cut::All], Is().EqualTo(2u)); - AssertThat(adiar::is_canonical(res), Is().True()); + AssertThat(zdd_iscanonical(res), Is().True()); AssertThat(res->number_of_terminals[false], Is().EqualTo(0u)); AssertThat(res->number_of_terminals[true], Is().EqualTo(2u)); @@ -567,9 +567,9 @@ go_bandit([]() { node_test_stream ns(res); AssertThat(ns.can_pull(), Is().True()); - AssertThat(ns.pull(), Is().EqualTo(node(42, zdd::MAX_ID, - node::ptr_t(true), - node::ptr_t(true)))); + AssertThat(ns.pull(), Is().EqualTo(node(42, zdd::max_id, + node::pointer_type(true), + node::pointer_type(true)))); AssertThat(ns.can_pull(), Is().False()); @@ -580,17 +580,17 @@ go_bandit([]() { AssertThat(res->width, Is().EqualTo(1u)); - AssertThat(res->max_1level_cut[cut_type::INTERNAL], Is().EqualTo(1u)); - AssertThat(res->max_1level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(1u)); - AssertThat(res->max_1level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(2u)); - AssertThat(res->max_1level_cut[cut_type::ALL], Is().EqualTo(2u)); + AssertThat(res->max_1level_cut[cut::Internal], Is().EqualTo(1u)); + AssertThat(res->max_1level_cut[cut::Internal_False], Is().EqualTo(1u)); + AssertThat(res->max_1level_cut[cut::Internal_True], Is().EqualTo(2u)); + AssertThat(res->max_1level_cut[cut::All], Is().EqualTo(2u)); - AssertThat(res->max_2level_cut[cut_type::INTERNAL], Is().EqualTo(1u)); - AssertThat(res->max_2level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(1u)); - AssertThat(res->max_2level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(2u)); - AssertThat(res->max_2level_cut[cut_type::ALL], Is().EqualTo(2u)); + AssertThat(res->max_2level_cut[cut::Internal], Is().EqualTo(1u)); + AssertThat(res->max_2level_cut[cut::Internal_False], Is().EqualTo(1u)); + AssertThat(res->max_2level_cut[cut::Internal_True], Is().EqualTo(2u)); + AssertThat(res->max_2level_cut[cut::All], Is().EqualTo(2u)); - AssertThat(adiar::is_canonical(res), Is().True()); + AssertThat(zdd_iscanonical(res), Is().True()); AssertThat(res->number_of_terminals[false], Is().EqualTo(0u)); AssertThat(res->number_of_terminals[true], Is().EqualTo(2u)); @@ -604,14 +604,14 @@ go_bandit([]() { node_test_stream ns(res); AssertThat(ns.can_pull(), Is().True()); - AssertThat(ns.pull(), Is().EqualTo(node(2, zdd::MAX_ID, - node::ptr_t(true), - node::ptr_t(true)))); + AssertThat(ns.pull(), Is().EqualTo(node(2, zdd::max_id, + node::pointer_type(true), + node::pointer_type(true)))); AssertThat(ns.can_pull(), Is().True()); - AssertThat(ns.pull(), Is().EqualTo(node(0, zdd::MAX_ID, - node::ptr_t(2, zdd::MAX_ID), - node::ptr_t(2, zdd::MAX_ID)))); + AssertThat(ns.pull(), Is().EqualTo(node(0, zdd::max_id, + node::pointer_type(2, zdd::max_id), + node::pointer_type(2, zdd::max_id)))); AssertThat(ns.can_pull(), Is().False()); @@ -624,17 +624,17 @@ go_bandit([]() { AssertThat(res->width, Is().EqualTo(1u)); - AssertThat(res->max_1level_cut[cut_type::INTERNAL], Is().EqualTo(2u)); - AssertThat(res->max_1level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(2u)); - AssertThat(res->max_1level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(2u)); - AssertThat(res->max_1level_cut[cut_type::ALL], Is().EqualTo(2u)); + AssertThat(res->max_1level_cut[cut::Internal], Is().EqualTo(2u)); + AssertThat(res->max_1level_cut[cut::Internal_False], Is().EqualTo(2u)); + AssertThat(res->max_1level_cut[cut::Internal_True], Is().EqualTo(2u)); + AssertThat(res->max_1level_cut[cut::All], Is().EqualTo(2u)); - AssertThat(res->max_2level_cut[cut_type::INTERNAL], Is().EqualTo(2u)); - AssertThat(res->max_2level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(2u)); - AssertThat(res->max_2level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(2u)); - AssertThat(res->max_2level_cut[cut_type::ALL], Is().EqualTo(2u)); + AssertThat(res->max_2level_cut[cut::Internal], Is().EqualTo(2u)); + AssertThat(res->max_2level_cut[cut::Internal_False], Is().EqualTo(2u)); + AssertThat(res->max_2level_cut[cut::Internal_True], Is().EqualTo(2u)); + AssertThat(res->max_2level_cut[cut::All], Is().EqualTo(2u)); - AssertThat(adiar::is_canonical(res), Is().True()); + AssertThat(zdd_iscanonical(res), Is().True()); AssertThat(res->number_of_terminals[false], Is().EqualTo(0u)); AssertThat(res->number_of_terminals[true], Is().EqualTo(2u)); @@ -650,7 +650,7 @@ go_bandit([]() { describe("zdd_nithvar(i)", [&]() { { std::vector dom = { 0, 1, 2, 3 }; - adiar_set_domain(dom.begin(), dom.end()); + domain_set(dom.begin(), dom.end()); } it("constructs chain for i = 2 global dom = {0,1,2,3}", [&]() { @@ -659,19 +659,19 @@ go_bandit([]() { node_test_stream ns(res); AssertThat(ns.can_pull(), Is().True()); - AssertThat(ns.pull(), Is().EqualTo(node(3, node::MAX_ID, - node::ptr_t(true), - node::ptr_t(true)))); + AssertThat(ns.pull(), Is().EqualTo(node(3, node::max_id, + node::pointer_type(true), + node::pointer_type(true)))); AssertThat(ns.can_pull(), Is().True()); - AssertThat(ns.pull(), Is().EqualTo(node(1, node::MAX_ID, - node::ptr_t(3, node::MAX_ID), - node::ptr_t(3, node::MAX_ID)))); + AssertThat(ns.pull(), Is().EqualTo(node(1, node::max_id, + node::pointer_type(3, node::max_id), + node::pointer_type(3, node::max_id)))); AssertThat(ns.can_pull(), Is().True()); - AssertThat(ns.pull(), Is().EqualTo(node(0, node::MAX_ID, - node::ptr_t(1, node::MAX_ID), - node::ptr_t(1, node::MAX_ID)))); + AssertThat(ns.pull(), Is().EqualTo(node(0, node::max_id, + node::pointer_type(1, node::max_id), + node::pointer_type(1, node::max_id)))); AssertThat(ns.can_pull(), Is().False()); @@ -687,17 +687,17 @@ go_bandit([]() { AssertThat(res->width, Is().EqualTo(1u)); - AssertThat(res->max_1level_cut[cut_type::INTERNAL], Is().EqualTo(2u)); - AssertThat(res->max_1level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(2u)); - AssertThat(res->max_1level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(2u)); - AssertThat(res->max_1level_cut[cut_type::ALL], Is().EqualTo(2u)); + AssertThat(res->max_1level_cut[cut::Internal], Is().EqualTo(2u)); + AssertThat(res->max_1level_cut[cut::Internal_False], Is().EqualTo(2u)); + AssertThat(res->max_1level_cut[cut::Internal_True], Is().EqualTo(2u)); + AssertThat(res->max_1level_cut[cut::All], Is().EqualTo(2u)); - AssertThat(res->max_2level_cut[cut_type::INTERNAL], Is().EqualTo(2u)); - AssertThat(res->max_2level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(2u)); - AssertThat(res->max_2level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(2u)); - AssertThat(res->max_2level_cut[cut_type::ALL], Is().EqualTo(2u)); + AssertThat(res->max_2level_cut[cut::Internal], Is().EqualTo(2u)); + AssertThat(res->max_2level_cut[cut::Internal_False], Is().EqualTo(2u)); + AssertThat(res->max_2level_cut[cut::Internal_True], Is().EqualTo(2u)); + AssertThat(res->max_2level_cut[cut::All], Is().EqualTo(2u)); - AssertThat(adiar::is_canonical(res), Is().True()); + AssertThat(zdd_iscanonical(res), Is().True()); AssertThat(res->number_of_terminals[false], Is().EqualTo(0u)); AssertThat(res->number_of_terminals[true], Is().EqualTo(2u)); @@ -709,19 +709,19 @@ go_bandit([]() { node_test_stream ns(res); AssertThat(ns.can_pull(), Is().True()); - AssertThat(ns.pull(), Is().EqualTo(node(2, node::MAX_ID, - node::ptr_t(true), - node::ptr_t(true)))); + AssertThat(ns.pull(), Is().EqualTo(node(2, node::max_id, + node::pointer_type(true), + node::pointer_type(true)))); AssertThat(ns.can_pull(), Is().True()); - AssertThat(ns.pull(), Is().EqualTo(node(1, node::MAX_ID, - node::ptr_t(2, node::MAX_ID), - node::ptr_t(2, node::MAX_ID)))); + AssertThat(ns.pull(), Is().EqualTo(node(1, node::max_id, + node::pointer_type(2, node::max_id), + node::pointer_type(2, node::max_id)))); AssertThat(ns.can_pull(), Is().True()); - AssertThat(ns.pull(), Is().EqualTo(node(0, node::MAX_ID, - node::ptr_t(1, node::MAX_ID), - node::ptr_t(1, node::MAX_ID)))); + AssertThat(ns.pull(), Is().EqualTo(node(0, node::max_id, + node::pointer_type(1, node::max_id), + node::pointer_type(1, node::max_id)))); AssertThat(ns.can_pull(), Is().False()); @@ -737,17 +737,17 @@ go_bandit([]() { AssertThat(res->width, Is().EqualTo(1u)); - AssertThat(res->max_1level_cut[cut_type::INTERNAL], Is().EqualTo(2u)); - AssertThat(res->max_1level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(2u)); - AssertThat(res->max_1level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(2u)); - AssertThat(res->max_1level_cut[cut_type::ALL], Is().EqualTo(2u)); + AssertThat(res->max_1level_cut[cut::Internal], Is().EqualTo(2u)); + AssertThat(res->max_1level_cut[cut::Internal_False], Is().EqualTo(2u)); + AssertThat(res->max_1level_cut[cut::Internal_True], Is().EqualTo(2u)); + AssertThat(res->max_1level_cut[cut::All], Is().EqualTo(2u)); - AssertThat(res->max_2level_cut[cut_type::INTERNAL], Is().EqualTo(2u)); - AssertThat(res->max_2level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(2u)); - AssertThat(res->max_2level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(2u)); - AssertThat(res->max_2level_cut[cut_type::ALL], Is().EqualTo(2u)); + AssertThat(res->max_2level_cut[cut::Internal], Is().EqualTo(2u)); + AssertThat(res->max_2level_cut[cut::Internal_False], Is().EqualTo(2u)); + AssertThat(res->max_2level_cut[cut::Internal_True], Is().EqualTo(2u)); + AssertThat(res->max_2level_cut[cut::All], Is().EqualTo(2u)); - AssertThat(adiar::is_canonical(res), Is().True()); + AssertThat(zdd_iscanonical(res), Is().True()); AssertThat(res->number_of_terminals[false], Is().EqualTo(0u)); AssertThat(res->number_of_terminals[true], Is().EqualTo(2u)); @@ -759,19 +759,19 @@ go_bandit([]() { node_test_stream ns(res); AssertThat(ns.can_pull(), Is().True()); - AssertThat(ns.pull(), Is().EqualTo(node(3, node::MAX_ID, - node::ptr_t(true), - node::ptr_t(true)))); + AssertThat(ns.pull(), Is().EqualTo(node(3, node::max_id, + node::pointer_type(true), + node::pointer_type(true)))); AssertThat(ns.can_pull(), Is().True()); - AssertThat(ns.pull(), Is().EqualTo(node(2, node::MAX_ID, - node::ptr_t(3, node::MAX_ID), - node::ptr_t(3, node::MAX_ID)))); + AssertThat(ns.pull(), Is().EqualTo(node(2, node::max_id, + node::pointer_type(3, node::max_id), + node::pointer_type(3, node::max_id)))); AssertThat(ns.can_pull(), Is().True()); - AssertThat(ns.pull(), Is().EqualTo(node(1, node::MAX_ID, - node::ptr_t(2, node::MAX_ID), - node::ptr_t(2, node::MAX_ID)))); + AssertThat(ns.pull(), Is().EqualTo(node(1, node::max_id, + node::pointer_type(2, node::max_id), + node::pointer_type(2, node::max_id)))); AssertThat(ns.can_pull(), Is().False()); @@ -787,17 +787,17 @@ go_bandit([]() { AssertThat(res->width, Is().EqualTo(1u)); - AssertThat(res->max_1level_cut[cut_type::INTERNAL], Is().EqualTo(2u)); - AssertThat(res->max_1level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(2u)); - AssertThat(res->max_1level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(2u)); - AssertThat(res->max_1level_cut[cut_type::ALL], Is().EqualTo(2u)); + AssertThat(res->max_1level_cut[cut::Internal], Is().EqualTo(2u)); + AssertThat(res->max_1level_cut[cut::Internal_False], Is().EqualTo(2u)); + AssertThat(res->max_1level_cut[cut::Internal_True], Is().EqualTo(2u)); + AssertThat(res->max_1level_cut[cut::All], Is().EqualTo(2u)); - AssertThat(res->max_2level_cut[cut_type::INTERNAL], Is().EqualTo(2u)); - AssertThat(res->max_2level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(2u)); - AssertThat(res->max_2level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(2u)); - AssertThat(res->max_2level_cut[cut_type::ALL], Is().EqualTo(2u)); + AssertThat(res->max_2level_cut[cut::Internal], Is().EqualTo(2u)); + AssertThat(res->max_2level_cut[cut::Internal_False], Is().EqualTo(2u)); + AssertThat(res->max_2level_cut[cut::Internal_True], Is().EqualTo(2u)); + AssertThat(res->max_2level_cut[cut::All], Is().EqualTo(2u)); - AssertThat(adiar::is_canonical(res), Is().True()); + AssertThat(zdd_iscanonical(res), Is().True()); AssertThat(res->number_of_terminals[false], Is().EqualTo(0u)); AssertThat(res->number_of_terminals[true], Is().EqualTo(2u)); @@ -825,17 +825,17 @@ go_bandit([]() { AssertThat(res->width, Is().EqualTo(0u)); - AssertThat(res->max_1level_cut[cut_type::INTERNAL], Is().EqualTo(0u)); - AssertThat(res->max_1level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(0u)); - AssertThat(res->max_1level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(1u)); - AssertThat(res->max_1level_cut[cut_type::ALL], Is().EqualTo(1u)); + AssertThat(res->max_1level_cut[cut::Internal], Is().EqualTo(0u)); + AssertThat(res->max_1level_cut[cut::Internal_False], Is().EqualTo(0u)); + AssertThat(res->max_1level_cut[cut::Internal_True], Is().EqualTo(1u)); + AssertThat(res->max_1level_cut[cut::All], Is().EqualTo(1u)); - AssertThat(res->max_2level_cut[cut_type::INTERNAL], Is().EqualTo(0u)); - AssertThat(res->max_2level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(0u)); - AssertThat(res->max_2level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(1u)); - AssertThat(res->max_2level_cut[cut_type::ALL], Is().EqualTo(1u)); + AssertThat(res->max_2level_cut[cut::Internal], Is().EqualTo(0u)); + AssertThat(res->max_2level_cut[cut::Internal_False], Is().EqualTo(0u)); + AssertThat(res->max_2level_cut[cut::Internal_True], Is().EqualTo(1u)); + AssertThat(res->max_2level_cut[cut::All], Is().EqualTo(1u)); - AssertThat(adiar::is_canonical(res), Is().True()); + AssertThat(zdd_iscanonical(res), Is().True()); AssertThat(res->number_of_terminals[false], Is().EqualTo(0u)); AssertThat(res->number_of_terminals[true], Is().EqualTo(1u)); @@ -848,7 +848,7 @@ go_bandit([]() { node_test_stream ns(res); AssertThat(ns.can_pull(), Is().True()); - AssertThat(ns.pull(), Is().EqualTo(node(42, node::MAX_ID, terminal_F, terminal_T))); + AssertThat(ns.pull(), Is().EqualTo(node(42, node::max_id, terminal_F, terminal_T))); AssertThat(ns.can_pull(), Is().False()); level_info_test_stream ms(res); @@ -860,17 +860,17 @@ go_bandit([]() { AssertThat(res->width, Is().EqualTo(1u)); - AssertThat(res->max_1level_cut[cut_type::INTERNAL], Is().EqualTo(1u)); - AssertThat(res->max_1level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(1u)); - AssertThat(res->max_1level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(1u)); - AssertThat(res->max_1level_cut[cut_type::ALL], Is().EqualTo(2u)); + AssertThat(res->max_1level_cut[cut::Internal], Is().EqualTo(1u)); + AssertThat(res->max_1level_cut[cut::Internal_False], Is().EqualTo(1u)); + AssertThat(res->max_1level_cut[cut::Internal_True], Is().EqualTo(1u)); + AssertThat(res->max_1level_cut[cut::All], Is().EqualTo(2u)); - AssertThat(res->max_2level_cut[cut_type::INTERNAL], Is().EqualTo(1u)); - AssertThat(res->max_2level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(1u)); - AssertThat(res->max_2level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(1u)); - AssertThat(res->max_2level_cut[cut_type::ALL], Is().EqualTo(2u)); + AssertThat(res->max_2level_cut[cut::Internal], Is().EqualTo(1u)); + AssertThat(res->max_2level_cut[cut::Internal_False], Is().EqualTo(1u)); + AssertThat(res->max_2level_cut[cut::Internal_True], Is().EqualTo(1u)); + AssertThat(res->max_2level_cut[cut::All], Is().EqualTo(2u)); - AssertThat(adiar::is_canonical(res), Is().True()); + AssertThat(zdd_iscanonical(res), Is().True()); AssertThat(res->number_of_terminals[false], Is().EqualTo(1u)); AssertThat(res->number_of_terminals[true], Is().EqualTo(1u)); @@ -883,11 +883,11 @@ go_bandit([]() { node_test_stream ns(res); AssertThat(ns.can_pull(), Is().True()); - AssertThat(ns.pull(), Is().EqualTo(node(5, node::MAX_ID, terminal_F, terminal_T))); + AssertThat(ns.pull(), Is().EqualTo(node(5, node::max_id, terminal_F, terminal_T))); AssertThat(ns.can_pull(), Is().True()); - AssertThat(ns.pull(), Is().EqualTo(node(2, node::MAX_ID, terminal_F, ptr_uint64(5, ptr_uint64::MAX_ID)))); + AssertThat(ns.pull(), Is().EqualTo(node(2, node::max_id, terminal_F, ptr_uint64(5, ptr_uint64::max_id)))); AssertThat(ns.can_pull(), Is().True()); - AssertThat(ns.pull(), Is().EqualTo(node(1, node::MAX_ID, terminal_F, ptr_uint64(2, ptr_uint64::MAX_ID)))); + AssertThat(ns.pull(), Is().EqualTo(node(1, node::max_id, terminal_F, ptr_uint64(2, ptr_uint64::max_id)))); AssertThat(ns.can_pull(), Is().False()); @@ -903,17 +903,17 @@ go_bandit([]() { AssertThat(res->width, Is().EqualTo(1u)); - AssertThat(res->max_1level_cut[cut_type::INTERNAL], Is().EqualTo(1u)); - AssertThat(res->max_1level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(3u)); - AssertThat(res->max_1level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(1u)); - AssertThat(res->max_1level_cut[cut_type::ALL], Is().EqualTo(4u)); + AssertThat(res->max_1level_cut[cut::Internal], Is().EqualTo(1u)); + AssertThat(res->max_1level_cut[cut::Internal_False], Is().EqualTo(3u)); + AssertThat(res->max_1level_cut[cut::Internal_True], Is().EqualTo(1u)); + AssertThat(res->max_1level_cut[cut::All], Is().EqualTo(4u)); - AssertThat(res->max_2level_cut[cut_type::INTERNAL], Is().EqualTo(1u)); - AssertThat(res->max_2level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(3u)); - AssertThat(res->max_2level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(1u)); - AssertThat(res->max_2level_cut[cut_type::ALL], Is().EqualTo(4u)); + AssertThat(res->max_2level_cut[cut::Internal], Is().EqualTo(1u)); + AssertThat(res->max_2level_cut[cut::Internal_False], Is().EqualTo(3u)); + AssertThat(res->max_2level_cut[cut::Internal_True], Is().EqualTo(1u)); + AssertThat(res->max_2level_cut[cut::All], Is().EqualTo(4u)); - AssertThat(adiar::is_canonical(res), Is().True()); + AssertThat(zdd_iscanonical(res), Is().True()); AssertThat(res->number_of_terminals[false], Is().EqualTo(3u)); AssertThat(res->number_of_terminals[true], Is().EqualTo(1u)); @@ -932,7 +932,7 @@ go_bandit([]() { node_test_stream ns(res); AssertThat(ns.can_pull(), Is().True()); - AssertThat(ns.pull(), Is().EqualTo(node(0, node::MAX_ID, terminal_F, terminal_T))); + AssertThat(ns.pull(), Is().EqualTo(node(0, node::max_id, terminal_F, terminal_T))); AssertThat(ns.can_pull(), Is().False()); level_info_test_stream ms(res); @@ -943,17 +943,17 @@ go_bandit([]() { AssertThat(res->width, Is().EqualTo(1u)); - AssertThat(res->max_1level_cut[cut_type::INTERNAL], Is().EqualTo(1u)); - AssertThat(res->max_1level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(1u)); - AssertThat(res->max_1level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(1u)); - AssertThat(res->max_1level_cut[cut_type::ALL], Is().EqualTo(2u)); + AssertThat(res->max_1level_cut[cut::Internal], Is().EqualTo(1u)); + AssertThat(res->max_1level_cut[cut::Internal_False], Is().EqualTo(1u)); + AssertThat(res->max_1level_cut[cut::Internal_True], Is().EqualTo(1u)); + AssertThat(res->max_1level_cut[cut::All], Is().EqualTo(2u)); - AssertThat(res->max_2level_cut[cut_type::INTERNAL], Is().EqualTo(1u)); - AssertThat(res->max_2level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(1u)); - AssertThat(res->max_2level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(1u)); - AssertThat(res->max_2level_cut[cut_type::ALL], Is().EqualTo(2u)); + AssertThat(res->max_2level_cut[cut::Internal], Is().EqualTo(1u)); + AssertThat(res->max_2level_cut[cut::Internal_False], Is().EqualTo(1u)); + AssertThat(res->max_2level_cut[cut::Internal_True], Is().EqualTo(1u)); + AssertThat(res->max_2level_cut[cut::All], Is().EqualTo(2u)); - AssertThat(adiar::is_canonical(res), Is().True()); + AssertThat(zdd_iscanonical(res), Is().True()); AssertThat(res->number_of_terminals[false], Is().EqualTo(1u)); AssertThat(res->number_of_terminals[true], Is().EqualTo(1u)); @@ -964,7 +964,7 @@ go_bandit([]() { node_test_stream ns(res); AssertThat(ns.can_pull(), Is().True()); - AssertThat(ns.pull(), Is().EqualTo(node(42, node::MAX_ID, terminal_F, terminal_T))); + AssertThat(ns.pull(), Is().EqualTo(node(42, node::max_id, terminal_F, terminal_T))); AssertThat(ns.can_pull(), Is().False()); level_info_test_stream ms(res); @@ -975,24 +975,24 @@ go_bandit([]() { AssertThat(res->width, Is().EqualTo(1u)); - AssertThat(res->max_1level_cut[cut_type::INTERNAL], Is().EqualTo(1u)); - AssertThat(res->max_1level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(1u)); - AssertThat(res->max_1level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(1u)); - AssertThat(res->max_1level_cut[cut_type::ALL], Is().EqualTo(2u)); + AssertThat(res->max_1level_cut[cut::Internal], Is().EqualTo(1u)); + AssertThat(res->max_1level_cut[cut::Internal_False], Is().EqualTo(1u)); + AssertThat(res->max_1level_cut[cut::Internal_True], Is().EqualTo(1u)); + AssertThat(res->max_1level_cut[cut::All], Is().EqualTo(2u)); - AssertThat(res->max_2level_cut[cut_type::INTERNAL], Is().EqualTo(1u)); - AssertThat(res->max_2level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(1u)); - AssertThat(res->max_2level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(1u)); - AssertThat(res->max_2level_cut[cut_type::ALL], Is().EqualTo(2u)); + AssertThat(res->max_2level_cut[cut::Internal], Is().EqualTo(1u)); + AssertThat(res->max_2level_cut[cut::Internal_False], Is().EqualTo(1u)); + AssertThat(res->max_2level_cut[cut::Internal_True], Is().EqualTo(1u)); + AssertThat(res->max_2level_cut[cut::All], Is().EqualTo(2u)); - AssertThat(adiar::is_canonical(res), Is().True()); + AssertThat(zdd_iscanonical(res), Is().True()); AssertThat(res->number_of_terminals[false], Is().EqualTo(1u)); AssertThat(res->number_of_terminals[true], Is().EqualTo(1u)); }); it("throws exception if the label is too large", [&]() { - AssertThrows(invalid_argument, zdd_singleton(zdd::MAX_LABEL+1)); + AssertThrows(invalid_argument, zdd_singleton(zdd::max_label+1)); }); }); @@ -1012,17 +1012,17 @@ go_bandit([]() { AssertThat(res->width, Is().EqualTo(0u)); - AssertThat(res->max_1level_cut[cut_type::INTERNAL], Is().EqualTo(0u)); - AssertThat(res->max_1level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(1u)); - AssertThat(res->max_1level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(0u)); - AssertThat(res->max_1level_cut[cut_type::ALL], Is().EqualTo(1u)); + AssertThat(res->max_1level_cut[cut::Internal], Is().EqualTo(0u)); + AssertThat(res->max_1level_cut[cut::Internal_False], Is().EqualTo(1u)); + AssertThat(res->max_1level_cut[cut::Internal_True], Is().EqualTo(0u)); + AssertThat(res->max_1level_cut[cut::All], Is().EqualTo(1u)); - AssertThat(res->max_2level_cut[cut_type::INTERNAL], Is().EqualTo(0u)); - AssertThat(res->max_2level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(1u)); - AssertThat(res->max_2level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(0u)); - AssertThat(res->max_2level_cut[cut_type::ALL], Is().EqualTo(1u)); + AssertThat(res->max_2level_cut[cut::Internal], Is().EqualTo(0u)); + AssertThat(res->max_2level_cut[cut::Internal_False], Is().EqualTo(1u)); + AssertThat(res->max_2level_cut[cut::Internal_True], Is().EqualTo(0u)); + AssertThat(res->max_2level_cut[cut::All], Is().EqualTo(1u)); - AssertThat(adiar::is_canonical(res), Is().True()); + AssertThat(zdd_iscanonical(res), Is().True()); AssertThat(res->number_of_terminals[false], Is().EqualTo(1u)); AssertThat(res->number_of_terminals[true], Is().EqualTo(0u)); @@ -1035,7 +1035,7 @@ go_bandit([]() { node_test_stream ns(res); AssertThat(ns.can_pull(), Is().True()); - AssertThat(ns.pull(), Is().EqualTo(node(42, node::MAX_ID, terminal_F, terminal_T))); + AssertThat(ns.pull(), Is().EqualTo(node(42, node::max_id, terminal_F, terminal_T))); AssertThat(ns.can_pull(), Is().False()); level_info_test_stream ms(res); @@ -1046,17 +1046,17 @@ go_bandit([]() { AssertThat(res->width, Is().EqualTo(1u)); - AssertThat(res->max_1level_cut[cut_type::INTERNAL], Is().EqualTo(1u)); - AssertThat(res->max_1level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(1u)); - AssertThat(res->max_1level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(1u)); - AssertThat(res->max_1level_cut[cut_type::ALL], Is().EqualTo(2u)); + AssertThat(res->max_1level_cut[cut::Internal], Is().EqualTo(1u)); + AssertThat(res->max_1level_cut[cut::Internal_False], Is().EqualTo(1u)); + AssertThat(res->max_1level_cut[cut::Internal_True], Is().EqualTo(1u)); + AssertThat(res->max_1level_cut[cut::All], Is().EqualTo(2u)); - AssertThat(res->max_2level_cut[cut_type::INTERNAL], Is().EqualTo(1u)); - AssertThat(res->max_2level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(1u)); - AssertThat(res->max_2level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(1u)); - AssertThat(res->max_2level_cut[cut_type::ALL], Is().EqualTo(2u)); + AssertThat(res->max_2level_cut[cut::Internal], Is().EqualTo(1u)); + AssertThat(res->max_2level_cut[cut::Internal_False], Is().EqualTo(1u)); + AssertThat(res->max_2level_cut[cut::Internal_True], Is().EqualTo(1u)); + AssertThat(res->max_2level_cut[cut::All], Is().EqualTo(2u)); - AssertThat(adiar::is_canonical(res), Is().True()); + AssertThat(zdd_iscanonical(res), Is().True()); AssertThat(res->number_of_terminals[false], Is().EqualTo(1u)); AssertThat(res->number_of_terminals[true], Is().EqualTo(1u)); @@ -1069,11 +1069,11 @@ go_bandit([]() { node_test_stream ns(res); AssertThat(ns.can_pull(), Is().True()); - AssertThat(ns.pull(), Is().EqualTo(node(5, node::MAX_ID, terminal_F, terminal_T))); + AssertThat(ns.pull(), Is().EqualTo(node(5, node::max_id, terminal_F, terminal_T))); AssertThat(ns.can_pull(), Is().True()); - AssertThat(ns.pull(), Is().EqualTo(node(2, node::MAX_ID, ptr_uint64(5, ptr_uint64::MAX_ID), terminal_T))); + AssertThat(ns.pull(), Is().EqualTo(node(2, node::max_id, ptr_uint64(5, ptr_uint64::max_id), terminal_T))); AssertThat(ns.can_pull(), Is().True()); - AssertThat(ns.pull(), Is().EqualTo(node(1, node::MAX_ID, ptr_uint64(2, ptr_uint64::MAX_ID), terminal_T))); + AssertThat(ns.pull(), Is().EqualTo(node(1, node::max_id, ptr_uint64(2, ptr_uint64::max_id), terminal_T))); AssertThat(ns.can_pull(), Is().False()); @@ -1089,17 +1089,17 @@ go_bandit([]() { AssertThat(res->width, Is().EqualTo(1u)); - AssertThat(res->max_1level_cut[cut_type::INTERNAL], Is().EqualTo(1u)); - AssertThat(res->max_1level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(1u)); - AssertThat(res->max_1level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(3u)); - AssertThat(res->max_1level_cut[cut_type::ALL], Is().EqualTo(4u)); + AssertThat(res->max_1level_cut[cut::Internal], Is().EqualTo(1u)); + AssertThat(res->max_1level_cut[cut::Internal_False], Is().EqualTo(1u)); + AssertThat(res->max_1level_cut[cut::Internal_True], Is().EqualTo(3u)); + AssertThat(res->max_1level_cut[cut::All], Is().EqualTo(4u)); - AssertThat(res->max_2level_cut[cut_type::INTERNAL], Is().EqualTo(1u)); - AssertThat(res->max_2level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(1u)); - AssertThat(res->max_2level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(3u)); - AssertThat(res->max_2level_cut[cut_type::ALL], Is().EqualTo(4u)); + AssertThat(res->max_2level_cut[cut::Internal], Is().EqualTo(1u)); + AssertThat(res->max_2level_cut[cut::Internal_False], Is().EqualTo(1u)); + AssertThat(res->max_2level_cut[cut::Internal_True], Is().EqualTo(3u)); + AssertThat(res->max_2level_cut[cut::All], Is().EqualTo(4u)); - AssertThat(adiar::is_canonical(res), Is().True()); + AssertThat(zdd_iscanonical(res), Is().True()); AssertThat(res->number_of_terminals[false], Is().EqualTo(1u)); AssertThat(res->number_of_terminals[true], Is().EqualTo(3u)); @@ -1132,10 +1132,10 @@ go_bandit([]() { AssertThat(res->width, Is().EqualTo(0u)); - AssertThat(res->max_1level_cut[cut_type::INTERNAL], Is().EqualTo(0u)); - AssertThat(res->max_1level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(0u)); - AssertThat(res->max_1level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(1u)); - AssertThat(res->max_1level_cut[cut_type::ALL], Is().EqualTo(1u)); + AssertThat(res->max_1level_cut[cut::Internal], Is().EqualTo(0u)); + AssertThat(res->max_1level_cut[cut::Internal_False], Is().EqualTo(0u)); + AssertThat(res->max_1level_cut[cut::Internal_True], Is().EqualTo(1u)); + AssertThat(res->max_1level_cut[cut::All], Is().EqualTo(1u)); AssertThat(res->number_of_terminals[false], Is().EqualTo(0u)); AssertThat(res->number_of_terminals[true], Is().EqualTo(1u)); @@ -1148,7 +1148,7 @@ go_bandit([]() { node_test_stream ns(res); AssertThat(ns.can_pull(), Is().True()); - AssertThat(ns.pull(), Is().EqualTo(node(42, node::MAX_ID, terminal_T, terminal_T))); + AssertThat(ns.pull(), Is().EqualTo(node(42, node::max_id, terminal_T, terminal_T))); AssertThat(ns.can_pull(), Is().False()); level_info_test_stream ms(res); @@ -1159,17 +1159,17 @@ go_bandit([]() { AssertThat(res->width, Is().EqualTo(1u)); - AssertThat(res->max_1level_cut[cut_type::INTERNAL], Is().EqualTo(1u)); - AssertThat(res->max_1level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(1u)); - AssertThat(res->max_1level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(2u)); - AssertThat(res->max_1level_cut[cut_type::ALL], Is().EqualTo(2u)); + AssertThat(res->max_1level_cut[cut::Internal], Is().EqualTo(1u)); + AssertThat(res->max_1level_cut[cut::Internal_False], Is().EqualTo(1u)); + AssertThat(res->max_1level_cut[cut::Internal_True], Is().EqualTo(2u)); + AssertThat(res->max_1level_cut[cut::All], Is().EqualTo(2u)); - AssertThat(res->max_2level_cut[cut_type::INTERNAL], Is().EqualTo(1u)); - AssertThat(res->max_2level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(1u)); - AssertThat(res->max_2level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(2u)); - AssertThat(res->max_2level_cut[cut_type::ALL], Is().EqualTo(2u)); + AssertThat(res->max_2level_cut[cut::Internal], Is().EqualTo(1u)); + AssertThat(res->max_2level_cut[cut::Internal_False], Is().EqualTo(1u)); + AssertThat(res->max_2level_cut[cut::Internal_True], Is().EqualTo(2u)); + AssertThat(res->max_2level_cut[cut::All], Is().EqualTo(2u)); - AssertThat(adiar::is_canonical(res), Is().True()); + AssertThat(zdd_iscanonical(res), Is().True()); AssertThat(res->number_of_terminals[false], Is().EqualTo(0u)); AssertThat(res->number_of_terminals[true], Is().EqualTo(2u)); @@ -1182,15 +1182,15 @@ go_bandit([]() { node_test_stream ns(res); AssertThat(ns.can_pull(), Is().True()); - AssertThat(ns.pull(), Is().EqualTo(node(5, node::MAX_ID, terminal_T, terminal_T))); + AssertThat(ns.pull(), Is().EqualTo(node(5, node::max_id, terminal_T, terminal_T))); AssertThat(ns.can_pull(), Is().True()); - AssertThat(ns.pull(), Is().EqualTo(node(2, node::MAX_ID, - ptr_uint64(5, ptr_uint64::MAX_ID), - ptr_uint64(5, ptr_uint64::MAX_ID)))); + AssertThat(ns.pull(), Is().EqualTo(node(2, node::max_id, + ptr_uint64(5, ptr_uint64::max_id), + ptr_uint64(5, ptr_uint64::max_id)))); AssertThat(ns.can_pull(), Is().True()); - AssertThat(ns.pull(), Is().EqualTo(node(1, node::MAX_ID, - ptr_uint64(2, ptr_uint64::MAX_ID), - ptr_uint64(2, ptr_uint64::MAX_ID)))); + AssertThat(ns.pull(), Is().EqualTo(node(1, node::max_id, + ptr_uint64(2, ptr_uint64::max_id), + ptr_uint64(2, ptr_uint64::max_id)))); AssertThat(ns.can_pull(), Is().False()); @@ -1206,17 +1206,17 @@ go_bandit([]() { AssertThat(res->width, Is().EqualTo(1u)); - AssertThat(res->max_1level_cut[cut_type::INTERNAL], Is().EqualTo(2u)); - AssertThat(res->max_1level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(2u)); - AssertThat(res->max_1level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(2u)); - AssertThat(res->max_1level_cut[cut_type::ALL], Is().EqualTo(2u)); + AssertThat(res->max_1level_cut[cut::Internal], Is().EqualTo(2u)); + AssertThat(res->max_1level_cut[cut::Internal_False], Is().EqualTo(2u)); + AssertThat(res->max_1level_cut[cut::Internal_True], Is().EqualTo(2u)); + AssertThat(res->max_1level_cut[cut::All], Is().EqualTo(2u)); - AssertThat(res->max_2level_cut[cut_type::INTERNAL], Is().EqualTo(2u)); - AssertThat(res->max_2level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(2u)); - AssertThat(res->max_2level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(2u)); - AssertThat(res->max_2level_cut[cut_type::ALL], Is().EqualTo(2u)); + AssertThat(res->max_2level_cut[cut::Internal], Is().EqualTo(2u)); + AssertThat(res->max_2level_cut[cut::Internal_False], Is().EqualTo(2u)); + AssertThat(res->max_2level_cut[cut::Internal_True], Is().EqualTo(2u)); + AssertThat(res->max_2level_cut[cut::All], Is().EqualTo(2u)); - AssertThat(adiar::is_canonical(res), Is().True()); + AssertThat(zdd_iscanonical(res), Is().True()); AssertThat(res->number_of_terminals[false], Is().EqualTo(0u)); AssertThat(res->number_of_terminals[true], Is().EqualTo(2u)); @@ -1245,17 +1245,17 @@ go_bandit([]() { AssertThat(res->width, Is().EqualTo(0u)); - AssertThat(res->max_1level_cut[cut_type::INTERNAL], Is().EqualTo(0u)); - AssertThat(res->max_1level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(1u)); - AssertThat(res->max_1level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(0u)); - AssertThat(res->max_1level_cut[cut_type::ALL], Is().EqualTo(1u)); + AssertThat(res->max_1level_cut[cut::Internal], Is().EqualTo(0u)); + AssertThat(res->max_1level_cut[cut::Internal_False], Is().EqualTo(1u)); + AssertThat(res->max_1level_cut[cut::Internal_True], Is().EqualTo(0u)); + AssertThat(res->max_1level_cut[cut::All], Is().EqualTo(1u)); - AssertThat(res->max_2level_cut[cut_type::INTERNAL], Is().EqualTo(0u)); - AssertThat(res->max_2level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(1u)); - AssertThat(res->max_2level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(0u)); - AssertThat(res->max_2level_cut[cut_type::ALL], Is().EqualTo(1u)); + AssertThat(res->max_2level_cut[cut::Internal], Is().EqualTo(0u)); + AssertThat(res->max_2level_cut[cut::Internal_False], Is().EqualTo(1u)); + AssertThat(res->max_2level_cut[cut::Internal_True], Is().EqualTo(0u)); + AssertThat(res->max_2level_cut[cut::All], Is().EqualTo(1u)); - AssertThat(adiar::is_canonical(res), Is().True()); + AssertThat(zdd_iscanonical(res), Is().True()); AssertThat(res->number_of_terminals[false], Is().EqualTo(1u)); AssertThat(res->number_of_terminals[true], Is().EqualTo(0u)); @@ -1276,25 +1276,25 @@ go_bandit([]() { AssertThat(res->width, Is().EqualTo(0u)); - AssertThat(res->max_1level_cut[cut_type::INTERNAL], Is().EqualTo(0u)); - AssertThat(res->max_1level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(1u)); - AssertThat(res->max_1level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(0u)); - AssertThat(res->max_1level_cut[cut_type::ALL], Is().EqualTo(1u)); + AssertThat(res->max_1level_cut[cut::Internal], Is().EqualTo(0u)); + AssertThat(res->max_1level_cut[cut::Internal_False], Is().EqualTo(1u)); + AssertThat(res->max_1level_cut[cut::Internal_True], Is().EqualTo(0u)); + AssertThat(res->max_1level_cut[cut::All], Is().EqualTo(1u)); - AssertThat(res->max_2level_cut[cut_type::INTERNAL], Is().EqualTo(0u)); - AssertThat(res->max_2level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(1u)); - AssertThat(res->max_2level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(0u)); - AssertThat(res->max_2level_cut[cut_type::ALL], Is().EqualTo(1u)); + AssertThat(res->max_2level_cut[cut::Internal], Is().EqualTo(0u)); + AssertThat(res->max_2level_cut[cut::Internal_False], Is().EqualTo(1u)); + AssertThat(res->max_2level_cut[cut::Internal_True], Is().EqualTo(0u)); + AssertThat(res->max_2level_cut[cut::All], Is().EqualTo(1u)); - AssertThat(adiar::is_canonical(res), Is().True()); + AssertThat(zdd_iscanonical(res), Is().True()); AssertThat(res->number_of_terminals[false], Is().EqualTo(1u)); AssertThat(res->number_of_terminals[true], Is().EqualTo(0u)); }); it("is Ø when there is no global domain", [&]() { - adiar_unset_domain(); - AssertThat(adiar_has_domain(), Is().False()); + domain_unset(); + AssertThat(domain_isset(), Is().False()); zdd res = zdd_bot(); node_test_stream ns(res); @@ -1308,25 +1308,25 @@ go_bandit([]() { AssertThat(res->width, Is().EqualTo(0u)); - AssertThat(res->max_1level_cut[cut_type::INTERNAL], Is().EqualTo(0u)); - AssertThat(res->max_1level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(1u)); - AssertThat(res->max_1level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(0u)); - AssertThat(res->max_1level_cut[cut_type::ALL], Is().EqualTo(1u)); + AssertThat(res->max_1level_cut[cut::Internal], Is().EqualTo(0u)); + AssertThat(res->max_1level_cut[cut::Internal_False], Is().EqualTo(1u)); + AssertThat(res->max_1level_cut[cut::Internal_True], Is().EqualTo(0u)); + AssertThat(res->max_1level_cut[cut::All], Is().EqualTo(1u)); - AssertThat(res->max_2level_cut[cut_type::INTERNAL], Is().EqualTo(0u)); - AssertThat(res->max_2level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(1u)); - AssertThat(res->max_2level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(0u)); - AssertThat(res->max_2level_cut[cut_type::ALL], Is().EqualTo(1u)); + AssertThat(res->max_2level_cut[cut::Internal], Is().EqualTo(0u)); + AssertThat(res->max_2level_cut[cut::Internal_False], Is().EqualTo(1u)); + AssertThat(res->max_2level_cut[cut::Internal_True], Is().EqualTo(0u)); + AssertThat(res->max_2level_cut[cut::All], Is().EqualTo(1u)); - AssertThat(adiar::is_canonical(res), Is().True()); + AssertThat(zdd_iscanonical(res), Is().True()); AssertThat(res->number_of_terminals[false], Is().EqualTo(1u)); AssertThat(res->number_of_terminals[true], Is().EqualTo(0u)); }); it("is Ø when there is a global domain", [&]() { - adiar_set_domain(3); - AssertThat(adiar_has_domain(), Is().True()); + domain_set(3); + AssertThat(domain_isset(), Is().True()); zdd res = zdd_bot(); node_test_stream ns(res); @@ -1340,17 +1340,17 @@ go_bandit([]() { AssertThat(res->width, Is().EqualTo(0u)); - AssertThat(res->max_1level_cut[cut_type::INTERNAL], Is().EqualTo(0u)); - AssertThat(res->max_1level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(1u)); - AssertThat(res->max_1level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(0u)); - AssertThat(res->max_1level_cut[cut_type::ALL], Is().EqualTo(1u)); + AssertThat(res->max_1level_cut[cut::Internal], Is().EqualTo(0u)); + AssertThat(res->max_1level_cut[cut::Internal_False], Is().EqualTo(1u)); + AssertThat(res->max_1level_cut[cut::Internal_True], Is().EqualTo(0u)); + AssertThat(res->max_1level_cut[cut::All], Is().EqualTo(1u)); - AssertThat(res->max_2level_cut[cut_type::INTERNAL], Is().EqualTo(0u)); - AssertThat(res->max_2level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(1u)); - AssertThat(res->max_2level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(0u)); - AssertThat(res->max_2level_cut[cut_type::ALL], Is().EqualTo(1u)); + AssertThat(res->max_2level_cut[cut::Internal], Is().EqualTo(0u)); + AssertThat(res->max_2level_cut[cut::Internal_False], Is().EqualTo(1u)); + AssertThat(res->max_2level_cut[cut::Internal_True], Is().EqualTo(0u)); + AssertThat(res->max_2level_cut[cut::All], Is().EqualTo(1u)); - AssertThat(adiar::is_canonical(res), Is().True()); + AssertThat(zdd_iscanonical(res), Is().True()); AssertThat(res->number_of_terminals[false], Is().EqualTo(1u)); AssertThat(res->number_of_terminals[true], Is().EqualTo(0u)); @@ -1373,17 +1373,17 @@ go_bandit([]() { AssertThat(res->width, Is().EqualTo(0u)); - AssertThat(res->max_1level_cut[cut_type::INTERNAL], Is().EqualTo(0u)); - AssertThat(res->max_1level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(0u)); - AssertThat(res->max_1level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(1u)); - AssertThat(res->max_1level_cut[cut_type::ALL], Is().EqualTo(1u)); + AssertThat(res->max_1level_cut[cut::Internal], Is().EqualTo(0u)); + AssertThat(res->max_1level_cut[cut::Internal_False], Is().EqualTo(0u)); + AssertThat(res->max_1level_cut[cut::Internal_True], Is().EqualTo(1u)); + AssertThat(res->max_1level_cut[cut::All], Is().EqualTo(1u)); - AssertThat(res->max_2level_cut[cut_type::INTERNAL], Is().EqualTo(0u)); - AssertThat(res->max_2level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(0u)); - AssertThat(res->max_2level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(1u)); - AssertThat(res->max_2level_cut[cut_type::ALL], Is().EqualTo(1u)); + AssertThat(res->max_2level_cut[cut::Internal], Is().EqualTo(0u)); + AssertThat(res->max_2level_cut[cut::Internal_False], Is().EqualTo(0u)); + AssertThat(res->max_2level_cut[cut::Internal_True], Is().EqualTo(1u)); + AssertThat(res->max_2level_cut[cut::All], Is().EqualTo(1u)); - AssertThat(adiar::is_canonical(res), Is().True()); + AssertThat(zdd_iscanonical(res), Is().True()); AssertThat(res->number_of_terminals[false], Is().EqualTo(0u)); AssertThat(res->number_of_terminals[true], Is().EqualTo(1u)); @@ -1397,19 +1397,19 @@ go_bandit([]() { node_test_stream ns(res); AssertThat(ns.can_pull(), Is().True()); - AssertThat(ns.pull(), Is().EqualTo(node(3, node::MAX_ID, terminal_T, terminal_T))); + AssertThat(ns.pull(), Is().EqualTo(node(3, node::max_id, terminal_T, terminal_T))); AssertThat(ns.can_pull(), Is().True()); - AssertThat(ns.pull(), Is().EqualTo(node(2, node::MAX_ID, - ptr_uint64(3, ptr_uint64::MAX_ID), - ptr_uint64(3, ptr_uint64::MAX_ID)))); + AssertThat(ns.pull(), Is().EqualTo(node(2, node::max_id, + ptr_uint64(3, ptr_uint64::max_id), + ptr_uint64(3, ptr_uint64::max_id)))); AssertThat(ns.can_pull(), Is().True()); - AssertThat(ns.pull(), Is().EqualTo(node(1, node::MAX_ID, - ptr_uint64(2, ptr_uint64::MAX_ID), - ptr_uint64(2, ptr_uint64::MAX_ID)))); + AssertThat(ns.pull(), Is().EqualTo(node(1, node::max_id, + ptr_uint64(2, ptr_uint64::max_id), + ptr_uint64(2, ptr_uint64::max_id)))); AssertThat(ns.can_pull(), Is().True()); - AssertThat(ns.pull(), Is().EqualTo(node(0, node::MAX_ID, - ptr_uint64(1, ptr_uint64::MAX_ID), - ptr_uint64(1, ptr_uint64::MAX_ID)))); + AssertThat(ns.pull(), Is().EqualTo(node(0, node::max_id, + ptr_uint64(1, ptr_uint64::max_id), + ptr_uint64(1, ptr_uint64::max_id)))); AssertThat(ns.can_pull(), Is().False()); @@ -1427,17 +1427,17 @@ go_bandit([]() { AssertThat(res->width, Is().EqualTo(1u)); - AssertThat(res->max_1level_cut[cut_type::INTERNAL], Is().EqualTo(2u)); - AssertThat(res->max_1level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(2u)); - AssertThat(res->max_1level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(2u)); - AssertThat(res->max_1level_cut[cut_type::ALL], Is().EqualTo(2u)); + AssertThat(res->max_1level_cut[cut::Internal], Is().EqualTo(2u)); + AssertThat(res->max_1level_cut[cut::Internal_False], Is().EqualTo(2u)); + AssertThat(res->max_1level_cut[cut::Internal_True], Is().EqualTo(2u)); + AssertThat(res->max_1level_cut[cut::All], Is().EqualTo(2u)); - AssertThat(res->max_2level_cut[cut_type::INTERNAL], Is().EqualTo(2u)); - AssertThat(res->max_2level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(2u)); - AssertThat(res->max_2level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(2u)); - AssertThat(res->max_2level_cut[cut_type::ALL], Is().EqualTo(2u)); + AssertThat(res->max_2level_cut[cut::Internal], Is().EqualTo(2u)); + AssertThat(res->max_2level_cut[cut::Internal_False], Is().EqualTo(2u)); + AssertThat(res->max_2level_cut[cut::Internal_True], Is().EqualTo(2u)); + AssertThat(res->max_2level_cut[cut::All], Is().EqualTo(2u)); - AssertThat(adiar::is_canonical(res), Is().True()); + AssertThat(zdd_iscanonical(res), Is().True()); AssertThat(res->number_of_terminals[false], Is().EqualTo(0u)); AssertThat(res->number_of_terminals[true], Is().EqualTo(2u)); @@ -1458,17 +1458,17 @@ go_bandit([]() { AssertThat(res->width, Is().EqualTo(0u)); - AssertThat(res->max_1level_cut[cut_type::INTERNAL], Is().EqualTo(0u)); - AssertThat(res->max_1level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(0u)); - AssertThat(res->max_1level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(1u)); - AssertThat(res->max_1level_cut[cut_type::ALL], Is().EqualTo(1u)); + AssertThat(res->max_1level_cut[cut::Internal], Is().EqualTo(0u)); + AssertThat(res->max_1level_cut[cut::Internal_False], Is().EqualTo(0u)); + AssertThat(res->max_1level_cut[cut::Internal_True], Is().EqualTo(1u)); + AssertThat(res->max_1level_cut[cut::All], Is().EqualTo(1u)); - AssertThat(res->max_2level_cut[cut_type::INTERNAL], Is().EqualTo(0u)); - AssertThat(res->max_2level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(0u)); - AssertThat(res->max_2level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(1u)); - AssertThat(res->max_2level_cut[cut_type::ALL], Is().EqualTo(1u)); + AssertThat(res->max_2level_cut[cut::Internal], Is().EqualTo(0u)); + AssertThat(res->max_2level_cut[cut::Internal_False], Is().EqualTo(0u)); + AssertThat(res->max_2level_cut[cut::Internal_True], Is().EqualTo(1u)); + AssertThat(res->max_2level_cut[cut::All], Is().EqualTo(1u)); - AssertThat(adiar::is_canonical(res), Is().True()); + AssertThat(zdd_iscanonical(res), Is().True()); AssertThat(res->number_of_terminals[false], Is().EqualTo(0u)); AssertThat(res->number_of_terminals[true], Is().EqualTo(1u)); @@ -1481,15 +1481,15 @@ go_bandit([]() { node_test_stream ns(res); AssertThat(ns.can_pull(), Is().True()); - AssertThat(ns.pull(), Is().EqualTo(node(4, node::MAX_ID, terminal_T, terminal_T))); + AssertThat(ns.pull(), Is().EqualTo(node(4, node::max_id, terminal_T, terminal_T))); AssertThat(ns.can_pull(), Is().True()); - AssertThat(ns.pull(), Is().EqualTo(node(2, node::MAX_ID, - ptr_uint64(4, ptr_uint64::MAX_ID), - ptr_uint64(4, ptr_uint64::MAX_ID)))); + AssertThat(ns.pull(), Is().EqualTo(node(2, node::max_id, + ptr_uint64(4, ptr_uint64::max_id), + ptr_uint64(4, ptr_uint64::max_id)))); AssertThat(ns.can_pull(), Is().True()); - AssertThat(ns.pull(), Is().EqualTo(node(0, node::MAX_ID, - ptr_uint64(2, ptr_uint64::MAX_ID), - ptr_uint64(2, ptr_uint64::MAX_ID)))); + AssertThat(ns.pull(), Is().EqualTo(node(0, node::max_id, + ptr_uint64(2, ptr_uint64::max_id), + ptr_uint64(2, ptr_uint64::max_id)))); AssertThat(ns.can_pull(), Is().False()); @@ -1505,25 +1505,25 @@ go_bandit([]() { AssertThat(res->width, Is().EqualTo(1u)); - AssertThat(res->max_1level_cut[cut_type::INTERNAL], Is().EqualTo(2u)); - AssertThat(res->max_1level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(2u)); - AssertThat(res->max_1level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(2u)); - AssertThat(res->max_1level_cut[cut_type::ALL], Is().EqualTo(2u)); + AssertThat(res->max_1level_cut[cut::Internal], Is().EqualTo(2u)); + AssertThat(res->max_1level_cut[cut::Internal_False], Is().EqualTo(2u)); + AssertThat(res->max_1level_cut[cut::Internal_True], Is().EqualTo(2u)); + AssertThat(res->max_1level_cut[cut::All], Is().EqualTo(2u)); - AssertThat(res->max_2level_cut[cut_type::INTERNAL], Is().EqualTo(2u)); - AssertThat(res->max_2level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(2u)); - AssertThat(res->max_2level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(2u)); - AssertThat(res->max_2level_cut[cut_type::ALL], Is().EqualTo(2u)); + AssertThat(res->max_2level_cut[cut::Internal], Is().EqualTo(2u)); + AssertThat(res->max_2level_cut[cut::Internal_False], Is().EqualTo(2u)); + AssertThat(res->max_2level_cut[cut::Internal_True], Is().EqualTo(2u)); + AssertThat(res->max_2level_cut[cut::All], Is().EqualTo(2u)); - AssertThat(adiar::is_canonical(res), Is().True()); + AssertThat(zdd_iscanonical(res), Is().True()); AssertThat(res->number_of_terminals[false], Is().EqualTo(0u)); AssertThat(res->number_of_terminals[true], Is().EqualTo(2u)); }); it("is { Ø } terminal when there is no global domain", [&]() { - adiar_unset_domain(); - AssertThat(adiar_has_domain(), Is().False()); + domain_unset(); + AssertThat(domain_isset(), Is().False()); zdd res = zdd_top(); node_test_stream ns(res); @@ -1537,35 +1537,35 @@ go_bandit([]() { AssertThat(res->width, Is().EqualTo(0u)); - AssertThat(res->max_1level_cut[cut_type::INTERNAL], Is().EqualTo(0u)); - AssertThat(res->max_1level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(0u)); - AssertThat(res->max_1level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(1u)); - AssertThat(res->max_1level_cut[cut_type::ALL], Is().EqualTo(1u)); + AssertThat(res->max_1level_cut[cut::Internal], Is().EqualTo(0u)); + AssertThat(res->max_1level_cut[cut::Internal_False], Is().EqualTo(0u)); + AssertThat(res->max_1level_cut[cut::Internal_True], Is().EqualTo(1u)); + AssertThat(res->max_1level_cut[cut::All], Is().EqualTo(1u)); - AssertThat(res->max_2level_cut[cut_type::INTERNAL], Is().EqualTo(0u)); - AssertThat(res->max_2level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(0u)); - AssertThat(res->max_2level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(1u)); - AssertThat(res->max_2level_cut[cut_type::ALL], Is().EqualTo(1u)); + AssertThat(res->max_2level_cut[cut::Internal], Is().EqualTo(0u)); + AssertThat(res->max_2level_cut[cut::Internal_False], Is().EqualTo(0u)); + AssertThat(res->max_2level_cut[cut::Internal_True], Is().EqualTo(1u)); + AssertThat(res->max_2level_cut[cut::All], Is().EqualTo(1u)); - AssertThat(adiar::is_canonical(res), Is().True()); + AssertThat(zdd_iscanonical(res), Is().True()); AssertThat(res->number_of_terminals[false], Is().EqualTo(0u)); AssertThat(res->number_of_terminals[true], Is().EqualTo(1u)); }); it("creates { Ø, {0}, {1}, {0,1}, {0,1} } from global domain", [&]() { - adiar_set_domain(2); - AssertThat(adiar_has_domain(), Is().True()); + domain_set(2); + AssertThat(domain_isset(), Is().True()); zdd res = zdd_top(); node_test_stream ns(res); AssertThat(ns.can_pull(), Is().True()); - AssertThat(ns.pull(), Is().EqualTo(node(1, node::MAX_ID, terminal_T, terminal_T))); + AssertThat(ns.pull(), Is().EqualTo(node(1, node::max_id, terminal_T, terminal_T))); AssertThat(ns.can_pull(), Is().True()); - AssertThat(ns.pull(), Is().EqualTo(node(0, node::MAX_ID, - ptr_uint64(1, ptr_uint64::MAX_ID), - ptr_uint64(1, ptr_uint64::MAX_ID)))); + AssertThat(ns.pull(), Is().EqualTo(node(0, node::max_id, + ptr_uint64(1, ptr_uint64::max_id), + ptr_uint64(1, ptr_uint64::max_id)))); AssertThat(ns.can_pull(), Is().False()); @@ -1579,17 +1579,17 @@ go_bandit([]() { AssertThat(res->width, Is().EqualTo(1u)); - AssertThat(res->max_1level_cut[cut_type::INTERNAL], Is().EqualTo(2u)); - AssertThat(res->max_1level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(2u)); - AssertThat(res->max_1level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(2u)); - AssertThat(res->max_1level_cut[cut_type::ALL], Is().EqualTo(2u)); + AssertThat(res->max_1level_cut[cut::Internal], Is().EqualTo(2u)); + AssertThat(res->max_1level_cut[cut::Internal_False], Is().EqualTo(2u)); + AssertThat(res->max_1level_cut[cut::Internal_True], Is().EqualTo(2u)); + AssertThat(res->max_1level_cut[cut::All], Is().EqualTo(2u)); - AssertThat(res->max_2level_cut[cut_type::INTERNAL], Is().EqualTo(2u)); - AssertThat(res->max_2level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(2u)); - AssertThat(res->max_2level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(2u)); - AssertThat(res->max_2level_cut[cut_type::ALL], Is().EqualTo(2u)); + AssertThat(res->max_2level_cut[cut::Internal], Is().EqualTo(2u)); + AssertThat(res->max_2level_cut[cut::Internal_False], Is().EqualTo(2u)); + AssertThat(res->max_2level_cut[cut::Internal_True], Is().EqualTo(2u)); + AssertThat(res->max_2level_cut[cut::All], Is().EqualTo(2u)); - AssertThat(adiar::is_canonical(res), Is().True()); + AssertThat(zdd_iscanonical(res), Is().True()); AssertThat(res->number_of_terminals[false], Is().EqualTo(0u)); AssertThat(res->number_of_terminals[true], Is().EqualTo(2u)); diff --git a/test/adiar/zdd/test_change.cpp b/test/adiar/zdd/test_change.cpp index 38cffbd7a..52140ec40 100644 --- a/test/adiar/zdd/test_change.cpp +++ b/test/adiar/zdd/test_change.cpp @@ -2,8 +2,8 @@ go_bandit([]() { describe("adiar/zdd/change.cpp", [&]() { - shared_levelized_file zdd_F; - shared_levelized_file zdd_T; + shared_levelized_file zdd_F; + shared_levelized_file zdd_T; { // Garbage collect writers to free write-lock node_writer nw_F(zdd_F); @@ -16,7 +16,7 @@ go_bandit([]() { const ptr_uint64 terminal_F = ptr_uint64(false); const ptr_uint64 terminal_T = ptr_uint64(true); - shared_levelized_file zdd_x0; + shared_levelized_file zdd_x0; /* // 1 ---- x0 // / \ @@ -24,10 +24,10 @@ go_bandit([]() { */ { // Garbage collect writers to free write-lock node_writer nw_0(zdd_x0); - nw_0 << node(0, node::MAX_ID, terminal_F, terminal_T); + nw_0 << node(0, node::max_id, terminal_F, terminal_T); } - shared_levelized_file zdd_x1; + shared_levelized_file zdd_x1; /* // 1 ---- x1 // / \ @@ -36,7 +36,7 @@ go_bandit([]() { { // Garbage collect writers to free write-lock node_writer nw_1(zdd_x1); - nw_1 << node(1, node::MAX_ID, terminal_F, terminal_T); + nw_1 << node(1, node::max_id, terminal_F, terminal_T); } /* @@ -50,13 +50,13 @@ go_bandit([]() { // / \ // F T */ - shared_levelized_file zdd_1; + shared_levelized_file zdd_1; - const node n1_5 = node(3, node::MAX_ID, terminal_F, terminal_T); - const node n1_4 = node(2, node::MAX_ID, terminal_T, terminal_T); - const node n1_3 = node(2, node::MAX_ID-1, n1_5.uid(), terminal_T); - const node n1_2 = node(1, node::MAX_ID, n1_3.uid(), n1_4.uid()); - const node n1_1 = node(0, node::MAX_ID, n1_2.uid(), n1_4.uid()); + const node n1_5 = node(3, node::max_id, terminal_F, terminal_T); + const node n1_4 = node(2, node::max_id, terminal_T, terminal_T); + const node n1_3 = node(2, node::max_id-1, n1_5.uid(), terminal_T); + const node n1_2 = node(1, node::max_id, n1_3.uid(), n1_4.uid()); + const node n1_1 = node(0, node::max_id, n1_2.uid(), n1_4.uid()); { // Garbage collect writers to free write-lock node_writer nw(zdd_1); @@ -72,28 +72,28 @@ go_bandit([]() { const std::vector vars = { }; __zdd out = zdd_change(zdd_F, vars.begin(), vars.end()); - AssertThat(out.get>(), Is().EqualTo(zdd_F)); + AssertThat(out.get>(), Is().EqualTo(zdd_F)); }); it("returns same file for { Ø } on empty labels", [&]() { const std::vector vars = { }; __zdd out = zdd_change(zdd_T, vars.begin(), vars.end()); - AssertThat(out.get>(), Is().EqualTo(zdd_T)); + AssertThat(out.get>(), Is().EqualTo(zdd_T)); }); it("returns same file for { {1} } on empty labels", [&]() { const std::vector vars = { }; __zdd out = zdd_change(zdd_x1, vars.begin(), vars.end()); - AssertThat(out.get>(), Is().EqualTo(zdd_x1)); + AssertThat(out.get>(), Is().EqualTo(zdd_x1)); }); it("returns same file for Ø on (1,2)", [&]() { const std::vector vars = { 1, 2 }; __zdd out = zdd_change(zdd_F, vars.begin(), vars.end()); - AssertThat(out.get>(), Is().EqualTo(zdd_F)); + AssertThat(out.get>(), Is().EqualTo(zdd_F)); }); it("returns { {1,2} } for { Ø } on (1,2)", [&]() { @@ -104,10 +104,10 @@ go_bandit([]() { node_test_stream ns(out); AssertThat(ns.can_pull(), Is().True()); - AssertThat(ns.pull(), Is().EqualTo(node(2, node::MAX_ID, terminal_F, terminal_T))); + AssertThat(ns.pull(), Is().EqualTo(node(2, node::max_id, terminal_F, terminal_T))); AssertThat(ns.can_pull(), Is().True()); - AssertThat(ns.pull(), Is().EqualTo(node(1, node::MAX_ID, terminal_F, ptr_uint64(2, ptr_uint64::MAX_ID)))); + AssertThat(ns.pull(), Is().EqualTo(node(1, node::max_id, terminal_F, ptr_uint64(2, ptr_uint64::max_id)))); AssertThat(ns.can_pull(), Is().False()); @@ -121,13 +121,13 @@ go_bandit([]() { AssertThat(levels.can_pull(), Is().False()); - AssertThat(out.get>()->max_1level_cut[cut_type::INTERNAL], Is().EqualTo(1u)); - AssertThat(out.get>()->max_1level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(2u)); - AssertThat(out.get>()->max_1level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(1u)); - AssertThat(out.get>()->max_1level_cut[cut_type::ALL], Is().EqualTo(3u)); + AssertThat(out.get>()->max_1level_cut[cut::Internal], Is().EqualTo(1u)); + AssertThat(out.get>()->max_1level_cut[cut::Internal_False], Is().EqualTo(2u)); + AssertThat(out.get>()->max_1level_cut[cut::Internal_True], Is().EqualTo(1u)); + AssertThat(out.get>()->max_1level_cut[cut::All], Is().EqualTo(3u)); - AssertThat(out.get>()->number_of_terminals[false], Is().EqualTo(2u)); - AssertThat(out.get>()->number_of_terminals[true], Is().EqualTo(1u)); + AssertThat(out.get>()->number_of_terminals[false], Is().EqualTo(2u)); + AssertThat(out.get>()->number_of_terminals[true], Is().EqualTo(1u)); }); it("adds new root for { {1} } on (0)", [&]() { @@ -163,18 +163,18 @@ go_bandit([]() { AssertThat(levels.can_pull(), Is().False()); - AssertThat(out.get<__zdd::shared_arcs_t>()->max_1level_cut, Is().GreaterThanOrEqualTo(1u)); + AssertThat(out.get<__zdd::shared_arc_file_type>()->max_1level_cut, Is().GreaterThanOrEqualTo(1u)); - AssertThat(out.get<__zdd::shared_arcs_t>()->number_of_terminals[false], Is().EqualTo(2u)); - AssertThat(out.get<__zdd::shared_arcs_t>()->number_of_terminals[true], Is().EqualTo(1u)); + AssertThat(out.get<__zdd::shared_arc_file_type>()->number_of_terminals[false], Is().EqualTo(2u)); + AssertThat(out.get<__zdd::shared_arc_file_type>()->number_of_terminals[true], Is().EqualTo(1u)); }); it("adds new root chain for { {2} } on (0,1)", [&]() { - shared_levelized_file in; + shared_levelized_file in; { // Garbage collect writer to free write-lock node_writer w(in); - w << node(2, node::MAX_ID, terminal_T, terminal_T); + w << node(2, node::max_id, terminal_T, terminal_T); } const std::vector vars = { 0, 1 }; @@ -218,10 +218,10 @@ go_bandit([]() { AssertThat(levels.can_pull(), Is().False()); - AssertThat(out.get<__zdd::shared_arcs_t>()->max_1level_cut, Is().GreaterThanOrEqualTo(1u)); + AssertThat(out.get<__zdd::shared_arc_file_type>()->max_1level_cut, Is().GreaterThanOrEqualTo(1u)); - AssertThat(out.get<__zdd::shared_arcs_t>()->number_of_terminals[false], Is().EqualTo(2u)); - AssertThat(out.get<__zdd::shared_arcs_t>()->number_of_terminals[true], Is().EqualTo(2u)); + AssertThat(out.get<__zdd::shared_arc_file_type>()->number_of_terminals[false], Is().EqualTo(2u)); + AssertThat(out.get<__zdd::shared_arc_file_type>()->number_of_terminals[true], Is().EqualTo(2u)); }); it("adds new nodes after root for { {1} } on (2,3)", [&]() { @@ -266,10 +266,10 @@ go_bandit([]() { AssertThat(levels.can_pull(), Is().False()); - AssertThat(out.get<__zdd::shared_arcs_t>()->max_1level_cut, Is().GreaterThanOrEqualTo(1u)); + AssertThat(out.get<__zdd::shared_arc_file_type>()->max_1level_cut, Is().GreaterThanOrEqualTo(1u)); - AssertThat(out.get<__zdd::shared_arcs_t>()->number_of_terminals[false], Is().EqualTo(3u)); - AssertThat(out.get<__zdd::shared_arcs_t>()->number_of_terminals[true], Is().EqualTo(1u)); + AssertThat(out.get<__zdd::shared_arc_file_type>()->number_of_terminals[false], Is().EqualTo(3u)); + AssertThat(out.get<__zdd::shared_arc_file_type>()->number_of_terminals[true], Is().EqualTo(1u)); }); it("adds a new node before and after root for { {1} } on (0,2)", [&]() { @@ -314,10 +314,10 @@ go_bandit([]() { AssertThat(levels.can_pull(), Is().False()); - AssertThat(out.get<__zdd::shared_arcs_t>()->max_1level_cut, Is().GreaterThanOrEqualTo(1u)); + AssertThat(out.get<__zdd::shared_arc_file_type>()->max_1level_cut, Is().GreaterThanOrEqualTo(1u)); - AssertThat(out.get<__zdd::shared_arcs_t>()->number_of_terminals[false], Is().EqualTo(3u)); - AssertThat(out.get<__zdd::shared_arcs_t>()->number_of_terminals[true], Is().EqualTo(1u)); + AssertThat(out.get<__zdd::shared_arc_file_type>()->number_of_terminals[false], Is().EqualTo(3u)); + AssertThat(out.get<__zdd::shared_arc_file_type>()->number_of_terminals[true], Is().EqualTo(1u)); }); it("adds new nodes before and after root for { {1} } on (0,2,4)", [&]() { @@ -371,19 +371,19 @@ go_bandit([]() { AssertThat(levels.can_pull(), Is().False()); - AssertThat(out.get<__zdd::shared_arcs_t>()->max_1level_cut, Is().GreaterThanOrEqualTo(1u)); + AssertThat(out.get<__zdd::shared_arc_file_type>()->max_1level_cut, Is().GreaterThanOrEqualTo(1u)); - AssertThat(out.get<__zdd::shared_arcs_t>()->number_of_terminals[false], Is().EqualTo(4u)); - AssertThat(out.get<__zdd::shared_arcs_t>()->number_of_terminals[true], Is().EqualTo(1u)); + AssertThat(out.get<__zdd::shared_arc_file_type>()->number_of_terminals[false], Is().EqualTo(4u)); + AssertThat(out.get<__zdd::shared_arc_file_type>()->number_of_terminals[true], Is().EqualTo(1u)); }); it("adds node between root and child for { {1}, {3} } on (2)", [&]() { - shared_levelized_file in; + shared_levelized_file in; { // Garbage collect writer to free write-lock node_writer w(in); - w << node(3, node::MAX_ID, terminal_F, terminal_T) - << node(1, node::MAX_ID, ptr_uint64(3, ptr_uint64::MAX_ID), terminal_T) + w << node(3, node::max_id, terminal_F, terminal_T) + << node(1, node::max_id, ptr_uint64(3, ptr_uint64::max_id), terminal_T) ; } @@ -434,10 +434,10 @@ go_bandit([]() { AssertThat(levels.can_pull(), Is().False()); - AssertThat(out.get<__zdd::shared_arcs_t>()->max_1level_cut, Is().GreaterThanOrEqualTo(2u)); + AssertThat(out.get<__zdd::shared_arc_file_type>()->max_1level_cut, Is().GreaterThanOrEqualTo(2u)); - AssertThat(out.get<__zdd::shared_arcs_t>()->number_of_terminals[false], Is().EqualTo(3u)); - AssertThat(out.get<__zdd::shared_arcs_t>()->number_of_terminals[true], Is().EqualTo(2u)); + AssertThat(out.get<__zdd::shared_arc_file_type>()->number_of_terminals[false], Is().EqualTo(3u)); + AssertThat(out.get<__zdd::shared_arc_file_type>()->number_of_terminals[true], Is().EqualTo(2u)); }); it("returns { Ø } for { {0} } on (0)", [&]() { @@ -456,13 +456,13 @@ go_bandit([]() { AssertThat(levels.can_pull(), Is().False()); - AssertThat(out.get>()->max_1level_cut[cut_type::INTERNAL], Is().EqualTo(0u)); - AssertThat(out.get>()->max_1level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(0u)); - AssertThat(out.get>()->max_1level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(1u)); - AssertThat(out.get>()->max_1level_cut[cut_type::ALL], Is().EqualTo(1u)); + AssertThat(out.get>()->max_1level_cut[cut::Internal], Is().EqualTo(0u)); + AssertThat(out.get>()->max_1level_cut[cut::Internal_False], Is().EqualTo(0u)); + AssertThat(out.get>()->max_1level_cut[cut::Internal_True], Is().EqualTo(1u)); + AssertThat(out.get>()->max_1level_cut[cut::All], Is().EqualTo(1u)); - AssertThat(out.get>()->number_of_terminals[false], Is().EqualTo(0u)); - AssertThat(out.get>()->number_of_terminals[true], Is().EqualTo(1u)); + AssertThat(out.get>()->number_of_terminals[false], Is().EqualTo(0u)); + AssertThat(out.get>()->number_of_terminals[true], Is().EqualTo(1u)); }); it("returns { Ø } for { {1} } on (1)", [&]() { @@ -481,22 +481,22 @@ go_bandit([]() { AssertThat(levels.can_pull(), Is().False()); - AssertThat(out.get>()->max_1level_cut[cut_type::INTERNAL], Is().EqualTo(0u)); - AssertThat(out.get>()->max_1level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(0u)); - AssertThat(out.get>()->max_1level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(1u)); - AssertThat(out.get>()->max_1level_cut[cut_type::ALL], Is().EqualTo(1u)); + AssertThat(out.get>()->max_1level_cut[cut::Internal], Is().EqualTo(0u)); + AssertThat(out.get>()->max_1level_cut[cut::Internal_False], Is().EqualTo(0u)); + AssertThat(out.get>()->max_1level_cut[cut::Internal_True], Is().EqualTo(1u)); + AssertThat(out.get>()->max_1level_cut[cut::All], Is().EqualTo(1u)); - AssertThat(out.get>()->number_of_terminals[false], Is().EqualTo(0u)); - AssertThat(out.get>()->number_of_terminals[true], Is().EqualTo(1u)); + AssertThat(out.get>()->number_of_terminals[false], Is().EqualTo(0u)); + AssertThat(out.get>()->number_of_terminals[true], Is().EqualTo(1u)); }); it("shortcuts root for { {0,1} } on (0)", [&]() { - shared_levelized_file in; + shared_levelized_file in; { // Garbage collect writer to free write-lock node_writer w(in); - w << node(1, node::MAX_ID, terminal_F, terminal_T) - << node(0, node::MAX_ID, terminal_F, ptr_uint64(1, ptr_uint64::MAX_ID)); + w << node(1, node::max_id, terminal_F, terminal_T) + << node(0, node::max_id, terminal_F, ptr_uint64(1, ptr_uint64::max_id)); } const std::vector vars = { 0 }; @@ -522,19 +522,19 @@ go_bandit([]() { AssertThat(levels.can_pull(), Is().False()); - AssertThat(out.get<__zdd::shared_arcs_t>()->max_1level_cut, Is().GreaterThanOrEqualTo(0u)); + AssertThat(out.get<__zdd::shared_arc_file_type>()->max_1level_cut, Is().GreaterThanOrEqualTo(0u)); - AssertThat(out.get<__zdd::shared_arcs_t>()->number_of_terminals[false], Is().EqualTo(1u)); - AssertThat(out.get<__zdd::shared_arcs_t>()->number_of_terminals[true], Is().EqualTo(1u)); + AssertThat(out.get<__zdd::shared_arc_file_type>()->number_of_terminals[false], Is().EqualTo(1u)); + AssertThat(out.get<__zdd::shared_arc_file_type>()->number_of_terminals[true], Is().EqualTo(1u)); }); it("shortcuts root for { {0,2} } on (0,1)", [&]() { - shared_levelized_file in; + shared_levelized_file in; { // Garbage collect writer to free write-lock node_writer w(in); - w << node(2, node::MAX_ID, terminal_F, terminal_T) - << node(0, node::MAX_ID, terminal_F, ptr_uint64(2, ptr_uint64::MAX_ID)); + w << node(2, node::max_id, terminal_F, terminal_T) + << node(0, node::max_id, terminal_F, ptr_uint64(2, ptr_uint64::max_id)); } const std::vector vars = { 0, 1 }; @@ -569,20 +569,20 @@ go_bandit([]() { AssertThat(levels.can_pull(), Is().False()); - AssertThat(out.get<__zdd::shared_arcs_t>()->max_1level_cut, Is().GreaterThanOrEqualTo(1u)); + AssertThat(out.get<__zdd::shared_arc_file_type>()->max_1level_cut, Is().GreaterThanOrEqualTo(1u)); - AssertThat(out.get<__zdd::shared_arcs_t>()->number_of_terminals[false], Is().EqualTo(2u)); - AssertThat(out.get<__zdd::shared_arcs_t>()->number_of_terminals[true], Is().EqualTo(1u)); + AssertThat(out.get<__zdd::shared_arc_file_type>()->number_of_terminals[false], Is().EqualTo(2u)); + AssertThat(out.get<__zdd::shared_arc_file_type>()->number_of_terminals[true], Is().EqualTo(1u)); }); it("shortcuts root and its child for { {0,2}, {0,2,3} } on (0,2)", [&]() { - shared_levelized_file in; + shared_levelized_file in; { // Garbage collect writer to free write-lock node_writer w(in); - w << node(3, node::MAX_ID, terminal_T, terminal_T) - << node(2, node::MAX_ID, terminal_F, ptr_uint64(3, ptr_uint64::MAX_ID)) - << node(0, node::MAX_ID, terminal_F, ptr_uint64(2, ptr_uint64::MAX_ID)); + w << node(3, node::max_id, terminal_T, terminal_T) + << node(2, node::max_id, terminal_F, ptr_uint64(3, ptr_uint64::max_id)) + << node(0, node::max_id, terminal_F, ptr_uint64(2, ptr_uint64::max_id)); } std::vector vars = { 0, 2 }; @@ -608,18 +608,18 @@ go_bandit([]() { AssertThat(levels.can_pull(), Is().False()); - AssertThat(out.get<__zdd::shared_arcs_t>()->max_1level_cut, Is().GreaterThanOrEqualTo(0u)); + AssertThat(out.get<__zdd::shared_arc_file_type>()->max_1level_cut, Is().GreaterThanOrEqualTo(0u)); - AssertThat(out.get<__zdd::shared_arcs_t>()->number_of_terminals[false], Is().EqualTo(0u)); - AssertThat(out.get<__zdd::shared_arcs_t>()->number_of_terminals[true], Is().EqualTo(2u)); + AssertThat(out.get<__zdd::shared_arc_file_type>()->number_of_terminals[false], Is().EqualTo(0u)); + AssertThat(out.get<__zdd::shared_arc_file_type>()->number_of_terminals[true], Is().EqualTo(2u)); }); it("flips root for { Ø, {0} } on (0)", [&]() { - shared_levelized_file in; + shared_levelized_file in; { // Garbage collect writer to free write-lock node_writer w(in); - w << node(0, node::MAX_ID, terminal_T, terminal_T); + w << node(0, node::max_id, terminal_T, terminal_T); } const std::vector vars = { 0 }; @@ -645,19 +645,19 @@ go_bandit([]() { AssertThat(levels.can_pull(), Is().False()); - AssertThat(out.get<__zdd::shared_arcs_t>()->max_1level_cut, Is().GreaterThanOrEqualTo(0u)); + AssertThat(out.get<__zdd::shared_arc_file_type>()->max_1level_cut, Is().GreaterThanOrEqualTo(0u)); - AssertThat(out.get<__zdd::shared_arcs_t>()->number_of_terminals[false], Is().EqualTo(0u)); - AssertThat(out.get<__zdd::shared_arcs_t>()->number_of_terminals[true], Is().EqualTo(2u)); + AssertThat(out.get<__zdd::shared_arc_file_type>()->number_of_terminals[false], Is().EqualTo(0u)); + AssertThat(out.get<__zdd::shared_arc_file_type>()->number_of_terminals[true], Is().EqualTo(2u)); }); it("flips root for { {0}, {1} } on (0)", [&]() { - shared_levelized_file in; + shared_levelized_file in; { // Garbage collect writer to free write-lock node_writer w(in); - w << node(1, node::MAX_ID, terminal_F, terminal_T) - << node(0, node::MAX_ID, ptr_uint64(1, ptr_uint64::MAX_ID), terminal_T); + w << node(1, node::max_id, terminal_F, terminal_T) + << node(0, node::max_id, ptr_uint64(1, ptr_uint64::max_id), terminal_T); } const std::vector vars = { 0 }; @@ -692,10 +692,10 @@ go_bandit([]() { AssertThat(levels.can_pull(), Is().False()); - AssertThat(out.get<__zdd::shared_arcs_t>()->max_1level_cut, Is().GreaterThanOrEqualTo(1u)); + AssertThat(out.get<__zdd::shared_arc_file_type>()->max_1level_cut, Is().GreaterThanOrEqualTo(1u)); - AssertThat(out.get<__zdd::shared_arcs_t>()->number_of_terminals[false], Is().EqualTo(1u)); - AssertThat(out.get<__zdd::shared_arcs_t>()->number_of_terminals[true], Is().EqualTo(2u)); + AssertThat(out.get<__zdd::shared_arc_file_type>()->number_of_terminals[false], Is().EqualTo(1u)); + AssertThat(out.get<__zdd::shared_arc_file_type>()->number_of_terminals[true], Is().EqualTo(2u)); }); it("flips root for [1] on (0)", [&]() { @@ -755,20 +755,20 @@ go_bandit([]() { AssertThat(levels.can_pull(), Is().False()); - AssertThat(out.get<__zdd::shared_arcs_t>()->max_1level_cut, Is().GreaterThanOrEqualTo(3u)); + AssertThat(out.get<__zdd::shared_arc_file_type>()->max_1level_cut, Is().GreaterThanOrEqualTo(3u)); - AssertThat(out.get<__zdd::shared_arcs_t>()->number_of_terminals[false], Is().EqualTo(1u)); - AssertThat(out.get<__zdd::shared_arcs_t>()->number_of_terminals[true], Is().EqualTo(4u)); + AssertThat(out.get<__zdd::shared_arc_file_type>()->number_of_terminals[false], Is().EqualTo(1u)); + AssertThat(out.get<__zdd::shared_arc_file_type>()->number_of_terminals[true], Is().EqualTo(4u)); }); it("flips node in the middle for { Ø, {0}, {1,2} } on (1)", [&]() { - shared_levelized_file in; + shared_levelized_file in; { // Garbage collect writer to free write-lock node_writer w(in); - w << node(2, node::MAX_ID, terminal_F, terminal_T) - << node(1, node::MAX_ID, terminal_T, ptr_uint64(2, ptr_uint64::MAX_ID)) - << node(0, node::MAX_ID, ptr_uint64(1, ptr_uint64::MAX_ID), terminal_T); + w << node(2, node::max_id, terminal_F, terminal_T) + << node(1, node::max_id, terminal_T, ptr_uint64(2, ptr_uint64::max_id)) + << node(0, node::max_id, ptr_uint64(1, ptr_uint64::max_id), terminal_T); } const std::vector vars = { 1 }; @@ -818,10 +818,10 @@ go_bandit([]() { AssertThat(levels.can_pull(), Is().False()); - AssertThat(out.get<__zdd::shared_arcs_t>()->max_1level_cut, Is().GreaterThanOrEqualTo(2u)); + AssertThat(out.get<__zdd::shared_arc_file_type>()->max_1level_cut, Is().GreaterThanOrEqualTo(2u)); - AssertThat(out.get<__zdd::shared_arcs_t>()->number_of_terminals[false], Is().EqualTo(2u)); - AssertThat(out.get<__zdd::shared_arcs_t>()->number_of_terminals[true], Is().EqualTo(3u)); + AssertThat(out.get<__zdd::shared_arc_file_type>()->number_of_terminals[false], Is().EqualTo(2u)); + AssertThat(out.get<__zdd::shared_arc_file_type>()->number_of_terminals[true], Is().EqualTo(3u)); }); it("flips and adds a node for [1] on (1)", [&]() { @@ -887,19 +887,19 @@ go_bandit([]() { AssertThat(levels.can_pull(), Is().False()); - AssertThat(out.get<__zdd::shared_arcs_t>()->max_1level_cut, Is().GreaterThanOrEqualTo(3u)); + AssertThat(out.get<__zdd::shared_arc_file_type>()->max_1level_cut, Is().GreaterThanOrEqualTo(3u)); - AssertThat(out.get<__zdd::shared_arcs_t>()->number_of_terminals[false], Is().EqualTo(2u)); - AssertThat(out.get<__zdd::shared_arcs_t>()->number_of_terminals[true], Is().EqualTo(4u)); + AssertThat(out.get<__zdd::shared_arc_file_type>()->number_of_terminals[false], Is().EqualTo(2u)); + AssertThat(out.get<__zdd::shared_arc_file_type>()->number_of_terminals[true], Is().EqualTo(4u)); }); it("collapses to a terminal for { {0,1} } on (0,1)", [&]() { - shared_levelized_file in; + shared_levelized_file in; { // Garbage collect writer to free write-lock node_writer w(in); - w << node(1, node::MAX_ID, terminal_F, terminal_T) - << node(0, node::MAX_ID, terminal_F, ptr_uint64(1, ptr_uint64::MAX_ID)); + w << node(1, node::max_id, terminal_F, terminal_T) + << node(0, node::max_id, terminal_F, ptr_uint64(1, ptr_uint64::max_id)); } const std::vector vars = { 0, 1 }; @@ -917,23 +917,23 @@ go_bandit([]() { AssertThat(levels.can_pull(), Is().False()); - AssertThat(out.get>()->max_1level_cut[cut_type::INTERNAL], Is().EqualTo(0u)); - AssertThat(out.get>()->max_1level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(0u)); - AssertThat(out.get>()->max_1level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(1u)); - AssertThat(out.get>()->max_1level_cut[cut_type::ALL], Is().EqualTo(1u)); + AssertThat(out.get>()->max_1level_cut[cut::Internal], Is().EqualTo(0u)); + AssertThat(out.get>()->max_1level_cut[cut::Internal_False], Is().EqualTo(0u)); + AssertThat(out.get>()->max_1level_cut[cut::Internal_True], Is().EqualTo(1u)); + AssertThat(out.get>()->max_1level_cut[cut::All], Is().EqualTo(1u)); - AssertThat(out.get>()->number_of_terminals[false], Is().EqualTo(0u)); - AssertThat(out.get>()->number_of_terminals[true], Is().EqualTo(1u)); + AssertThat(out.get>()->number_of_terminals[false], Is().EqualTo(0u)); + AssertThat(out.get>()->number_of_terminals[true], Is().EqualTo(1u)); }); it("bridges over a deleted node for { {0,1,2} } on (1)", [&]() { - shared_levelized_file in; + shared_levelized_file in; { // Garbage collect writer to free write-lock node_writer w(in); - w << node(2, node::MAX_ID, terminal_F, terminal_T) - << node(1, node::MAX_ID, terminal_F, ptr_uint64(2, ptr_uint64::MAX_ID)) - << node(0, node::MAX_ID, terminal_F, ptr_uint64(1, ptr_uint64::MAX_ID)) + w << node(2, node::max_id, terminal_F, terminal_T) + << node(1, node::max_id, terminal_F, ptr_uint64(2, ptr_uint64::max_id)) + << node(0, node::max_id, terminal_F, ptr_uint64(1, ptr_uint64::max_id)) ; } @@ -969,20 +969,20 @@ go_bandit([]() { AssertThat(levels.can_pull(), Is().False()); - AssertThat(out.get<__zdd::shared_arcs_t>()->max_1level_cut, Is().GreaterThanOrEqualTo(1u)); + AssertThat(out.get<__zdd::shared_arc_file_type>()->max_1level_cut, Is().GreaterThanOrEqualTo(1u)); - AssertThat(out.get<__zdd::shared_arcs_t>()->number_of_terminals[false], Is().EqualTo(2u)); - AssertThat(out.get<__zdd::shared_arcs_t>()->number_of_terminals[true], Is().EqualTo(1u)); + AssertThat(out.get<__zdd::shared_arc_file_type>()->number_of_terminals[false], Is().EqualTo(2u)); + AssertThat(out.get<__zdd::shared_arc_file_type>()->number_of_terminals[true], Is().EqualTo(1u)); }); it("bridges over a deleted node for { {1,2}, {0,1,2} } on (1)", [&]() { - shared_levelized_file in; + shared_levelized_file in; { // Garbage collect writer to free write-lock node_writer w(in); - w << node(2, node::MAX_ID, terminal_F, terminal_T) - << node(1, node::MAX_ID, terminal_F, ptr_uint64(2, ptr_uint64::MAX_ID)) - << node(0, node::MAX_ID, ptr_uint64(1, ptr_uint64::MAX_ID), ptr_uint64(1, ptr_uint64::MAX_ID)) + w << node(2, node::max_id, terminal_F, terminal_T) + << node(1, node::max_id, terminal_F, ptr_uint64(2, ptr_uint64::max_id)) + << node(0, node::max_id, ptr_uint64(1, ptr_uint64::max_id), ptr_uint64(1, ptr_uint64::max_id)) ; } @@ -1018,19 +1018,19 @@ go_bandit([]() { AssertThat(levels.can_pull(), Is().False()); - AssertThat(out.get<__zdd::shared_arcs_t>()->max_1level_cut, Is().GreaterThanOrEqualTo(2u)); + AssertThat(out.get<__zdd::shared_arc_file_type>()->max_1level_cut, Is().GreaterThanOrEqualTo(2u)); - AssertThat(out.get<__zdd::shared_arcs_t>()->number_of_terminals[false], Is().EqualTo(1u)); - AssertThat(out.get<__zdd::shared_arcs_t>()->number_of_terminals[true], Is().EqualTo(1u)); + AssertThat(out.get<__zdd::shared_arc_file_type>()->number_of_terminals[false], Is().EqualTo(1u)); + AssertThat(out.get<__zdd::shared_arc_file_type>()->number_of_terminals[true], Is().EqualTo(1u)); }); it("only adds a one node when cutting arcs to the same node for { {2}, {0,2} } on (1)", [&]() { - shared_levelized_file in; + shared_levelized_file in; { // Garbage collect writer to free write-lock node_writer w(in); - w << node(2, node::MAX_ID, terminal_F, terminal_T) - << node(0, node::MAX_ID, ptr_uint64(2, ptr_uint64::MAX_ID), ptr_uint64(2, ptr_uint64::MAX_ID)) + w << node(2, node::max_id, terminal_F, terminal_T) + << node(0, node::max_id, ptr_uint64(2, ptr_uint64::max_id), ptr_uint64(2, ptr_uint64::max_id)) ; } @@ -1075,10 +1075,10 @@ go_bandit([]() { AssertThat(levels.can_pull(), Is().False()); - AssertThat(out.get<__zdd::shared_arcs_t>()->max_1level_cut, Is().GreaterThanOrEqualTo(2u)); + AssertThat(out.get<__zdd::shared_arc_file_type>()->max_1level_cut, Is().GreaterThanOrEqualTo(2u)); - AssertThat(out.get<__zdd::shared_arcs_t>()->number_of_terminals[false], Is().EqualTo(2u)); - AssertThat(out.get<__zdd::shared_arcs_t>()->number_of_terminals[true], Is().EqualTo(1u)); + AssertThat(out.get<__zdd::shared_arc_file_type>()->number_of_terminals[false], Is().EqualTo(2u)); + AssertThat(out.get<__zdd::shared_arc_file_type>()->number_of_terminals[true], Is().EqualTo(1u)); }); it("bridges node before the last label and a terminal for { {0}, {1} } on (0,1)", [&]() { @@ -1094,12 +1094,12 @@ go_bandit([]() { // rather than the current level then this edge is by mistake placed into // the "cut edge with a new node" queue. */ - shared_levelized_file in; + shared_levelized_file in; { // Garbage collect writer to free write-lock node_writer w(in); - w << node(1, node::MAX_ID, terminal_F, terminal_T) - << node(0, node::MAX_ID, ptr_uint64(1, ptr_uint64::MAX_ID), terminal_T) + w << node(1, node::max_id, terminal_F, terminal_T) + << node(0, node::max_id, ptr_uint64(1, ptr_uint64::max_id), terminal_T) ; } @@ -1135,10 +1135,10 @@ go_bandit([]() { AssertThat(levels.can_pull(), Is().False()); - AssertThat(out.get<__zdd::shared_arcs_t>()->max_1level_cut, Is().GreaterThanOrEqualTo(1u)); + AssertThat(out.get<__zdd::shared_arc_file_type>()->max_1level_cut, Is().GreaterThanOrEqualTo(1u)); - AssertThat(out.get<__zdd::shared_arcs_t>()->number_of_terminals[false], Is().EqualTo(1u)); - AssertThat(out.get<__zdd::shared_arcs_t>()->number_of_terminals[true], Is().EqualTo(2u)); + AssertThat(out.get<__zdd::shared_arc_file_type>()->number_of_terminals[false], Is().EqualTo(1u)); + AssertThat(out.get<__zdd::shared_arc_file_type>()->number_of_terminals[true], Is().EqualTo(2u)); }); it("flips, adds and bridges nodes for [1] on (2,3)", [&]() { @@ -1212,14 +1212,14 @@ go_bandit([]() { AssertThat(levels.can_pull(), Is().False()); - AssertThat(out.get<__zdd::shared_arcs_t>()->max_1level_cut, Is().GreaterThanOrEqualTo(3u)); + AssertThat(out.get<__zdd::shared_arc_file_type>()->max_1level_cut, Is().GreaterThanOrEqualTo(3u)); - AssertThat(out.get<__zdd::shared_arcs_t>()->number_of_terminals[false], Is().EqualTo(1u)); - AssertThat(out.get<__zdd::shared_arcs_t>()->number_of_terminals[true], Is().EqualTo(2u)); + AssertThat(out.get<__zdd::shared_arc_file_type>()->number_of_terminals[false], Is().EqualTo(1u)); + AssertThat(out.get<__zdd::shared_arc_file_type>()->number_of_terminals[true], Is().EqualTo(2u)); }); it("correctly connects pre-root chain with skipped root for { { 1 }, { 1,2 } } on (0,1)", [&]() { - shared_levelized_file in; + shared_levelized_file in; /* // 1 ---- x1 // / \ @@ -1228,8 +1228,8 @@ go_bandit([]() { // T T */ - const node n2 = node(2, node::MAX_ID, terminal_T, terminal_T); - const node n1 = node(1, node::MAX_ID, terminal_F, n2.uid()); + const node n2 = node(2, node::max_id, terminal_T, terminal_T); + const node n1 = node(1, node::max_id, terminal_F, n2.uid()); { node_writer nw(in); @@ -1268,14 +1268,14 @@ go_bandit([]() { AssertThat(levels.can_pull(), Is().False()); - AssertThat(out.get<__zdd::shared_arcs_t>()->max_1level_cut, Is().GreaterThanOrEqualTo(1u)); + AssertThat(out.get<__zdd::shared_arc_file_type>()->max_1level_cut, Is().GreaterThanOrEqualTo(1u)); - AssertThat(out.get<__zdd::shared_arcs_t>()->number_of_terminals[false], Is().EqualTo(1u)); - AssertThat(out.get<__zdd::shared_arcs_t>()->number_of_terminals[true], Is().EqualTo(2u)); + AssertThat(out.get<__zdd::shared_arc_file_type>()->number_of_terminals[false], Is().EqualTo(1u)); + AssertThat(out.get<__zdd::shared_arc_file_type>()->number_of_terminals[true], Is().EqualTo(2u)); }); it("cuts collapse of root to a terminal for { { 0 } } on (0,1)", [&]() { - shared_levelized_file in; + shared_levelized_file in; /* // 1 ---- x0 // / \ @@ -1283,7 +1283,7 @@ go_bandit([]() { */ { // Garbage collect writer to free write-lock node_writer nw(in); - nw << node(0, node::MAX_ID, terminal_F, terminal_T); + nw << node(0, node::max_id, terminal_F, terminal_T); } const std::vector vars = { 0, 1 }; @@ -1309,14 +1309,14 @@ go_bandit([]() { AssertThat(levels.can_pull(), Is().False()); - AssertThat(out.get<__zdd::shared_arcs_t>()->max_1level_cut, Is().GreaterThanOrEqualTo(0u)); + AssertThat(out.get<__zdd::shared_arc_file_type>()->max_1level_cut, Is().GreaterThanOrEqualTo(0u)); - AssertThat(out.get<__zdd::shared_arcs_t>()->number_of_terminals[false], Is().EqualTo(1u)); - AssertThat(out.get<__zdd::shared_arcs_t>()->number_of_terminals[true], Is().EqualTo(1u)); + AssertThat(out.get<__zdd::shared_arc_file_type>()->number_of_terminals[false], Is().EqualTo(1u)); + AssertThat(out.get<__zdd::shared_arc_file_type>()->number_of_terminals[true], Is().EqualTo(1u)); }); it("cuts collapse to a terminal for { { 0,1 } } on (0,1,2)", [&]() { - shared_levelized_file in; + shared_levelized_file in; /* // 1 ---- x0 // / \ @@ -1326,8 +1326,8 @@ go_bandit([]() { */ { // Garbage collect writer to free write-lock node_writer nw(in); - nw << node(1, node::MAX_ID, terminal_F, terminal_T) - << node(0, node::MAX_ID, terminal_F, ptr_uint64(1, ptr_uint64::MAX_ID)); + nw << node(1, node::max_id, terminal_F, terminal_T) + << node(0, node::max_id, terminal_F, ptr_uint64(1, ptr_uint64::max_id)); } const std::vector vars = { 0, 1, 2 }; @@ -1353,14 +1353,14 @@ go_bandit([]() { AssertThat(levels.can_pull(), Is().False()); - AssertThat(out.get<__zdd::shared_arcs_t>()->max_1level_cut, Is().GreaterThanOrEqualTo(0u)); + AssertThat(out.get<__zdd::shared_arc_file_type>()->max_1level_cut, Is().GreaterThanOrEqualTo(0u)); - AssertThat(out.get<__zdd::shared_arcs_t>()->number_of_terminals[false], Is().EqualTo(1u)); - AssertThat(out.get<__zdd::shared_arcs_t>()->number_of_terminals[true], Is().EqualTo(1u)); + AssertThat(out.get<__zdd::shared_arc_file_type>()->number_of_terminals[false], Is().EqualTo(1u)); + AssertThat(out.get<__zdd::shared_arc_file_type>()->number_of_terminals[true], Is().EqualTo(1u)); }); it("keeps pre-root chain despite collapse to a terminal of the root for { { 1 } } on (0,1)", [&]() { - shared_levelized_file in; + shared_levelized_file in; /* // 1 ---- x1 // / \ @@ -1368,7 +1368,7 @@ go_bandit([]() { */ { // Garbage collect writer to free write-lock node_writer nw(in); - nw << node(1, node::MAX_ID, terminal_F, terminal_T); + nw << node(1, node::max_id, terminal_F, terminal_T); } const std::vector vars = { 0, 1 }; @@ -1394,10 +1394,10 @@ go_bandit([]() { AssertThat(levels.can_pull(), Is().False()); - AssertThat(out.get<__zdd::shared_arcs_t>()->max_1level_cut, Is().GreaterThanOrEqualTo(0u)); + AssertThat(out.get<__zdd::shared_arc_file_type>()->max_1level_cut, Is().GreaterThanOrEqualTo(0u)); - AssertThat(out.get<__zdd::shared_arcs_t>()->number_of_terminals[false], Is().EqualTo(1u)); - AssertThat(out.get<__zdd::shared_arcs_t>()->number_of_terminals[true], Is().EqualTo(1u)); + AssertThat(out.get<__zdd::shared_arc_file_type>()->number_of_terminals[false], Is().EqualTo(1u)); + AssertThat(out.get<__zdd::shared_arc_file_type>()->number_of_terminals[true], Is().EqualTo(1u)); }); }); }); diff --git a/test/adiar/zdd/test_complement.cpp b/test/adiar/zdd/test_complement.cpp index 2bc59430b..e1c012574 100644 --- a/test/adiar/zdd/test_complement.cpp +++ b/test/adiar/zdd/test_complement.cpp @@ -2,8 +2,8 @@ go_bandit([]() { describe("adiar/zdd/complement.cpp", []() { - shared_levelized_file zdd_F; - shared_levelized_file zdd_T; + shared_levelized_file zdd_F; + shared_levelized_file zdd_T; { // Garbage collect writers to free write-lock node_writer nw_F(zdd_F); @@ -16,7 +16,7 @@ go_bandit([]() { ptr_uint64 terminal_T = ptr_uint64(true); ptr_uint64 terminal_F = ptr_uint64(false); - shared_levelized_file zdd_pow_24; + shared_levelized_file zdd_pow_24; // { Ø, { 2 }, { 4 }, { 2,4 } } /* // 1 ---- x2 @@ -28,8 +28,8 @@ go_bandit([]() { // T T */ { // Garbage collect writer early - const node n2 = node(4, node::MAX_ID, terminal_T, terminal_T); - const node n1 = node(2, node::MAX_ID, n2.uid(), n2.uid()); + const node n2 = node(4, node::max_id, terminal_T, terminal_T); + const node n1 = node(2, node::max_id, n2.uid(), n2.uid()); node_writer nw(zdd_pow_24); nw << n2 << n1; @@ -47,14 +47,14 @@ go_bandit([]() { it("produces Ø on Ø and U = Ø", [&]() { __zdd out = zdd_complement(zdd_F, dom_empty.begin(), dom_empty.end()); - AssertThat(out.get>(), Is().EqualTo(zdd_F)); + AssertThat(out.get>(), Is().EqualTo(zdd_F)); AssertThat(out.negate, Is().False()); }); it("produces { Ø } on { Ø } and U = Ø", [&]() { __zdd out = zdd_complement(zdd_F, dom_empty.begin(), dom_empty.end()); - AssertThat(out.get>(), Is().EqualTo(zdd_F)); + AssertThat(out.get>(), Is().EqualTo(zdd_F)); AssertThat(out.negate, Is().False()); }); @@ -64,24 +64,24 @@ go_bandit([]() { node_test_stream ns(out); AssertThat(ns.can_pull(), Is().True()); - AssertThat(ns.pull(), Is().EqualTo(node(3, node::MAX_ID, + AssertThat(ns.pull(), Is().EqualTo(node(3, node::max_id, terminal_T, terminal_T))); AssertThat(ns.can_pull(), Is().True()); - AssertThat(ns.pull(), Is().EqualTo(node(2, node::MAX_ID, - ptr_uint64(3, ptr_uint64::MAX_ID), - ptr_uint64(3, ptr_uint64::MAX_ID)))); + AssertThat(ns.pull(), Is().EqualTo(node(2, node::max_id, + ptr_uint64(3, ptr_uint64::max_id), + ptr_uint64(3, ptr_uint64::max_id)))); AssertThat(ns.can_pull(), Is().True()); - AssertThat(ns.pull(), Is().EqualTo(node(1, node::MAX_ID, - ptr_uint64(2, ptr_uint64::MAX_ID), - ptr_uint64(2, ptr_uint64::MAX_ID)))); + AssertThat(ns.pull(), Is().EqualTo(node(1, node::max_id, + ptr_uint64(2, ptr_uint64::max_id), + ptr_uint64(2, ptr_uint64::max_id)))); AssertThat(ns.can_pull(), Is().True()); - AssertThat(ns.pull(), Is().EqualTo(node(0, node::MAX_ID, - ptr_uint64(1, ptr_uint64::MAX_ID), - ptr_uint64(1, ptr_uint64::MAX_ID)))); + AssertThat(ns.pull(), Is().EqualTo(node(0, node::max_id, + ptr_uint64(1, ptr_uint64::max_id), + ptr_uint64(1, ptr_uint64::max_id)))); AssertThat(ns.can_pull(), Is().False()); @@ -101,13 +101,13 @@ go_bandit([]() { AssertThat(levels.can_pull(), Is().False()); - AssertThat(out.get>()->max_1level_cut[cut_type::INTERNAL], Is().EqualTo(2u)); - AssertThat(out.get>()->max_1level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(2u)); - AssertThat(out.get>()->max_1level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(2u)); - AssertThat(out.get>()->max_1level_cut[cut_type::ALL], Is().EqualTo(2u)); + AssertThat(out.get>()->max_1level_cut[cut::Internal], Is().EqualTo(2u)); + AssertThat(out.get>()->max_1level_cut[cut::Internal_False], Is().EqualTo(2u)); + AssertThat(out.get>()->max_1level_cut[cut::Internal_True], Is().EqualTo(2u)); + AssertThat(out.get>()->max_1level_cut[cut::All], Is().EqualTo(2u)); - AssertThat(out.get>()->number_of_terminals[false], Is().EqualTo(0u)); - AssertThat(out.get>()->number_of_terminals[true], Is().EqualTo(2u)); + AssertThat(out.get>()->number_of_terminals[false], Is().EqualTo(0u)); + AssertThat(out.get>()->number_of_terminals[true], Is().EqualTo(2u)); }); it("produces pow(U) on F terminal and U = { 1, 2, 3, 4 }", [&]() { @@ -116,24 +116,24 @@ go_bandit([]() { node_test_stream ns(out); AssertThat(ns.can_pull(), Is().True()); - AssertThat(ns.pull(), Is().EqualTo(node(4, node::MAX_ID, + AssertThat(ns.pull(), Is().EqualTo(node(4, node::max_id, terminal_T, terminal_T))); AssertThat(ns.can_pull(), Is().True()); - AssertThat(ns.pull(), Is().EqualTo(node(3, node::MAX_ID, - ptr_uint64(4, ptr_uint64::MAX_ID), - ptr_uint64(4, ptr_uint64::MAX_ID)))); + AssertThat(ns.pull(), Is().EqualTo(node(3, node::max_id, + ptr_uint64(4, ptr_uint64::max_id), + ptr_uint64(4, ptr_uint64::max_id)))); AssertThat(ns.can_pull(), Is().True()); - AssertThat(ns.pull(), Is().EqualTo(node(2, node::MAX_ID, - ptr_uint64(3, ptr_uint64::MAX_ID), - ptr_uint64(3, ptr_uint64::MAX_ID)))); + AssertThat(ns.pull(), Is().EqualTo(node(2, node::max_id, + ptr_uint64(3, ptr_uint64::max_id), + ptr_uint64(3, ptr_uint64::max_id)))); AssertThat(ns.can_pull(), Is().True()); - AssertThat(ns.pull(), Is().EqualTo(node(1, node::MAX_ID, - ptr_uint64(2, ptr_uint64::MAX_ID), - ptr_uint64(2, ptr_uint64::MAX_ID)))); + AssertThat(ns.pull(), Is().EqualTo(node(1, node::max_id, + ptr_uint64(2, ptr_uint64::max_id), + ptr_uint64(2, ptr_uint64::max_id)))); AssertThat(ns.can_pull(), Is().False()); @@ -153,13 +153,13 @@ go_bandit([]() { AssertThat(levels.can_pull(), Is().False()); - AssertThat(out.get>()->max_1level_cut[cut_type::INTERNAL], Is().EqualTo(2u)); - AssertThat(out.get>()->max_1level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(2u)); - AssertThat(out.get>()->max_1level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(2u)); - AssertThat(out.get>()->max_1level_cut[cut_type::ALL], Is().EqualTo(2u)); + AssertThat(out.get>()->max_1level_cut[cut::Internal], Is().EqualTo(2u)); + AssertThat(out.get>()->max_1level_cut[cut::Internal_False], Is().EqualTo(2u)); + AssertThat(out.get>()->max_1level_cut[cut::Internal_True], Is().EqualTo(2u)); + AssertThat(out.get>()->max_1level_cut[cut::All], Is().EqualTo(2u)); - AssertThat(out.get>()->number_of_terminals[false], Is().EqualTo(0u)); - AssertThat(out.get>()->number_of_terminals[true], Is().EqualTo(2u)); + AssertThat(out.get>()->number_of_terminals[false], Is().EqualTo(0u)); + AssertThat(out.get>()->number_of_terminals[true], Is().EqualTo(2u)); }); it("produces pow(U) \\ Ø on T terminal and U = { 0, 2 }", [&]() { @@ -170,14 +170,14 @@ go_bandit([]() { node_test_stream ns(out); AssertThat(ns.can_pull(), Is().True()); - AssertThat(ns.pull(), Is().EqualTo(node(2, node::MAX_ID, + AssertThat(ns.pull(), Is().EqualTo(node(2, node::max_id, terminal_F, terminal_T))); AssertThat(ns.can_pull(), Is().True()); - AssertThat(ns.pull(), Is().EqualTo(node(0, node::MAX_ID, - ptr_uint64(2, ptr_uint64::MAX_ID), - ptr_uint64(2, ptr_uint64::MAX_ID)))); + AssertThat(ns.pull(), Is().EqualTo(node(0, node::max_id, + ptr_uint64(2, ptr_uint64::max_id), + ptr_uint64(2, ptr_uint64::max_id)))); AssertThat(ns.can_pull(), Is().False()); @@ -191,13 +191,13 @@ go_bandit([]() { AssertThat(levels.can_pull(), Is().False()); - AssertThat(out.get>()->max_1level_cut[cut_type::INTERNAL], Is().EqualTo(2u)); - AssertThat(out.get>()->max_1level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(2u)); - AssertThat(out.get>()->max_1level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(2u)); - AssertThat(out.get>()->max_1level_cut[cut_type::ALL], Is().EqualTo(2u)); + AssertThat(out.get>()->max_1level_cut[cut::Internal], Is().EqualTo(2u)); + AssertThat(out.get>()->max_1level_cut[cut::Internal_False], Is().EqualTo(2u)); + AssertThat(out.get>()->max_1level_cut[cut::Internal_True], Is().EqualTo(2u)); + AssertThat(out.get>()->max_1level_cut[cut::All], Is().EqualTo(2u)); - AssertThat(out.get>()->number_of_terminals[false], Is().EqualTo(1u)); - AssertThat(out.get>()->number_of_terminals[true], Is().EqualTo(1u)); + AssertThat(out.get>()->number_of_terminals[false], Is().EqualTo(1u)); + AssertThat(out.get>()->number_of_terminals[true], Is().EqualTo(1u)); }); it("produces pow(U) \\ Ø on T terminal and U = { 1, 2, 3, 4 }", [&]() { @@ -206,24 +206,24 @@ go_bandit([]() { node_test_stream ns(out); AssertThat(ns.can_pull(), Is().True()); - AssertThat(ns.pull(), Is().EqualTo(node(4, node::MAX_ID, + AssertThat(ns.pull(), Is().EqualTo(node(4, node::max_id, terminal_F, terminal_T))); AssertThat(ns.can_pull(), Is().True()); - AssertThat(ns.pull(), Is().EqualTo(node(3, node::MAX_ID, - ptr_uint64(4, ptr_uint64::MAX_ID), - ptr_uint64(4, ptr_uint64::MAX_ID)))); + AssertThat(ns.pull(), Is().EqualTo(node(3, node::max_id, + ptr_uint64(4, ptr_uint64::max_id), + ptr_uint64(4, ptr_uint64::max_id)))); AssertThat(ns.can_pull(), Is().True()); - AssertThat(ns.pull(), Is().EqualTo(node(2, node::MAX_ID, - ptr_uint64(3, ptr_uint64::MAX_ID), - ptr_uint64(3, ptr_uint64::MAX_ID)))); + AssertThat(ns.pull(), Is().EqualTo(node(2, node::max_id, + ptr_uint64(3, ptr_uint64::max_id), + ptr_uint64(3, ptr_uint64::max_id)))); AssertThat(ns.can_pull(), Is().True()); - AssertThat(ns.pull(), Is().EqualTo(node(1, node::MAX_ID, - ptr_uint64(2, ptr_uint64::MAX_ID), - ptr_uint64(2, ptr_uint64::MAX_ID)))); + AssertThat(ns.pull(), Is().EqualTo(node(1, node::max_id, + ptr_uint64(2, ptr_uint64::max_id), + ptr_uint64(2, ptr_uint64::max_id)))); AssertThat(ns.can_pull(), Is().False()); @@ -243,17 +243,17 @@ go_bandit([]() { AssertThat(levels.can_pull(), Is().False()); - AssertThat(out.get>()->max_1level_cut[cut_type::INTERNAL], Is().EqualTo(2u)); - AssertThat(out.get>()->max_1level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(2u)); - AssertThat(out.get>()->max_1level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(2u)); - AssertThat(out.get>()->max_1level_cut[cut_type::ALL], Is().EqualTo(2u)); + AssertThat(out.get>()->max_1level_cut[cut::Internal], Is().EqualTo(2u)); + AssertThat(out.get>()->max_1level_cut[cut::Internal_False], Is().EqualTo(2u)); + AssertThat(out.get>()->max_1level_cut[cut::Internal_True], Is().EqualTo(2u)); + AssertThat(out.get>()->max_1level_cut[cut::All], Is().EqualTo(2u)); - AssertThat(out.get>()->number_of_terminals[false], Is().EqualTo(1u)); - AssertThat(out.get>()->number_of_terminals[true], Is().EqualTo(1u)); + AssertThat(out.get>()->number_of_terminals[false], Is().EqualTo(1u)); + AssertThat(out.get>()->number_of_terminals[true], Is().EqualTo(1u)); }); it("adds out-of-set chain above root on { { 3 } } and U = { 0, 1, 2, 3 }", [&]() { - shared_levelized_file zdd_x3; + shared_levelized_file zdd_x3; { node_writer nw(zdd_x3); /* @@ -261,7 +261,7 @@ go_bandit([]() { // / \ // F T */ - nw << node(3, node::MAX_ID, terminal_F, terminal_T); + nw << node(3, node::max_id, terminal_F, terminal_T); } __zdd out = zdd_complement(zdd_x3, dom_0123.begin(), dom_0123.end()); @@ -341,17 +341,17 @@ go_bandit([]() { AssertThat(levels.can_pull(), Is().False()); - AssertThat(out.get<__zdd::shared_arcs_t>()->max_1level_cut, Is().EqualTo(4u)); + AssertThat(out.get<__zdd::shared_arc_file_type>()->max_1level_cut, Is().EqualTo(4u)); - AssertThat(out.get<__zdd::shared_arcs_t>()->number_of_terminals[false], Is().EqualTo(1u)); - AssertThat(out.get<__zdd::shared_arcs_t>()->number_of_terminals[true], Is().EqualTo(3u)); + AssertThat(out.get<__zdd::shared_arc_file_type>()->number_of_terminals[false], Is().EqualTo(1u)); + AssertThat(out.get<__zdd::shared_arc_file_type>()->number_of_terminals[true], Is().EqualTo(3u)); }); it("adds out-of-set chain above and below root on { { 2 } } and U = { 0, 1, 2, 3 }", [&]() { - shared_levelized_file zdd_x2; + shared_levelized_file zdd_x2; { node_writer nw(zdd_x2); - nw << node(2, node::MAX_ID, terminal_F, terminal_T); + nw << node(2, node::max_id, terminal_F, terminal_T); } __zdd out = zdd_complement(zdd_x2, dom_0123.begin(), dom_0123.end()); @@ -420,14 +420,14 @@ go_bandit([]() { AssertThat(levels.can_pull(), Is().False()); - AssertThat(out.get<__zdd::shared_arcs_t>()->max_1level_cut, Is().EqualTo(4u)); + AssertThat(out.get<__zdd::shared_arc_file_type>()->max_1level_cut, Is().EqualTo(4u)); - AssertThat(out.get<__zdd::shared_arcs_t>()->number_of_terminals[false], Is().EqualTo(1u)); - AssertThat(out.get<__zdd::shared_arcs_t>()->number_of_terminals[true], Is().EqualTo(3u)); + AssertThat(out.get<__zdd::shared_arc_file_type>()->number_of_terminals[false], Is().EqualTo(1u)); + AssertThat(out.get<__zdd::shared_arc_file_type>()->number_of_terminals[true], Is().EqualTo(3u)); }); it("adds out-of-set chain above and below root on { Ø, { 1 } } and U = { 1, 2, 3, 4 }", [&]() { - shared_levelized_file zdd_x1_null; + shared_levelized_file zdd_x1_null; /* // 1 ---- x1 // / \ @@ -435,7 +435,7 @@ go_bandit([]() { */ { node_writer nw(zdd_x1_null); - nw << node(1, node::MAX_ID, terminal_T, terminal_T); + nw << node(1, node::max_id, terminal_T, terminal_T); } __zdd out = zdd_complement(zdd_x1_null, dom_0123.begin(), dom_0123.end()); @@ -516,14 +516,14 @@ go_bandit([]() { AssertThat(levels.can_pull(), Is().False()); - AssertThat(out.get<__zdd::shared_arcs_t>()->max_1level_cut, Is().EqualTo(4u)); + AssertThat(out.get<__zdd::shared_arc_file_type>()->max_1level_cut, Is().EqualTo(4u)); - AssertThat(out.get<__zdd::shared_arcs_t>()->number_of_terminals[false], Is().EqualTo(1u)); - AssertThat(out.get<__zdd::shared_arcs_t>()->number_of_terminals[true], Is().EqualTo(3u)); + AssertThat(out.get<__zdd::shared_arc_file_type>()->number_of_terminals[false], Is().EqualTo(1u)); + AssertThat(out.get<__zdd::shared_arc_file_type>()->number_of_terminals[true], Is().EqualTo(3u)); }); it("computes U \\ { { 2 }, { 3 }, { 4 }, { 2,4 }, { 3,4 } } with U = { 1, 2, 3, 4 }", [&]() { - shared_levelized_file in; + shared_levelized_file in; // { { 2 }, { 3 }, { 4 }, { 2,4 }, { 3,4 } } /* // 1 ---- x2 @@ -535,10 +535,10 @@ go_bandit([]() { // F T T */ { // Garbage collect writer early - const node n4 = node(4, node::MAX_ID, terminal_T, terminal_T); - const node n3 = node(4, node::MAX_ID-1, terminal_F, terminal_T); - const node n2 = node(3, node::MAX_ID, n3.uid(), n4.uid()); - const node n1 = node(2, node::MAX_ID, n2.uid(), n4.uid()); + const node n4 = node(4, node::max_id, terminal_T, terminal_T); + const node n3 = node(4, node::max_id-1, terminal_F, terminal_T); + const node n2 = node(3, node::max_id, n3.uid(), n4.uid()); + const node n1 = node(2, node::max_id, n2.uid(), n4.uid()); node_writer nw(in); nw << n4 << n3 << n2 << n1; @@ -631,14 +631,14 @@ go_bandit([]() { AssertThat(levels.can_pull(), Is().False()); - AssertThat(out.get<__zdd::shared_arcs_t>()->max_1level_cut, Is().EqualTo(6u)); + AssertThat(out.get<__zdd::shared_arc_file_type>()->max_1level_cut, Is().EqualTo(6u)); - AssertThat(out.get<__zdd::shared_arcs_t>()->number_of_terminals[false], Is().EqualTo(3u)); - AssertThat(out.get<__zdd::shared_arcs_t>()->number_of_terminals[true], Is().EqualTo(3u)); + AssertThat(out.get<__zdd::shared_arc_file_type>()->number_of_terminals[false], Is().EqualTo(3u)); + AssertThat(out.get<__zdd::shared_arc_file_type>()->number_of_terminals[true], Is().EqualTo(3u)); }); it("computes pow(U) \\ { Ø, { 1,2 }, { 2,3 }, { 2,4 }, { 1,2,3 }, { 1,2,4 } } with U = { 1, 2, 3, 4 }", [&]() { - shared_levelized_file in; + shared_levelized_file in; /* // _1_ ---- x1 // / \ @@ -651,13 +651,13 @@ go_bandit([]() { // F T T T */ { // Garbage collect writer early - const node n7 = node(4, node::MAX_ID, terminal_T, terminal_T); - const node n6 = node(4, node::MAX_ID-1, terminal_F, terminal_T); - const node n5 = node(3, node::MAX_ID, n7.uid(), terminal_T); - const node n4 = node(3, node::MAX_ID-1, n6.uid(), terminal_T); - const node n3 = node(2, node::MAX_ID, terminal_F, n5.uid()); - const node n2 = node(2, node::MAX_ID-1, terminal_T, n4.uid()); // <-- breaks canonicity - const node n1 = node(1, node::MAX_ID, n2.uid(), n3.uid()); + const node n7 = node(4, node::max_id, terminal_T, terminal_T); + const node n6 = node(4, node::max_id-1, terminal_F, terminal_T); + const node n5 = node(3, node::max_id, n7.uid(), terminal_T); + const node n4 = node(3, node::max_id-1, n6.uid(), terminal_T); + const node n3 = node(2, node::max_id, terminal_F, n5.uid()); + const node n2 = node(2, node::max_id-1, terminal_T, n4.uid()); // <-- breaks canonicity + const node n1 = node(1, node::max_id, n2.uid(), n3.uid()); node_writer nw(in); nw << n7 << n6 << n5 << n4 << n3 << n2 << n1; @@ -768,10 +768,10 @@ go_bandit([]() { AssertThat(levels.can_pull(), Is().False()); - AssertThat(out.get<__zdd::shared_arcs_t>()->max_1level_cut, Is().EqualTo(8u)); + AssertThat(out.get<__zdd::shared_arc_file_type>()->max_1level_cut, Is().EqualTo(8u)); - AssertThat(out.get<__zdd::shared_arcs_t>()->number_of_terminals[false], Is().EqualTo(4u)); - AssertThat(out.get<__zdd::shared_arcs_t>()->number_of_terminals[true], Is().EqualTo(4u)); + AssertThat(out.get<__zdd::shared_arc_file_type>()->number_of_terminals[false], Is().EqualTo(4u)); + AssertThat(out.get<__zdd::shared_arc_file_type>()->number_of_terminals[true], Is().EqualTo(4u)); }); it("computes pow(U) \\ pow(U) with U = { 2, 4 }", [&]() { @@ -816,10 +816,10 @@ go_bandit([]() { AssertThat(levels.can_pull(), Is().False()); - AssertThat(out.get<__zdd::shared_arcs_t>()->max_1level_cut, Is().EqualTo(2u)); + AssertThat(out.get<__zdd::shared_arc_file_type>()->max_1level_cut, Is().EqualTo(2u)); - AssertThat(out.get<__zdd::shared_arcs_t>()->number_of_terminals[false], Is().EqualTo(2u)); - AssertThat(out.get<__zdd::shared_arcs_t>()->number_of_terminals[true], Is().EqualTo(0u)); + AssertThat(out.get<__zdd::shared_arc_file_type>()->number_of_terminals[false], Is().EqualTo(2u)); + AssertThat(out.get<__zdd::shared_arc_file_type>()->number_of_terminals[true], Is().EqualTo(0u)); }); it("computes pow(U) \\ pow({ 2, 4 }) with U = { 1, 2, 3, 4 }", [&]() { @@ -900,40 +900,40 @@ go_bandit([]() { AssertThat(levels.can_pull(), Is().False()); - AssertThat(out.get<__zdd::shared_arcs_t>()->max_1level_cut, Is().EqualTo(4u)); + AssertThat(out.get<__zdd::shared_arc_file_type>()->max_1level_cut, Is().EqualTo(4u)); - AssertThat(out.get<__zdd::shared_arcs_t>()->number_of_terminals[false], Is().EqualTo(2u)); - AssertThat(out.get<__zdd::shared_arcs_t>()->number_of_terminals[true], Is().EqualTo(2u)); + AssertThat(out.get<__zdd::shared_arc_file_type>()->number_of_terminals[false], Is().EqualTo(2u)); + AssertThat(out.get<__zdd::shared_arc_file_type>()->number_of_terminals[true], Is().EqualTo(2u)); }); }); describe("zdd_complement(A)", [&]() { it("produces pow(U) on F terminal with set domain U = { 0, 1, 2, 3 }", [&]() { - adiar_set_domain(dom_0123.begin(), dom_0123.end()); + domain_set(dom_0123.begin(), dom_0123.end()); __zdd out = zdd_complement(zdd_F); node_test_stream ns(out); AssertThat(ns.can_pull(), Is().True()); - AssertThat(ns.pull(), Is().EqualTo(node(3, node::MAX_ID, + AssertThat(ns.pull(), Is().EqualTo(node(3, node::max_id, terminal_T, terminal_T))); AssertThat(ns.can_pull(), Is().True()); - AssertThat(ns.pull(), Is().EqualTo(node(2, node::MAX_ID, - ptr_uint64(3, ptr_uint64::MAX_ID), - ptr_uint64(3, ptr_uint64::MAX_ID)))); + AssertThat(ns.pull(), Is().EqualTo(node(2, node::max_id, + ptr_uint64(3, ptr_uint64::max_id), + ptr_uint64(3, ptr_uint64::max_id)))); AssertThat(ns.can_pull(), Is().True()); - AssertThat(ns.pull(), Is().EqualTo(node(1, node::MAX_ID, - ptr_uint64(2, ptr_uint64::MAX_ID), - ptr_uint64(2, ptr_uint64::MAX_ID)))); + AssertThat(ns.pull(), Is().EqualTo(node(1, node::max_id, + ptr_uint64(2, ptr_uint64::max_id), + ptr_uint64(2, ptr_uint64::max_id)))); AssertThat(ns.can_pull(), Is().True()); - AssertThat(ns.pull(), Is().EqualTo(node(0, node::MAX_ID, - ptr_uint64(1, ptr_uint64::MAX_ID), - ptr_uint64(1, ptr_uint64::MAX_ID)))); + AssertThat(ns.pull(), Is().EqualTo(node(0, node::max_id, + ptr_uint64(1, ptr_uint64::max_id), + ptr_uint64(1, ptr_uint64::max_id)))); AssertThat(ns.can_pull(), Is().False()); @@ -953,41 +953,41 @@ go_bandit([]() { AssertThat(levels.can_pull(), Is().False()); - AssertThat(out.get>()->max_1level_cut[cut_type::INTERNAL], Is().EqualTo(2u)); - AssertThat(out.get>()->max_1level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(2u)); - AssertThat(out.get>()->max_1level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(2u)); - AssertThat(out.get>()->max_1level_cut[cut_type::ALL], Is().EqualTo(2u)); + AssertThat(out.get>()->max_1level_cut[cut::Internal], Is().EqualTo(2u)); + AssertThat(out.get>()->max_1level_cut[cut::Internal_False], Is().EqualTo(2u)); + AssertThat(out.get>()->max_1level_cut[cut::Internal_True], Is().EqualTo(2u)); + AssertThat(out.get>()->max_1level_cut[cut::All], Is().EqualTo(2u)); - AssertThat(out.get>()->number_of_terminals[false], Is().EqualTo(0u)); - AssertThat(out.get>()->number_of_terminals[true], Is().EqualTo(2u)); + AssertThat(out.get>()->number_of_terminals[false], Is().EqualTo(0u)); + AssertThat(out.get>()->number_of_terminals[true], Is().EqualTo(2u)); }); it("produces pow(U) \\ Ø on T terminal with set domain U = { 1, 2, 3, 4 }", [&]() { - adiar_set_domain(dom_1234.begin(), dom_1234.end()); + domain_set(dom_1234.begin(), dom_1234.end()); __zdd out = zdd_complement(zdd_T); node_test_stream ns(out); AssertThat(ns.can_pull(), Is().True()); - AssertThat(ns.pull(), Is().EqualTo(node(4, node::MAX_ID, + AssertThat(ns.pull(), Is().EqualTo(node(4, node::max_id, terminal_F, terminal_T))); AssertThat(ns.can_pull(), Is().True()); - AssertThat(ns.pull(), Is().EqualTo(node(3, node::MAX_ID, - ptr_uint64(4, ptr_uint64::MAX_ID), - ptr_uint64(4, ptr_uint64::MAX_ID)))); + AssertThat(ns.pull(), Is().EqualTo(node(3, node::max_id, + ptr_uint64(4, ptr_uint64::max_id), + ptr_uint64(4, ptr_uint64::max_id)))); AssertThat(ns.can_pull(), Is().True()); - AssertThat(ns.pull(), Is().EqualTo(node(2, node::MAX_ID, - ptr_uint64(3, ptr_uint64::MAX_ID), - ptr_uint64(3, ptr_uint64::MAX_ID)))); + AssertThat(ns.pull(), Is().EqualTo(node(2, node::max_id, + ptr_uint64(3, ptr_uint64::max_id), + ptr_uint64(3, ptr_uint64::max_id)))); AssertThat(ns.can_pull(), Is().True()); - AssertThat(ns.pull(), Is().EqualTo(node(1, node::MAX_ID, - ptr_uint64(2, ptr_uint64::MAX_ID), - ptr_uint64(2, ptr_uint64::MAX_ID)))); + AssertThat(ns.pull(), Is().EqualTo(node(1, node::max_id, + ptr_uint64(2, ptr_uint64::max_id), + ptr_uint64(2, ptr_uint64::max_id)))); AssertThat(ns.can_pull(), Is().False()); @@ -1007,13 +1007,13 @@ go_bandit([]() { AssertThat(levels.can_pull(), Is().False()); - AssertThat(out.get>()->max_1level_cut[cut_type::INTERNAL], Is().EqualTo(2u)); - AssertThat(out.get>()->max_1level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(2u)); - AssertThat(out.get>()->max_1level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(2u)); - AssertThat(out.get>()->max_1level_cut[cut_type::ALL], Is().EqualTo(2u)); + AssertThat(out.get>()->max_1level_cut[cut::Internal], Is().EqualTo(2u)); + AssertThat(out.get>()->max_1level_cut[cut::Internal_False], Is().EqualTo(2u)); + AssertThat(out.get>()->max_1level_cut[cut::Internal_True], Is().EqualTo(2u)); + AssertThat(out.get>()->max_1level_cut[cut::All], Is().EqualTo(2u)); - AssertThat(out.get>()->number_of_terminals[false], Is().EqualTo(1u)); - AssertThat(out.get>()->number_of_terminals[true], Is().EqualTo(1u)); + AssertThat(out.get>()->number_of_terminals[false], Is().EqualTo(1u)); + AssertThat(out.get>()->number_of_terminals[true], Is().EqualTo(1u)); }); }); }); diff --git a/test/adiar/zdd/test_contains.cpp b/test/adiar/zdd/test_contains.cpp index 0a7a224a5..4ffaa2959 100644 --- a/test/adiar/zdd/test_contains.cpp +++ b/test/adiar/zdd/test_contains.cpp @@ -2,8 +2,8 @@ go_bandit([]() { describe("adiar/zdd/contains.cpp", [&]() { - shared_levelized_file zdd_F; - shared_levelized_file zdd_T; + shared_levelized_file zdd_F; + shared_levelized_file zdd_T; { // Garbage collect writers to free write-lock node_writer nw_F(zdd_F); @@ -16,7 +16,7 @@ go_bandit([]() { const ptr_uint64 terminal_F = ptr_uint64(false); const ptr_uint64 terminal_T = ptr_uint64(true); - shared_levelized_file zdd_x0; + shared_levelized_file zdd_x0; // { { 0 } } /* // 1 ---- x0 @@ -25,12 +25,12 @@ go_bandit([]() { */ { // Garbage collect writers to free write-lock node_writer nw(zdd_x0); - nw << node(0, node::MAX_ID, terminal_F, terminal_T); + nw << node(0, node::max_id, terminal_F, terminal_T); } // TODO: tests... - shared_levelized_file zdd_x1_null; + shared_levelized_file zdd_x1_null; // { Ø, { 1 } } /* // 1 ---- x1 @@ -39,12 +39,12 @@ go_bandit([]() { */ { // Garbage collect writers to free write-lock node_writer nw(zdd_x1_null); - nw << node(1, node::MAX_ID, terminal_T, terminal_T); + nw << node(1, node::max_id, terminal_T, terminal_T); } // TODO: tests... - shared_levelized_file zdd_1; + shared_levelized_file zdd_1; // { Ø, { 0,2 }, { 0,3 } { 1,2 }, { 1,3 }, { 1,2,3 }, { 0,2,3 } } /* // 1 ---- x0 @@ -57,18 +57,18 @@ go_bandit([]() { // / \/ \ // F T T */ - const node n1_5 = node(3, node::MAX_ID, terminal_T, terminal_T); - const node n1_4 = node(3, node::MAX_ID-1, terminal_F, terminal_T); - const node n1_3 = node(2, node::MAX_ID, n1_4.uid(), n1_5.uid()); - const node n1_2 = node(1, node::MAX_ID, terminal_T, n1_3.uid()); - const node n1_1 = node(0, node::MAX_ID, n1_2.uid(), n1_3.uid()); + const node n1_5 = node(3, node::max_id, terminal_T, terminal_T); + const node n1_4 = node(3, node::max_id-1, terminal_F, terminal_T); + const node n1_3 = node(2, node::max_id, n1_4.uid(), n1_5.uid()); + const node n1_2 = node(1, node::max_id, terminal_T, n1_3.uid()); + const node n1_1 = node(0, node::max_id, n1_2.uid(), n1_3.uid()); { // Garbage collect writers to free write-lock node_writer nw(zdd_1); nw << n1_5 << n1_4 << n1_3 << n1_2 << n1_1; } - shared_levelized_file zdd_2; + shared_levelized_file zdd_2; // { { 6 }, { 2,4 }, { 2,6 }, { 2,4,6 } } /* // 1 ---- x2 @@ -79,10 +79,10 @@ go_bandit([]() { // / \/ \ // F T T */ - const node n2_4 = node(6, node::MAX_ID, terminal_T, terminal_T); - const node n2_3 = node(6, node::MAX_ID-1, terminal_F, terminal_T); - const node n2_2 = node(4, node::MAX_ID, n2_3.uid(), n2_4.uid()); - const node n2_1 = node(2, node::MAX_ID, n2_3.uid(), n2_2.uid()); + const node n2_4 = node(6, node::max_id, terminal_T, terminal_T); + const node n2_3 = node(6, node::max_id-1, terminal_F, terminal_T); + const node n2_2 = node(4, node::max_id, n2_3.uid(), n2_4.uid()); + const node n2_1 = node(2, node::max_id, n2_3.uid(), n2_2.uid()); { // Garbage collect writers to free write-lock node_writer nw(zdd_2); diff --git a/test/adiar/zdd/test_count.cpp b/test/adiar/zdd/test_count.cpp index b48f1e8a8..a4f04063c 100644 --- a/test/adiar/zdd/test_count.cpp +++ b/test/adiar/zdd/test_count.cpp @@ -5,7 +5,7 @@ go_bandit([]() { ptr_uint64 terminal_T = ptr_uint64(true); ptr_uint64 terminal_F = ptr_uint64(false); - shared_levelized_file zdd_1; + shared_levelized_file zdd_1; /* 1 ---- x0 / \ @@ -27,7 +27,7 @@ go_bandit([]() { nw_1 << n4 << n3 << n2 << n1; } - shared_levelized_file zdd_2; + shared_levelized_file zdd_2; /* ---- x0 @@ -45,7 +45,7 @@ go_bandit([]() { nw_2 << n2 << n1; } - shared_levelized_file zdd_T; + shared_levelized_file zdd_T; /* T */ @@ -56,7 +56,7 @@ go_bandit([]() { nw_T << node(true); } - shared_levelized_file zdd_F; + shared_levelized_file zdd_F; /* F */ @@ -67,7 +67,7 @@ go_bandit([]() { nw_F << node(false); } - shared_levelized_file zdd_root_1; + shared_levelized_file zdd_root_1; /* 1 ---- x1 / \ diff --git a/test/adiar/zdd/test_elem.cpp b/test/adiar/zdd/test_elem.cpp index e911f652e..70c4a2876 100644 --- a/test/adiar/zdd/test_elem.cpp +++ b/test/adiar/zdd/test_elem.cpp @@ -2,8 +2,8 @@ go_bandit([]() { describe("adiar/zdd/elem.cpp", [&]() { - shared_levelized_file zdd_F; - shared_levelized_file zdd_T; + shared_levelized_file zdd_F; + shared_levelized_file zdd_T; { // Garbage collect writers to free write-lock node_writer nw_F(zdd_F); @@ -16,7 +16,7 @@ go_bandit([]() { const ptr_uint64 terminal_T = ptr_uint64(true); const ptr_uint64 terminal_F = ptr_uint64(false); - shared_levelized_file zdd_1; + shared_levelized_file zdd_1; // { { 0 }, { 1 }, { 0,2 }, { 1,2 } } /* // 1 ---- x0 @@ -29,15 +29,15 @@ go_bandit([]() { */ { - const node n3 = node(2, node::MAX_ID, terminal_T, terminal_T); - const node n2 = node(1, node::MAX_ID, terminal_F, n3.uid()); - const node n1 = node(0, node::MAX_ID, n2.uid(), n3.uid()); + const node n3 = node(2, node::max_id, terminal_T, terminal_T); + const node n2 = node(1, node::max_id, terminal_F, n3.uid()); + const node n1 = node(0, node::max_id, n2.uid(), n3.uid()); node_writer nw(zdd_1); nw << n3 << n2 << n1; } - shared_levelized_file zdd_2; + shared_levelized_file zdd_2; // { Ø, { 1 }, { 2 }, { 2,3 } } /* // 1 ---- x1 @@ -50,15 +50,15 @@ go_bandit([]() { */ { - const node n3 = node(3, node::MAX_ID, terminal_T, terminal_T); - const node n2 = node(2, node::MAX_ID, terminal_T, n3.uid()); - const node n1 = node(1, node::MAX_ID, n2.uid(), terminal_T); + const node n3 = node(3, node::max_id, terminal_T, terminal_T); + const node n2 = node(2, node::max_id, terminal_T, n3.uid()); + const node n1 = node(1, node::max_id, n2.uid(), terminal_T); node_writer nw(zdd_2); nw << n3 << n2 << n1; } - shared_levelized_file zdd_3; + shared_levelized_file zdd_3; // { { 2,4 }, { 0,2 }, { 0,4 } } /* // _1_ ---- x0 @@ -70,16 +70,16 @@ go_bandit([]() { // F T */ { - const node n4 = node(4, node::MAX_ID, terminal_F, terminal_T); - const node n3 = node(2, node::MAX_ID, n4.uid(), terminal_T); - const node n2 = node(2, node::MAX_ID-1, terminal_F, n4.uid()); - const node n1 = node(1, node::MAX_ID, n2.uid(), n3.uid()); + const node n4 = node(4, node::max_id, terminal_F, terminal_T); + const node n3 = node(2, node::max_id, n4.uid(), terminal_T); + const node n2 = node(2, node::max_id-1, terminal_F, n4.uid()); + const node n1 = node(1, node::max_id, n2.uid(), n3.uid()); node_writer nw(zdd_3); nw << n4 << n3 << n2 << n1; } - shared_levelized_file zdd_4; + shared_levelized_file zdd_4; // { {1}, {0,1} } /* // 1 ---- x0 @@ -89,8 +89,8 @@ go_bandit([]() { // F T */ { - const node n2 = node(1, node::MAX_ID, terminal_F, terminal_T); - const node n1 = node(0, node::MAX_ID, n2.uid(), n2.uid()); + const node n2 = node(1, node::max_id, terminal_F, terminal_T); + const node n1 = node(0, node::max_id, n2.uid(), n2.uid()); node_writer nw(zdd_4); nw << n2 << n1; @@ -104,7 +104,7 @@ go_bandit([]() { node_test_stream out_nodes(out); AssertThat(out_nodes.can_pull(), Is().True()); - AssertThat(out_nodes.pull(), Is().EqualTo(zdd::node_t(true))); + AssertThat(out_nodes.pull(), Is().EqualTo(zdd::node_type(true))); AssertThat(out_nodes.can_pull(), Is().False()); @@ -112,15 +112,15 @@ go_bandit([]() { AssertThat(out_meta.can_pull(), Is().False()); - AssertThat(out->max_1level_cut[cut_type::INTERNAL], Is().EqualTo(0u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(0u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(1u)); - AssertThat(out->max_1level_cut[cut_type::ALL], Is().EqualTo(1u)); + AssertThat(out->max_1level_cut[cut::Internal], Is().EqualTo(0u)); + AssertThat(out->max_1level_cut[cut::Internal_False], Is().EqualTo(0u)); + AssertThat(out->max_1level_cut[cut::Internal_True], Is().EqualTo(1u)); + AssertThat(out->max_1level_cut[cut::All], Is().EqualTo(1u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL], Is().EqualTo(0u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(0u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(1u)); - AssertThat(out->max_2level_cut[cut_type::ALL], Is().EqualTo(1u)); + AssertThat(out->max_2level_cut[cut::Internal], Is().EqualTo(0u)); + AssertThat(out->max_2level_cut[cut::Internal_False], Is().EqualTo(0u)); + AssertThat(out->max_2level_cut[cut::Internal_True], Is().EqualTo(1u)); + AssertThat(out->max_2level_cut[cut::All], Is().EqualTo(1u)); AssertThat(out->number_of_terminals[false], Is().EqualTo(0u)); AssertThat(out->number_of_terminals[true], Is().EqualTo(1u)); @@ -133,7 +133,7 @@ go_bandit([]() { node_test_stream out_nodes(out); AssertThat(out_nodes.can_pull(), Is().True()); - AssertThat(out_nodes.pull(), Is().EqualTo(zdd::node_t(true))); + AssertThat(out_nodes.pull(), Is().EqualTo(zdd::node_type(true))); AssertThat(out_nodes.can_pull(), Is().False()); @@ -141,15 +141,15 @@ go_bandit([]() { AssertThat(out_meta.can_pull(), Is().False()); - AssertThat(out->max_1level_cut[cut_type::INTERNAL], Is().EqualTo(0u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(0u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(1u)); - AssertThat(out->max_1level_cut[cut_type::ALL], Is().EqualTo(1u)); + AssertThat(out->max_1level_cut[cut::Internal], Is().EqualTo(0u)); + AssertThat(out->max_1level_cut[cut::Internal_False], Is().EqualTo(0u)); + AssertThat(out->max_1level_cut[cut::Internal_True], Is().EqualTo(1u)); + AssertThat(out->max_1level_cut[cut::All], Is().EqualTo(1u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL], Is().EqualTo(0u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(0u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(1u)); - AssertThat(out->max_2level_cut[cut_type::ALL], Is().EqualTo(1u)); + AssertThat(out->max_2level_cut[cut::Internal], Is().EqualTo(0u)); + AssertThat(out->max_2level_cut[cut::Internal_False], Is().EqualTo(0u)); + AssertThat(out->max_2level_cut[cut::Internal_True], Is().EqualTo(1u)); + AssertThat(out->max_2level_cut[cut::All], Is().EqualTo(1u)); AssertThat(out->number_of_terminals[false], Is().EqualTo(0u)); AssertThat(out->number_of_terminals[true], Is().EqualTo(1u)); @@ -162,7 +162,7 @@ go_bandit([]() { node_test_stream out_nodes(out); AssertThat(out_nodes.can_pull(), Is().True()); - AssertThat(out_nodes.pull(), Is().EqualTo(zdd::node_t(1, zdd::MAX_ID, terminal_F, terminal_T))); + AssertThat(out_nodes.pull(), Is().EqualTo(zdd::node_type(1, zdd::max_id, terminal_F, terminal_T))); AssertThat(out_nodes.can_pull(), Is().False()); @@ -173,15 +173,15 @@ go_bandit([]() { AssertThat(out_meta.can_pull(), Is().False()); - AssertThat(out->max_1level_cut[cut_type::INTERNAL], Is().EqualTo(1u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(1u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(1u)); - AssertThat(out->max_1level_cut[cut_type::ALL], Is().EqualTo(2u)); + AssertThat(out->max_1level_cut[cut::Internal], Is().EqualTo(1u)); + AssertThat(out->max_1level_cut[cut::Internal_False], Is().EqualTo(1u)); + AssertThat(out->max_1level_cut[cut::Internal_True], Is().EqualTo(1u)); + AssertThat(out->max_1level_cut[cut::All], Is().EqualTo(2u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL], Is().EqualTo(1u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(1u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(1u)); - AssertThat(out->max_2level_cut[cut_type::ALL], Is().EqualTo(2u)); + AssertThat(out->max_2level_cut[cut::Internal], Is().EqualTo(1u)); + AssertThat(out->max_2level_cut[cut::Internal_False], Is().EqualTo(1u)); + AssertThat(out->max_2level_cut[cut::Internal_True], Is().EqualTo(1u)); + AssertThat(out->max_2level_cut[cut::All], Is().EqualTo(2u)); AssertThat(out->number_of_terminals[false], Is().EqualTo(1u)); AssertThat(out->number_of_terminals[true], Is().EqualTo(1u)); @@ -194,7 +194,7 @@ go_bandit([]() { node_test_stream out_nodes(out); AssertThat(out_nodes.can_pull(), Is().True()); - AssertThat(out_nodes.pull(), Is().EqualTo(zdd::node_t(true))); + AssertThat(out_nodes.pull(), Is().EqualTo(zdd::node_type(true))); AssertThat(out_nodes.can_pull(), Is().False()); @@ -202,15 +202,15 @@ go_bandit([]() { AssertThat(out_meta.can_pull(), Is().False()); - AssertThat(out->max_1level_cut[cut_type::INTERNAL], Is().EqualTo(0u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(0u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(1u)); - AssertThat(out->max_1level_cut[cut_type::ALL], Is().EqualTo(1u)); + AssertThat(out->max_1level_cut[cut::Internal], Is().EqualTo(0u)); + AssertThat(out->max_1level_cut[cut::Internal_False], Is().EqualTo(0u)); + AssertThat(out->max_1level_cut[cut::Internal_True], Is().EqualTo(1u)); + AssertThat(out->max_1level_cut[cut::All], Is().EqualTo(1u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL], Is().EqualTo(0u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(0u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(1u)); - AssertThat(out->max_2level_cut[cut_type::ALL], Is().EqualTo(1u)); + AssertThat(out->max_2level_cut[cut::Internal], Is().EqualTo(0u)); + AssertThat(out->max_2level_cut[cut::Internal_False], Is().EqualTo(0u)); + AssertThat(out->max_2level_cut[cut::Internal_True], Is().EqualTo(1u)); + AssertThat(out->max_2level_cut[cut::All], Is().EqualTo(1u)); AssertThat(out->number_of_terminals[false], Is().EqualTo(0u)); AssertThat(out->number_of_terminals[true], Is().EqualTo(1u)); @@ -223,13 +223,13 @@ go_bandit([]() { node_test_stream out_nodes(out); AssertThat(out_nodes.can_pull(), Is().True()); - AssertThat(out_nodes.pull(), Is().EqualTo(zdd::node_t(4, zdd::MAX_ID, + AssertThat(out_nodes.pull(), Is().EqualTo(zdd::node_type(4, zdd::max_id, terminal_F, terminal_T))); AssertThat(out_nodes.can_pull(), Is().True()); - AssertThat(out_nodes.pull(), Is().EqualTo(zdd::node_t(2, zdd::MAX_ID, + AssertThat(out_nodes.pull(), Is().EqualTo(zdd::node_type(2, zdd::max_id, terminal_F, - zdd::ptr_t(4, zdd::MAX_ID)))); + zdd::pointer_type(4, zdd::max_id)))); AssertThat(out_nodes.can_pull(), Is().False()); @@ -244,15 +244,15 @@ go_bandit([]() { AssertThat(out_meta.can_pull(), Is().False()); - AssertThat(out->max_1level_cut[cut_type::INTERNAL], Is().EqualTo(1u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(2u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(1u)); - AssertThat(out->max_1level_cut[cut_type::ALL], Is().EqualTo(3u)); + AssertThat(out->max_1level_cut[cut::Internal], Is().EqualTo(1u)); + AssertThat(out->max_1level_cut[cut::Internal_False], Is().EqualTo(2u)); + AssertThat(out->max_1level_cut[cut::Internal_True], Is().EqualTo(1u)); + AssertThat(out->max_1level_cut[cut::All], Is().EqualTo(3u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL], Is().EqualTo(1u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(2u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(1u)); - AssertThat(out->max_2level_cut[cut_type::ALL], Is().EqualTo(3u)); + AssertThat(out->max_2level_cut[cut::Internal], Is().EqualTo(1u)); + AssertThat(out->max_2level_cut[cut::Internal_False], Is().EqualTo(2u)); + AssertThat(out->max_2level_cut[cut::Internal_True], Is().EqualTo(1u)); + AssertThat(out->max_2level_cut[cut::All], Is().EqualTo(3u)); AssertThat(out->number_of_terminals[false], Is().EqualTo(2u)); AssertThat(out->number_of_terminals[true], Is().EqualTo(1u)); @@ -265,7 +265,7 @@ go_bandit([]() { node_test_stream out_nodes(out); AssertThat(out_nodes.can_pull(), Is().True()); - AssertThat(out_nodes.pull(), Is().EqualTo(zdd::node_t(1, zdd::MAX_ID, terminal_F, terminal_T))); + AssertThat(out_nodes.pull(), Is().EqualTo(zdd::node_type(1, zdd::max_id, terminal_F, terminal_T))); AssertThat(out_nodes.can_pull(), Is().False()); @@ -276,15 +276,15 @@ go_bandit([]() { AssertThat(out_meta.can_pull(), Is().False()); - AssertThat(out->max_1level_cut[cut_type::INTERNAL], Is().EqualTo(1u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(1u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(1u)); - AssertThat(out->max_1level_cut[cut_type::ALL], Is().EqualTo(2u)); + AssertThat(out->max_1level_cut[cut::Internal], Is().EqualTo(1u)); + AssertThat(out->max_1level_cut[cut::Internal_False], Is().EqualTo(1u)); + AssertThat(out->max_1level_cut[cut::Internal_True], Is().EqualTo(1u)); + AssertThat(out->max_1level_cut[cut::All], Is().EqualTo(2u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL], Is().EqualTo(1u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(1u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(1u)); - AssertThat(out->max_2level_cut[cut_type::ALL], Is().EqualTo(2u)); + AssertThat(out->max_2level_cut[cut::Internal], Is().EqualTo(1u)); + AssertThat(out->max_2level_cut[cut::Internal_False], Is().EqualTo(1u)); + AssertThat(out->max_2level_cut[cut::Internal_True], Is().EqualTo(1u)); + AssertThat(out->max_2level_cut[cut::All], Is().EqualTo(2u)); AssertThat(out->number_of_terminals[false], Is().EqualTo(1u)); AssertThat(out->number_of_terminals[true], Is().EqualTo(1u)); @@ -294,7 +294,7 @@ go_bandit([]() { describe("zdd_minelem(A, cb)", [&]() { it("makes no calls for { Ø } on { Ø }", [&]() { size_t calls = 0u; - const auto cb = [&calls](zdd::label_t) { + const auto cb = [&calls](zdd::label_type) { calls++; }; @@ -304,9 +304,9 @@ go_bandit([]() { it("calls with 1 on [1]", [&]() { size_t calls = 0u; - std::vector expected { 1 }; + std::vector expected { 1 }; - const auto cb = [&calls, &expected](zdd::label_t x) { + const auto cb = [&calls, &expected](zdd::label_type x) { AssertThat(x, Is().EqualTo(expected.at(calls))); calls++; }; @@ -317,7 +317,7 @@ go_bandit([]() { it("makes no calls for { Ø } on [2]", [&]() { size_t calls = 0u; - const auto cb = [&calls](zdd::label_t) { + const auto cb = [&calls](zdd::label_type) { calls++; }; @@ -327,9 +327,9 @@ go_bandit([]() { it("calls with 2,4 on [3]", [&]() { size_t calls = 0u; - std::vector expected { 2,4 }; + std::vector expected { 2,4 }; - const auto cb = [&calls, &expected](zdd::label_t x) { + const auto cb = [&calls, &expected](zdd::label_type x) { AssertThat(x, Is().EqualTo(expected.at(calls))); calls++; }; @@ -340,9 +340,9 @@ go_bandit([]() { it("calls with 1 on [4]", [&]() { size_t calls = 0u; - std::vector expected { 1 }; + std::vector expected { 1 }; - const auto cb = [&calls, &expected](zdd::label_t x) { + const auto cb = [&calls, &expected](zdd::label_type x) { AssertThat(x, Is().EqualTo(expected.at(calls))); calls++; }; @@ -360,7 +360,7 @@ go_bandit([]() { node_test_stream out_nodes(out); AssertThat(out_nodes.can_pull(), Is().True()); - AssertThat(out_nodes.pull(), Is().EqualTo(zdd::node_t(true))); + AssertThat(out_nodes.pull(), Is().EqualTo(zdd::node_type(true))); AssertThat(out_nodes.can_pull(), Is().False()); @@ -368,15 +368,15 @@ go_bandit([]() { AssertThat(out_meta.can_pull(), Is().False()); - AssertThat(out->max_1level_cut[cut_type::INTERNAL], Is().EqualTo(0u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(0u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(1u)); - AssertThat(out->max_1level_cut[cut_type::ALL], Is().EqualTo(1u)); + AssertThat(out->max_1level_cut[cut::Internal], Is().EqualTo(0u)); + AssertThat(out->max_1level_cut[cut::Internal_False], Is().EqualTo(0u)); + AssertThat(out->max_1level_cut[cut::Internal_True], Is().EqualTo(1u)); + AssertThat(out->max_1level_cut[cut::All], Is().EqualTo(1u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL], Is().EqualTo(0u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(0u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(1u)); - AssertThat(out->max_2level_cut[cut_type::ALL], Is().EqualTo(1u)); + AssertThat(out->max_2level_cut[cut::Internal], Is().EqualTo(0u)); + AssertThat(out->max_2level_cut[cut::Internal_False], Is().EqualTo(0u)); + AssertThat(out->max_2level_cut[cut::Internal_True], Is().EqualTo(1u)); + AssertThat(out->max_2level_cut[cut::All], Is().EqualTo(1u)); AssertThat(out->number_of_terminals[false], Is().EqualTo(0u)); AssertThat(out->number_of_terminals[true], Is().EqualTo(1u)); @@ -389,7 +389,7 @@ go_bandit([]() { node_test_stream out_nodes(out); AssertThat(out_nodes.can_pull(), Is().True()); - AssertThat(out_nodes.pull(), Is().EqualTo(zdd::node_t(true))); + AssertThat(out_nodes.pull(), Is().EqualTo(zdd::node_type(true))); AssertThat(out_nodes.can_pull(), Is().False()); @@ -397,15 +397,15 @@ go_bandit([]() { AssertThat(out_meta.can_pull(), Is().False()); - AssertThat(out->max_1level_cut[cut_type::INTERNAL], Is().EqualTo(0u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(0u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(1u)); - AssertThat(out->max_1level_cut[cut_type::ALL], Is().EqualTo(1u)); + AssertThat(out->max_1level_cut[cut::Internal], Is().EqualTo(0u)); + AssertThat(out->max_1level_cut[cut::Internal_False], Is().EqualTo(0u)); + AssertThat(out->max_1level_cut[cut::Internal_True], Is().EqualTo(1u)); + AssertThat(out->max_1level_cut[cut::All], Is().EqualTo(1u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL], Is().EqualTo(0u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(0u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(1u)); - AssertThat(out->max_2level_cut[cut_type::ALL], Is().EqualTo(1u)); + AssertThat(out->max_2level_cut[cut::Internal], Is().EqualTo(0u)); + AssertThat(out->max_2level_cut[cut::Internal_False], Is().EqualTo(0u)); + AssertThat(out->max_2level_cut[cut::Internal_True], Is().EqualTo(1u)); + AssertThat(out->max_2level_cut[cut::All], Is().EqualTo(1u)); AssertThat(out->number_of_terminals[false], Is().EqualTo(0u)); AssertThat(out->number_of_terminals[true], Is().EqualTo(1u)); @@ -418,13 +418,13 @@ go_bandit([]() { node_test_stream out_nodes(out); AssertThat(out_nodes.can_pull(), Is().True()); - AssertThat(out_nodes.pull(), Is().EqualTo(zdd::node_t(2, zdd::MAX_ID, + AssertThat(out_nodes.pull(), Is().EqualTo(zdd::node_type(2, zdd::max_id, terminal_F, terminal_T))); AssertThat(out_nodes.can_pull(), Is().True()); - AssertThat(out_nodes.pull(), Is().EqualTo(zdd::node_t(0, zdd::MAX_ID, + AssertThat(out_nodes.pull(), Is().EqualTo(zdd::node_type(0, zdd::max_id, terminal_F, - zdd::ptr_t(2, zdd::MAX_ID)))); + zdd::pointer_type(2, zdd::max_id)))); AssertThat(out_nodes.can_pull(), Is().False()); @@ -439,15 +439,15 @@ go_bandit([]() { AssertThat(out_meta.can_pull(), Is().False()); - AssertThat(out->max_1level_cut[cut_type::INTERNAL], Is().EqualTo(1u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(2u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(1u)); - AssertThat(out->max_1level_cut[cut_type::ALL], Is().EqualTo(3u)); + AssertThat(out->max_1level_cut[cut::Internal], Is().EqualTo(1u)); + AssertThat(out->max_1level_cut[cut::Internal_False], Is().EqualTo(2u)); + AssertThat(out->max_1level_cut[cut::Internal_True], Is().EqualTo(1u)); + AssertThat(out->max_1level_cut[cut::All], Is().EqualTo(3u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL], Is().EqualTo(1u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(2u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(1u)); - AssertThat(out->max_2level_cut[cut_type::ALL], Is().EqualTo(3u)); + AssertThat(out->max_2level_cut[cut::Internal], Is().EqualTo(1u)); + AssertThat(out->max_2level_cut[cut::Internal_False], Is().EqualTo(2u)); + AssertThat(out->max_2level_cut[cut::Internal_True], Is().EqualTo(1u)); + AssertThat(out->max_2level_cut[cut::All], Is().EqualTo(3u)); AssertThat(out->number_of_terminals[false], Is().EqualTo(2u)); AssertThat(out->number_of_terminals[true], Is().EqualTo(1u)); @@ -460,7 +460,7 @@ go_bandit([]() { node_test_stream out_nodes(out); AssertThat(out_nodes.can_pull(), Is().True()); - AssertThat(out_nodes.pull(), Is().EqualTo(zdd::node_t(1, zdd::MAX_ID, terminal_F, terminal_T))); + AssertThat(out_nodes.pull(), Is().EqualTo(zdd::node_type(1, zdd::max_id, terminal_F, terminal_T))); AssertThat(out_nodes.can_pull(), Is().False()); @@ -471,15 +471,15 @@ go_bandit([]() { AssertThat(out_meta.can_pull(), Is().False()); - AssertThat(out->max_1level_cut[cut_type::INTERNAL], Is().EqualTo(1u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(1u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(1u)); - AssertThat(out->max_1level_cut[cut_type::ALL], Is().EqualTo(2u)); + AssertThat(out->max_1level_cut[cut::Internal], Is().EqualTo(1u)); + AssertThat(out->max_1level_cut[cut::Internal_False], Is().EqualTo(1u)); + AssertThat(out->max_1level_cut[cut::Internal_True], Is().EqualTo(1u)); + AssertThat(out->max_1level_cut[cut::All], Is().EqualTo(2u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL], Is().EqualTo(1u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(1u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(1u)); - AssertThat(out->max_2level_cut[cut_type::ALL], Is().EqualTo(2u)); + AssertThat(out->max_2level_cut[cut::Internal], Is().EqualTo(1u)); + AssertThat(out->max_2level_cut[cut::Internal_False], Is().EqualTo(1u)); + AssertThat(out->max_2level_cut[cut::Internal_True], Is().EqualTo(1u)); + AssertThat(out->max_2level_cut[cut::All], Is().EqualTo(2u)); AssertThat(out->number_of_terminals[false], Is().EqualTo(1u)); AssertThat(out->number_of_terminals[true], Is().EqualTo(1u)); @@ -492,13 +492,13 @@ go_bandit([]() { node_test_stream out_nodes(out); AssertThat(out_nodes.can_pull(), Is().True()); - AssertThat(out_nodes.pull(), Is().EqualTo(zdd::node_t(1, zdd::MAX_ID, + AssertThat(out_nodes.pull(), Is().EqualTo(zdd::node_type(1, zdd::max_id, terminal_F, terminal_T))); AssertThat(out_nodes.can_pull(), Is().True()); - AssertThat(out_nodes.pull(), Is().EqualTo(zdd::node_t(0, zdd::MAX_ID, + AssertThat(out_nodes.pull(), Is().EqualTo(zdd::node_type(0, zdd::max_id, terminal_F, - zdd::ptr_t(1, zdd::MAX_ID)))); + zdd::pointer_type(1, zdd::max_id)))); AssertThat(out_nodes.can_pull(), Is().False()); @@ -513,15 +513,15 @@ go_bandit([]() { AssertThat(out_meta.can_pull(), Is().False()); - AssertThat(out->max_1level_cut[cut_type::INTERNAL], Is().EqualTo(1u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(2u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(1u)); - AssertThat(out->max_1level_cut[cut_type::ALL], Is().EqualTo(3u)); + AssertThat(out->max_1level_cut[cut::Internal], Is().EqualTo(1u)); + AssertThat(out->max_1level_cut[cut::Internal_False], Is().EqualTo(2u)); + AssertThat(out->max_1level_cut[cut::Internal_True], Is().EqualTo(1u)); + AssertThat(out->max_1level_cut[cut::All], Is().EqualTo(3u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL], Is().EqualTo(1u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(2u)); - AssertThat(out->max_2level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(1u)); - AssertThat(out->max_2level_cut[cut_type::ALL], Is().EqualTo(3u)); + AssertThat(out->max_2level_cut[cut::Internal], Is().EqualTo(1u)); + AssertThat(out->max_2level_cut[cut::Internal_False], Is().EqualTo(2u)); + AssertThat(out->max_2level_cut[cut::Internal_True], Is().EqualTo(1u)); + AssertThat(out->max_2level_cut[cut::All], Is().EqualTo(3u)); AssertThat(out->number_of_terminals[false], Is().EqualTo(2u)); AssertThat(out->number_of_terminals[true], Is().EqualTo(1u)); @@ -532,7 +532,7 @@ go_bandit([]() { describe("zdd_maxelem(A, cb)", [&]() { it("makes no calls for { Ø } on { Ø }", [&]() { size_t calls = 0u; - const auto cb = [&calls](zdd::label_t) { + const auto cb = [&calls](zdd::label_type) { calls++; }; @@ -544,9 +544,9 @@ go_bandit([]() { it("calls 0,2 on [1]", [&]() { size_t calls = 0u; - std::vector expected { 0,2 }; + std::vector expected { 0,2 }; - const auto cb = [&calls, &expected](zdd::label_t x) { + const auto cb = [&calls, &expected](zdd::label_type x) { AssertThat(x, Is().EqualTo(expected.at(calls))); calls++; }; @@ -557,9 +557,9 @@ go_bandit([]() { it("calls with 1 on [2]", [&]() { size_t calls = 0u; - std::vector expected { 1 }; + std::vector expected { 1 }; - const auto cb = [&calls, &expected](zdd::label_t x) { + const auto cb = [&calls, &expected](zdd::label_type x) { AssertThat(x, Is().EqualTo(expected.at(calls))); calls++; }; @@ -570,9 +570,9 @@ go_bandit([]() { it("calls with 0,1 on [4]", [&]() { size_t calls = 0u; - std::vector expected { 0,1 }; + std::vector expected { 0,1 }; - const auto cb = [&calls, &expected](zdd::label_t x) { + const auto cb = [&calls, &expected](zdd::label_type x) { AssertThat(x, Is().EqualTo(expected.at(calls))); calls++; }; diff --git a/test/adiar/zdd/test_expand.cpp b/test/adiar/zdd/test_expand.cpp index 2eba230ee..15cf3c916 100644 --- a/test/adiar/zdd/test_expand.cpp +++ b/test/adiar/zdd/test_expand.cpp @@ -2,8 +2,8 @@ go_bandit([]() { describe("adiar/zdd/expand.cpp", [&]() { - shared_levelized_file zdd_F; - shared_levelized_file zdd_T; + shared_levelized_file zdd_F; + shared_levelized_file zdd_T; { // Garbage collect writers to free write-lock node_writer nw_F(zdd_F); @@ -16,7 +16,7 @@ go_bandit([]() { const ptr_uint64 terminal_F = ptr_uint64(false); const ptr_uint64 terminal_T = ptr_uint64(true); - shared_levelized_file zdd_x1; + shared_levelized_file zdd_x1; /* // 1 ---- x1 // / \ @@ -25,10 +25,10 @@ go_bandit([]() { { // Garbage collect writers to free write-lock node_writer nw(zdd_x1); - nw << node(1, node::MAX_ID, terminal_F, terminal_T); + nw << node(1, node::max_id, terminal_F, terminal_T); } - shared_levelized_file zdd_1; + shared_levelized_file zdd_1; /* // _1_ ---- x2 // / \ @@ -43,13 +43,13 @@ go_bandit([]() { // F T */ - const node n1_7 = node(10, zdd::MAX_ID, terminal_F, terminal_T); - const node n1_6 = node(8, zdd::MAX_ID, terminal_T, terminal_T); - const node n1_5 = node(8, zdd::MAX_ID-1, n1_7.uid(), terminal_T); - const node n1_4 = node(6, zdd::MAX_ID, n1_5.uid(), n1_6.uid()); - const node n1_3 = node(4, zdd::MAX_ID, n1_4.uid(), terminal_T); - const node n1_2 = node(4, zdd::MAX_ID-1, terminal_F, n1_4.uid()); - const node n1_1 = node(2, zdd::MAX_ID, n1_2.uid(), n1_3.uid()); + const node n1_7 = node(10, zdd::max_id, terminal_F, terminal_T); + const node n1_6 = node(8, zdd::max_id, terminal_T, terminal_T); + const node n1_5 = node(8, zdd::max_id-1, n1_7.uid(), terminal_T); + const node n1_4 = node(6, zdd::max_id, n1_5.uid(), n1_6.uid()); + const node n1_3 = node(4, zdd::max_id, n1_4.uid(), terminal_T); + const node n1_2 = node(4, zdd::max_id-1, terminal_F, n1_4.uid()); + const node n1_1 = node(2, zdd::max_id, n1_2.uid(), n1_3.uid()); { // Garbage collect writers to free write-lock node_writer nw(zdd_1); @@ -65,35 +65,35 @@ go_bandit([]() { const std::vector vars = { }; __zdd out = zdd_expand(zdd_F, vars.begin(), vars.end()); - AssertThat(out.get>(), Is().EqualTo(zdd_F)); + AssertThat(out.get>(), Is().EqualTo(zdd_F)); }); it("returns same file for { Ø } on empty labels", [&]() { const std::vector vars = { }; __zdd out = zdd_expand(zdd_T, vars.begin(), vars.end()); - AssertThat(out.get>(), Is().EqualTo(zdd_T)); + AssertThat(out.get>(), Is().EqualTo(zdd_T)); }); it("returns same file for { {1} } on empty labels", [&]() { const std::vector vars = { }; __zdd out = zdd_expand(zdd_x1, vars.begin(), vars.end()); - AssertThat(out.get>(), Is().EqualTo(zdd_x1)); + AssertThat(out.get>(), Is().EqualTo(zdd_x1)); }); it("returns same file for [1] on empty labels", [&]() { const std::vector vars = { }; __zdd out = zdd_expand(zdd_x1, vars.begin(), vars.end()); - AssertThat(out.get>(), Is().EqualTo(zdd_x1)); + AssertThat(out.get>(), Is().EqualTo(zdd_x1)); }); it("returns same file for Ø on (1,2)", [&]() { const std::vector vars = { 1, 2 }; __zdd out = zdd_expand(zdd_F, vars.begin(), vars.end()); - AssertThat(out.get>(), Is().EqualTo(zdd_F)); + AssertThat(out.get>(), Is().EqualTo(zdd_F)); }); it("returns don't care node for { Ø } on (42)", [&]() { @@ -104,7 +104,7 @@ go_bandit([]() { node_test_stream ns(out); AssertThat(ns.can_pull(), Is().True()); - AssertThat(ns.pull(), Is().EqualTo(node(42, node::MAX_ID, terminal_T, terminal_T))); + AssertThat(ns.pull(), Is().EqualTo(node(42, node::max_id, terminal_T, terminal_T))); AssertThat(ns.can_pull(), Is().False()); @@ -115,13 +115,13 @@ go_bandit([]() { AssertThat(levels.can_pull(), Is().False()); - AssertThat(out.get>()->max_1level_cut[cut_type::INTERNAL], Is().EqualTo(1u)); - AssertThat(out.get>()->max_1level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(1u)); - AssertThat(out.get>()->max_1level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(2u)); - AssertThat(out.get>()->max_1level_cut[cut_type::ALL], Is().EqualTo(2u)); + AssertThat(out.get>()->max_1level_cut[cut::Internal], Is().EqualTo(1u)); + AssertThat(out.get>()->max_1level_cut[cut::Internal_False], Is().EqualTo(1u)); + AssertThat(out.get>()->max_1level_cut[cut::Internal_True], Is().EqualTo(2u)); + AssertThat(out.get>()->max_1level_cut[cut::All], Is().EqualTo(2u)); - AssertThat(out.get>()->number_of_terminals[false], Is().EqualTo(0u)); - AssertThat(out.get>()->number_of_terminals[true], Is().EqualTo(2u)); + AssertThat(out.get>()->number_of_terminals[false], Is().EqualTo(0u)); + AssertThat(out.get>()->number_of_terminals[true], Is().EqualTo(2u)); }); it("returns don't care chain for { Ø } on (0,2)", [&]() { @@ -132,12 +132,12 @@ go_bandit([]() { node_test_stream ns(out); AssertThat(ns.can_pull(), Is().True()); - AssertThat(ns.pull(), Is().EqualTo(node(2, node::MAX_ID, terminal_T, terminal_T))); + AssertThat(ns.pull(), Is().EqualTo(node(2, node::max_id, terminal_T, terminal_T))); AssertThat(ns.can_pull(), Is().True()); - AssertThat(ns.pull(), Is().EqualTo(node(0, node::MAX_ID, - ptr_uint64(2, ptr_uint64::MAX_ID), - ptr_uint64(2, ptr_uint64::MAX_ID)))); + AssertThat(ns.pull(), Is().EqualTo(node(0, node::max_id, + ptr_uint64(2, ptr_uint64::max_id), + ptr_uint64(2, ptr_uint64::max_id)))); AssertThat(ns.can_pull(), Is().False()); @@ -151,21 +151,21 @@ go_bandit([]() { AssertThat(levels.can_pull(), Is().False()); - AssertThat(out.get>()->max_1level_cut[cut_type::INTERNAL], Is().EqualTo(2u)); - AssertThat(out.get>()->max_1level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(2u)); - AssertThat(out.get>()->max_1level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(2u)); - AssertThat(out.get>()->max_1level_cut[cut_type::ALL], Is().EqualTo(2u)); + AssertThat(out.get>()->max_1level_cut[cut::Internal], Is().EqualTo(2u)); + AssertThat(out.get>()->max_1level_cut[cut::Internal_False], Is().EqualTo(2u)); + AssertThat(out.get>()->max_1level_cut[cut::Internal_True], Is().EqualTo(2u)); + AssertThat(out.get>()->max_1level_cut[cut::All], Is().EqualTo(2u)); - AssertThat(out.get>()->number_of_terminals[false], Is().EqualTo(0u)); - AssertThat(out.get>()->number_of_terminals[true], Is().EqualTo(2u)); + AssertThat(out.get>()->number_of_terminals[false], Is().EqualTo(0u)); + AssertThat(out.get>()->number_of_terminals[true], Is().EqualTo(2u)); }); it("adds new root for { { 1 } } on (0)", [&]() { - shared_levelized_file in; + shared_levelized_file in; { // Garbage collect writer to free write-lock node_writer w(in); - w << node(1, node::MAX_ID, terminal_F, terminal_T); + w << node(1, node::max_id, terminal_F, terminal_T); } const std::vector vars = { 0 }; @@ -200,19 +200,19 @@ go_bandit([]() { AssertThat(levels.can_pull(), Is().False()); - AssertThat(out.get<__zdd::shared_arcs_t>()->max_1level_cut, Is().EqualTo(2u)); + AssertThat(out.get<__zdd::shared_arc_file_type>()->max_1level_cut, Is().EqualTo(2u)); - AssertThat(out.get<__zdd::shared_arcs_t>()->number_of_terminals[false], Is().EqualTo(1u)); - AssertThat(out.get<__zdd::shared_arcs_t>()->number_of_terminals[true], Is().EqualTo(1u)); + AssertThat(out.get<__zdd::shared_arc_file_type>()->number_of_terminals[false], Is().EqualTo(1u)); + AssertThat(out.get<__zdd::shared_arc_file_type>()->number_of_terminals[true], Is().EqualTo(1u)); }); it("adds node chain for { { 3 }, { 3,4 } } on (0,2)", [&]() { - shared_levelized_file in; + shared_levelized_file in; { // Garbage collect writer to free write-lock node_writer w(in); - w << node(4, node::MAX_ID, terminal_F, terminal_T) - << node(3, node::MAX_ID, terminal_T, ptr_uint64(4, ptr_uint64::MAX_ID)) + w << node(4, node::max_id, terminal_F, terminal_T) + << node(3, node::max_id, terminal_T, ptr_uint64(4, ptr_uint64::max_id)) ; } @@ -266,18 +266,18 @@ go_bandit([]() { AssertThat(levels.can_pull(), Is().False()); - AssertThat(out.get<__zdd::shared_arcs_t>()->max_1level_cut, Is().EqualTo(2u)); + AssertThat(out.get<__zdd::shared_arc_file_type>()->max_1level_cut, Is().EqualTo(2u)); - AssertThat(out.get<__zdd::shared_arcs_t>()->number_of_terminals[false], Is().EqualTo(1u)); - AssertThat(out.get<__zdd::shared_arcs_t>()->number_of_terminals[true], Is().EqualTo(2u)); + AssertThat(out.get<__zdd::shared_arc_file_type>()->number_of_terminals[false], Is().EqualTo(1u)); + AssertThat(out.get<__zdd::shared_arc_file_type>()->number_of_terminals[true], Is().EqualTo(2u)); }); it("adds nodes before and after for { Ø, { 3 } } on (0,2,4)", [&]() { - shared_levelized_file in; + shared_levelized_file in; { // Garbage collect writer to free write-lock node_writer w(in); - w << node(3, node::MAX_ID, terminal_T, terminal_T); + w << node(3, node::max_id, terminal_T, terminal_T); } const std::vector vars = { 0, 2, 4 }; @@ -330,22 +330,22 @@ go_bandit([]() { AssertThat(levels.can_pull(), Is().False()); - AssertThat(out.get<__zdd::shared_arcs_t>()->max_1level_cut, Is().EqualTo(2u)); + AssertThat(out.get<__zdd::shared_arc_file_type>()->max_1level_cut, Is().EqualTo(2u)); - AssertThat(out.get<__zdd::shared_arcs_t>()->number_of_terminals[false], Is().EqualTo(0u)); - AssertThat(out.get<__zdd::shared_arcs_t>()->number_of_terminals[true], Is().EqualTo(2u)); + AssertThat(out.get<__zdd::shared_arc_file_type>()->number_of_terminals[false], Is().EqualTo(0u)); + AssertThat(out.get<__zdd::shared_arc_file_type>()->number_of_terminals[true], Is().EqualTo(2u)); }); it("adds nodes for T terminal but not F terminal for { { 1,2 }, { 1,3 } } on (4,5,6)", [&]() { // Alternative title: Only creates one terminal-chain. - shared_levelized_file in; + shared_levelized_file in; { // Garbage collect writer to free write-lock node_writer w(in); - w << node(3, node::MAX_ID, terminal_F, terminal_T) - << node(2, node::MAX_ID, ptr_uint64(3, ptr_uint64::MAX_ID), terminal_T) - << node(1, node::MAX_ID, terminal_F, ptr_uint64(2, ptr_uint64::MAX_ID)); + w << node(3, node::max_id, terminal_F, terminal_T) + << node(2, node::max_id, ptr_uint64(3, ptr_uint64::max_id), terminal_T) + << node(1, node::max_id, terminal_F, ptr_uint64(2, ptr_uint64::max_id)); } const std::vector vars = { 4, 5, 6 }; @@ -416,19 +416,19 @@ go_bandit([]() { AssertThat(levels.can_pull(), Is().False()); - AssertThat(out.get<__zdd::shared_arcs_t>()->max_1level_cut, Is().EqualTo(2u)); + AssertThat(out.get<__zdd::shared_arc_file_type>()->max_1level_cut, Is().EqualTo(2u)); - AssertThat(out.get<__zdd::shared_arcs_t>()->number_of_terminals[false], Is().EqualTo(2u)); - AssertThat(out.get<__zdd::shared_arcs_t>()->number_of_terminals[true], Is().EqualTo(2u)); + AssertThat(out.get<__zdd::shared_arc_file_type>()->number_of_terminals[false], Is().EqualTo(2u)); + AssertThat(out.get<__zdd::shared_arc_file_type>()->number_of_terminals[true], Is().EqualTo(2u)); }); it("adds node in between levels { { 0,2 } } on (1)", [&]() { - shared_levelized_file in; + shared_levelized_file in; { // Garbage collect writer to free write-lock node_writer w(in); - w << node(2, node::MAX_ID, terminal_F, terminal_T) - << node(0, node::MAX_ID, terminal_F, ptr_uint64(2, ptr_uint64::MAX_ID)); + w << node(2, node::max_id, terminal_F, terminal_T) + << node(0, node::max_id, terminal_F, ptr_uint64(2, ptr_uint64::max_id)); } const std::vector vars = { 1 }; @@ -472,19 +472,19 @@ go_bandit([]() { AssertThat(levels.can_pull(), Is().False()); - AssertThat(out.get<__zdd::shared_arcs_t>()->max_1level_cut, Is().EqualTo(2u)); + AssertThat(out.get<__zdd::shared_arc_file_type>()->max_1level_cut, Is().EqualTo(2u)); - AssertThat(out.get<__zdd::shared_arcs_t>()->number_of_terminals[false], Is().EqualTo(2u)); - AssertThat(out.get<__zdd::shared_arcs_t>()->number_of_terminals[true], Is().EqualTo(1u)); + AssertThat(out.get<__zdd::shared_arc_file_type>()->number_of_terminals[false], Is().EqualTo(2u)); + AssertThat(out.get<__zdd::shared_arc_file_type>()->number_of_terminals[true], Is().EqualTo(1u)); }); it("adds nodes in between levels { { 0,3 } } on (1,2)", [&]() { - shared_levelized_file in; + shared_levelized_file in; { // Garbage collect writer to free write-lock node_writer w(in); - w << node(3, node::MAX_ID, terminal_F, terminal_T) - << node(0, node::MAX_ID, terminal_F, ptr_uint64(3, ptr_uint64::MAX_ID)); + w << node(3, node::max_id, terminal_F, terminal_T) + << node(0, node::max_id, terminal_F, ptr_uint64(3, ptr_uint64::max_id)); } const std::vector vars = { 1, 2 }; @@ -537,20 +537,20 @@ go_bandit([]() { AssertThat(levels.can_pull(), Is().False()); - AssertThat(out.get<__zdd::shared_arcs_t>()->max_1level_cut, Is().EqualTo(2u)); + AssertThat(out.get<__zdd::shared_arc_file_type>()->max_1level_cut, Is().EqualTo(2u)); - AssertThat(out.get<__zdd::shared_arcs_t>()->number_of_terminals[false], Is().EqualTo(2u)); - AssertThat(out.get<__zdd::shared_arcs_t>()->number_of_terminals[true], Is().EqualTo(1u)); + AssertThat(out.get<__zdd::shared_arc_file_type>()->number_of_terminals[false], Is().EqualTo(2u)); + AssertThat(out.get<__zdd::shared_arc_file_type>()->number_of_terminals[true], Is().EqualTo(1u)); }); it("adds different don't care nodes on different arcs cut for { {0}, {2}, { 0,2 } } on (1,2)", [&]() { - shared_levelized_file in; + shared_levelized_file in; { // Garbage collect writer to free write-lock node_writer w(in); - w << node(2, node::MAX_ID, terminal_T, terminal_T) - << node(2, node::MAX_ID-1, terminal_F, terminal_T) - << node(0, node::MAX_ID, ptr_uint64(2, ptr_uint64::MAX_ID-1), ptr_uint64(2, ptr_uint64::MAX_ID)); + w << node(2, node::max_id, terminal_T, terminal_T) + << node(2, node::max_id-1, terminal_F, terminal_T) + << node(0, node::max_id, ptr_uint64(2, ptr_uint64::max_id-1), ptr_uint64(2, ptr_uint64::max_id)); } const std::vector vars = { 1 }; @@ -606,10 +606,10 @@ go_bandit([]() { AssertThat(levels.can_pull(), Is().False()); - AssertThat(out.get<__zdd::shared_arcs_t>()->max_1level_cut, Is().EqualTo(4u)); + AssertThat(out.get<__zdd::shared_arc_file_type>()->max_1level_cut, Is().EqualTo(4u)); - AssertThat(out.get<__zdd::shared_arcs_t>()->number_of_terminals[false], Is().EqualTo(1u)); - AssertThat(out.get<__zdd::shared_arcs_t>()->number_of_terminals[true], Is().EqualTo(3u)); + AssertThat(out.get<__zdd::shared_arc_file_type>()->number_of_terminals[false], Is().EqualTo(1u)); + AssertThat(out.get<__zdd::shared_arc_file_type>()->number_of_terminals[true], Is().EqualTo(3u)); }); it("adds don't care nodes before, in between, and after for [1] on (0,1,3,5,7,9,11)", [&]() { @@ -783,10 +783,10 @@ go_bandit([]() { AssertThat(levels.can_pull(), Is().False()); - AssertThat(out.get<__zdd::shared_arcs_t>()->max_1level_cut, Is().EqualTo(6u)); + AssertThat(out.get<__zdd::shared_arc_file_type>()->max_1level_cut, Is().EqualTo(6u)); - AssertThat(out.get<__zdd::shared_arcs_t>()->number_of_terminals[false], Is().EqualTo(2u)); - AssertThat(out.get<__zdd::shared_arcs_t>()->number_of_terminals[true], Is().EqualTo(2u)); + AssertThat(out.get<__zdd::shared_arc_file_type>()->number_of_terminals[false], Is().EqualTo(2u)); + AssertThat(out.get<__zdd::shared_arc_file_type>()->number_of_terminals[true], Is().EqualTo(2u)); }); }); }); diff --git a/test/adiar/zdd/test_pred.cpp b/test/adiar/zdd/test_pred.cpp index a7d717315..88d00844f 100644 --- a/test/adiar/zdd/test_pred.cpp +++ b/test/adiar/zdd/test_pred.cpp @@ -6,101 +6,101 @@ go_bandit([]() { ptr_uint64 terminal_F = ptr_uint64(false); // Ø - shared_levelized_file zdd_empty_nf; + shared_levelized_file zdd_empty_nf; { node_writer nw(zdd_empty_nf); nw << node(false); } - shared_levelized_file zdd_empty_nf_copy; + shared_levelized_file zdd_empty_nf_copy; { node_writer nw(zdd_empty_nf_copy); nw << node(false); } // { Ø } - shared_levelized_file zdd_null_nf; + shared_levelized_file zdd_null_nf; { node_writer nw(zdd_null_nf); nw << node(true); } - shared_levelized_file zdd_null_nf_copy; + shared_levelized_file zdd_null_nf_copy; { node_writer nw(zdd_null_nf_copy); nw << node(true); } // { {1} } - shared_levelized_file zdd_A_nf; + shared_levelized_file zdd_A_nf; { node_writer nw(zdd_A_nf); - nw << node(1, node::MAX_ID, terminal_F, terminal_T); + nw << node(1, node::max_id, terminal_F, terminal_T); } - shared_levelized_file zdd_A_nf_copy; + shared_levelized_file zdd_A_nf_copy; { node_writer nw(zdd_A_nf_copy); - nw << node(1, node::MAX_ID, terminal_F, terminal_T); + nw << node(1, node::max_id, terminal_F, terminal_T); } // { {1}, {1,2} } - shared_levelized_file zdd_B_nf; + shared_levelized_file zdd_B_nf; { node_writer nw(zdd_B_nf); - nw << node(2, node::MAX_ID, terminal_T, terminal_T) - << node(1, node::MAX_ID, terminal_F, ptr_uint64(2, ptr_uint64::MAX_ID)) + nw << node(2, node::max_id, terminal_T, terminal_T) + << node(1, node::max_id, terminal_F, ptr_uint64(2, ptr_uint64::max_id)) ; } // { Ø, {1}, {2}, {1,2} } - shared_levelized_file zdd_C_nf; + shared_levelized_file zdd_C_nf; { node_writer nw(zdd_C_nf); - nw << node(2, node::MAX_ID, terminal_T, terminal_T) - << node(1, node::MAX_ID, ptr_uint64(2, ptr_uint64::MAX_ID), ptr_uint64(2, ptr_uint64::MAX_ID)) + nw << node(2, node::max_id, terminal_T, terminal_T) + << node(1, node::max_id, ptr_uint64(2, ptr_uint64::max_id), ptr_uint64(2, ptr_uint64::max_id)) ; } - shared_levelized_file zdd_C_nf_copy; + shared_levelized_file zdd_C_nf_copy; { node_writer nw(zdd_C_nf_copy); - nw << node(2, node::MAX_ID, terminal_T, terminal_T) - << node(1, node::MAX_ID, ptr_uint64(2, ptr_uint64::MAX_ID), ptr_uint64(2, ptr_uint64::MAX_ID)) + nw << node(2, node::max_id, terminal_T, terminal_T) + << node(1, node::max_id, ptr_uint64(2, ptr_uint64::max_id), ptr_uint64(2, ptr_uint64::max_id)) ; } // { {1}, {1,2}, {0,1,3} } - shared_levelized_file zdd_D_nf; + shared_levelized_file zdd_D_nf; { node_writer nw(zdd_D_nf); - nw << node(3, node::MAX_ID, terminal_F, terminal_T) - << node(2, node::MAX_ID, terminal_T, terminal_T) - << node(1, node::MAX_ID, terminal_F, ptr_uint64(3, ptr_uint64::MAX_ID)) - << node(1, node::MAX_ID-1, terminal_F, ptr_uint64(2, ptr_uint64::MAX_ID)) - << node(0, node::MAX_ID, ptr_uint64(1, ptr_uint64::MAX_ID-1), ptr_uint64(1, ptr_uint64::MAX_ID)) + nw << node(3, node::max_id, terminal_F, terminal_T) + << node(2, node::max_id, terminal_T, terminal_T) + << node(1, node::max_id, terminal_F, ptr_uint64(3, ptr_uint64::max_id)) + << node(1, node::max_id-1, terminal_F, ptr_uint64(2, ptr_uint64::max_id)) + << node(0, node::max_id, ptr_uint64(1, ptr_uint64::max_id-1), ptr_uint64(1, ptr_uint64::max_id)) ; } - shared_levelized_file zdd_D_nf_copy; + shared_levelized_file zdd_D_nf_copy; { node_writer nw(zdd_D_nf_copy); - nw << node(3, node::MAX_ID, terminal_F, terminal_T) - << node(2, node::MAX_ID, terminal_T, terminal_T) - << node(1, node::MAX_ID, terminal_F, ptr_uint64(3, ptr_uint64::MAX_ID)) - << node(1, node::MAX_ID-1, terminal_F, ptr_uint64(2, ptr_uint64::MAX_ID)) - << node(0, node::MAX_ID, ptr_uint64(1, ptr_uint64::MAX_ID-1), ptr_uint64(1, ptr_uint64::MAX_ID)) + nw << node(3, node::max_id, terminal_F, terminal_T) + << node(2, node::max_id, terminal_T, terminal_T) + << node(1, node::max_id, terminal_F, ptr_uint64(3, ptr_uint64::max_id)) + << node(1, node::max_id-1, terminal_F, ptr_uint64(2, ptr_uint64::max_id)) + << node(0, node::max_id, ptr_uint64(1, ptr_uint64::max_id-1), ptr_uint64(1, ptr_uint64::max_id)) ; } // { Ø, {0,3} } - shared_levelized_file zdd_E_nf; + shared_levelized_file zdd_E_nf; { node_writer nw(zdd_E_nf); - nw << node(3, node::MAX_ID, terminal_F, terminal_T) - << node(0, node::MAX_ID, terminal_T, ptr_uint64(3, ptr_uint64::MAX_ID)) + nw << node(3, node::max_id, terminal_F, terminal_T) + << node(0, node::max_id, terminal_T, ptr_uint64(3, ptr_uint64::max_id)) ; } - shared_levelized_file zdd_E_nf_copy; + shared_levelized_file zdd_E_nf_copy; { node_writer nw(zdd_E_nf_copy); - nw << node(3, node::MAX_ID, terminal_F, terminal_T) - << node(0, node::MAX_ID, terminal_T, ptr_uint64(3, ptr_uint64::MAX_ID)) + nw << node(3, node::max_id, terminal_F, terminal_T) + << node(0, node::max_id, terminal_T, ptr_uint64(3, ptr_uint64::max_id)) ; } // { {2} } - shared_levelized_file zdd_F_nf; + shared_levelized_file zdd_F_nf; { node_writer nw(zdd_F_nf); - nw << node(2, node::MAX_ID, terminal_F, terminal_T); + nw << node(2, node::max_id, terminal_F, terminal_T); } // Equal and unequal will not be tested, since it merely is a call to diff --git a/test/adiar/zdd/test_project.cpp b/test/adiar/zdd/test_project.cpp index 82d5b429f..e78e4326c 100644 --- a/test/adiar/zdd/test_project.cpp +++ b/test/adiar/zdd/test_project.cpp @@ -6,14 +6,14 @@ go_bandit([]() { // Sink cases // Ø - shared_levelized_file zdd_empty; + shared_levelized_file zdd_empty; { node_writer nw(zdd_empty); nw << node(false); } // { Ø } - shared_levelized_file zdd_null; + shared_levelized_file zdd_null; { node_writer nw(zdd_null); nw << node(true); @@ -38,14 +38,14 @@ go_bandit([]() { // / \ // T T */ - shared_levelized_file zdd_1; + shared_levelized_file zdd_1; { node_writer nw(zdd_1); - nw << node(4, node::MAX_ID, terminal_T, terminal_T) - << node(3, node::MAX_ID, terminal_F, ptr_uint64(4, ptr_uint64::MAX_ID)) - << node(2, node::MAX_ID, ptr_uint64(3, ptr_uint64::MAX_ID), terminal_T) - << node(1, node::MAX_ID, ptr_uint64(2, ptr_uint64::MAX_ID), ptr_uint64(2, ptr_uint64::MAX_ID)) - << node(0, node::MAX_ID, ptr_uint64(1, ptr_uint64::MAX_ID), terminal_T) + nw << node(4, node::max_id, terminal_T, terminal_T) + << node(3, node::max_id, terminal_F, ptr_uint64(4, ptr_uint64::max_id)) + << node(2, node::max_id, ptr_uint64(3, ptr_uint64::max_id), terminal_T) + << node(1, node::max_id, ptr_uint64(2, ptr_uint64::max_id), ptr_uint64(2, ptr_uint64::max_id)) + << node(0, node::max_id, ptr_uint64(1, ptr_uint64::max_id), terminal_T) ; } @@ -63,13 +63,13 @@ go_bandit([]() { // / \ // T T */ - shared_levelized_file zdd_2; + shared_levelized_file zdd_2; { node_writer nw(zdd_2); - nw << node(4, node::MAX_ID, terminal_T, terminal_T) - << node(3, node::MAX_ID, terminal_T, terminal_T) - << node(2, node::MAX_ID, terminal_F, ptr_uint64(4, ptr_uint64::MAX_ID)) - << node(0, node::MAX_ID, ptr_uint64(2, ptr_uint64::MAX_ID), ptr_uint64(3, ptr_uint64::MAX_ID)) + nw << node(4, node::max_id, terminal_T, terminal_T) + << node(3, node::max_id, terminal_T, terminal_T) + << node(2, node::max_id, terminal_F, ptr_uint64(4, ptr_uint64::max_id)) + << node(0, node::max_id, ptr_uint64(2, ptr_uint64::max_id), ptr_uint64(3, ptr_uint64::max_id)) ; } @@ -83,13 +83,13 @@ go_bandit([]() { // / \/ \ // F T T */ - shared_levelized_file zdd_3; + shared_levelized_file zdd_3; { node_writer nw(zdd_3); - nw << node(2, node::MAX_ID, terminal_T, terminal_T) - << node(2, node::MAX_ID-1, terminal_F, terminal_T) - << node(1, node::MAX_ID, ptr_uint64(2, ptr_uint64::MAX_ID-1), ptr_uint64(2, ptr_uint64::MAX_ID)) - << node(0, node::MAX_ID, ptr_uint64(1, ptr_uint64::MAX_ID), ptr_uint64(2, ptr_uint64::MAX_ID)) + nw << node(2, node::max_id, terminal_T, terminal_T) + << node(2, node::max_id-1, terminal_F, terminal_T) + << node(1, node::max_id, ptr_uint64(2, ptr_uint64::max_id-1), ptr_uint64(2, ptr_uint64::max_id)) + << node(0, node::max_id, ptr_uint64(1, ptr_uint64::max_id), ptr_uint64(2, ptr_uint64::max_id)) ; } @@ -103,14 +103,14 @@ go_bandit([]() { // / \/ \ // F T T */ - shared_levelized_file zdd_4; + shared_levelized_file zdd_4; { node_writer nw(zdd_4); - nw << node(4, node::MAX_ID, terminal_T, terminal_T) - << node(4, node::MAX_ID-1, terminal_F, terminal_T) - << node(2, node::MAX_ID, ptr_uint64(4, ptr_uint64::MAX_ID-1), ptr_uint64(4, ptr_uint64::MAX_ID)) - << node(2, node::MAX_ID-1, ptr_uint64(4, ptr_uint64::MAX_ID-1), ptr_uint64(4, ptr_uint64::MAX_ID-1)) - << node(0, node::MAX_ID, ptr_uint64(2, ptr_uint64::MAX_ID-1), ptr_uint64(2, ptr_uint64::MAX_ID)) + nw << node(4, node::max_id, terminal_T, terminal_T) + << node(4, node::max_id-1, terminal_F, terminal_T) + << node(2, node::max_id, ptr_uint64(4, ptr_uint64::max_id-1), ptr_uint64(4, ptr_uint64::max_id)) + << node(2, node::max_id-1, ptr_uint64(4, ptr_uint64::max_id-1), ptr_uint64(4, ptr_uint64::max_id-1)) + << node(0, node::max_id, ptr_uint64(2, ptr_uint64::max_id-1), ptr_uint64(2, ptr_uint64::max_id)) ; } @@ -172,55 +172,55 @@ go_bandit([]() { // /| |\ // F T T T */ - const node n5_o = node(13, node::MAX_ID, ptr_uint64(true), ptr_uint64(true)); - const node n5_n = node(13, node::MAX_ID-1, ptr_uint64(false), ptr_uint64(true)); + const node n5_o = node(13, node::max_id, ptr_uint64(true), ptr_uint64(true)); + const node n5_n = node(13, node::max_id-1, ptr_uint64(false), ptr_uint64(true)); - const node n5_17 = node(12, node::MAX_ID, ptr_uint64(true), ptr_uint64(true)); - const node n5_16 = node(12, node::MAX_ID-1, ptr_uint64(false), ptr_uint64(true)); + const node n5_17 = node(12, node::max_id, ptr_uint64(true), ptr_uint64(true)); + const node n5_16 = node(12, node::max_id-1, ptr_uint64(false), ptr_uint64(true)); - const node n5_m = node(11, node::MAX_ID, n5_o.uid(), n5_n.uid()); - const node n5_l = node(11, node::MAX_ID-1, n5_n.uid(), n5_o.uid()); - const node n5_15 = node(11, node::MAX_ID-2, n5_17.uid(), n5_16.uid()); - const node n5_14 = node(11, node::MAX_ID-3, n5_16.uid(), n5_17.uid()); + const node n5_m = node(11, node::max_id, n5_o.uid(), n5_n.uid()); + const node n5_l = node(11, node::max_id-1, n5_n.uid(), n5_o.uid()); + const node n5_15 = node(11, node::max_id-2, n5_17.uid(), n5_16.uid()); + const node n5_14 = node(11, node::max_id-3, n5_16.uid(), n5_17.uid()); - const node n5_k = node(10, node::MAX_ID, n5_m.uid(), n5_l.uid()); - const node n5_j = node(10, node::MAX_ID-1, n5_l.uid(), n5_m.uid()); - const node n5_13 = node(10, node::MAX_ID-2, n5_15.uid(), n5_14.uid()); - const node n5_12 = node(10, node::MAX_ID-3, n5_14.uid(), n5_15.uid()); + const node n5_k = node(10, node::max_id, n5_m.uid(), n5_l.uid()); + const node n5_j = node(10, node::max_id-1, n5_l.uid(), n5_m.uid()); + const node n5_13 = node(10, node::max_id-2, n5_15.uid(), n5_14.uid()); + const node n5_12 = node(10, node::max_id-3, n5_14.uid(), n5_15.uid()); - const node n5_i = node(9, node::MAX_ID, n5_k.uid(), n5_j.uid()); - const node n5_h = node(9, node::MAX_ID-1, n5_j.uid(), n5_k.uid()); - const node n5_11 = node(9, node::MAX_ID-2, n5_13.uid(), n5_12.uid()); - const node n5_10 = node(9, node::MAX_ID-3, n5_12.uid(), n5_13.uid()); + const node n5_i = node(9, node::max_id, n5_k.uid(), n5_j.uid()); + const node n5_h = node(9, node::max_id-1, n5_j.uid(), n5_k.uid()); + const node n5_11 = node(9, node::max_id-2, n5_13.uid(), n5_12.uid()); + const node n5_10 = node(9, node::max_id-3, n5_12.uid(), n5_13.uid()); - const node n5_g = node(8, node::MAX_ID, n5_i.uid(), n5_h.uid()); - const node n5_f = node(8, node::MAX_ID-1, n5_h.uid(), n5_i.uid()); - const node n5_9 = node(8, node::MAX_ID-2, n5_11.uid(), n5_10.uid()); - const node n5_8 = node(8, node::MAX_ID-3, n5_10.uid(), n5_11.uid()); + const node n5_g = node(8, node::max_id, n5_i.uid(), n5_h.uid()); + const node n5_f = node(8, node::max_id-1, n5_h.uid(), n5_i.uid()); + const node n5_9 = node(8, node::max_id-2, n5_11.uid(), n5_10.uid()); + const node n5_8 = node(8, node::max_id-3, n5_10.uid(), n5_11.uid()); - const node n5_7 = node(7, node::MAX_ID, n5_8.uid(), n5_9.uid()); + const node n5_7 = node(7, node::max_id, n5_8.uid(), n5_9.uid()); - const node n5_d = node(6, node::MAX_ID, n5_f.uid(), n5_g.uid()); - const node n5_6 = node(6, node::MAX_ID-1, n5_7.uid(), n5_9.uid()); - const node n5_5 = node(6, node::MAX_ID-2, n5_8.uid(), n5_7.uid()); + const node n5_d = node(6, node::max_id, n5_f.uid(), n5_g.uid()); + const node n5_6 = node(6, node::max_id-1, n5_7.uid(), n5_9.uid()); + const node n5_5 = node(6, node::max_id-2, n5_8.uid(), n5_7.uid()); - const node n5_c = node(5, node::MAX_ID, n5_d.uid(), ptr_uint64(true)); - const node n5_b = node(5, node::MAX_ID-1, ptr_uint64(false), n5_d.uid()); - const node n5_4 = node(5, node::MAX_ID-2, n5_5.uid(), n5_6.uid()); + const node n5_c = node(5, node::max_id, n5_d.uid(), ptr_uint64(true)); + const node n5_b = node(5, node::max_id-1, ptr_uint64(false), n5_d.uid()); + const node n5_4 = node(5, node::max_id-2, n5_5.uid(), n5_6.uid()); - const node n5_3 = node(4, node::MAX_ID, n5_4.uid(), ptr_uint64(true)); - const node n5_2 = node(4, node::MAX_ID-1, ptr_uint64(false), n5_4.uid()); + const node n5_3 = node(4, node::max_id, n5_4.uid(), ptr_uint64(true)); + const node n5_2 = node(4, node::max_id-1, ptr_uint64(false), n5_4.uid()); - const node n5_1 = node(3, node::MAX_ID, n5_2.uid(), n5_3.uid()); + const node n5_1 = node(3, node::max_id, n5_2.uid(), n5_3.uid()); - const node n5_a = node(2, node::MAX_ID, n5_b.uid(), n5_c.uid()); + const node n5_a = node(2, node::max_id, n5_b.uid(), n5_c.uid()); - const node n5_r3 = node(1, node::MAX_ID, n5_5.uid(), n5_d.uid()); - const node n5_r2 = node(1, node::MAX_ID-1, n5_1.uid(), n5_a.uid()); + const node n5_r3 = node(1, node::max_id, n5_5.uid(), n5_d.uid()); + const node n5_r2 = node(1, node::max_id-1, n5_1.uid(), n5_a.uid()); - const node n5_r1 = node(0, node::MAX_ID, n5_r2.uid(), n5_r3.uid()); + const node n5_r1 = node(0, node::max_id, n5_r2.uid(), n5_r3.uid()); - shared_levelized_file zdd_5; + shared_levelized_file zdd_5; { node_writer nw(zdd_5); nw << n5_o << n5_n @@ -243,25 +243,25 @@ go_bandit([]() { // TODO: Turn 'GreaterThanOrEqualTo' in max 1-level cuts below into an // 'EqualTo'. - describe("zdd_project(const zdd&, const predicate)", [&]() { + describe("zdd_project(const zdd&, const predicate)", [&]() { it("returns same file for Ø with dom = {1,3,5,...} [const &]", [&](){ - zdd out = zdd_project(zdd_empty, [](zdd::label_t x) { return x % 2; }); + zdd out = zdd_project(zdd_empty, [](zdd::label_type x) { return x % 2; }); AssertThat(out.file_ptr(), Is().EqualTo(zdd_empty)); }); it("returns same file for { Ø } with dom = {0,2,4,...} [&&]", [&](){ - zdd out = zdd_project(zdd(zdd_null), [](zdd::label_t x) { return !(x % 2); }); + zdd out = zdd_project(zdd(zdd_null), [](zdd::label_type x) { return !(x % 2); }); AssertThat(out.file_ptr(), Is().EqualTo(zdd_null)); }); - describe("quantify_mode == SINGLETON", [&]() { - quantify_mode = quantify_mode_t::SINGLETON; + describe("quantify_mode == Singleton", [&]() { + quantify_mode = quantify_mode_t::Singleton; it("computes with dom = Ø to be { Ø } for non-empty input [zdd_1] [const &]", [&](){ - adiar::shared_file dom; + adiar::shared_file dom; const zdd in = zdd_1; - zdd out = zdd_project(in, [](zdd::label_t) { return false; }); + zdd out = zdd_project(in, [](zdd::label_type) { return false; }); node_test_stream out_nodes(out); AssertThat(out_nodes.can_pull(), Is().True()); @@ -272,19 +272,19 @@ go_bandit([]() { level_info_test_stream ms(out); AssertThat(ms.can_pull(), Is().False()); - AssertThat(out->max_1level_cut[cut_type::INTERNAL], Is().GreaterThanOrEqualTo(0u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_FALSE], Is().GreaterThanOrEqualTo(0u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_TRUE], Is().GreaterThanOrEqualTo(1u)); - AssertThat(out->max_1level_cut[cut_type::ALL], Is().GreaterThanOrEqualTo(1u)); + AssertThat(out->max_1level_cut[cut::Internal], Is().GreaterThanOrEqualTo(0u)); + AssertThat(out->max_1level_cut[cut::Internal_False], Is().GreaterThanOrEqualTo(0u)); + AssertThat(out->max_1level_cut[cut::Internal_True], Is().GreaterThanOrEqualTo(1u)); + AssertThat(out->max_1level_cut[cut::All], Is().GreaterThanOrEqualTo(1u)); AssertThat(out->number_of_terminals[false], Is().EqualTo(0u)); AssertThat(out->number_of_terminals[true], Is().EqualTo(1u)); }); it("computes with dom = Ø to be { Ø } for non-empty input [zdd_2] [&&]", [&](){ - adiar::shared_file dom; + adiar::shared_file dom; - zdd out = zdd_project(zdd(zdd_2), [](zdd::label_t) { return false; }); + zdd out = zdd_project(zdd(zdd_2), [](zdd::label_type) { return false; }); node_test_stream out_nodes(out); AssertThat(out_nodes.can_pull(), Is().True()); @@ -295,17 +295,17 @@ go_bandit([]() { level_info_test_stream ms(out); AssertThat(ms.can_pull(), Is().False()); - AssertThat(out->max_1level_cut[cut_type::INTERNAL], Is().GreaterThanOrEqualTo(0u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_FALSE], Is().GreaterThanOrEqualTo(0u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_TRUE], Is().GreaterThanOrEqualTo(1u)); - AssertThat(out->max_1level_cut[cut_type::ALL], Is().GreaterThanOrEqualTo(1u)); + AssertThat(out->max_1level_cut[cut::Internal], Is().GreaterThanOrEqualTo(0u)); + AssertThat(out->max_1level_cut[cut::Internal_False], Is().GreaterThanOrEqualTo(0u)); + AssertThat(out->max_1level_cut[cut::Internal_True], Is().GreaterThanOrEqualTo(1u)); + AssertThat(out->max_1level_cut[cut::All], Is().GreaterThanOrEqualTo(1u)); AssertThat(out->number_of_terminals[false], Is().EqualTo(0u)); AssertThat(out->number_of_terminals[true], Is().EqualTo(1u)); }); it("computes with disjoint dom = { x | x > 2 } to be { Ø } [zdd_3] [&&]", [&](){ - zdd out = zdd_project(zdd(zdd_3), [](zdd::label_t x) { return x > 2; }); + zdd out = zdd_project(zdd(zdd_3), [](zdd::label_type x) { return x > 2; }); node_test_stream out_nodes(out); AssertThat(out_nodes.can_pull(), Is().True()); @@ -316,10 +316,10 @@ go_bandit([]() { level_info_test_stream ms(out); AssertThat(ms.can_pull(), Is().False()); - AssertThat(out->max_1level_cut[cut_type::INTERNAL], Is().GreaterThanOrEqualTo(0u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_FALSE], Is().GreaterThanOrEqualTo(0u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_TRUE], Is().GreaterThanOrEqualTo(1u)); - AssertThat(out->max_1level_cut[cut_type::ALL], Is().GreaterThanOrEqualTo(1u)); + AssertThat(out->max_1level_cut[cut::Internal], Is().GreaterThanOrEqualTo(0u)); + AssertThat(out->max_1level_cut[cut::Internal_False], Is().GreaterThanOrEqualTo(0u)); + AssertThat(out->max_1level_cut[cut::Internal_True], Is().GreaterThanOrEqualTo(1u)); + AssertThat(out->max_1level_cut[cut::All], Is().GreaterThanOrEqualTo(1u)); AssertThat(out->number_of_terminals[false], Is().EqualTo(0u)); AssertThat(out->number_of_terminals[true], Is().EqualTo(1u)); @@ -337,19 +337,19 @@ go_bandit([]() { // T T */ - zdd out = zdd_project(zdd_3, [](zdd::label_t x) { return !(x % 2); }); + zdd out = zdd_project(zdd_3, [](zdd::label_type x) { return !(x % 2); }); node_test_stream out_nodes(out); AssertThat(out_nodes.can_pull(), Is().True()); - AssertThat(out_nodes.pull(), Is().EqualTo(node(2, node::MAX_ID, + AssertThat(out_nodes.pull(), Is().EqualTo(node(2, node::max_id, terminal_T, terminal_T))); AssertThat(out_nodes.can_pull(), Is().True()); - AssertThat(out_nodes.pull(), Is().EqualTo(node(0, node::MAX_ID, - ptr_uint64(2, ptr_uint64::MAX_ID), - ptr_uint64(2, ptr_uint64::MAX_ID)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(0, node::max_id, + ptr_uint64(2, ptr_uint64::max_id), + ptr_uint64(2, ptr_uint64::max_id)))); AssertThat(out_nodes.can_pull(), Is().False()); @@ -363,20 +363,20 @@ go_bandit([]() { AssertThat(ms.can_pull(), Is().False()); - AssertThat(out->max_1level_cut[cut_type::INTERNAL], Is().GreaterThanOrEqualTo(2u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_FALSE], Is().GreaterThanOrEqualTo(2u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_TRUE], Is().GreaterThanOrEqualTo(2u)); - AssertThat(out->max_1level_cut[cut_type::ALL], Is().GreaterThanOrEqualTo(2u)); + AssertThat(out->max_1level_cut[cut::Internal], Is().GreaterThanOrEqualTo(2u)); + AssertThat(out->max_1level_cut[cut::Internal_False], Is().GreaterThanOrEqualTo(2u)); + AssertThat(out->max_1level_cut[cut::Internal_True], Is().GreaterThanOrEqualTo(2u)); + AssertThat(out->max_1level_cut[cut::All], Is().GreaterThanOrEqualTo(2u)); AssertThat(out->number_of_terminals[false], Is().EqualTo(0u)); AssertThat(out->number_of_terminals[true], Is().EqualTo(2u)); }); - quantify_mode = quantify_mode_t::AUTO; + quantify_mode = quantify_mode_t::Auto; }); - describe("quantify_mode == PARTIAL", [&]() { - quantify_mode = quantify_mode_t::PARTIAL; + describe("quantify_mode == Partial", [&]() { + quantify_mode = quantify_mode_t::Partial; it("computes zdd_3 in a single sweep with dom = { x | x % 2 == 0 }", [&](){ /* Expected: { {0}, {2}, {0,2} } @@ -390,8 +390,8 @@ go_bandit([]() { // T T */ - std::vector call_history; - zdd out = zdd_project(zdd_3, [&call_history](zdd::label_t x) { + std::vector call_history; + zdd out = zdd_project(zdd_3, [&call_history](zdd::label_type x) { call_history.push_back(x); return (x % 2) == 0; }); @@ -399,14 +399,14 @@ go_bandit([]() { node_test_stream out_nodes(out); AssertThat(out_nodes.can_pull(), Is().True()); - AssertThat(out_nodes.pull(), Is().EqualTo(node(2, node::MAX_ID, + AssertThat(out_nodes.pull(), Is().EqualTo(node(2, node::max_id, terminal_T, terminal_T))); AssertThat(out_nodes.can_pull(), Is().True()); - AssertThat(out_nodes.pull(), Is().EqualTo(node(0, node::MAX_ID, - ptr_uint64(2, ptr_uint64::MAX_ID), - ptr_uint64(2, ptr_uint64::MAX_ID)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(0, node::max_id, + ptr_uint64(2, ptr_uint64::max_id), + ptr_uint64(2, ptr_uint64::max_id)))); AssertThat(out_nodes.can_pull(), Is().False()); @@ -420,10 +420,10 @@ go_bandit([]() { AssertThat(ms.can_pull(), Is().False()); - AssertThat(out->max_1level_cut[cut_type::INTERNAL], Is().GreaterThanOrEqualTo(2u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_FALSE], Is().GreaterThanOrEqualTo(2u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_TRUE], Is().GreaterThanOrEqualTo(2u)); - AssertThat(out->max_1level_cut[cut_type::ALL], Is().GreaterThanOrEqualTo(2u)); + AssertThat(out->max_1level_cut[cut::Internal], Is().GreaterThanOrEqualTo(2u)); + AssertThat(out->max_1level_cut[cut::Internal_False], Is().GreaterThanOrEqualTo(2u)); + AssertThat(out->max_1level_cut[cut::Internal_True], Is().GreaterThanOrEqualTo(2u)); + AssertThat(out->max_1level_cut[cut::All], Is().GreaterThanOrEqualTo(2u)); AssertThat(out->number_of_terminals[false], Is().EqualTo(0u)); AssertThat(out->number_of_terminals[true], Is().EqualTo(2u)); @@ -449,8 +449,8 @@ go_bandit([]() { }); it("quantifies exploding ZDD 5", [&]() { - std::vector call_history; - zdd out = zdd_project(zdd_5, [&call_history](const zdd::label_t x) -> bool { + std::vector call_history; + zdd out = zdd_project(zdd_5, [&call_history](const zdd::label_type x) -> bool { call_history.push_back(x); return 1 < x; }); @@ -458,234 +458,234 @@ go_bandit([]() { node_test_stream out_nodes(out); AssertThat(out_nodes.can_pull(), Is().True()); // (o) / (n,o) - AssertThat(out_nodes.pull(), Is().EqualTo(node(13, node::MAX_ID, - node::ptr_t(true), - node::ptr_t(true)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(13, node::max_id, + node::pointer_type(true), + node::pointer_type(true)))); AssertThat(out_nodes.can_pull(), Is().True()); // (n) - AssertThat(out_nodes.pull(), Is().EqualTo(node(13, node::MAX_ID-1, - node::ptr_t(false), - node::ptr_t(true)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(13, node::max_id-1, + node::pointer_type(false), + node::pointer_type(true)))); AssertThat(out_nodes.can_pull(), Is().True()); // (17) - AssertThat(out_nodes.pull(), Is().EqualTo(node(12, node::MAX_ID, - node::ptr_t(true), - node::ptr_t(true)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(12, node::max_id, + node::pointer_type(true), + node::pointer_type(true)))); AssertThat(out_nodes.can_pull(), Is().True()); // (16) - AssertThat(out_nodes.pull(), Is().EqualTo(node(12, node::MAX_ID-1, - node::ptr_t(false), - node::ptr_t(true)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(12, node::max_id-1, + node::pointer_type(false), + node::pointer_type(true)))); AssertThat(out_nodes.can_pull(), Is().True()); // (16,o) / (16,o,n) - AssertThat(out_nodes.pull(), Is().EqualTo(node(12, node::MAX_ID-2, - node::ptr_t(13, node::MAX_ID), - node::ptr_t(true)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(12, node::max_id-2, + node::pointer_type(13, node::max_id), + node::pointer_type(true)))); AssertThat(out_nodes.can_pull(), Is().True()); // (16,n) - AssertThat(out_nodes.pull(), Is().EqualTo(node(12, node::MAX_ID-3, - node::ptr_t(13, node::MAX_ID-1), - node::ptr_t(true)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(12, node::max_id-3, + node::pointer_type(13, node::max_id-1), + node::pointer_type(true)))); AssertThat(out_nodes.can_pull(), Is().True()); // (l) - AssertThat(out_nodes.pull(), Is().EqualTo(node(11, node::MAX_ID, - node::ptr_t(13, node::MAX_ID-1), - node::ptr_t(13, node::MAX_ID)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(11, node::max_id, + node::pointer_type(13, node::max_id-1), + node::pointer_type(13, node::max_id)))); AssertThat(out_nodes.can_pull(), Is().True()); // (m) - AssertThat(out_nodes.pull(), Is().EqualTo(node(11, node::MAX_ID-1, - node::ptr_t(13, node::MAX_ID), - node::ptr_t(13, node::MAX_ID-1)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(11, node::max_id-1, + node::pointer_type(13, node::max_id), + node::pointer_type(13, node::max_id-1)))); AssertThat(out_nodes.can_pull(), Is().True()); // (14) - AssertThat(out_nodes.pull(), Is().EqualTo(node(11, node::MAX_ID-2, - node::ptr_t(12, node::MAX_ID-1), - node::ptr_t(12, node::MAX_ID)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(11, node::max_id-2, + node::pointer_type(12, node::max_id-1), + node::pointer_type(12, node::max_id)))); AssertThat(out_nodes.can_pull(), Is().True()); // (15) - AssertThat(out_nodes.pull(), Is().EqualTo(node(11, node::MAX_ID-3, - node::ptr_t(12, node::MAX_ID), - node::ptr_t(12, node::MAX_ID-1)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(11, node::max_id-3, + node::pointer_type(12, node::max_id), + node::pointer_type(12, node::max_id-1)))); AssertThat(out_nodes.can_pull(), Is().True()); // (TODO) - AssertThat(out_nodes.pull(), Is().EqualTo(node(11, node::MAX_ID-4, - node::ptr_t(12, node::MAX_ID-2), - node::ptr_t(12, node::MAX_ID-2)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(11, node::max_id-4, + node::pointer_type(12, node::max_id-2), + node::pointer_type(12, node::max_id-2)))); AssertThat(out_nodes.can_pull(), Is().True()); // (14,l) - AssertThat(out_nodes.pull(), Is().EqualTo(node(11, node::MAX_ID-5, - node::ptr_t(12, node::MAX_ID-3), - node::ptr_t(12, node::MAX_ID-2)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(11, node::max_id-5, + node::pointer_type(12, node::max_id-3), + node::pointer_type(12, node::max_id-2)))); AssertThat(out_nodes.can_pull(), Is().True()); // (15,m) - AssertThat(out_nodes.pull(), Is().EqualTo(node(11, node::MAX_ID-6, - node::ptr_t(12, node::MAX_ID-2), - node::ptr_t(12, node::MAX_ID-3)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(11, node::max_id-6, + node::pointer_type(12, node::max_id-2), + node::pointer_type(12, node::max_id-3)))); AssertThat(out_nodes.can_pull(), Is().True()); // (k) - AssertThat(out_nodes.pull(), Is().EqualTo(node(10, node::MAX_ID, - node::ptr_t(11, node::MAX_ID-1), - node::ptr_t(11, node::MAX_ID)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(10, node::max_id, + node::pointer_type(11, node::max_id-1), + node::pointer_type(11, node::max_id)))); AssertThat(out_nodes.can_pull(), Is().True()); // (j) - AssertThat(out_nodes.pull(), Is().EqualTo(node(10, node::MAX_ID-1, - node::ptr_t(11, node::MAX_ID), - node::ptr_t(11, node::MAX_ID-1)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(10, node::max_id-1, + node::pointer_type(11, node::max_id), + node::pointer_type(11, node::max_id-1)))); AssertThat(out_nodes.can_pull(), Is().True()); // (13) - AssertThat(out_nodes.pull(), Is().EqualTo(node(10, node::MAX_ID-2, - node::ptr_t(11, node::MAX_ID-3), - node::ptr_t(11, node::MAX_ID-2)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(10, node::max_id-2, + node::pointer_type(11, node::max_id-3), + node::pointer_type(11, node::max_id-2)))); AssertThat(out_nodes.can_pull(), Is().True()); // (12) - AssertThat(out_nodes.pull(), Is().EqualTo(node(10, node::MAX_ID-3, - node::ptr_t(11, node::MAX_ID-2), - node::ptr_t(11, node::MAX_ID-3)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(10, node::max_id-3, + node::pointer_type(11, node::max_id-2), + node::pointer_type(11, node::max_id-3)))); AssertThat(out_nodes.can_pull(), Is().True()); // (TODO) - AssertThat(out_nodes.pull(), Is().EqualTo(node(10, node::MAX_ID-4, - node::ptr_t(11, node::MAX_ID-4), - node::ptr_t(11, node::MAX_ID-4)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(10, node::max_id-4, + node::pointer_type(11, node::max_id-4), + node::pointer_type(11, node::max_id-4)))); AssertThat(out_nodes.can_pull(), Is().True()); // (13,k) - AssertThat(out_nodes.pull(), Is().EqualTo(node(10, node::MAX_ID-5, - node::ptr_t(11, node::MAX_ID-6), - node::ptr_t(11, node::MAX_ID-5)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(10, node::max_id-5, + node::pointer_type(11, node::max_id-6), + node::pointer_type(11, node::max_id-5)))); AssertThat(out_nodes.can_pull(), Is().True()); // (12,j) - AssertThat(out_nodes.pull(), Is().EqualTo(node(10, node::MAX_ID-6, - node::ptr_t(11, node::MAX_ID-5), - node::ptr_t(11, node::MAX_ID-6)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(10, node::max_id-6, + node::pointer_type(11, node::max_id-5), + node::pointer_type(11, node::max_id-6)))); AssertThat(out_nodes.can_pull(), Is().True()); // (h) - AssertThat(out_nodes.pull(), Is().EqualTo(node(9, node::MAX_ID, - node::ptr_t(10, node::MAX_ID-1), - node::ptr_t(10, node::MAX_ID)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(9, node::max_id, + node::pointer_type(10, node::max_id-1), + node::pointer_type(10, node::max_id)))); AssertThat(out_nodes.can_pull(), Is().True()); // (i) - AssertThat(out_nodes.pull(), Is().EqualTo(node(9, node::MAX_ID-1, - node::ptr_t(10, node::MAX_ID), - node::ptr_t(10, node::MAX_ID-1)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(9, node::max_id-1, + node::pointer_type(10, node::max_id), + node::pointer_type(10, node::max_id-1)))); AssertThat(out_nodes.can_pull(), Is().True()); // (10) - AssertThat(out_nodes.pull(), Is().EqualTo(node(9, node::MAX_ID-2, - node::ptr_t(10, node::MAX_ID-3), - node::ptr_t(10, node::MAX_ID-2)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(9, node::max_id-2, + node::pointer_type(10, node::max_id-3), + node::pointer_type(10, node::max_id-2)))); AssertThat(out_nodes.can_pull(), Is().True()); // (11) - AssertThat(out_nodes.pull(), Is().EqualTo(node(9, node::MAX_ID-3, - node::ptr_t(10, node::MAX_ID-2), - node::ptr_t(10, node::MAX_ID-3)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(9, node::max_id-3, + node::pointer_type(10, node::max_id-2), + node::pointer_type(10, node::max_id-3)))); AssertThat(out_nodes.can_pull(), Is().True()); // (TODO) - AssertThat(out_nodes.pull(), Is().EqualTo(node(9, node::MAX_ID-4, - node::ptr_t(10, node::MAX_ID-4), - node::ptr_t(10, node::MAX_ID-4)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(9, node::max_id-4, + node::pointer_type(10, node::max_id-4), + node::pointer_type(10, node::max_id-4)))); AssertThat(out_nodes.can_pull(), Is().True()); // (10,h) - AssertThat(out_nodes.pull(), Is().EqualTo(node(9, node::MAX_ID-5, - node::ptr_t(10, node::MAX_ID-6), - node::ptr_t(10, node::MAX_ID-5)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(9, node::max_id-5, + node::pointer_type(10, node::max_id-6), + node::pointer_type(10, node::max_id-5)))); AssertThat(out_nodes.can_pull(), Is().True()); // (11,i) - AssertThat(out_nodes.pull(), Is().EqualTo(node(9, node::MAX_ID-6, - node::ptr_t(10, node::MAX_ID-5), - node::ptr_t(10, node::MAX_ID-6)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(9, node::max_id-6, + node::pointer_type(10, node::max_id-5), + node::pointer_type(10, node::max_id-6)))); AssertThat(out_nodes.can_pull(), Is().True()); // (g) - AssertThat(out_nodes.pull(), Is().EqualTo(node(8, node::MAX_ID, - node::ptr_t(9, node::MAX_ID-1), - node::ptr_t(9, node::MAX_ID)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(8, node::max_id, + node::pointer_type(9, node::max_id-1), + node::pointer_type(9, node::max_id)))); AssertThat(out_nodes.can_pull(), Is().True()); // (f) - AssertThat(out_nodes.pull(), Is().EqualTo(node(8, node::MAX_ID-1, - node::ptr_t(9, node::MAX_ID), - node::ptr_t(9, node::MAX_ID-1)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(8, node::max_id-1, + node::pointer_type(9, node::max_id), + node::pointer_type(9, node::max_id-1)))); AssertThat(out_nodes.can_pull(), Is().True()); // (9) - AssertThat(out_nodes.pull(), Is().EqualTo(node(8, node::MAX_ID-2, - node::ptr_t(9, node::MAX_ID-3), - node::ptr_t(9, node::MAX_ID-2)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(8, node::max_id-2, + node::pointer_type(9, node::max_id-3), + node::pointer_type(9, node::max_id-2)))); AssertThat(out_nodes.can_pull(), Is().True()); // (8) - AssertThat(out_nodes.pull(), Is().EqualTo(node(8, node::MAX_ID-3, - node::ptr_t(9, node::MAX_ID-2), - node::ptr_t(9, node::MAX_ID-3)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(8, node::max_id-3, + node::pointer_type(9, node::max_id-2), + node::pointer_type(9, node::max_id-3)))); AssertThat(out_nodes.can_pull(), Is().True()); // (8,g) - AssertThat(out_nodes.pull(), Is().EqualTo(node(8, node::MAX_ID-4, - node::ptr_t(9, node::MAX_ID-4), - node::ptr_t(9, node::MAX_ID-4)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(8, node::max_id-4, + node::pointer_type(9, node::max_id-4), + node::pointer_type(9, node::max_id-4)))); AssertThat(out_nodes.can_pull(), Is().True()); // (8,f) - AssertThat(out_nodes.pull(), Is().EqualTo(node(8, node::MAX_ID-5, - node::ptr_t(9, node::MAX_ID-5), - node::ptr_t(9, node::MAX_ID-6)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(8, node::max_id-5, + node::pointer_type(9, node::max_id-5), + node::pointer_type(9, node::max_id-6)))); AssertThat(out_nodes.can_pull(), Is().True()); // (7) - AssertThat(out_nodes.pull(), Is().EqualTo(node(7, node::MAX_ID, - node::ptr_t(8, node::MAX_ID-3), - node::ptr_t(8, node::MAX_ID-2)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(7, node::max_id, + node::pointer_type(8, node::max_id-3), + node::pointer_type(8, node::max_id-2)))); AssertThat(out_nodes.can_pull(), Is().True()); // (7,g) - AssertThat(out_nodes.pull(), Is().EqualTo(node(7, node::MAX_ID-1, - node::ptr_t(8, node::MAX_ID-4), - node::ptr_t(8, node::MAX_ID-2)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(7, node::max_id-1, + node::pointer_type(8, node::max_id-4), + node::pointer_type(8, node::max_id-2)))); AssertThat(out_nodes.can_pull(), Is().True()); // (d) - AssertThat(out_nodes.pull(), Is().EqualTo(node(6, node::MAX_ID, - node::ptr_t(8, node::MAX_ID-1), - node::ptr_t(8, node::MAX_ID)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(6, node::max_id, + node::pointer_type(8, node::max_id-1), + node::pointer_type(8, node::max_id)))); AssertThat(out_nodes.can_pull(), Is().True()); // (6) - AssertThat(out_nodes.pull(), Is().EqualTo(node(6, node::MAX_ID-1, - node::ptr_t(7, node::MAX_ID), - node::ptr_t(8, node::MAX_ID-2)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(6, node::max_id-1, + node::pointer_type(7, node::max_id), + node::pointer_type(8, node::max_id-2)))); AssertThat(out_nodes.can_pull(), Is().True()); // (5) - AssertThat(out_nodes.pull(), Is().EqualTo(node(6, node::MAX_ID-2, - node::ptr_t(8, node::MAX_ID-3), - node::ptr_t(7, node::MAX_ID)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(6, node::max_id-2, + node::pointer_type(8, node::max_id-3), + node::pointer_type(7, node::max_id)))); AssertThat(out_nodes.can_pull(), Is().True()); // (5,d) - AssertThat(out_nodes.pull(), Is().EqualTo(node(6, node::MAX_ID-3, - node::ptr_t(8, node::MAX_ID-5), - node::ptr_t(7, node::MAX_ID-1)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(6, node::max_id-3, + node::pointer_type(8, node::max_id-5), + node::pointer_type(7, node::max_id-1)))); AssertThat(out_nodes.can_pull(), Is().True()); // (c) - AssertThat(out_nodes.pull(), Is().EqualTo(node(5, node::MAX_ID, - node::ptr_t(6, node::MAX_ID), - node::ptr_t(true)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(5, node::max_id, + node::pointer_type(6, node::max_id), + node::pointer_type(true)))); AssertThat(out_nodes.can_pull(), Is().True()); // (b,5,d) - AssertThat(out_nodes.pull(), Is().EqualTo(node(5, node::MAX_ID-1, - node::ptr_t(6, node::MAX_ID-3), - node::ptr_t(6, node::MAX_ID)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(5, node::max_id-1, + node::pointer_type(6, node::max_id-3), + node::pointer_type(6, node::max_id)))); AssertThat(out_nodes.can_pull(), Is().True()); // (4,b,5,d) - AssertThat(out_nodes.pull(), Is().EqualTo(node(5, node::MAX_ID-2, - node::ptr_t(6, node::MAX_ID-2), - node::ptr_t(6, node::MAX_ID-1)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(5, node::max_id-2, + node::pointer_type(6, node::max_id-2), + node::pointer_type(6, node::max_id-1)))); AssertThat(out_nodes.can_pull(), Is().True()); // (3,b,5,d) - AssertThat(out_nodes.pull(), Is().EqualTo(node(4, node::MAX_ID, - node::ptr_t(5, node::MAX_ID-2), - node::ptr_t(true)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(4, node::max_id, + node::pointer_type(5, node::max_id-2), + node::pointer_type(true)))); AssertThat(out_nodes.can_pull(), Is().True()); // (2,b,5,d) - AssertThat(out_nodes.pull(), Is().EqualTo(node(4, node::MAX_ID-1, - node::ptr_t(5, node::MAX_ID-1), - node::ptr_t(5, node::MAX_ID-2)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(4, node::max_id-1, + node::pointer_type(5, node::max_id-1), + node::pointer_type(5, node::max_id-2)))); AssertThat(out_nodes.can_pull(), Is().True()); // (1,b,5,d) - AssertThat(out_nodes.pull(), Is().EqualTo(node(3, node::MAX_ID, - node::ptr_t(4, node::MAX_ID-1), - node::ptr_t(4, node::MAX_ID)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(3, node::max_id, + node::pointer_type(4, node::max_id-1), + node::pointer_type(4, node::max_id)))); AssertThat(out_nodes.can_pull(), Is().True()); // (1,a,5,d) - AssertThat(out_nodes.pull(), Is().EqualTo(node(2, node::MAX_ID, - node::ptr_t(3, node::MAX_ID), - node::ptr_t(5, node::MAX_ID)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(2, node::max_id, + node::pointer_type(3, node::max_id), + node::pointer_type(5, node::max_id)))); AssertThat(out_nodes.can_pull(), Is().False()); @@ -791,17 +791,17 @@ go_bandit([]() { AssertThat(call_history.at(41), Is().EqualTo(13u)); }); - quantify_mode = quantify_mode_t::AUTO; + quantify_mode = quantify_mode_t::Auto; }); - describe("quantify_mode == NESTED", [&]() { - quantify_mode = quantify_mode_t::NESTED; + describe("quantify_mode == Nested", [&]() { + quantify_mode = quantify_mode_t::Nested; it("computes with dom = Ø to be { Ø } for non-empty input [zdd_1]", [&](){ - adiar::shared_file dom; + adiar::shared_file dom; const zdd in = zdd_1; - zdd out = zdd_project(in, [](zdd::label_t) { return false; }); + zdd out = zdd_project(in, [](zdd::label_type) { return false; }); node_test_stream out_nodes(out); AssertThat(out_nodes.can_pull(), Is().True()); @@ -812,17 +812,17 @@ go_bandit([]() { level_info_test_stream ms(out); AssertThat(ms.can_pull(), Is().False()); - AssertThat(out->max_1level_cut[cut_type::INTERNAL], Is().GreaterThanOrEqualTo(0u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_FALSE], Is().GreaterThanOrEqualTo(0u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_TRUE], Is().GreaterThanOrEqualTo(1u)); - AssertThat(out->max_1level_cut[cut_type::ALL], Is().GreaterThanOrEqualTo(1u)); + AssertThat(out->max_1level_cut[cut::Internal], Is().GreaterThanOrEqualTo(0u)); + AssertThat(out->max_1level_cut[cut::Internal_False], Is().GreaterThanOrEqualTo(0u)); + AssertThat(out->max_1level_cut[cut::Internal_True], Is().GreaterThanOrEqualTo(1u)); + AssertThat(out->max_1level_cut[cut::All], Is().GreaterThanOrEqualTo(1u)); AssertThat(out->number_of_terminals[false], Is().EqualTo(0u)); AssertThat(out->number_of_terminals[true], Is().EqualTo(1u)); }); it("computes with disjoint dom = { x | x > 2 } to be { Ø } [zdd_3]", [&](){ - zdd out = zdd_project(zdd(zdd_3), [](zdd::label_t x) { return x > 2; }); + zdd out = zdd_project(zdd(zdd_3), [](zdd::label_type x) { return x > 2; }); node_test_stream out_nodes(out); AssertThat(out_nodes.can_pull(), Is().True()); @@ -833,10 +833,10 @@ go_bandit([]() { level_info_test_stream ms(out); AssertThat(ms.can_pull(), Is().False()); - AssertThat(out->max_1level_cut[cut_type::INTERNAL], Is().GreaterThanOrEqualTo(0u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_FALSE], Is().GreaterThanOrEqualTo(0u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_TRUE], Is().GreaterThanOrEqualTo(1u)); - AssertThat(out->max_1level_cut[cut_type::ALL], Is().GreaterThanOrEqualTo(1u)); + AssertThat(out->max_1level_cut[cut::Internal], Is().GreaterThanOrEqualTo(0u)); + AssertThat(out->max_1level_cut[cut::Internal_False], Is().GreaterThanOrEqualTo(0u)); + AssertThat(out->max_1level_cut[cut::Internal_True], Is().GreaterThanOrEqualTo(1u)); + AssertThat(out->max_1level_cut[cut::All], Is().GreaterThanOrEqualTo(1u)); AssertThat(out->number_of_terminals[false], Is().EqualTo(0u)); AssertThat(out->number_of_terminals[true], Is().EqualTo(1u)); @@ -854,19 +854,19 @@ go_bandit([]() { // T T */ - zdd out = zdd_project(zdd_3, [](zdd::label_t x) { return !(x % 2); }); + zdd out = zdd_project(zdd_3, [](zdd::label_type x) { return !(x % 2); }); node_test_stream out_nodes(out); AssertThat(out_nodes.can_pull(), Is().True()); - AssertThat(out_nodes.pull(), Is().EqualTo(node(2, node::MAX_ID, + AssertThat(out_nodes.pull(), Is().EqualTo(node(2, node::max_id, terminal_T, terminal_T))); AssertThat(out_nodes.can_pull(), Is().True()); - AssertThat(out_nodes.pull(), Is().EqualTo(node(0, node::MAX_ID, - ptr_uint64(2, ptr_uint64::MAX_ID), - ptr_uint64(2, ptr_uint64::MAX_ID)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(0, node::max_id, + ptr_uint64(2, ptr_uint64::max_id), + ptr_uint64(2, ptr_uint64::max_id)))); AssertThat(out_nodes.can_pull(), Is().False()); @@ -880,10 +880,10 @@ go_bandit([]() { AssertThat(ms.can_pull(), Is().False()); - AssertThat(out->max_1level_cut[cut_type::INTERNAL], Is().GreaterThanOrEqualTo(2u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_FALSE], Is().GreaterThanOrEqualTo(2u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_TRUE], Is().GreaterThanOrEqualTo(2u)); - AssertThat(out->max_1level_cut[cut_type::ALL], Is().GreaterThanOrEqualTo(2u)); + AssertThat(out->max_1level_cut[cut::Internal], Is().GreaterThanOrEqualTo(2u)); + AssertThat(out->max_1level_cut[cut::Internal_False], Is().GreaterThanOrEqualTo(2u)); + AssertThat(out->max_1level_cut[cut::Internal_True], Is().GreaterThanOrEqualTo(2u)); + AssertThat(out->max_1level_cut[cut::All], Is().GreaterThanOrEqualTo(2u)); AssertThat(out->number_of_terminals[false], Is().EqualTo(0u)); AssertThat(out->number_of_terminals[true], Is().EqualTo(2u)); @@ -902,23 +902,23 @@ go_bandit([]() { // / \ // T T */ - zdd out = zdd_project(in, [](const zdd::label_t x) { return x % 2 == 0; }); + zdd out = zdd_project(in, [](const zdd::label_type x) { return x % 2 == 0; }); node_test_stream out_nodes(out); AssertThat(out_nodes.can_pull(), Is().True()); - AssertThat(out_nodes.pull(), Is().EqualTo(node(4, node::MAX_ID, + AssertThat(out_nodes.pull(), Is().EqualTo(node(4, node::max_id, terminal_T, terminal_T))); AssertThat(out_nodes.can_pull(), Is().True()); - AssertThat(out_nodes.pull(), Is().EqualTo(node(2, node::MAX_ID, - ptr_uint64(4, ptr_uint64::MAX_ID), + AssertThat(out_nodes.pull(), Is().EqualTo(node(2, node::max_id, + ptr_uint64(4, ptr_uint64::max_id), terminal_T))); AssertThat(out_nodes.can_pull(), Is().True()); - AssertThat(out_nodes.pull(), Is().EqualTo(node(0, node::MAX_ID, - ptr_uint64(2, ptr_uint64::MAX_ID), + AssertThat(out_nodes.pull(), Is().EqualTo(node(0, node::max_id, + ptr_uint64(2, ptr_uint64::max_id), terminal_T))); AssertThat(out_nodes.can_pull(), Is().False()); @@ -936,25 +936,25 @@ go_bandit([]() { AssertThat(ms.can_pull(), Is().False()); - AssertThat(out->max_1level_cut[cut_type::INTERNAL], Is().GreaterThanOrEqualTo(1u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_FALSE], Is().GreaterThanOrEqualTo(1u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_TRUE], Is().GreaterThanOrEqualTo(4u)); - AssertThat(out->max_1level_cut[cut_type::ALL], Is().GreaterThanOrEqualTo(4u)); + AssertThat(out->max_1level_cut[cut::Internal], Is().GreaterThanOrEqualTo(1u)); + AssertThat(out->max_1level_cut[cut::Internal_False], Is().GreaterThanOrEqualTo(1u)); + AssertThat(out->max_1level_cut[cut::Internal_True], Is().GreaterThanOrEqualTo(4u)); + AssertThat(out->max_1level_cut[cut::All], Is().GreaterThanOrEqualTo(4u)); AssertThat(out->number_of_terminals[false], Is().EqualTo(0u)); AssertThat(out->number_of_terminals[true], Is().EqualTo(4u)); }); - quantify_mode = quantify_mode_t::AUTO; + quantify_mode = quantify_mode_t::Auto; }); - describe("quantify_mode == AUTO", [&]() { - quantify_mode = quantify_mode_t::AUTO; + describe("quantify_mode == Auto", [&]() { + quantify_mode = quantify_mode_t::Auto; it("computes with dom = Ø to be { Ø } for non-empty input [zdd_2]", [&](){ - adiar::shared_file dom; + adiar::shared_file dom; - zdd out = zdd_project(zdd(zdd_2), [](zdd::label_t) { return false; }); + zdd out = zdd_project(zdd(zdd_2), [](zdd::label_type) { return false; }); node_test_stream out_nodes(out); AssertThat(out_nodes.can_pull(), Is().True()); @@ -965,17 +965,17 @@ go_bandit([]() { level_info_test_stream ms(out); AssertThat(ms.can_pull(), Is().False()); - AssertThat(out->max_1level_cut[cut_type::INTERNAL], Is().GreaterThanOrEqualTo(0u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_FALSE], Is().GreaterThanOrEqualTo(0u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_TRUE], Is().GreaterThanOrEqualTo(1u)); - AssertThat(out->max_1level_cut[cut_type::ALL], Is().GreaterThanOrEqualTo(1u)); + AssertThat(out->max_1level_cut[cut::Internal], Is().GreaterThanOrEqualTo(0u)); + AssertThat(out->max_1level_cut[cut::Internal_False], Is().GreaterThanOrEqualTo(0u)); + AssertThat(out->max_1level_cut[cut::Internal_True], Is().GreaterThanOrEqualTo(1u)); + AssertThat(out->max_1level_cut[cut::All], Is().GreaterThanOrEqualTo(1u)); AssertThat(out->number_of_terminals[false], Is().EqualTo(0u)); AssertThat(out->number_of_terminals[true], Is().EqualTo(1u)); }); it("computes with disjoint dom = { x | x > 2 } to be { Ø } [zdd_3]", [&](){ - zdd out = zdd_project(zdd(zdd_3), [](zdd::label_t x) { return x > 2; }); + zdd out = zdd_project(zdd(zdd_3), [](zdd::label_type x) { return x > 2; }); node_test_stream out_nodes(out); AssertThat(out_nodes.can_pull(), Is().True()); @@ -986,10 +986,10 @@ go_bandit([]() { level_info_test_stream ms(out); AssertThat(ms.can_pull(), Is().False()); - AssertThat(out->max_1level_cut[cut_type::INTERNAL], Is().GreaterThanOrEqualTo(0u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_FALSE], Is().GreaterThanOrEqualTo(0u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_TRUE], Is().GreaterThanOrEqualTo(1u)); - AssertThat(out->max_1level_cut[cut_type::ALL], Is().GreaterThanOrEqualTo(1u)); + AssertThat(out->max_1level_cut[cut::Internal], Is().GreaterThanOrEqualTo(0u)); + AssertThat(out->max_1level_cut[cut::Internal_False], Is().GreaterThanOrEqualTo(0u)); + AssertThat(out->max_1level_cut[cut::Internal_True], Is().GreaterThanOrEqualTo(1u)); + AssertThat(out->max_1level_cut[cut::All], Is().GreaterThanOrEqualTo(1u)); AssertThat(out->number_of_terminals[false], Is().EqualTo(0u)); AssertThat(out->number_of_terminals[true], Is().EqualTo(1u)); @@ -1007,19 +1007,19 @@ go_bandit([]() { // T T */ - zdd out = zdd_project(zdd_1, [](zdd::label_t x) { return x % 2 == 1; }); + zdd out = zdd_project(zdd_1, [](zdd::label_type x) { return x % 2 == 1; }); node_test_stream out_nodes(out); AssertThat(out_nodes.can_pull(), Is().True()); - AssertThat(out_nodes.pull(), Is().EqualTo(node(3, node::MAX_ID, + AssertThat(out_nodes.pull(), Is().EqualTo(node(3, node::max_id, terminal_T, terminal_T))); AssertThat(out_nodes.can_pull(), Is().True()); - AssertThat(out_nodes.pull(), Is().EqualTo(node(1, node::MAX_ID, - ptr_uint64(3, ptr_uint64::MAX_ID), - ptr_uint64(3, ptr_uint64::MAX_ID)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(1, node::max_id, + ptr_uint64(3, ptr_uint64::max_id), + ptr_uint64(3, ptr_uint64::max_id)))); AssertThat(out_nodes.can_pull(), Is().False()); @@ -1033,10 +1033,10 @@ go_bandit([]() { AssertThat(ms.can_pull(), Is().False()); - AssertThat(out->max_1level_cut[cut_type::INTERNAL], Is().GreaterThanOrEqualTo(2u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_FALSE], Is().GreaterThanOrEqualTo(2u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_TRUE], Is().GreaterThanOrEqualTo(2u)); - AssertThat(out->max_1level_cut[cut_type::ALL], Is().GreaterThanOrEqualTo(2u)); + AssertThat(out->max_1level_cut[cut::Internal], Is().GreaterThanOrEqualTo(2u)); + AssertThat(out->max_1level_cut[cut::Internal_False], Is().GreaterThanOrEqualTo(2u)); + AssertThat(out->max_1level_cut[cut::Internal_True], Is().GreaterThanOrEqualTo(2u)); + AssertThat(out->max_1level_cut[cut::All], Is().GreaterThanOrEqualTo(2u)); AssertThat(out->number_of_terminals[false], Is().EqualTo(0u)); AssertThat(out->number_of_terminals[true], Is().EqualTo(2u)); @@ -1056,24 +1056,24 @@ go_bandit([]() { // T T */ - zdd out = zdd_project(zdd_1, [](zdd::label_t x) { return x != 0 && x != 2; }); + zdd out = zdd_project(zdd_1, [](zdd::label_type x) { return x != 0 && x != 2; }); node_test_stream out_nodes(out); AssertThat(out_nodes.can_pull(), Is().True()); - AssertThat(out_nodes.pull(), Is().EqualTo(node(4, node::MAX_ID, + AssertThat(out_nodes.pull(), Is().EqualTo(node(4, node::max_id, terminal_T, terminal_T))); AssertThat(out_nodes.can_pull(), Is().True()); - AssertThat(out_nodes.pull(), Is().EqualTo(node(3, node::MAX_ID, + AssertThat(out_nodes.pull(), Is().EqualTo(node(3, node::max_id, terminal_T, - ptr_uint64(4, ptr_uint64::MAX_ID)))); + ptr_uint64(4, ptr_uint64::max_id)))); AssertThat(out_nodes.can_pull(), Is().True()); - AssertThat(out_nodes.pull(), Is().EqualTo(node(1, node::MAX_ID, - ptr_uint64(3, ptr_uint64::MAX_ID), - ptr_uint64(3, ptr_uint64::MAX_ID)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(1, node::max_id, + ptr_uint64(3, ptr_uint64::max_id), + ptr_uint64(3, ptr_uint64::max_id)))); AssertThat(out_nodes.can_pull(), Is().False()); @@ -1090,10 +1090,10 @@ go_bandit([]() { AssertThat(ms.can_pull(), Is().False()); - AssertThat(out->max_1level_cut[cut_type::INTERNAL], Is().GreaterThanOrEqualTo(2u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_FALSE], Is().GreaterThanOrEqualTo(2u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_TRUE], Is().GreaterThanOrEqualTo(3u)); - AssertThat(out->max_1level_cut[cut_type::ALL], Is().GreaterThanOrEqualTo(3u)); + AssertThat(out->max_1level_cut[cut::Internal], Is().GreaterThanOrEqualTo(2u)); + AssertThat(out->max_1level_cut[cut::Internal_False], Is().GreaterThanOrEqualTo(2u)); + AssertThat(out->max_1level_cut[cut::Internal_True], Is().GreaterThanOrEqualTo(3u)); + AssertThat(out->max_1level_cut[cut::All], Is().GreaterThanOrEqualTo(3u)); AssertThat(out->number_of_terminals[false], Is().EqualTo(0u)); AssertThat(out->number_of_terminals[true], Is().EqualTo(3u)); @@ -1111,19 +1111,19 @@ go_bandit([]() { // T T */ - zdd out = zdd_project(zdd_3, [](zdd::label_t x) { return x % 2 == 0; }); + zdd out = zdd_project(zdd_3, [](zdd::label_type x) { return x % 2 == 0; }); node_test_stream out_nodes(out); AssertThat(out_nodes.can_pull(), Is().True()); - AssertThat(out_nodes.pull(), Is().EqualTo(node(2, node::MAX_ID, + AssertThat(out_nodes.pull(), Is().EqualTo(node(2, node::max_id, terminal_T, terminal_T))); AssertThat(out_nodes.can_pull(), Is().True()); - AssertThat(out_nodes.pull(), Is().EqualTo(node(0, node::MAX_ID, - ptr_uint64(2, ptr_uint64::MAX_ID), - ptr_uint64(2, ptr_uint64::MAX_ID)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(0, node::max_id, + ptr_uint64(2, ptr_uint64::max_id), + ptr_uint64(2, ptr_uint64::max_id)))); AssertThat(out_nodes.can_pull(), Is().False()); @@ -1137,18 +1137,18 @@ go_bandit([]() { AssertThat(ms.can_pull(), Is().False()); - AssertThat(out->max_1level_cut[cut_type::INTERNAL], Is().GreaterThanOrEqualTo(2u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_FALSE], Is().GreaterThanOrEqualTo(2u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_TRUE], Is().GreaterThanOrEqualTo(2u)); - AssertThat(out->max_1level_cut[cut_type::ALL], Is().GreaterThanOrEqualTo(2u)); + AssertThat(out->max_1level_cut[cut::Internal], Is().GreaterThanOrEqualTo(2u)); + AssertThat(out->max_1level_cut[cut::Internal_False], Is().GreaterThanOrEqualTo(2u)); + AssertThat(out->max_1level_cut[cut::Internal_True], Is().GreaterThanOrEqualTo(2u)); + AssertThat(out->max_1level_cut[cut::All], Is().GreaterThanOrEqualTo(2u)); AssertThat(out->number_of_terminals[false], Is().EqualTo(0u)); AssertThat(out->number_of_terminals[true], Is().EqualTo(2u)); }); it("switches to Nested Sweeping for exploding ZDD 5", [&]() { - std::vector call_history; - zdd out = zdd_project(zdd_5, [&call_history](const zdd::label_t x) -> bool { + std::vector call_history; + zdd out = zdd_project(zdd_5, [&call_history](const zdd::label_type x) -> bool { call_history.push_back(x); return 1 < x; }); @@ -1156,234 +1156,234 @@ go_bandit([]() { node_test_stream out_nodes(out); AssertThat(out_nodes.can_pull(), Is().True()); // (o) / (n,o) - AssertThat(out_nodes.pull(), Is().EqualTo(node(13, node::MAX_ID, - node::ptr_t(true), - node::ptr_t(true)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(13, node::max_id, + node::pointer_type(true), + node::pointer_type(true)))); AssertThat(out_nodes.can_pull(), Is().True()); // (n) - AssertThat(out_nodes.pull(), Is().EqualTo(node(13, node::MAX_ID-1, - node::ptr_t(false), - node::ptr_t(true)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(13, node::max_id-1, + node::pointer_type(false), + node::pointer_type(true)))); AssertThat(out_nodes.can_pull(), Is().True()); // (17) - AssertThat(out_nodes.pull(), Is().EqualTo(node(12, node::MAX_ID, - node::ptr_t(true), - node::ptr_t(true)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(12, node::max_id, + node::pointer_type(true), + node::pointer_type(true)))); AssertThat(out_nodes.can_pull(), Is().True()); // (16) - AssertThat(out_nodes.pull(), Is().EqualTo(node(12, node::MAX_ID-1, - node::ptr_t(false), - node::ptr_t(true)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(12, node::max_id-1, + node::pointer_type(false), + node::pointer_type(true)))); AssertThat(out_nodes.can_pull(), Is().True()); // (16,o) / (16,o,n) - AssertThat(out_nodes.pull(), Is().EqualTo(node(12, node::MAX_ID-2, - node::ptr_t(13, node::MAX_ID), - node::ptr_t(true)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(12, node::max_id-2, + node::pointer_type(13, node::max_id), + node::pointer_type(true)))); AssertThat(out_nodes.can_pull(), Is().True()); // (16,n) - AssertThat(out_nodes.pull(), Is().EqualTo(node(12, node::MAX_ID-3, - node::ptr_t(13, node::MAX_ID-1), - node::ptr_t(true)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(12, node::max_id-3, + node::pointer_type(13, node::max_id-1), + node::pointer_type(true)))); AssertThat(out_nodes.can_pull(), Is().True()); // (l) - AssertThat(out_nodes.pull(), Is().EqualTo(node(11, node::MAX_ID, - node::ptr_t(13, node::MAX_ID-1), - node::ptr_t(13, node::MAX_ID)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(11, node::max_id, + node::pointer_type(13, node::max_id-1), + node::pointer_type(13, node::max_id)))); AssertThat(out_nodes.can_pull(), Is().True()); // (m) - AssertThat(out_nodes.pull(), Is().EqualTo(node(11, node::MAX_ID-1, - node::ptr_t(13, node::MAX_ID), - node::ptr_t(13, node::MAX_ID-1)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(11, node::max_id-1, + node::pointer_type(13, node::max_id), + node::pointer_type(13, node::max_id-1)))); AssertThat(out_nodes.can_pull(), Is().True()); // (14) - AssertThat(out_nodes.pull(), Is().EqualTo(node(11, node::MAX_ID-2, - node::ptr_t(12, node::MAX_ID-1), - node::ptr_t(12, node::MAX_ID)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(11, node::max_id-2, + node::pointer_type(12, node::max_id-1), + node::pointer_type(12, node::max_id)))); AssertThat(out_nodes.can_pull(), Is().True()); // (15) - AssertThat(out_nodes.pull(), Is().EqualTo(node(11, node::MAX_ID-3, - node::ptr_t(12, node::MAX_ID), - node::ptr_t(12, node::MAX_ID-1)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(11, node::max_id-3, + node::pointer_type(12, node::max_id), + node::pointer_type(12, node::max_id-1)))); AssertThat(out_nodes.can_pull(), Is().True()); // (TODO) - AssertThat(out_nodes.pull(), Is().EqualTo(node(11, node::MAX_ID-4, - node::ptr_t(12, node::MAX_ID-2), - node::ptr_t(12, node::MAX_ID-2)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(11, node::max_id-4, + node::pointer_type(12, node::max_id-2), + node::pointer_type(12, node::max_id-2)))); AssertThat(out_nodes.can_pull(), Is().True()); // (14,l) - AssertThat(out_nodes.pull(), Is().EqualTo(node(11, node::MAX_ID-5, - node::ptr_t(12, node::MAX_ID-3), - node::ptr_t(12, node::MAX_ID-2)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(11, node::max_id-5, + node::pointer_type(12, node::max_id-3), + node::pointer_type(12, node::max_id-2)))); AssertThat(out_nodes.can_pull(), Is().True()); // (15,m) - AssertThat(out_nodes.pull(), Is().EqualTo(node(11, node::MAX_ID-6, - node::ptr_t(12, node::MAX_ID-2), - node::ptr_t(12, node::MAX_ID-3)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(11, node::max_id-6, + node::pointer_type(12, node::max_id-2), + node::pointer_type(12, node::max_id-3)))); AssertThat(out_nodes.can_pull(), Is().True()); // (k) - AssertThat(out_nodes.pull(), Is().EqualTo(node(10, node::MAX_ID, - node::ptr_t(11, node::MAX_ID-1), - node::ptr_t(11, node::MAX_ID)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(10, node::max_id, + node::pointer_type(11, node::max_id-1), + node::pointer_type(11, node::max_id)))); AssertThat(out_nodes.can_pull(), Is().True()); // (j) - AssertThat(out_nodes.pull(), Is().EqualTo(node(10, node::MAX_ID-1, - node::ptr_t(11, node::MAX_ID), - node::ptr_t(11, node::MAX_ID-1)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(10, node::max_id-1, + node::pointer_type(11, node::max_id), + node::pointer_type(11, node::max_id-1)))); AssertThat(out_nodes.can_pull(), Is().True()); // (13) - AssertThat(out_nodes.pull(), Is().EqualTo(node(10, node::MAX_ID-2, - node::ptr_t(11, node::MAX_ID-3), - node::ptr_t(11, node::MAX_ID-2)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(10, node::max_id-2, + node::pointer_type(11, node::max_id-3), + node::pointer_type(11, node::max_id-2)))); AssertThat(out_nodes.can_pull(), Is().True()); // (12) - AssertThat(out_nodes.pull(), Is().EqualTo(node(10, node::MAX_ID-3, - node::ptr_t(11, node::MAX_ID-2), - node::ptr_t(11, node::MAX_ID-3)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(10, node::max_id-3, + node::pointer_type(11, node::max_id-2), + node::pointer_type(11, node::max_id-3)))); AssertThat(out_nodes.can_pull(), Is().True()); // (TODO) - AssertThat(out_nodes.pull(), Is().EqualTo(node(10, node::MAX_ID-4, - node::ptr_t(11, node::MAX_ID-4), - node::ptr_t(11, node::MAX_ID-4)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(10, node::max_id-4, + node::pointer_type(11, node::max_id-4), + node::pointer_type(11, node::max_id-4)))); AssertThat(out_nodes.can_pull(), Is().True()); // (13,k) - AssertThat(out_nodes.pull(), Is().EqualTo(node(10, node::MAX_ID-5, - node::ptr_t(11, node::MAX_ID-6), - node::ptr_t(11, node::MAX_ID-5)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(10, node::max_id-5, + node::pointer_type(11, node::max_id-6), + node::pointer_type(11, node::max_id-5)))); AssertThat(out_nodes.can_pull(), Is().True()); // (12,j) - AssertThat(out_nodes.pull(), Is().EqualTo(node(10, node::MAX_ID-6, - node::ptr_t(11, node::MAX_ID-5), - node::ptr_t(11, node::MAX_ID-6)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(10, node::max_id-6, + node::pointer_type(11, node::max_id-5), + node::pointer_type(11, node::max_id-6)))); AssertThat(out_nodes.can_pull(), Is().True()); // (h) - AssertThat(out_nodes.pull(), Is().EqualTo(node(9, node::MAX_ID, - node::ptr_t(10, node::MAX_ID-1), - node::ptr_t(10, node::MAX_ID)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(9, node::max_id, + node::pointer_type(10, node::max_id-1), + node::pointer_type(10, node::max_id)))); AssertThat(out_nodes.can_pull(), Is().True()); // (i) - AssertThat(out_nodes.pull(), Is().EqualTo(node(9, node::MAX_ID-1, - node::ptr_t(10, node::MAX_ID), - node::ptr_t(10, node::MAX_ID-1)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(9, node::max_id-1, + node::pointer_type(10, node::max_id), + node::pointer_type(10, node::max_id-1)))); AssertThat(out_nodes.can_pull(), Is().True()); // (10) - AssertThat(out_nodes.pull(), Is().EqualTo(node(9, node::MAX_ID-2, - node::ptr_t(10, node::MAX_ID-3), - node::ptr_t(10, node::MAX_ID-2)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(9, node::max_id-2, + node::pointer_type(10, node::max_id-3), + node::pointer_type(10, node::max_id-2)))); AssertThat(out_nodes.can_pull(), Is().True()); // (11) - AssertThat(out_nodes.pull(), Is().EqualTo(node(9, node::MAX_ID-3, - node::ptr_t(10, node::MAX_ID-2), - node::ptr_t(10, node::MAX_ID-3)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(9, node::max_id-3, + node::pointer_type(10, node::max_id-2), + node::pointer_type(10, node::max_id-3)))); AssertThat(out_nodes.can_pull(), Is().True()); // (TODO) - AssertThat(out_nodes.pull(), Is().EqualTo(node(9, node::MAX_ID-4, - node::ptr_t(10, node::MAX_ID-4), - node::ptr_t(10, node::MAX_ID-4)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(9, node::max_id-4, + node::pointer_type(10, node::max_id-4), + node::pointer_type(10, node::max_id-4)))); AssertThat(out_nodes.can_pull(), Is().True()); // (10,h) - AssertThat(out_nodes.pull(), Is().EqualTo(node(9, node::MAX_ID-5, - node::ptr_t(10, node::MAX_ID-6), - node::ptr_t(10, node::MAX_ID-5)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(9, node::max_id-5, + node::pointer_type(10, node::max_id-6), + node::pointer_type(10, node::max_id-5)))); AssertThat(out_nodes.can_pull(), Is().True()); // (11,i) - AssertThat(out_nodes.pull(), Is().EqualTo(node(9, node::MAX_ID-6, - node::ptr_t(10, node::MAX_ID-5), - node::ptr_t(10, node::MAX_ID-6)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(9, node::max_id-6, + node::pointer_type(10, node::max_id-5), + node::pointer_type(10, node::max_id-6)))); AssertThat(out_nodes.can_pull(), Is().True()); // (g) - AssertThat(out_nodes.pull(), Is().EqualTo(node(8, node::MAX_ID, - node::ptr_t(9, node::MAX_ID-1), - node::ptr_t(9, node::MAX_ID)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(8, node::max_id, + node::pointer_type(9, node::max_id-1), + node::pointer_type(9, node::max_id)))); AssertThat(out_nodes.can_pull(), Is().True()); // (f) - AssertThat(out_nodes.pull(), Is().EqualTo(node(8, node::MAX_ID-1, - node::ptr_t(9, node::MAX_ID), - node::ptr_t(9, node::MAX_ID-1)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(8, node::max_id-1, + node::pointer_type(9, node::max_id), + node::pointer_type(9, node::max_id-1)))); AssertThat(out_nodes.can_pull(), Is().True()); // (9) - AssertThat(out_nodes.pull(), Is().EqualTo(node(8, node::MAX_ID-2, - node::ptr_t(9, node::MAX_ID-3), - node::ptr_t(9, node::MAX_ID-2)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(8, node::max_id-2, + node::pointer_type(9, node::max_id-3), + node::pointer_type(9, node::max_id-2)))); AssertThat(out_nodes.can_pull(), Is().True()); // (8) - AssertThat(out_nodes.pull(), Is().EqualTo(node(8, node::MAX_ID-3, - node::ptr_t(9, node::MAX_ID-2), - node::ptr_t(9, node::MAX_ID-3)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(8, node::max_id-3, + node::pointer_type(9, node::max_id-2), + node::pointer_type(9, node::max_id-3)))); AssertThat(out_nodes.can_pull(), Is().True()); // (8,g) - AssertThat(out_nodes.pull(), Is().EqualTo(node(8, node::MAX_ID-4, - node::ptr_t(9, node::MAX_ID-4), - node::ptr_t(9, node::MAX_ID-4)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(8, node::max_id-4, + node::pointer_type(9, node::max_id-4), + node::pointer_type(9, node::max_id-4)))); AssertThat(out_nodes.can_pull(), Is().True()); // (8,f) - AssertThat(out_nodes.pull(), Is().EqualTo(node(8, node::MAX_ID-5, - node::ptr_t(9, node::MAX_ID-5), - node::ptr_t(9, node::MAX_ID-6)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(8, node::max_id-5, + node::pointer_type(9, node::max_id-5), + node::pointer_type(9, node::max_id-6)))); AssertThat(out_nodes.can_pull(), Is().True()); // (7) - AssertThat(out_nodes.pull(), Is().EqualTo(node(7, node::MAX_ID, - node::ptr_t(8, node::MAX_ID-3), - node::ptr_t(8, node::MAX_ID-2)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(7, node::max_id, + node::pointer_type(8, node::max_id-3), + node::pointer_type(8, node::max_id-2)))); AssertThat(out_nodes.can_pull(), Is().True()); // (7,g) - AssertThat(out_nodes.pull(), Is().EqualTo(node(7, node::MAX_ID-1, - node::ptr_t(8, node::MAX_ID-4), - node::ptr_t(8, node::MAX_ID-2)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(7, node::max_id-1, + node::pointer_type(8, node::max_id-4), + node::pointer_type(8, node::max_id-2)))); AssertThat(out_nodes.can_pull(), Is().True()); // (d) - AssertThat(out_nodes.pull(), Is().EqualTo(node(6, node::MAX_ID, - node::ptr_t(8, node::MAX_ID-1), - node::ptr_t(8, node::MAX_ID)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(6, node::max_id, + node::pointer_type(8, node::max_id-1), + node::pointer_type(8, node::max_id)))); AssertThat(out_nodes.can_pull(), Is().True()); // (6) - AssertThat(out_nodes.pull(), Is().EqualTo(node(6, node::MAX_ID-1, - node::ptr_t(7, node::MAX_ID), - node::ptr_t(8, node::MAX_ID-2)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(6, node::max_id-1, + node::pointer_type(7, node::max_id), + node::pointer_type(8, node::max_id-2)))); AssertThat(out_nodes.can_pull(), Is().True()); // (5) - AssertThat(out_nodes.pull(), Is().EqualTo(node(6, node::MAX_ID-2, - node::ptr_t(8, node::MAX_ID-3), - node::ptr_t(7, node::MAX_ID)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(6, node::max_id-2, + node::pointer_type(8, node::max_id-3), + node::pointer_type(7, node::max_id)))); AssertThat(out_nodes.can_pull(), Is().True()); // (5,d) - AssertThat(out_nodes.pull(), Is().EqualTo(node(6, node::MAX_ID-3, - node::ptr_t(8, node::MAX_ID-5), - node::ptr_t(7, node::MAX_ID-1)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(6, node::max_id-3, + node::pointer_type(8, node::max_id-5), + node::pointer_type(7, node::max_id-1)))); AssertThat(out_nodes.can_pull(), Is().True()); // (c) - AssertThat(out_nodes.pull(), Is().EqualTo(node(5, node::MAX_ID, - node::ptr_t(6, node::MAX_ID), - node::ptr_t(true)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(5, node::max_id, + node::pointer_type(6, node::max_id), + node::pointer_type(true)))); AssertThat(out_nodes.can_pull(), Is().True()); // (b,5,d) - AssertThat(out_nodes.pull(), Is().EqualTo(node(5, node::MAX_ID-1, - node::ptr_t(6, node::MAX_ID-3), - node::ptr_t(6, node::MAX_ID)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(5, node::max_id-1, + node::pointer_type(6, node::max_id-3), + node::pointer_type(6, node::max_id)))); AssertThat(out_nodes.can_pull(), Is().True()); // (4,b,5,d) - AssertThat(out_nodes.pull(), Is().EqualTo(node(5, node::MAX_ID-2, - node::ptr_t(6, node::MAX_ID-2), - node::ptr_t(6, node::MAX_ID-1)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(5, node::max_id-2, + node::pointer_type(6, node::max_id-2), + node::pointer_type(6, node::max_id-1)))); AssertThat(out_nodes.can_pull(), Is().True()); // (3,b,5,d) - AssertThat(out_nodes.pull(), Is().EqualTo(node(4, node::MAX_ID, - node::ptr_t(5, node::MAX_ID-2), - node::ptr_t(true)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(4, node::max_id, + node::pointer_type(5, node::max_id-2), + node::pointer_type(true)))); AssertThat(out_nodes.can_pull(), Is().True()); // (2,b,5,d) - AssertThat(out_nodes.pull(), Is().EqualTo(node(4, node::MAX_ID-1, - node::ptr_t(5, node::MAX_ID-1), - node::ptr_t(5, node::MAX_ID-2)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(4, node::max_id-1, + node::pointer_type(5, node::max_id-1), + node::pointer_type(5, node::max_id-2)))); AssertThat(out_nodes.can_pull(), Is().True()); // (1,b,5,d) - AssertThat(out_nodes.pull(), Is().EqualTo(node(3, node::MAX_ID, - node::ptr_t(4, node::MAX_ID-1), - node::ptr_t(4, node::MAX_ID)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(3, node::max_id, + node::pointer_type(4, node::max_id-1), + node::pointer_type(4, node::max_id)))); AssertThat(out_nodes.can_pull(), Is().True()); // (1,a,5,d) - AssertThat(out_nodes.pull(), Is().EqualTo(node(2, node::MAX_ID, - node::ptr_t(3, node::MAX_ID), - node::ptr_t(5, node::MAX_ID)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(2, node::max_id, + node::pointer_type(3, node::max_id), + node::pointer_type(5, node::max_id)))); AssertThat(out_nodes.can_pull(), Is().False()); @@ -1500,17 +1500,17 @@ go_bandit([]() { AssertThat(call_history.at(52), Is().EqualTo(1u)); }); - quantify_mode = quantify_mode_t::AUTO; + quantify_mode = quantify_mode_t::Auto; }); }); - describe("zdd_project(const zdd&, const generator&)", [&]() { + describe("zdd_project(const zdd&, const generator&)", [&]() { it("returns same file for Ø with dom = {6,4,2,0} [const &]", [&](){ - zdd::label_t var = 6; + zdd::label_type var = 6; const zdd in = zdd_empty; zdd out = zdd_project(in, [&var]() { - const zdd::label_t ret = var; + const zdd::label_type ret = var; var -= 2; return ret; }); @@ -1519,10 +1519,10 @@ go_bandit([]() { }); it("returns same file for { Ø } with dom = {1,3,5} [&&]", [&](){ - zdd::label_t var = 6; + zdd::label_type var = 6; zdd out = zdd_project(zdd(zdd_null), [&var]() { - const zdd::label_t ret = var; + const zdd::label_type ret = var; var -= 2; return ret; }); @@ -1541,8 +1541,8 @@ go_bandit([]() { AssertThat(out.file_ptr(), Is().EqualTo(in.file_ptr())); }); - describe("quantify_mode == SINGLETON / PARTIAL", [&]() { - quantify_mode = quantify_mode_t::SINGLETON; + describe("quantify_mode == Singleton / Partial", [&]() { + quantify_mode = quantify_mode_t::Singleton; it("collapses zdd_1 with dom = Ø into { Ø } [const &]", [&](){ const zdd in = zdd_1; @@ -1557,10 +1557,10 @@ go_bandit([]() { level_info_test_stream ms(out); AssertThat(ms.can_pull(), Is().False()); - AssertThat(out->max_1level_cut[cut_type::INTERNAL], Is().GreaterThanOrEqualTo(0u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_FALSE], Is().GreaterThanOrEqualTo(0u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_TRUE], Is().GreaterThanOrEqualTo(1u)); - AssertThat(out->max_1level_cut[cut_type::ALL], Is().GreaterThanOrEqualTo(1u)); + AssertThat(out->max_1level_cut[cut::Internal], Is().GreaterThanOrEqualTo(0u)); + AssertThat(out->max_1level_cut[cut::Internal_False], Is().GreaterThanOrEqualTo(0u)); + AssertThat(out->max_1level_cut[cut::Internal_True], Is().GreaterThanOrEqualTo(1u)); + AssertThat(out->max_1level_cut[cut::All], Is().GreaterThanOrEqualTo(1u)); AssertThat(out->number_of_terminals[false], Is().EqualTo(0u)); AssertThat(out->number_of_terminals[true], Is().EqualTo(1u)); @@ -1578,10 +1578,10 @@ go_bandit([]() { level_info_test_stream ms(out); AssertThat(ms.can_pull(), Is().False()); - AssertThat(out->max_1level_cut[cut_type::INTERNAL], Is().GreaterThanOrEqualTo(0u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_FALSE], Is().GreaterThanOrEqualTo(0u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_TRUE], Is().GreaterThanOrEqualTo(1u)); - AssertThat(out->max_1level_cut[cut_type::ALL], Is().GreaterThanOrEqualTo(1u)); + AssertThat(out->max_1level_cut[cut::Internal], Is().GreaterThanOrEqualTo(0u)); + AssertThat(out->max_1level_cut[cut::Internal_False], Is().GreaterThanOrEqualTo(0u)); + AssertThat(out->max_1level_cut[cut::Internal_True], Is().GreaterThanOrEqualTo(1u)); + AssertThat(out->max_1level_cut[cut::All], Is().GreaterThanOrEqualTo(1u)); AssertThat(out->number_of_terminals[false], Is().EqualTo(0u)); AssertThat(out->number_of_terminals[true], Is().EqualTo(1u)); @@ -1600,21 +1600,21 @@ go_bandit([]() { level_info_test_stream ms(out); AssertThat(ms.can_pull(), Is().False()); - AssertThat(out->max_1level_cut[cut_type::INTERNAL], Is().GreaterThanOrEqualTo(0u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_FALSE], Is().GreaterThanOrEqualTo(0u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_TRUE], Is().GreaterThanOrEqualTo(1u)); - AssertThat(out->max_1level_cut[cut_type::ALL], Is().GreaterThanOrEqualTo(1u)); + AssertThat(out->max_1level_cut[cut::Internal], Is().GreaterThanOrEqualTo(0u)); + AssertThat(out->max_1level_cut[cut::Internal_False], Is().GreaterThanOrEqualTo(0u)); + AssertThat(out->max_1level_cut[cut::Internal_True], Is().GreaterThanOrEqualTo(1u)); + AssertThat(out->max_1level_cut[cut::All], Is().GreaterThanOrEqualTo(1u)); AssertThat(out->number_of_terminals[false], Is().EqualTo(0u)); AssertThat(out->number_of_terminals[true], Is().EqualTo(1u)); }); it("collapses zdd_2 with disjoint domain into { Ø } [const &]", [&](){ - zdd::label_t var = 1; + zdd::label_type var = 1; const zdd in = zdd_2; zdd out = zdd_project(in, [&var]() { - const zdd::label_t ret = var; + const zdd::label_type ret = var; var -= 2; return ret; }); @@ -1628,17 +1628,17 @@ go_bandit([]() { level_info_test_stream ms(out); AssertThat(ms.can_pull(), Is().False()); - AssertThat(out->max_1level_cut[cut_type::INTERNAL], Is().GreaterThanOrEqualTo(0u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_FALSE], Is().GreaterThanOrEqualTo(0u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_TRUE], Is().GreaterThanOrEqualTo(1u)); - AssertThat(out->max_1level_cut[cut_type::ALL], Is().GreaterThanOrEqualTo(1u)); + AssertThat(out->max_1level_cut[cut::Internal], Is().GreaterThanOrEqualTo(0u)); + AssertThat(out->max_1level_cut[cut::Internal_False], Is().GreaterThanOrEqualTo(0u)); + AssertThat(out->max_1level_cut[cut::Internal_True], Is().GreaterThanOrEqualTo(1u)); + AssertThat(out->max_1level_cut[cut::All], Is().GreaterThanOrEqualTo(1u)); AssertThat(out->number_of_terminals[false], Is().EqualTo(0u)); AssertThat(out->number_of_terminals[true], Is().EqualTo(1u)); }); it("computes with disjoint dom to be { Ø } [zdd_3] [&&]", [&](){ - zdd::label_t var = 5; + zdd::label_type var = 5; zdd out = zdd_project(zdd(zdd_3), [&var]() { return 3 <= var && var <= 5 ? var-- : -1; }); @@ -1652,10 +1652,10 @@ go_bandit([]() { level_info_test_stream ms(out); AssertThat(ms.can_pull(), Is().False()); - AssertThat(out->max_1level_cut[cut_type::INTERNAL], Is().GreaterThanOrEqualTo(0u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_FALSE], Is().GreaterThanOrEqualTo(0u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_TRUE], Is().GreaterThanOrEqualTo(1u)); - AssertThat(out->max_1level_cut[cut_type::ALL], Is().GreaterThanOrEqualTo(1u)); + AssertThat(out->max_1level_cut[cut::Internal], Is().GreaterThanOrEqualTo(0u)); + AssertThat(out->max_1level_cut[cut::Internal_False], Is().GreaterThanOrEqualTo(0u)); + AssertThat(out->max_1level_cut[cut::Internal_True], Is().GreaterThanOrEqualTo(1u)); + AssertThat(out->max_1level_cut[cut::All], Is().GreaterThanOrEqualTo(1u)); AssertThat(out->number_of_terminals[false], Is().EqualTo(0u)); AssertThat(out->number_of_terminals[true], Is().EqualTo(1u)); @@ -1663,14 +1663,14 @@ go_bandit([]() { ////////////////////// // Single-node case - shared_levelized_file zdd_x1; + shared_levelized_file zdd_x1; { node_writer nw(zdd_x1); - nw << node(1u, node::MAX_ID, ptr_uint64(false), ptr_uint64(true)); + nw << node(1u, node::max_id, ptr_uint64(false), ptr_uint64(true)); } it("returns { Ø } for {1} with dom = {0} [const &]", [&](){ - adiar::shared_file dom; + adiar::shared_file dom; { label_writer lw(dom); lw << 0; } @@ -1682,7 +1682,7 @@ go_bandit([]() { * T */ - zdd::label_t var = 0; + zdd::label_type var = 0; zdd out = zdd_project(in, [&var]() { return var == 0 ? var--: var; }); @@ -1696,17 +1696,17 @@ go_bandit([]() { level_info_test_stream ms(out); AssertThat(ms.can_pull(), Is().False()); - AssertThat(out->max_1level_cut[cut_type::INTERNAL], Is().GreaterThanOrEqualTo(0u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_FALSE], Is().GreaterThanOrEqualTo(0u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_TRUE], Is().GreaterThanOrEqualTo(1u)); - AssertThat(out->max_1level_cut[cut_type::ALL], Is().GreaterThanOrEqualTo(1u)); + AssertThat(out->max_1level_cut[cut::Internal], Is().GreaterThanOrEqualTo(0u)); + AssertThat(out->max_1level_cut[cut::Internal_False], Is().GreaterThanOrEqualTo(0u)); + AssertThat(out->max_1level_cut[cut::Internal_True], Is().GreaterThanOrEqualTo(1u)); + AssertThat(out->max_1level_cut[cut::All], Is().GreaterThanOrEqualTo(1u)); AssertThat(out->number_of_terminals[false], Is().EqualTo(0u)); AssertThat(out->number_of_terminals[true], Is().EqualTo(1u)); }); it("returns { 1 } for {1} with dom = {1,0} [const &]", [&](){ - adiar::shared_file dom; + adiar::shared_file dom; { label_writer lw(dom); lw << 0 << 1; } @@ -1719,14 +1719,14 @@ go_bandit([]() { * / \ * F T */ - zdd::label_t var = 1; + zdd::label_type var = 1; zdd out = zdd_project(in, [&var]() { return var <= 1 ? var--: var; }); node_test_stream out_nodes(out); AssertThat(out_nodes.can_pull(), Is().True()); - AssertThat(out_nodes.pull(), Is().EqualTo(node(1, node::MAX_ID, zdd::ptr_t(false), zdd::ptr_t(true)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(1, node::max_id, zdd::pointer_type(false), zdd::pointer_type(true)))); AssertThat(out_nodes.can_pull(), Is().False()); @@ -1735,10 +1735,10 @@ go_bandit([]() { AssertThat(ms.pull(), Is().EqualTo(level_info(1,1u))); AssertThat(ms.can_pull(), Is().False()); - AssertThat(out->max_1level_cut[cut_type::INTERNAL], Is().GreaterThanOrEqualTo(0u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_FALSE], Is().GreaterThanOrEqualTo(0u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_TRUE], Is().GreaterThanOrEqualTo(1u)); - AssertThat(out->max_1level_cut[cut_type::ALL], Is().GreaterThanOrEqualTo(1u)); + AssertThat(out->max_1level_cut[cut::Internal], Is().GreaterThanOrEqualTo(0u)); + AssertThat(out->max_1level_cut[cut::Internal_False], Is().GreaterThanOrEqualTo(0u)); + AssertThat(out->max_1level_cut[cut::Internal_True], Is().GreaterThanOrEqualTo(1u)); + AssertThat(out->max_1level_cut[cut::All], Is().GreaterThanOrEqualTo(1u)); AssertThat(out->number_of_terminals[false], Is().EqualTo(1u)); AssertThat(out->number_of_terminals[true], Is().EqualTo(1u)); @@ -1759,7 +1759,7 @@ go_bandit([]() { // / \ // T T */ - zdd::label_t var = 4; + zdd::label_type var = 4; zdd out = zdd_project(in, [&var]() { return 2 <= var && var <= 4 ? var-- : -1; }); @@ -1767,18 +1767,18 @@ go_bandit([]() { node_test_stream out_nodes(out); AssertThat(out_nodes.can_pull(), Is().True()); - AssertThat(out_nodes.pull(), Is().EqualTo(node(4, node::MAX_ID, + AssertThat(out_nodes.pull(), Is().EqualTo(node(4, node::max_id, terminal_T, terminal_T))); AssertThat(out_nodes.can_pull(), Is().True()); - AssertThat(out_nodes.pull(), Is().EqualTo(node(3, node::MAX_ID, + AssertThat(out_nodes.pull(), Is().EqualTo(node(3, node::max_id, terminal_T, - ptr_uint64(4, ptr_uint64::MAX_ID)))); + ptr_uint64(4, ptr_uint64::max_id)))); AssertThat(out_nodes.can_pull(), Is().True()); - AssertThat(out_nodes.pull(), Is().EqualTo(node(2, node::MAX_ID, - ptr_uint64(3, ptr_uint64::MAX_ID), + AssertThat(out_nodes.pull(), Is().EqualTo(node(2, node::max_id, + ptr_uint64(3, ptr_uint64::max_id), terminal_T))); AssertThat(out_nodes.can_pull(), Is().False()); @@ -1797,10 +1797,10 @@ go_bandit([]() { AssertThat(ms.can_pull(), Is().False()); - AssertThat(out->max_1level_cut[cut_type::INTERNAL], Is().GreaterThanOrEqualTo(1u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_FALSE], Is().GreaterThanOrEqualTo(1u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_TRUE], Is().GreaterThanOrEqualTo(4u)); - AssertThat(out->max_1level_cut[cut_type::ALL], Is().GreaterThanOrEqualTo(4u)); + AssertThat(out->max_1level_cut[cut::Internal], Is().GreaterThanOrEqualTo(1u)); + AssertThat(out->max_1level_cut[cut::Internal_False], Is().GreaterThanOrEqualTo(1u)); + AssertThat(out->max_1level_cut[cut::Internal_True], Is().GreaterThanOrEqualTo(4u)); + AssertThat(out->max_1level_cut[cut::All], Is().GreaterThanOrEqualTo(4u)); AssertThat(out->number_of_terminals[false], Is().EqualTo(0u)); AssertThat(out->number_of_terminals[true], Is().EqualTo(4u)); @@ -1817,7 +1817,7 @@ go_bandit([]() { // / \ // T T */ - zdd::label_t var = 4; + zdd::label_type var = 4; zdd out = zdd_project(zdd_2, [&var]() { return 2 <= var && var <= 4 ? var-- : -1; }); @@ -1825,19 +1825,19 @@ go_bandit([]() { node_test_stream out_nodes(out); AssertThat(out_nodes.can_pull(), Is().True()); - AssertThat(out_nodes.pull(), Is().EqualTo(node(4, node::MAX_ID, + AssertThat(out_nodes.pull(), Is().EqualTo(node(4, node::max_id, terminal_T, terminal_T))); AssertThat(out_nodes.can_pull(), Is().True()); - AssertThat(out_nodes.pull(), Is().EqualTo(node(3, node::MAX_ID, + AssertThat(out_nodes.pull(), Is().EqualTo(node(3, node::max_id, terminal_T, terminal_T))); AssertThat(out_nodes.can_pull(), Is().True()); - AssertThat(out_nodes.pull(), Is().EqualTo(node(2, node::MAX_ID, - ptr_uint64(3, ptr_uint64::MAX_ID), - ptr_uint64(4, ptr_uint64::MAX_ID)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(2, node::max_id, + ptr_uint64(3, ptr_uint64::max_id), + ptr_uint64(4, ptr_uint64::max_id)))); AssertThat(out_nodes.can_pull(), Is().False()); @@ -1855,10 +1855,10 @@ go_bandit([]() { AssertThat(ms.can_pull(), Is().False()); - AssertThat(out->max_1level_cut[cut_type::INTERNAL], Is().GreaterThanOrEqualTo(1u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_FALSE], Is().GreaterThanOrEqualTo(1u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_TRUE], Is().GreaterThanOrEqualTo(0u)); - AssertThat(out->max_1level_cut[cut_type::ALL], Is().GreaterThanOrEqualTo(1u)); + AssertThat(out->max_1level_cut[cut::Internal], Is().GreaterThanOrEqualTo(1u)); + AssertThat(out->max_1level_cut[cut::Internal_False], Is().GreaterThanOrEqualTo(1u)); + AssertThat(out->max_1level_cut[cut::Internal_True], Is().GreaterThanOrEqualTo(0u)); + AssertThat(out->max_1level_cut[cut::All], Is().GreaterThanOrEqualTo(1u)); AssertThat(out->number_of_terminals[false], Is().EqualTo(0u)); AssertThat(out->number_of_terminals[true], Is().EqualTo(4u)); @@ -1875,9 +1875,9 @@ go_bandit([]() { // / \ // T T */ - zdd::label_t var = 4; + zdd::label_type var = 4; zdd out = zdd_project(zdd_3, [&var]() { - const zdd::label_t ret = var; + const zdd::label_type ret = var; var -= 2; return ret; }); @@ -1885,14 +1885,14 @@ go_bandit([]() { node_test_stream out_nodes(out); AssertThat(out_nodes.can_pull(), Is().True()); - AssertThat(out_nodes.pull(), Is().EqualTo(node(2, node::MAX_ID, + AssertThat(out_nodes.pull(), Is().EqualTo(node(2, node::max_id, terminal_T, terminal_T))); AssertThat(out_nodes.can_pull(), Is().True()); - AssertThat(out_nodes.pull(), Is().EqualTo(node(0, node::MAX_ID, - ptr_uint64(2, ptr_uint64::MAX_ID), - ptr_uint64(2, ptr_uint64::MAX_ID)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(0, node::max_id, + ptr_uint64(2, ptr_uint64::max_id), + ptr_uint64(2, ptr_uint64::max_id)))); AssertThat(out_nodes.can_pull(), Is().False()); @@ -1906,10 +1906,10 @@ go_bandit([]() { AssertThat(ms.can_pull(), Is().False()); - AssertThat(out->max_1level_cut[cut_type::INTERNAL], Is().GreaterThanOrEqualTo(2u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_FALSE], Is().GreaterThanOrEqualTo(2u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_TRUE], Is().GreaterThanOrEqualTo(2u)); - AssertThat(out->max_1level_cut[cut_type::ALL], Is().GreaterThanOrEqualTo(2u)); + AssertThat(out->max_1level_cut[cut::Internal], Is().GreaterThanOrEqualTo(2u)); + AssertThat(out->max_1level_cut[cut::Internal_False], Is().GreaterThanOrEqualTo(2u)); + AssertThat(out->max_1level_cut[cut::Internal_True], Is().GreaterThanOrEqualTo(2u)); + AssertThat(out->max_1level_cut[cut::All], Is().GreaterThanOrEqualTo(2u)); AssertThat(out->number_of_terminals[false], Is().EqualTo(0u)); AssertThat(out->number_of_terminals[true], Is().EqualTo(2u)); @@ -1926,9 +1926,9 @@ go_bandit([]() { // / \ / \ // F T T T */ - zdd::label_t var = 4; + zdd::label_type var = 4; zdd out = zdd_project(zdd_4, [&var]() { - const zdd::label_t ret = var; + const zdd::label_type ret = var; var -= 4; return ret; }); @@ -1936,19 +1936,19 @@ go_bandit([]() { node_test_stream out_nodes(out); AssertThat(out_nodes.can_pull(), Is().True()); - AssertThat(out_nodes.pull(), Is().EqualTo(node(4, node::MAX_ID, + AssertThat(out_nodes.pull(), Is().EqualTo(node(4, node::max_id, terminal_T, terminal_T))); AssertThat(out_nodes.can_pull(), Is().True()); - AssertThat(out_nodes.pull(), Is().EqualTo(node(4, node::MAX_ID-1, + AssertThat(out_nodes.pull(), Is().EqualTo(node(4, node::max_id-1, terminal_F, terminal_T))); AssertThat(out_nodes.can_pull(), Is().True()); - AssertThat(out_nodes.pull(), Is().EqualTo(node(0, node::MAX_ID, - ptr_uint64(4, ptr_uint64::MAX_ID-1), - ptr_uint64(4, ptr_uint64::MAX_ID)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(0, node::max_id, + ptr_uint64(4, ptr_uint64::max_id-1), + ptr_uint64(4, ptr_uint64::max_id)))); AssertThat(out_nodes.can_pull(), Is().False()); @@ -1962,10 +1962,10 @@ go_bandit([]() { AssertThat(ms.can_pull(), Is().False()); - AssertThat(out->max_1level_cut[cut_type::INTERNAL], Is().GreaterThanOrEqualTo(2u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_FALSE], Is().GreaterThanOrEqualTo(2u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_TRUE], Is().GreaterThanOrEqualTo(3u)); - AssertThat(out->max_1level_cut[cut_type::ALL], Is().GreaterThanOrEqualTo(3u)); + AssertThat(out->max_1level_cut[cut::Internal], Is().GreaterThanOrEqualTo(2u)); + AssertThat(out->max_1level_cut[cut::Internal_False], Is().GreaterThanOrEqualTo(2u)); + AssertThat(out->max_1level_cut[cut::Internal_True], Is().GreaterThanOrEqualTo(3u)); + AssertThat(out->max_1level_cut[cut::All], Is().GreaterThanOrEqualTo(3u)); AssertThat(out->number_of_terminals[false], Is().EqualTo(1u)); AssertThat(out->number_of_terminals[true], Is().EqualTo(3u)); @@ -1980,9 +1980,9 @@ go_bandit([]() { // / \|| // F T */ - zdd::label_t var = 4; + zdd::label_type var = 4; zdd out = zdd_project(zdd_4, [&var]() { - const zdd::label_t res = var; + const zdd::label_type res = var; if (var == 4) { var -= 2; } else { var = -1; } return res; @@ -1991,19 +1991,19 @@ go_bandit([]() { node_test_stream out_nodes(out); AssertThat(out_nodes.can_pull(), Is().True()); - AssertThat(out_nodes.pull(), Is().EqualTo(node(4, node::MAX_ID, + AssertThat(out_nodes.pull(), Is().EqualTo(node(4, node::max_id, terminal_T, terminal_T))); AssertThat(out_nodes.can_pull(), Is().True()); - AssertThat(out_nodes.pull(), Is().EqualTo(node(4, node::MAX_ID-1, + AssertThat(out_nodes.pull(), Is().EqualTo(node(4, node::max_id-1, terminal_F, terminal_T))); AssertThat(out_nodes.can_pull(), Is().True()); - AssertThat(out_nodes.pull(), Is().EqualTo(node(2, node::MAX_ID, - ptr_uint64(4, ptr_uint64::MAX_ID-1), - ptr_uint64(4, ptr_uint64::MAX_ID)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(2, node::max_id, + ptr_uint64(4, ptr_uint64::max_id-1), + ptr_uint64(4, ptr_uint64::max_id)))); AssertThat(out_nodes.can_pull(), Is().False()); @@ -2017,20 +2017,20 @@ go_bandit([]() { AssertThat(ms.can_pull(), Is().False()); - AssertThat(out->max_1level_cut[cut_type::INTERNAL], Is().GreaterThanOrEqualTo(2u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_FALSE], Is().GreaterThanOrEqualTo(2u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_TRUE], Is().GreaterThanOrEqualTo(2u)); - AssertThat(out->max_1level_cut[cut_type::ALL], Is().GreaterThanOrEqualTo(3u)); + AssertThat(out->max_1level_cut[cut::Internal], Is().GreaterThanOrEqualTo(2u)); + AssertThat(out->max_1level_cut[cut::Internal_False], Is().GreaterThanOrEqualTo(2u)); + AssertThat(out->max_1level_cut[cut::Internal_True], Is().GreaterThanOrEqualTo(2u)); + AssertThat(out->max_1level_cut[cut::All], Is().GreaterThanOrEqualTo(3u)); AssertThat(out->number_of_terminals[false], Is().EqualTo(1u)); AssertThat(out->number_of_terminals[true], Is().EqualTo(3u)); }); - quantify_mode = quantify_mode_t::AUTO; + quantify_mode = quantify_mode_t::Auto; }); - describe("quantify_mode == NESTED / AUTO", [&]() { - quantify_mode = quantify_mode_t::NESTED; + describe("quantify_mode == Nested / Auto", [&]() { + quantify_mode = quantify_mode_t::Nested; it("collapses zdd_1 with dom = Ø into { Ø } [const &]", [&](){ const zdd in = zdd_1; @@ -2045,10 +2045,10 @@ go_bandit([]() { level_info_test_stream ms(out); AssertThat(ms.can_pull(), Is().False()); - AssertThat(out->max_1level_cut[cut_type::INTERNAL], Is().GreaterThanOrEqualTo(0u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_FALSE], Is().GreaterThanOrEqualTo(0u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_TRUE], Is().GreaterThanOrEqualTo(1u)); - AssertThat(out->max_1level_cut[cut_type::ALL], Is().GreaterThanOrEqualTo(1u)); + AssertThat(out->max_1level_cut[cut::Internal], Is().GreaterThanOrEqualTo(0u)); + AssertThat(out->max_1level_cut[cut::Internal_False], Is().GreaterThanOrEqualTo(0u)); + AssertThat(out->max_1level_cut[cut::Internal_True], Is().GreaterThanOrEqualTo(1u)); + AssertThat(out->max_1level_cut[cut::All], Is().GreaterThanOrEqualTo(1u)); AssertThat(out->number_of_terminals[false], Is().EqualTo(0u)); AssertThat(out->number_of_terminals[true], Is().EqualTo(1u)); @@ -2066,10 +2066,10 @@ go_bandit([]() { level_info_test_stream ms(out); AssertThat(ms.can_pull(), Is().False()); - AssertThat(out->max_1level_cut[cut_type::INTERNAL], Is().GreaterThanOrEqualTo(0u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_FALSE], Is().GreaterThanOrEqualTo(0u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_TRUE], Is().GreaterThanOrEqualTo(1u)); - AssertThat(out->max_1level_cut[cut_type::ALL], Is().GreaterThanOrEqualTo(1u)); + AssertThat(out->max_1level_cut[cut::Internal], Is().GreaterThanOrEqualTo(0u)); + AssertThat(out->max_1level_cut[cut::Internal_False], Is().GreaterThanOrEqualTo(0u)); + AssertThat(out->max_1level_cut[cut::Internal_True], Is().GreaterThanOrEqualTo(1u)); + AssertThat(out->max_1level_cut[cut::All], Is().GreaterThanOrEqualTo(1u)); AssertThat(out->number_of_terminals[false], Is().EqualTo(0u)); AssertThat(out->number_of_terminals[true], Is().EqualTo(1u)); @@ -2088,21 +2088,21 @@ go_bandit([]() { level_info_test_stream ms(out); AssertThat(ms.can_pull(), Is().False()); - AssertThat(out->max_1level_cut[cut_type::INTERNAL], Is().GreaterThanOrEqualTo(0u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_FALSE], Is().GreaterThanOrEqualTo(0u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_TRUE], Is().GreaterThanOrEqualTo(1u)); - AssertThat(out->max_1level_cut[cut_type::ALL], Is().GreaterThanOrEqualTo(1u)); + AssertThat(out->max_1level_cut[cut::Internal], Is().GreaterThanOrEqualTo(0u)); + AssertThat(out->max_1level_cut[cut::Internal_False], Is().GreaterThanOrEqualTo(0u)); + AssertThat(out->max_1level_cut[cut::Internal_True], Is().GreaterThanOrEqualTo(1u)); + AssertThat(out->max_1level_cut[cut::All], Is().GreaterThanOrEqualTo(1u)); AssertThat(out->number_of_terminals[false], Is().EqualTo(0u)); AssertThat(out->number_of_terminals[true], Is().EqualTo(1u)); }); it("collapses zdd_2 with disjoint domain into { Ø } [const &]", [&](){ - zdd::label_t var = 1; + zdd::label_type var = 1; const zdd in = zdd_2; zdd out = zdd_project(in, [&var]() { - const zdd::label_t ret = var; + const zdd::label_type ret = var; var -= 2; return ret; }); @@ -2116,17 +2116,17 @@ go_bandit([]() { level_info_test_stream ms(out); AssertThat(ms.can_pull(), Is().False()); - AssertThat(out->max_1level_cut[cut_type::INTERNAL], Is().GreaterThanOrEqualTo(0u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_FALSE], Is().GreaterThanOrEqualTo(0u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_TRUE], Is().GreaterThanOrEqualTo(1u)); - AssertThat(out->max_1level_cut[cut_type::ALL], Is().GreaterThanOrEqualTo(1u)); + AssertThat(out->max_1level_cut[cut::Internal], Is().GreaterThanOrEqualTo(0u)); + AssertThat(out->max_1level_cut[cut::Internal_False], Is().GreaterThanOrEqualTo(0u)); + AssertThat(out->max_1level_cut[cut::Internal_True], Is().GreaterThanOrEqualTo(1u)); + AssertThat(out->max_1level_cut[cut::All], Is().GreaterThanOrEqualTo(1u)); AssertThat(out->number_of_terminals[false], Is().EqualTo(0u)); AssertThat(out->number_of_terminals[true], Is().EqualTo(1u)); }); it("computes with disjoint dom to be { Ø } [zdd_3] [&&]", [&](){ - zdd::label_t var = 5; + zdd::label_type var = 5; zdd out = zdd_project(zdd(zdd_3), [&var]() { return 3 <= var && var <= 5 ? var-- : -1; }); @@ -2140,10 +2140,10 @@ go_bandit([]() { level_info_test_stream ms(out); AssertThat(ms.can_pull(), Is().False()); - AssertThat(out->max_1level_cut[cut_type::INTERNAL], Is().GreaterThanOrEqualTo(0u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_FALSE], Is().GreaterThanOrEqualTo(0u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_TRUE], Is().GreaterThanOrEqualTo(1u)); - AssertThat(out->max_1level_cut[cut_type::ALL], Is().GreaterThanOrEqualTo(1u)); + AssertThat(out->max_1level_cut[cut::Internal], Is().GreaterThanOrEqualTo(0u)); + AssertThat(out->max_1level_cut[cut::Internal_False], Is().GreaterThanOrEqualTo(0u)); + AssertThat(out->max_1level_cut[cut::Internal_True], Is().GreaterThanOrEqualTo(1u)); + AssertThat(out->max_1level_cut[cut::All], Is().GreaterThanOrEqualTo(1u)); AssertThat(out->number_of_terminals[false], Is().EqualTo(0u)); AssertThat(out->number_of_terminals[true], Is().EqualTo(1u)); @@ -2153,14 +2153,14 @@ go_bandit([]() { ////////////////////// // Single-node case - shared_levelized_file zdd_x1; + shared_levelized_file zdd_x1; { node_writer nw(zdd_x1); - nw << node(1u, node::MAX_ID, ptr_uint64(false), ptr_uint64(true)); + nw << node(1u, node::max_id, ptr_uint64(false), ptr_uint64(true)); } it("returns { Ø } for {1} with dom = {0} [const &]", [&](){ - adiar::shared_file dom; + adiar::shared_file dom; { label_writer lw(dom); lw << 0; } @@ -2172,7 +2172,7 @@ go_bandit([]() { * T */ - zdd::label_t var = 0; + zdd::label_type var = 0; zdd out = zdd_project(in, [&var]() { return var == 0 ? var--: var; }); @@ -2186,17 +2186,17 @@ go_bandit([]() { level_info_test_stream ms(out); AssertThat(ms.can_pull(), Is().False()); - AssertThat(out->max_1level_cut[cut_type::INTERNAL], Is().GreaterThanOrEqualTo(0u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_FALSE], Is().GreaterThanOrEqualTo(0u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_TRUE], Is().GreaterThanOrEqualTo(1u)); - AssertThat(out->max_1level_cut[cut_type::ALL], Is().GreaterThanOrEqualTo(1u)); + AssertThat(out->max_1level_cut[cut::Internal], Is().GreaterThanOrEqualTo(0u)); + AssertThat(out->max_1level_cut[cut::Internal_False], Is().GreaterThanOrEqualTo(0u)); + AssertThat(out->max_1level_cut[cut::Internal_True], Is().GreaterThanOrEqualTo(1u)); + AssertThat(out->max_1level_cut[cut::All], Is().GreaterThanOrEqualTo(1u)); AssertThat(out->number_of_terminals[false], Is().EqualTo(0u)); AssertThat(out->number_of_terminals[true], Is().EqualTo(1u)); }); it("returns { 1 } for {1} with dom = {1,0} [const &]", [&](){ - adiar::shared_file dom; + adiar::shared_file dom; { label_writer lw(dom); lw << 0 << 1; } @@ -2209,14 +2209,14 @@ go_bandit([]() { * / \ * F T */ - zdd::label_t var = 1; + zdd::label_type var = 1; zdd out = zdd_project(in, [&var]() { return var <= 1 ? var--: var; }); node_test_stream out_nodes(out); AssertThat(out_nodes.can_pull(), Is().True()); - AssertThat(out_nodes.pull(), Is().EqualTo(node(1, node::MAX_ID, zdd::ptr_t(false), zdd::ptr_t(true)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(1, node::max_id, zdd::pointer_type(false), zdd::pointer_type(true)))); AssertThat(out_nodes.can_pull(), Is().False()); @@ -2225,10 +2225,10 @@ go_bandit([]() { AssertThat(ms.pull(), Is().EqualTo(level_info(1,1u))); AssertThat(ms.can_pull(), Is().False()); - AssertThat(out->max_1level_cut[cut_type::INTERNAL], Is().GreaterThanOrEqualTo(0u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_FALSE], Is().GreaterThanOrEqualTo(0u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_TRUE], Is().GreaterThanOrEqualTo(1u)); - AssertThat(out->max_1level_cut[cut_type::ALL], Is().GreaterThanOrEqualTo(1u)); + AssertThat(out->max_1level_cut[cut::Internal], Is().GreaterThanOrEqualTo(0u)); + AssertThat(out->max_1level_cut[cut::Internal_False], Is().GreaterThanOrEqualTo(0u)); + AssertThat(out->max_1level_cut[cut::Internal_True], Is().GreaterThanOrEqualTo(1u)); + AssertThat(out->max_1level_cut[cut::All], Is().GreaterThanOrEqualTo(1u)); AssertThat(out->number_of_terminals[false], Is().EqualTo(1u)); AssertThat(out->number_of_terminals[true], Is().EqualTo(1u)); @@ -2249,7 +2249,7 @@ go_bandit([]() { // / \ // T T */ - zdd::label_t var = 4; + zdd::label_type var = 4; zdd out = zdd_project(in, [&var]() { return 2 <= var && var <= 4 ? var-- : -1; }); @@ -2257,18 +2257,18 @@ go_bandit([]() { node_test_stream out_nodes(out); AssertThat(out_nodes.can_pull(), Is().True()); - AssertThat(out_nodes.pull(), Is().EqualTo(node(4, node::MAX_ID, + AssertThat(out_nodes.pull(), Is().EqualTo(node(4, node::max_id, terminal_T, terminal_T))); AssertThat(out_nodes.can_pull(), Is().True()); - AssertThat(out_nodes.pull(), Is().EqualTo(node(3, node::MAX_ID, + AssertThat(out_nodes.pull(), Is().EqualTo(node(3, node::max_id, terminal_T, - ptr_uint64(4, ptr_uint64::MAX_ID)))); + ptr_uint64(4, ptr_uint64::max_id)))); AssertThat(out_nodes.can_pull(), Is().True()); - AssertThat(out_nodes.pull(), Is().EqualTo(node(2, node::MAX_ID, - ptr_uint64(3, ptr_uint64::MAX_ID), + AssertThat(out_nodes.pull(), Is().EqualTo(node(2, node::max_id, + ptr_uint64(3, ptr_uint64::max_id), terminal_T))); AssertThat(out_nodes.can_pull(), Is().False()); @@ -2287,10 +2287,10 @@ go_bandit([]() { AssertThat(ms.can_pull(), Is().False()); - AssertThat(out->max_1level_cut[cut_type::INTERNAL], Is().GreaterThanOrEqualTo(1u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_FALSE], Is().GreaterThanOrEqualTo(1u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_TRUE], Is().GreaterThanOrEqualTo(4u)); - AssertThat(out->max_1level_cut[cut_type::ALL], Is().GreaterThanOrEqualTo(4u)); + AssertThat(out->max_1level_cut[cut::Internal], Is().GreaterThanOrEqualTo(1u)); + AssertThat(out->max_1level_cut[cut::Internal_False], Is().GreaterThanOrEqualTo(1u)); + AssertThat(out->max_1level_cut[cut::Internal_True], Is().GreaterThanOrEqualTo(4u)); + AssertThat(out->max_1level_cut[cut::All], Is().GreaterThanOrEqualTo(4u)); AssertThat(out->number_of_terminals[false], Is().EqualTo(0u)); AssertThat(out->number_of_terminals[true], Is().EqualTo(4u)); @@ -2307,7 +2307,7 @@ go_bandit([]() { // / \ // T T */ - zdd::label_t var = 4; + zdd::label_type var = 4; zdd out = zdd_project(zdd_2, [&var]() { return 2 <= var && var <= 4 ? var-- : -1; }); @@ -2315,19 +2315,19 @@ go_bandit([]() { node_test_stream out_nodes(out); AssertThat(out_nodes.can_pull(), Is().True()); - AssertThat(out_nodes.pull(), Is().EqualTo(node(4, node::MAX_ID, + AssertThat(out_nodes.pull(), Is().EqualTo(node(4, node::max_id, terminal_T, terminal_T))); AssertThat(out_nodes.can_pull(), Is().True()); - AssertThat(out_nodes.pull(), Is().EqualTo(node(3, node::MAX_ID, + AssertThat(out_nodes.pull(), Is().EqualTo(node(3, node::max_id, terminal_T, terminal_T))); AssertThat(out_nodes.can_pull(), Is().True()); - AssertThat(out_nodes.pull(), Is().EqualTo(node(2, node::MAX_ID, - ptr_uint64(3, ptr_uint64::MAX_ID), - ptr_uint64(4, ptr_uint64::MAX_ID)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(2, node::max_id, + ptr_uint64(3, ptr_uint64::max_id), + ptr_uint64(4, ptr_uint64::max_id)))); AssertThat(out_nodes.can_pull(), Is().False()); @@ -2345,10 +2345,10 @@ go_bandit([]() { AssertThat(ms.can_pull(), Is().False()); - AssertThat(out->max_1level_cut[cut_type::INTERNAL], Is().GreaterThanOrEqualTo(1u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_FALSE], Is().GreaterThanOrEqualTo(1u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_TRUE], Is().GreaterThanOrEqualTo(0u)); - AssertThat(out->max_1level_cut[cut_type::ALL], Is().GreaterThanOrEqualTo(1u)); + AssertThat(out->max_1level_cut[cut::Internal], Is().GreaterThanOrEqualTo(1u)); + AssertThat(out->max_1level_cut[cut::Internal_False], Is().GreaterThanOrEqualTo(1u)); + AssertThat(out->max_1level_cut[cut::Internal_True], Is().GreaterThanOrEqualTo(0u)); + AssertThat(out->max_1level_cut[cut::All], Is().GreaterThanOrEqualTo(1u)); AssertThat(out->number_of_terminals[false], Is().EqualTo(0u)); AssertThat(out->number_of_terminals[true], Is().EqualTo(4u)); @@ -2365,9 +2365,9 @@ go_bandit([]() { // / \ // T T */ - zdd::label_t var = 4; + zdd::label_type var = 4; zdd out = zdd_project(zdd_3, [&var]() { - const zdd::label_t ret = var; + const zdd::label_type ret = var; var -= 2; return ret; }); @@ -2375,14 +2375,14 @@ go_bandit([]() { node_test_stream out_nodes(out); AssertThat(out_nodes.can_pull(), Is().True()); - AssertThat(out_nodes.pull(), Is().EqualTo(node(2, node::MAX_ID, + AssertThat(out_nodes.pull(), Is().EqualTo(node(2, node::max_id, terminal_T, terminal_T))); AssertThat(out_nodes.can_pull(), Is().True()); - AssertThat(out_nodes.pull(), Is().EqualTo(node(0, node::MAX_ID, - ptr_uint64(2, ptr_uint64::MAX_ID), - ptr_uint64(2, ptr_uint64::MAX_ID)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(0, node::max_id, + ptr_uint64(2, ptr_uint64::max_id), + ptr_uint64(2, ptr_uint64::max_id)))); AssertThat(out_nodes.can_pull(), Is().False()); @@ -2396,10 +2396,10 @@ go_bandit([]() { AssertThat(ms.can_pull(), Is().False()); - AssertThat(out->max_1level_cut[cut_type::INTERNAL], Is().GreaterThanOrEqualTo(2u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_FALSE], Is().GreaterThanOrEqualTo(2u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_TRUE], Is().GreaterThanOrEqualTo(2u)); - AssertThat(out->max_1level_cut[cut_type::ALL], Is().GreaterThanOrEqualTo(2u)); + AssertThat(out->max_1level_cut[cut::Internal], Is().GreaterThanOrEqualTo(2u)); + AssertThat(out->max_1level_cut[cut::Internal_False], Is().GreaterThanOrEqualTo(2u)); + AssertThat(out->max_1level_cut[cut::Internal_True], Is().GreaterThanOrEqualTo(2u)); + AssertThat(out->max_1level_cut[cut::All], Is().GreaterThanOrEqualTo(2u)); AssertThat(out->number_of_terminals[false], Is().EqualTo(0u)); AssertThat(out->number_of_terminals[true], Is().EqualTo(2u)); @@ -2416,9 +2416,9 @@ go_bandit([]() { // / \ / \ // F T T T */ - zdd::label_t var = 4; + zdd::label_type var = 4; zdd out = zdd_project(zdd_4, [&var]() { - const zdd::label_t ret = var; + const zdd::label_type ret = var; var -= 4; return ret; }); @@ -2426,19 +2426,19 @@ go_bandit([]() { node_test_stream out_nodes(out); AssertThat(out_nodes.can_pull(), Is().True()); - AssertThat(out_nodes.pull(), Is().EqualTo(node(4, node::MAX_ID, + AssertThat(out_nodes.pull(), Is().EqualTo(node(4, node::max_id, terminal_T, terminal_T))); AssertThat(out_nodes.can_pull(), Is().True()); - AssertThat(out_nodes.pull(), Is().EqualTo(node(4, node::MAX_ID-1, + AssertThat(out_nodes.pull(), Is().EqualTo(node(4, node::max_id-1, terminal_F, terminal_T))); AssertThat(out_nodes.can_pull(), Is().True()); - AssertThat(out_nodes.pull(), Is().EqualTo(node(0, node::MAX_ID, - ptr_uint64(4, ptr_uint64::MAX_ID-1), - ptr_uint64(4, ptr_uint64::MAX_ID)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(0, node::max_id, + ptr_uint64(4, ptr_uint64::max_id-1), + ptr_uint64(4, ptr_uint64::max_id)))); AssertThat(out_nodes.can_pull(), Is().False()); @@ -2452,10 +2452,10 @@ go_bandit([]() { AssertThat(ms.can_pull(), Is().False()); - AssertThat(out->max_1level_cut[cut_type::INTERNAL], Is().GreaterThanOrEqualTo(2u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_FALSE], Is().GreaterThanOrEqualTo(2u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_TRUE], Is().GreaterThanOrEqualTo(3u)); - AssertThat(out->max_1level_cut[cut_type::ALL], Is().GreaterThanOrEqualTo(3u)); + AssertThat(out->max_1level_cut[cut::Internal], Is().GreaterThanOrEqualTo(2u)); + AssertThat(out->max_1level_cut[cut::Internal_False], Is().GreaterThanOrEqualTo(2u)); + AssertThat(out->max_1level_cut[cut::Internal_True], Is().GreaterThanOrEqualTo(3u)); + AssertThat(out->max_1level_cut[cut::All], Is().GreaterThanOrEqualTo(3u)); AssertThat(out->number_of_terminals[false], Is().EqualTo(1u)); AssertThat(out->number_of_terminals[true], Is().EqualTo(3u)); @@ -2470,9 +2470,9 @@ go_bandit([]() { // / \|| // F T */ - zdd::label_t var = 4; + zdd::label_type var = 4; zdd out = zdd_project(zdd_4, [&var]() { - const zdd::label_t res = var; + const zdd::label_type res = var; if (var == 4) { var -= 2; } else { var = -1; } return res; @@ -2481,19 +2481,19 @@ go_bandit([]() { node_test_stream out_nodes(out); AssertThat(out_nodes.can_pull(), Is().True()); - AssertThat(out_nodes.pull(), Is().EqualTo(node(4, node::MAX_ID, + AssertThat(out_nodes.pull(), Is().EqualTo(node(4, node::max_id, terminal_T, terminal_T))); AssertThat(out_nodes.can_pull(), Is().True()); - AssertThat(out_nodes.pull(), Is().EqualTo(node(4, node::MAX_ID-1, + AssertThat(out_nodes.pull(), Is().EqualTo(node(4, node::max_id-1, terminal_F, terminal_T))); AssertThat(out_nodes.can_pull(), Is().True()); - AssertThat(out_nodes.pull(), Is().EqualTo(node(2, node::MAX_ID, - ptr_uint64(4, ptr_uint64::MAX_ID-1), - ptr_uint64(4, ptr_uint64::MAX_ID)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(2, node::max_id, + ptr_uint64(4, ptr_uint64::max_id-1), + ptr_uint64(4, ptr_uint64::max_id)))); AssertThat(out_nodes.can_pull(), Is().False()); @@ -2507,10 +2507,10 @@ go_bandit([]() { AssertThat(ms.can_pull(), Is().False()); - AssertThat(out->max_1level_cut[cut_type::INTERNAL], Is().GreaterThanOrEqualTo(2u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_FALSE], Is().GreaterThanOrEqualTo(2u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_TRUE], Is().GreaterThanOrEqualTo(2u)); - AssertThat(out->max_1level_cut[cut_type::ALL], Is().GreaterThanOrEqualTo(3u)); + AssertThat(out->max_1level_cut[cut::Internal], Is().GreaterThanOrEqualTo(2u)); + AssertThat(out->max_1level_cut[cut::Internal_False], Is().GreaterThanOrEqualTo(2u)); + AssertThat(out->max_1level_cut[cut::Internal_True], Is().GreaterThanOrEqualTo(2u)); + AssertThat(out->max_1level_cut[cut::All], Is().GreaterThanOrEqualTo(3u)); AssertThat(out->number_of_terminals[false], Is().EqualTo(1u)); AssertThat(out->number_of_terminals[true], Is().EqualTo(3u)); @@ -2529,9 +2529,9 @@ go_bandit([]() { // / \ // T T */ - zdd::label_t var = 8; + zdd::label_type var = 8; zdd out = zdd_project(in, [&var]() { - const zdd::label_t res = var; + const zdd::label_type res = var; var -= 2; return res; }); @@ -2539,18 +2539,18 @@ go_bandit([]() { node_test_stream out_nodes(out); AssertThat(out_nodes.can_pull(), Is().True()); - AssertThat(out_nodes.pull(), Is().EqualTo(node(4, node::MAX_ID, + AssertThat(out_nodes.pull(), Is().EqualTo(node(4, node::max_id, terminal_T, terminal_T))); AssertThat(out_nodes.can_pull(), Is().True()); - AssertThat(out_nodes.pull(), Is().EqualTo(node(2, node::MAX_ID, - ptr_uint64(4, ptr_uint64::MAX_ID), + AssertThat(out_nodes.pull(), Is().EqualTo(node(2, node::max_id, + ptr_uint64(4, ptr_uint64::max_id), terminal_T))); AssertThat(out_nodes.can_pull(), Is().True()); - AssertThat(out_nodes.pull(), Is().EqualTo(node(0, node::MAX_ID, - ptr_uint64(2, ptr_uint64::MAX_ID), + AssertThat(out_nodes.pull(), Is().EqualTo(node(0, node::max_id, + ptr_uint64(2, ptr_uint64::max_id), terminal_T))); AssertThat(out_nodes.can_pull(), Is().False()); @@ -2568,16 +2568,16 @@ go_bandit([]() { AssertThat(ms.can_pull(), Is().False()); - AssertThat(out->max_1level_cut[cut_type::INTERNAL], Is().GreaterThanOrEqualTo(1u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_FALSE], Is().GreaterThanOrEqualTo(1u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_TRUE], Is().GreaterThanOrEqualTo(4u)); - AssertThat(out->max_1level_cut[cut_type::ALL], Is().GreaterThanOrEqualTo(4u)); + AssertThat(out->max_1level_cut[cut::Internal], Is().GreaterThanOrEqualTo(1u)); + AssertThat(out->max_1level_cut[cut::Internal_False], Is().GreaterThanOrEqualTo(1u)); + AssertThat(out->max_1level_cut[cut::Internal_True], Is().GreaterThanOrEqualTo(4u)); + AssertThat(out->max_1level_cut[cut::All], Is().GreaterThanOrEqualTo(4u)); AssertThat(out->number_of_terminals[false], Is().EqualTo(0u)); AssertThat(out->number_of_terminals[true], Is().EqualTo(4u)); }); - quantify_mode = quantify_mode_t::AUTO; + quantify_mode = quantify_mode_t::Auto; }); }); @@ -2585,8 +2585,8 @@ go_bandit([]() { // Since this is merely a wrapper on the generator function, we will just // double-check with a few tests. - describe("quantify_mode == SINGLETON / PARTIAL", [&]() { - quantify_mode = quantify_mode_t::SINGLETON; + describe("quantify_mode == Singleton / Partial", [&]() { + quantify_mode = quantify_mode_t::Singleton; it("computes zdd_2 with dom = {4,3,2} [&&]", [&](){ const std::vector dom = {4,3,2}; @@ -2606,19 +2606,19 @@ go_bandit([]() { node_test_stream out_nodes(out); AssertThat(out_nodes.can_pull(), Is().True()); - AssertThat(out_nodes.pull(), Is().EqualTo(node(4, node::MAX_ID, + AssertThat(out_nodes.pull(), Is().EqualTo(node(4, node::max_id, terminal_T, terminal_T))); AssertThat(out_nodes.can_pull(), Is().True()); - AssertThat(out_nodes.pull(), Is().EqualTo(node(3, node::MAX_ID, + AssertThat(out_nodes.pull(), Is().EqualTo(node(3, node::max_id, terminal_T, terminal_T))); AssertThat(out_nodes.can_pull(), Is().True()); - AssertThat(out_nodes.pull(), Is().EqualTo(node(2, node::MAX_ID, - ptr_uint64(3, ptr_uint64::MAX_ID), - ptr_uint64(4, ptr_uint64::MAX_ID)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(2, node::max_id, + ptr_uint64(3, ptr_uint64::max_id), + ptr_uint64(4, ptr_uint64::max_id)))); AssertThat(out_nodes.can_pull(), Is().False()); @@ -2636,20 +2636,20 @@ go_bandit([]() { AssertThat(ms.can_pull(), Is().False()); - AssertThat(out->max_1level_cut[cut_type::INTERNAL], Is().GreaterThanOrEqualTo(1u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_FALSE], Is().GreaterThanOrEqualTo(1u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_TRUE], Is().GreaterThanOrEqualTo(0u)); - AssertThat(out->max_1level_cut[cut_type::ALL], Is().GreaterThanOrEqualTo(1u)); + AssertThat(out->max_1level_cut[cut::Internal], Is().GreaterThanOrEqualTo(1u)); + AssertThat(out->max_1level_cut[cut::Internal_False], Is().GreaterThanOrEqualTo(1u)); + AssertThat(out->max_1level_cut[cut::Internal_True], Is().GreaterThanOrEqualTo(0u)); + AssertThat(out->max_1level_cut[cut::All], Is().GreaterThanOrEqualTo(1u)); AssertThat(out->number_of_terminals[false], Is().EqualTo(0u)); AssertThat(out->number_of_terminals[true], Is().EqualTo(4u)); }); - quantify_mode = quantify_mode_t::AUTO; + quantify_mode = quantify_mode_t::Auto; }); - describe("quantify_mode == NESTED / AUTO", [&]() { - quantify_mode = quantify_mode_t::NESTED; + describe("quantify_mode == Nested / Auto", [&]() { + quantify_mode = quantify_mode_t::Nested; it("computes zdd_3 with dom = {4,2,0} [&&]", [&](){ const std::vector dom = {4,2,0}; @@ -2669,14 +2669,14 @@ go_bandit([]() { node_test_stream out_nodes(out); AssertThat(out_nodes.can_pull(), Is().True()); - AssertThat(out_nodes.pull(), Is().EqualTo(node(2, node::MAX_ID, + AssertThat(out_nodes.pull(), Is().EqualTo(node(2, node::max_id, terminal_T, terminal_T))); AssertThat(out_nodes.can_pull(), Is().True()); - AssertThat(out_nodes.pull(), Is().EqualTo(node(0, node::MAX_ID, - ptr_uint64(2, ptr_uint64::MAX_ID), - ptr_uint64(2, ptr_uint64::MAX_ID)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(0, node::max_id, + ptr_uint64(2, ptr_uint64::max_id), + ptr_uint64(2, ptr_uint64::max_id)))); AssertThat(out_nodes.can_pull(), Is().False()); @@ -2690,10 +2690,10 @@ go_bandit([]() { AssertThat(ms.can_pull(), Is().False()); - AssertThat(out->max_1level_cut[cut_type::INTERNAL], Is().GreaterThanOrEqualTo(2u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_FALSE], Is().GreaterThanOrEqualTo(2u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_TRUE], Is().GreaterThanOrEqualTo(2u)); - AssertThat(out->max_1level_cut[cut_type::ALL], Is().GreaterThanOrEqualTo(2u)); + AssertThat(out->max_1level_cut[cut::Internal], Is().GreaterThanOrEqualTo(2u)); + AssertThat(out->max_1level_cut[cut::Internal_False], Is().GreaterThanOrEqualTo(2u)); + AssertThat(out->max_1level_cut[cut::Internal_True], Is().GreaterThanOrEqualTo(2u)); + AssertThat(out->max_1level_cut[cut::All], Is().GreaterThanOrEqualTo(2u)); AssertThat(out->number_of_terminals[false], Is().EqualTo(0u)); AssertThat(out->number_of_terminals[true], Is().EqualTo(2u)); @@ -2718,19 +2718,19 @@ go_bandit([]() { node_test_stream out_nodes(out); AssertThat(out_nodes.can_pull(), Is().True()); - AssertThat(out_nodes.pull(), Is().EqualTo(node(4, node::MAX_ID, + AssertThat(out_nodes.pull(), Is().EqualTo(node(4, node::max_id, terminal_T, terminal_T))); AssertThat(out_nodes.can_pull(), Is().True()); - AssertThat(out_nodes.pull(), Is().EqualTo(node(4, node::MAX_ID-1, + AssertThat(out_nodes.pull(), Is().EqualTo(node(4, node::max_id-1, terminal_F, terminal_T))); AssertThat(out_nodes.can_pull(), Is().True()); - AssertThat(out_nodes.pull(), Is().EqualTo(node(0, node::MAX_ID, - ptr_uint64(4, ptr_uint64::MAX_ID-1), - ptr_uint64(4, ptr_uint64::MAX_ID)))); + AssertThat(out_nodes.pull(), Is().EqualTo(node(0, node::max_id, + ptr_uint64(4, ptr_uint64::max_id-1), + ptr_uint64(4, ptr_uint64::max_id)))); AssertThat(out_nodes.can_pull(), Is().False()); @@ -2744,16 +2744,16 @@ go_bandit([]() { AssertThat(ms.can_pull(), Is().False()); - AssertThat(out->max_1level_cut[cut_type::INTERNAL], Is().GreaterThanOrEqualTo(2u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_FALSE], Is().GreaterThanOrEqualTo(2u)); - AssertThat(out->max_1level_cut[cut_type::INTERNAL_TRUE], Is().GreaterThanOrEqualTo(3u)); - AssertThat(out->max_1level_cut[cut_type::ALL], Is().GreaterThanOrEqualTo(3u)); + AssertThat(out->max_1level_cut[cut::Internal], Is().GreaterThanOrEqualTo(2u)); + AssertThat(out->max_1level_cut[cut::Internal_False], Is().GreaterThanOrEqualTo(2u)); + AssertThat(out->max_1level_cut[cut::Internal_True], Is().GreaterThanOrEqualTo(3u)); + AssertThat(out->max_1level_cut[cut::All], Is().GreaterThanOrEqualTo(3u)); AssertThat(out->number_of_terminals[false], Is().EqualTo(1u)); AssertThat(out->number_of_terminals[true], Is().EqualTo(3u)); }); - quantify_mode = quantify_mode_t::AUTO; + quantify_mode = quantify_mode_t::Auto; }); }); }); diff --git a/test/adiar/zdd/test_subset.cpp b/test/adiar/zdd/test_subset.cpp index 1b803f132..3f584289e 100644 --- a/test/adiar/zdd/test_subset.cpp +++ b/test/adiar/zdd/test_subset.cpp @@ -2,8 +2,8 @@ go_bandit([]() { describe("adiar/zdd/subset.cpp", [&]() { - shared_levelized_file zdd_F; - shared_levelized_file zdd_T; + shared_levelized_file zdd_F; + shared_levelized_file zdd_T; { // Garbage collect writers to free write-lock node_writer nw_F(zdd_F); @@ -30,14 +30,14 @@ go_bandit([]() { / \ T T */ - shared_levelized_file zdd_1; + shared_levelized_file zdd_1; - node n1_6 = node(4, node::MAX_ID, terminal_T, terminal_T); - node n1_5 = node(3, node::MAX_ID, n1_6.uid(), terminal_T); - node n1_4 = node(3, node::MAX_ID-1, terminal_F, n1_6.uid()); - node n1_3 = node(2, node::MAX_ID, n1_4.uid(), n1_5.uid()); - node n1_2 = node(1, node::MAX_ID, n1_4.uid(), n1_3.uid()); - node n1_1 = node(0, node::MAX_ID, n1_2.uid(), n1_2.uid()); + node n1_6 = node(4, node::max_id, terminal_T, terminal_T); + node n1_5 = node(3, node::max_id, n1_6.uid(), terminal_T); + node n1_4 = node(3, node::max_id-1, terminal_F, n1_6.uid()); + node n1_3 = node(2, node::max_id, n1_4.uid(), n1_5.uid()); + node n1_2 = node(1, node::max_id, n1_4.uid(), n1_3.uid()); + node n1_1 = node(0, node::max_id, n1_2.uid(), n1_2.uid()); { // Garbage collect writer to free write-lock node_writer w(zdd_1); @@ -56,12 +56,12 @@ go_bandit([]() { / \ F T */ - shared_levelized_file zdd_2; + shared_levelized_file zdd_2; - const node n2_4 = node(3, node::MAX_ID, terminal_F, terminal_T); - const node n2_3 = node(2, node::MAX_ID, terminal_T, n2_4.uid()); - const node n2_2 = node(1, node::MAX_ID, terminal_T, n2_3.uid()); - const node n2_1 = node(0, node::MAX_ID, n2_2.uid(), n2_3.uid()); + const node n2_4 = node(3, node::max_id, terminal_F, terminal_T); + const node n2_3 = node(2, node::max_id, terminal_T, n2_4.uid()); + const node n2_2 = node(1, node::max_id, terminal_T, n2_3.uid()); + const node n2_1 = node(0, node::max_id, n2_2.uid(), n2_3.uid()); { // Garbage collect writer to free write-lock node_writer w(zdd_2); @@ -77,45 +77,45 @@ go_bandit([]() { std::vector labels = { 21, 42 }; __zdd out = zdd_offset(zdd_F, labels.begin(), labels.end()); - AssertThat(out.get>(), Is().EqualTo(zdd_F)); + AssertThat(out.get>(), Is().EqualTo(zdd_F)); }); it("should return input unchanged when given { Ø }", [&]() { std::vector labels = { 7, 42 }; __zdd out = zdd_offset(zdd_T, labels.begin(), labels.end()); - AssertThat(out.get>(), Is().EqualTo(zdd_T)); + AssertThat(out.get>(), Is().EqualTo(zdd_T)); }); it("should return input unchanged when given empty set of labels", [&]() { std::vector labels = { }; __zdd out = zdd_offset(zdd_1, labels.begin(), labels.end()); - AssertThat(out.get>(), Is().EqualTo(zdd_1)); + AssertThat(out.get>(), Is().EqualTo(zdd_1)); }); it("should return input unchanged when given { { 2 }, { 1,2 } } without (0,3,4,5,6)", [&]() { std::vector labels = { 0, 3, 4, 5, 6 }; - shared_levelized_file in; + shared_levelized_file in; { node_writer nw(in); - nw << node(2, node::MAX_ID, terminal_F, terminal_T) - << node(1, node::MAX_ID, terminal_T, ptr_uint64(2, ptr_uint64::MAX_ID)); + nw << node(2, node::max_id, terminal_F, terminal_T) + << node(1, node::max_id, terminal_T, ptr_uint64(2, ptr_uint64::max_id)); } __zdd out = zdd_offset(in, labels.begin(), labels.end()); - AssertThat(out.get>(), Is().EqualTo(in)); + AssertThat(out.get>(), Is().EqualTo(in)); }); it("should return { Ø } when given { Ø, { 1,2 } } without (0,2)", [&]() { std::vector labels = { 0, 2 }; - shared_levelized_file in; + shared_levelized_file in; - node n2 = node(2, node::MAX_ID, terminal_F, terminal_T); - node n1 = node(1, node::MAX_ID, terminal_T, n2.uid());; + node n2 = node(2, node::max_id, terminal_F, terminal_T); + node n1 = node(1, node::max_id, terminal_T, n2.uid());; { node_writer nw(in); @@ -142,19 +142,19 @@ go_bandit([]() { AssertThat(meta_arcs.can_pull(), Is().False()); - AssertThat(out.get<__zdd::shared_arcs_t>()->max_1level_cut, Is().GreaterThanOrEqualTo(0u)); + AssertThat(out.get<__zdd::shared_arc_file_type>()->max_1level_cut, Is().GreaterThanOrEqualTo(0u)); - AssertThat(out.get<__zdd::shared_arcs_t>()->number_of_terminals[false], Is().EqualTo(1u)); - AssertThat(out.get<__zdd::shared_arcs_t>()->number_of_terminals[true], Is().EqualTo(1u)); + AssertThat(out.get<__zdd::shared_arc_file_type>()->number_of_terminals[false], Is().EqualTo(1u)); + AssertThat(out.get<__zdd::shared_arc_file_type>()->number_of_terminals[true], Is().EqualTo(1u)); }); it("should return { Ø, { 1 } } when given { Ø, { 1 }, { 2 }, { 1, 2 } } without (0,2)", [&]() { std::vector labels = { 0, 2 }; - shared_levelized_file in; + shared_levelized_file in; - node n2 = node(2, node::MAX_ID-1, terminal_T, terminal_T); - node n1 = node(1, node::MAX_ID, n2.uid(), n2.uid());; + node n2 = node(2, node::max_id-1, terminal_T, terminal_T); + node n1 = node(1, node::max_id, n2.uid(), n2.uid());; { node_writer nw(in); @@ -181,19 +181,19 @@ go_bandit([]() { AssertThat(meta_arcs.can_pull(), Is().False()); - AssertThat(out.get<__zdd::shared_arcs_t>()->max_1level_cut, Is().GreaterThanOrEqualTo(0u)); + AssertThat(out.get<__zdd::shared_arc_file_type>()->max_1level_cut, Is().GreaterThanOrEqualTo(0u)); - AssertThat(out.get<__zdd::shared_arcs_t>()->number_of_terminals[false], Is().EqualTo(0u)); - AssertThat(out.get<__zdd::shared_arcs_t>()->number_of_terminals[true], Is().EqualTo(2u)); + AssertThat(out.get<__zdd::shared_arc_file_type>()->number_of_terminals[false], Is().EqualTo(0u)); + AssertThat(out.get<__zdd::shared_arc_file_type>()->number_of_terminals[true], Is().EqualTo(2u)); }); it("should return { Ø, { 2 } } when given { Ø, { 1 }, { 2 }, { 1, 2 } } without (1,3)", [&]() { std::vector labels = { 1, 3}; - shared_levelized_file in; + shared_levelized_file in; - node n2 = node(2, node::MAX_ID, terminal_T, terminal_T); - node n1 = node(1, node::MAX_ID, n2.uid(), n2.uid());; + node n2 = node(2, node::max_id, terminal_T, terminal_T); + node n1 = node(1, node::max_id, n2.uid(), n2.uid());; { node_writer nw(in); @@ -220,10 +220,10 @@ go_bandit([]() { AssertThat(meta_arcs.can_pull(), Is().False()); - AssertThat(out.get<__zdd::shared_arcs_t>()->max_1level_cut, Is().GreaterThanOrEqualTo(0u)); + AssertThat(out.get<__zdd::shared_arc_file_type>()->max_1level_cut, Is().GreaterThanOrEqualTo(0u)); - AssertThat(out.get<__zdd::shared_arcs_t>()->number_of_terminals[false], Is().EqualTo(0u)); - AssertThat(out.get<__zdd::shared_arcs_t>()->number_of_terminals[true], Is().EqualTo(2u)); + AssertThat(out.get<__zdd::shared_arc_file_type>()->number_of_terminals[false], Is().EqualTo(0u)); + AssertThat(out.get<__zdd::shared_arc_file_type>()->number_of_terminals[true], Is().EqualTo(2u)); }); it("should skip root of [1] without (0,42)", [&]() { @@ -284,10 +284,10 @@ go_bandit([]() { AssertThat(meta_arcs.can_pull(), Is().False()); - AssertThat(out.get<__zdd::shared_arcs_t>()->max_1level_cut, Is().GreaterThanOrEqualTo(3u)); + AssertThat(out.get<__zdd::shared_arc_file_type>()->max_1level_cut, Is().GreaterThanOrEqualTo(3u)); - AssertThat(out.get<__zdd::shared_arcs_t>()->number_of_terminals[false], Is().EqualTo(1u)); - AssertThat(out.get<__zdd::shared_arcs_t>()->number_of_terminals[true], Is().EqualTo(3u)); + AssertThat(out.get<__zdd::shared_arc_file_type>()->number_of_terminals[false], Is().EqualTo(1u)); + AssertThat(out.get<__zdd::shared_arc_file_type>()->number_of_terminals[true], Is().EqualTo(3u)); }); it("should skip 'dead' nodes in [1] without (1)", [&]() { @@ -333,10 +333,10 @@ go_bandit([]() { AssertThat(meta_arcs.can_pull(), Is().False()); - AssertThat(out.get<__zdd::shared_arcs_t>()->max_1level_cut, Is().GreaterThanOrEqualTo(2u)); + AssertThat(out.get<__zdd::shared_arc_file_type>()->max_1level_cut, Is().GreaterThanOrEqualTo(2u)); - AssertThat(out.get<__zdd::shared_arcs_t>()->number_of_terminals[false], Is().EqualTo(1u)); - AssertThat(out.get<__zdd::shared_arcs_t>()->number_of_terminals[true], Is().EqualTo(2u)); + AssertThat(out.get<__zdd::shared_arc_file_type>()->number_of_terminals[false], Is().EqualTo(1u)); + AssertThat(out.get<__zdd::shared_arc_file_type>()->number_of_terminals[true], Is().EqualTo(2u)); }); it("should restrict to a terminal in [1] without (0,1,3)", [&]() { @@ -353,13 +353,13 @@ go_bandit([]() { level_info_test_stream meta_arcs(out); AssertThat(meta_arcs.can_pull(), Is().False()); - AssertThat(out.get>()->max_1level_cut[cut_type::INTERNAL], Is().EqualTo(0u)); - AssertThat(out.get>()->max_1level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(1u)); - AssertThat(out.get>()->max_1level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(0u)); - AssertThat(out.get>()->max_1level_cut[cut_type::ALL], Is().EqualTo(1u)); + AssertThat(out.get>()->max_1level_cut[cut::Internal], Is().EqualTo(0u)); + AssertThat(out.get>()->max_1level_cut[cut::Internal_False], Is().EqualTo(1u)); + AssertThat(out.get>()->max_1level_cut[cut::Internal_True], Is().EqualTo(0u)); + AssertThat(out.get>()->max_1level_cut[cut::All], Is().EqualTo(1u)); - AssertThat(out.get>()->number_of_terminals[false], Is().EqualTo(1u)); - AssertThat(out.get>()->number_of_terminals[true], Is().EqualTo(0u)); + AssertThat(out.get>()->number_of_terminals[false], Is().EqualTo(1u)); + AssertThat(out.get>()->number_of_terminals[true], Is().EqualTo(0u)); }); it("should restrict to a terminal in { Ø, { 1 }, { 2, 3 } } without (1,2)", [&]() { @@ -372,13 +372,13 @@ go_bandit([]() { / \ F T */ - shared_levelized_file in; + shared_levelized_file in; { node_writer w(in); - w << node(3, node::MAX_ID, terminal_F, terminal_T) - << node(2, node::MAX_ID, terminal_T, ptr_uint64(3, ptr_uint64::MAX_ID)) - << node(1, node::MAX_ID, ptr_uint64(2, ptr_uint64::MAX_ID), terminal_T); + w << node(3, node::max_id, terminal_F, terminal_T) + << node(2, node::max_id, terminal_T, ptr_uint64(3, ptr_uint64::max_id)) + << node(1, node::max_id, ptr_uint64(2, ptr_uint64::max_id), terminal_T); } std::vector labels = { 1,2 }; @@ -394,13 +394,13 @@ go_bandit([]() { level_info_test_stream meta_arcs(out); AssertThat(meta_arcs.can_pull(), Is().False()); - AssertThat(out.get>()->max_1level_cut[cut_type::INTERNAL], Is().EqualTo(0u)); - AssertThat(out.get>()->max_1level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(0u)); - AssertThat(out.get>()->max_1level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(1u)); - AssertThat(out.get>()->max_1level_cut[cut_type::ALL], Is().EqualTo(1u)); + AssertThat(out.get>()->max_1level_cut[cut::Internal], Is().EqualTo(0u)); + AssertThat(out.get>()->max_1level_cut[cut::Internal_False], Is().EqualTo(0u)); + AssertThat(out.get>()->max_1level_cut[cut::Internal_True], Is().EqualTo(1u)); + AssertThat(out.get>()->max_1level_cut[cut::All], Is().EqualTo(1u)); - AssertThat(out.get>()->number_of_terminals[false], Is().EqualTo(0u)); - AssertThat(out.get>()->number_of_terminals[true], Is().EqualTo(1u)); + AssertThat(out.get>()->number_of_terminals[false], Is().EqualTo(0u)); + AssertThat(out.get>()->number_of_terminals[true], Is().EqualTo(1u)); }); it("should restrict to a terminal from root", [&]() { @@ -411,12 +411,12 @@ go_bandit([]() { / \ T T */ - shared_levelized_file in; + shared_levelized_file in; { node_writer w(in); - w << node(2, node::MAX_ID, terminal_T, terminal_T) - << node(1, node::MAX_ID, terminal_T, ptr_uint64(2, ptr_uint64::MAX_ID)); + w << node(2, node::max_id, terminal_T, terminal_T) + << node(1, node::max_id, terminal_T, ptr_uint64(2, ptr_uint64::max_id)); } std::vector labels = { 1 }; @@ -432,13 +432,13 @@ go_bandit([]() { level_info_test_stream meta_arcs(out); AssertThat(meta_arcs.can_pull(), Is().False()); - AssertThat(out.get>()->max_1level_cut[cut_type::INTERNAL], Is().EqualTo(0u)); - AssertThat(out.get>()->max_1level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(0u)); - AssertThat(out.get>()->max_1level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(1u)); - AssertThat(out.get>()->max_1level_cut[cut_type::ALL], Is().EqualTo(1u)); + AssertThat(out.get>()->max_1level_cut[cut::Internal], Is().EqualTo(0u)); + AssertThat(out.get>()->max_1level_cut[cut::Internal_False], Is().EqualTo(0u)); + AssertThat(out.get>()->max_1level_cut[cut::Internal_True], Is().EqualTo(1u)); + AssertThat(out.get>()->max_1level_cut[cut::All], Is().EqualTo(1u)); - AssertThat(out.get>()->number_of_terminals[false], Is().EqualTo(0u)); - AssertThat(out.get>()->number_of_terminals[true], Is().EqualTo(1u)); + AssertThat(out.get>()->number_of_terminals[false], Is().EqualTo(0u)); + AssertThat(out.get>()->number_of_terminals[true], Is().EqualTo(1u)); }); it("should bridge levels in [2] on (3)", [&]() { @@ -484,10 +484,10 @@ go_bandit([]() { AssertThat(meta_arcs.can_pull(), Is().False()); - AssertThat(out.get<__zdd::shared_arcs_t>()->max_1level_cut, Is().GreaterThanOrEqualTo(2u)); + AssertThat(out.get<__zdd::shared_arc_file_type>()->max_1level_cut, Is().GreaterThanOrEqualTo(2u)); - AssertThat(out.get<__zdd::shared_arcs_t>()->number_of_terminals[false], Is().EqualTo(1u)); - AssertThat(out.get<__zdd::shared_arcs_t>()->number_of_terminals[true], Is().EqualTo(2u)); + AssertThat(out.get<__zdd::shared_arc_file_type>()->number_of_terminals[false], Is().EqualTo(1u)); + AssertThat(out.get<__zdd::shared_arc_file_type>()->number_of_terminals[true], Is().EqualTo(2u)); }); }); @@ -499,21 +499,21 @@ go_bandit([]() { std::vector labels = { 21, 42 }; __zdd out = zdd_onset(zdd_F, labels.begin(), labels.end()); - AssertThat(out.get>(), Is().EqualTo(zdd_F)); + AssertThat(out.get>(), Is().EqualTo(zdd_F)); }); it("should return input unchanged when given { Ø } for ()", [&]() { std::vector labels = { }; __zdd out = zdd_onset(zdd_T, labels.begin(), labels.end()); - AssertThat(out.get>(), Is().EqualTo(zdd_T)); + AssertThat(out.get>(), Is().EqualTo(zdd_T)); }); it("should return input unchanged when given [1] for ()", [&]() { std::vector labels = { }; __zdd out = zdd_onset(zdd_1, labels.begin(), labels.end()); - AssertThat(out.get>(), Is().EqualTo(zdd_1)); + AssertThat(out.get>(), Is().EqualTo(zdd_1)); }); it("should return Ø when given { Ø } for (0)", [&]() { @@ -530,13 +530,13 @@ go_bandit([]() { level_info_test_stream meta_arcs(out); AssertThat(meta_arcs.can_pull(), Is().False()); - AssertThat(out.get>()->max_1level_cut[cut_type::INTERNAL], Is().EqualTo(0u)); - AssertThat(out.get>()->max_1level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(1u)); - AssertThat(out.get>()->max_1level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(0u)); - AssertThat(out.get>()->max_1level_cut[cut_type::ALL], Is().EqualTo(1u)); + AssertThat(out.get>()->max_1level_cut[cut::Internal], Is().EqualTo(0u)); + AssertThat(out.get>()->max_1level_cut[cut::Internal_False], Is().EqualTo(1u)); + AssertThat(out.get>()->max_1level_cut[cut::Internal_True], Is().EqualTo(0u)); + AssertThat(out.get>()->max_1level_cut[cut::All], Is().EqualTo(1u)); - AssertThat(out.get>()->number_of_terminals[false], Is().EqualTo(1u)); - AssertThat(out.get>()->number_of_terminals[true], Is().EqualTo(0u)); + AssertThat(out.get>()->number_of_terminals[false], Is().EqualTo(1u)); + AssertThat(out.get>()->number_of_terminals[true], Is().EqualTo(0u)); }); it("should return Ø when given { Ø } for (21,42)", [&]() { @@ -553,13 +553,13 @@ go_bandit([]() { level_info_test_stream meta_arcs(out); AssertThat(meta_arcs.can_pull(), Is().False()); - AssertThat(out.get>()->max_1level_cut[cut_type::INTERNAL], Is().EqualTo(0u)); - AssertThat(out.get>()->max_1level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(1u)); - AssertThat(out.get>()->max_1level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(0u)); - AssertThat(out.get>()->max_1level_cut[cut_type::ALL], Is().EqualTo(1u)); + AssertThat(out.get>()->max_1level_cut[cut::Internal], Is().EqualTo(0u)); + AssertThat(out.get>()->max_1level_cut[cut::Internal_False], Is().EqualTo(1u)); + AssertThat(out.get>()->max_1level_cut[cut::Internal_True], Is().EqualTo(0u)); + AssertThat(out.get>()->max_1level_cut[cut::All], Is().EqualTo(1u)); - AssertThat(out.get>()->number_of_terminals[false], Is().EqualTo(1u)); - AssertThat(out.get>()->number_of_terminals[true], Is().EqualTo(0u)); + AssertThat(out.get>()->number_of_terminals[false], Is().EqualTo(1u)); + AssertThat(out.get>()->number_of_terminals[true], Is().EqualTo(0u)); }); it("should return Ø when given disjoint labels", [&]() { @@ -576,19 +576,19 @@ go_bandit([]() { level_info_test_stream meta_arcs(out); AssertThat(meta_arcs.can_pull(), Is().False()); - AssertThat(out.get>()->max_1level_cut[cut_type::INTERNAL], Is().EqualTo(0u)); - AssertThat(out.get>()->max_1level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(1u)); - AssertThat(out.get>()->max_1level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(0u)); - AssertThat(out.get>()->max_1level_cut[cut_type::ALL], Is().EqualTo(1u)); + AssertThat(out.get>()->max_1level_cut[cut::Internal], Is().EqualTo(0u)); + AssertThat(out.get>()->max_1level_cut[cut::Internal_False], Is().EqualTo(1u)); + AssertThat(out.get>()->max_1level_cut[cut::Internal_True], Is().EqualTo(0u)); + AssertThat(out.get>()->max_1level_cut[cut::All], Is().EqualTo(1u)); - AssertThat(out.get>()->number_of_terminals[false], Is().EqualTo(1u)); - AssertThat(out.get>()->number_of_terminals[true], Is().EqualTo(0u)); + AssertThat(out.get>()->number_of_terminals[false], Is().EqualTo(1u)); + AssertThat(out.get>()->number_of_terminals[true], Is().EqualTo(0u)); }); it("should return { { 0 } } when given { Ø, { 0 } } for (0)", [&]() { - shared_levelized_file in; + shared_levelized_file in; - const node n = node(0, node::MAX_ID, terminal_T, terminal_T); + const node n = node(0, node::max_id, terminal_T, terminal_T); { // Garbage collect writer to free write-lock node_writer w(in); @@ -617,18 +617,18 @@ go_bandit([]() { AssertThat(meta_arcs.can_pull(), Is().False()); - AssertThat(out.get<__zdd::shared_arcs_t>()->max_1level_cut, Is().GreaterThanOrEqualTo(0u)); + AssertThat(out.get<__zdd::shared_arc_file_type>()->max_1level_cut, Is().GreaterThanOrEqualTo(0u)); - AssertThat(out.get<__zdd::shared_arcs_t>()->number_of_terminals[false], Is().EqualTo(1u)); - AssertThat(out.get<__zdd::shared_arcs_t>()->number_of_terminals[true], Is().EqualTo(1u)); + AssertThat(out.get<__zdd::shared_arc_file_type>()->number_of_terminals[false], Is().EqualTo(1u)); + AssertThat(out.get<__zdd::shared_arc_file_type>()->number_of_terminals[true], Is().EqualTo(1u)); }); it("should return Ø when given { Ø, { 0 } } for (0,1)", [&]() { - shared_levelized_file in; + shared_levelized_file in; { // Garbage collect writer to free write-lock node_writer w(in); - w << node(0, node::MAX_ID, terminal_T, terminal_T); + w << node(0, node::max_id, terminal_T, terminal_T); } @@ -645,13 +645,13 @@ go_bandit([]() { level_info_test_stream meta_arcs(out); AssertThat(meta_arcs.can_pull(), Is().False()); - AssertThat(out.get>()->max_1level_cut[cut_type::INTERNAL], Is().EqualTo(0u)); - AssertThat(out.get>()->max_1level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(1u)); - AssertThat(out.get>()->max_1level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(0u)); - AssertThat(out.get>()->max_1level_cut[cut_type::ALL], Is().EqualTo(1u)); + AssertThat(out.get>()->max_1level_cut[cut::Internal], Is().EqualTo(0u)); + AssertThat(out.get>()->max_1level_cut[cut::Internal_False], Is().EqualTo(1u)); + AssertThat(out.get>()->max_1level_cut[cut::Internal_True], Is().EqualTo(0u)); + AssertThat(out.get>()->max_1level_cut[cut::All], Is().EqualTo(1u)); - AssertThat(out.get>()->number_of_terminals[false], Is().EqualTo(1u)); - AssertThat(out.get>()->number_of_terminals[true], Is().EqualTo(0u)); + AssertThat(out.get>()->number_of_terminals[false], Is().EqualTo(1u)); + AssertThat(out.get>()->number_of_terminals[true], Is().EqualTo(0u)); }); it("should return { Ø } in [2] for (0,2,3)", [&]() { @@ -699,10 +699,10 @@ go_bandit([]() { AssertThat(meta_arcs.can_pull(), Is().False()); - AssertThat(out.get<__zdd::shared_arcs_t>()->max_1level_cut, Is().GreaterThanOrEqualTo(1u)); + AssertThat(out.get<__zdd::shared_arc_file_type>()->max_1level_cut, Is().GreaterThanOrEqualTo(1u)); - AssertThat(out.get<__zdd::shared_arcs_t>()->number_of_terminals[false], Is().EqualTo(3u)); - AssertThat(out.get<__zdd::shared_arcs_t>()->number_of_terminals[true], Is().EqualTo(1u)); + AssertThat(out.get<__zdd::shared_arc_file_type>()->number_of_terminals[false], Is().EqualTo(3u)); + AssertThat(out.get<__zdd::shared_arc_file_type>()->number_of_terminals[true], Is().EqualTo(1u)); }); it("should return Ø in [2] for (0,2,3,4)", [&]() { @@ -746,10 +746,10 @@ go_bandit([]() { AssertThat(meta_arcs.can_pull(), Is().False()); - AssertThat(out.get<__zdd::shared_arcs_t>()->max_1level_cut, Is().GreaterThanOrEqualTo(1u)); + AssertThat(out.get<__zdd::shared_arc_file_type>()->max_1level_cut, Is().GreaterThanOrEqualTo(1u)); - AssertThat(out.get<__zdd::shared_arcs_t>()->number_of_terminals[false], Is().EqualTo(3u)); - AssertThat(out.get<__zdd::shared_arcs_t>()->number_of_terminals[true], Is().EqualTo(0u)); + AssertThat(out.get<__zdd::shared_arc_file_type>()->number_of_terminals[false], Is().EqualTo(3u)); + AssertThat(out.get<__zdd::shared_arc_file_type>()->number_of_terminals[true], Is().EqualTo(0u)); }); it("should keep root of [1] but shortcut its low for (0)", [&]() { @@ -819,10 +819,10 @@ go_bandit([]() { AssertThat(meta_arcs.can_pull(), Is().False()); - AssertThat(out.get<__zdd::shared_arcs_t>()->max_1level_cut, Is().GreaterThanOrEqualTo(2u)); + AssertThat(out.get<__zdd::shared_arc_file_type>()->max_1level_cut, Is().GreaterThanOrEqualTo(2u)); - AssertThat(out.get<__zdd::shared_arcs_t>()->number_of_terminals[false], Is().EqualTo(2u)); - AssertThat(out.get<__zdd::shared_arcs_t>()->number_of_terminals[true], Is().EqualTo(3u)); + AssertThat(out.get<__zdd::shared_arc_file_type>()->number_of_terminals[false], Is().EqualTo(2u)); + AssertThat(out.get<__zdd::shared_arc_file_type>()->number_of_terminals[true], Is().EqualTo(3u)); }); it("should skip 'dead' nodes of [1] for (1,2)", [&]() { @@ -886,10 +886,10 @@ go_bandit([]() { AssertThat(meta_arcs.can_pull(), Is().False()); - AssertThat(out.get<__zdd::shared_arcs_t>()->max_1level_cut, Is().GreaterThanOrEqualTo(2u)); + AssertThat(out.get<__zdd::shared_arc_file_type>()->max_1level_cut, Is().GreaterThanOrEqualTo(2u)); - AssertThat(out.get<__zdd::shared_arcs_t>()->number_of_terminals[false], Is().EqualTo(2u)); - AssertThat(out.get<__zdd::shared_arcs_t>()->number_of_terminals[true], Is().EqualTo(3u)); + AssertThat(out.get<__zdd::shared_arc_file_type>()->number_of_terminals[false], Is().EqualTo(2u)); + AssertThat(out.get<__zdd::shared_arc_file_type>()->number_of_terminals[true], Is().EqualTo(3u)); }); it("should return Ø in { Ø, {0}, {0,2} } for (1)", [&]() { @@ -902,12 +902,12 @@ go_bandit([]() { / \ T T */ - shared_levelized_file in; + shared_levelized_file in; { // Garbage collect writer to free write-lock node_writer w(in); - w << node(2, node::MAX_ID, terminal_T, terminal_T) - << node(0, node::MAX_ID, terminal_T, ptr_uint64(2, ptr_uint64::MAX_ID)); + w << node(2, node::max_id, terminal_T, terminal_T) + << node(0, node::max_id, terminal_T, ptr_uint64(2, ptr_uint64::max_id)); } std::vector labels = { 1 }; @@ -923,13 +923,13 @@ go_bandit([]() { level_info_test_stream meta_arcs(out); AssertThat(meta_arcs.can_pull(), Is().False()); - AssertThat(out.get>()->max_1level_cut[cut_type::INTERNAL], Is().EqualTo(0u)); - AssertThat(out.get>()->max_1level_cut[cut_type::INTERNAL_FALSE], Is().EqualTo(1u)); - AssertThat(out.get>()->max_1level_cut[cut_type::INTERNAL_TRUE], Is().EqualTo(0u)); - AssertThat(out.get>()->max_1level_cut[cut_type::ALL], Is().EqualTo(1u)); + AssertThat(out.get>()->max_1level_cut[cut::Internal], Is().EqualTo(0u)); + AssertThat(out.get>()->max_1level_cut[cut::Internal_False], Is().EqualTo(1u)); + AssertThat(out.get>()->max_1level_cut[cut::Internal_True], Is().EqualTo(0u)); + AssertThat(out.get>()->max_1level_cut[cut::All], Is().EqualTo(1u)); - AssertThat(out.get>()->number_of_terminals[false], Is().EqualTo(1u)); - AssertThat(out.get>()->number_of_terminals[true], Is().EqualTo(0u)); + AssertThat(out.get>()->number_of_terminals[false], Is().EqualTo(1u)); + AssertThat(out.get>()->number_of_terminals[true], Is().EqualTo(0u)); }); it("should cut edge going across onset label in { {2}, {0,1}, {0,2}, {0,1,2} } for (1)", [&]() { @@ -942,11 +942,11 @@ go_bandit([]() { / \ F T */ - shared_levelized_file in; + shared_levelized_file in; - const node n3 = node(2, node::MAX_ID, terminal_F, terminal_T); - const node n2 = node(1, node::MAX_ID, n3.uid(), n3.uid()); - const node n1 = node(0, node::MAX_ID, n3.uid(), n2.uid()); + const node n3 = node(2, node::max_id, terminal_F, terminal_T); + const node n2 = node(1, node::max_id, n3.uid(), n3.uid()); + const node n1 = node(0, node::max_id, n3.uid(), n2.uid()); { // Garbage collect writer to free write-lock node_writer w(in); @@ -995,10 +995,10 @@ go_bandit([]() { AssertThat(meta_arcs.can_pull(), Is().False()); - AssertThat(out.get<__zdd::shared_arcs_t>()->max_1level_cut, Is().GreaterThanOrEqualTo(1u)); + AssertThat(out.get<__zdd::shared_arc_file_type>()->max_1level_cut, Is().GreaterThanOrEqualTo(1u)); - AssertThat(out.get<__zdd::shared_arcs_t>()->number_of_terminals[false], Is().EqualTo(3u)); - AssertThat(out.get<__zdd::shared_arcs_t>()->number_of_terminals[true], Is().EqualTo(1u)); + AssertThat(out.get<__zdd::shared_arc_file_type>()->number_of_terminals[false], Is().EqualTo(3u)); + AssertThat(out.get<__zdd::shared_arc_file_type>()->number_of_terminals[true], Is().EqualTo(1u)); }); it("should cut edge and ignore 'dead' node in { {2}, {0,1}, {0,2} } for (1)", [&]() { @@ -1011,11 +1011,11 @@ go_bandit([]() { / \ F T */ - shared_levelized_file in; + shared_levelized_file in; - const node n3 = node(2, node::MAX_ID, terminal_F, terminal_T); - const node n2 = node(1, node::MAX_ID, n3.uid(), terminal_T); - const node n1 = node(0, node::MAX_ID, n3.uid(), n2.uid()); + const node n3 = node(2, node::max_id, terminal_F, terminal_T); + const node n2 = node(1, node::max_id, n3.uid(), terminal_T); + const node n1 = node(0, node::max_id, n3.uid(), n2.uid()); { // Garbage collect writer to free write-lock node_writer w(in); @@ -1054,10 +1054,10 @@ go_bandit([]() { AssertThat(meta_arcs.can_pull(), Is().False()); - AssertThat(out.get<__zdd::shared_arcs_t>()->max_1level_cut, Is().GreaterThanOrEqualTo(1u)); + AssertThat(out.get<__zdd::shared_arc_file_type>()->max_1level_cut, Is().GreaterThanOrEqualTo(1u)); - AssertThat(out.get<__zdd::shared_arcs_t>()->number_of_terminals[false], Is().EqualTo(2u)); - AssertThat(out.get<__zdd::shared_arcs_t>()->number_of_terminals[true], Is().EqualTo(1u)); + AssertThat(out.get<__zdd::shared_arc_file_type>()->number_of_terminals[false], Is().EqualTo(2u)); + AssertThat(out.get<__zdd::shared_arc_file_type>()->number_of_terminals[true], Is().EqualTo(1u)); }); it("should falsify early terminals in [2] for (3)", [&]() { @@ -1112,10 +1112,10 @@ go_bandit([]() { AssertThat(meta_arcs.can_pull(), Is().False()); - AssertThat(out.get<__zdd::shared_arcs_t>()->max_1level_cut, Is().GreaterThanOrEqualTo(2u)); + AssertThat(out.get<__zdd::shared_arc_file_type>()->max_1level_cut, Is().GreaterThanOrEqualTo(2u)); - AssertThat(out.get<__zdd::shared_arcs_t>()->number_of_terminals[false], Is().EqualTo(3u)); - AssertThat(out.get<__zdd::shared_arcs_t>()->number_of_terminals[true], Is().EqualTo(1u)); + AssertThat(out.get<__zdd::shared_arc_file_type>()->number_of_terminals[false], Is().EqualTo(3u)); + AssertThat(out.get<__zdd::shared_arc_file_type>()->number_of_terminals[true], Is().EqualTo(1u)); }); it("should skip root in [2] due to cut on high edge for (1,3)", [&]() { @@ -1161,10 +1161,10 @@ go_bandit([]() { AssertThat(meta_arcs.can_pull(), Is().False()); - AssertThat(out.get<__zdd::shared_arcs_t>()->max_1level_cut, Is().GreaterThanOrEqualTo(1u)); + AssertThat(out.get<__zdd::shared_arc_file_type>()->max_1level_cut, Is().GreaterThanOrEqualTo(1u)); - AssertThat(out.get<__zdd::shared_arcs_t>()->number_of_terminals[false], Is().EqualTo(2u)); - AssertThat(out.get<__zdd::shared_arcs_t>()->number_of_terminals[true], Is().EqualTo(2u)); + AssertThat(out.get<__zdd::shared_arc_file_type>()->number_of_terminals[false], Is().EqualTo(2u)); + AssertThat(out.get<__zdd::shared_arc_file_type>()->number_of_terminals[true], Is().EqualTo(2u)); }); it("should falsify early terminal and bridge over removed node in [1] for (4)", [&]() { @@ -1228,10 +1228,10 @@ go_bandit([]() { AssertThat(meta_arcs.can_pull(), Is().False()); - AssertThat(out.get<__zdd::shared_arcs_t>()->max_1level_cut, Is().GreaterThanOrEqualTo(3u)); + AssertThat(out.get<__zdd::shared_arc_file_type>()->max_1level_cut, Is().GreaterThanOrEqualTo(3u)); - AssertThat(out.get<__zdd::shared_arcs_t>()->number_of_terminals[false], Is().EqualTo(2u)); - AssertThat(out.get<__zdd::shared_arcs_t>()->number_of_terminals[true], Is().EqualTo(1u)); + AssertThat(out.get<__zdd::shared_arc_file_type>()->number_of_terminals[false], Is().EqualTo(2u)); + AssertThat(out.get<__zdd::shared_arc_file_type>()->number_of_terminals[true], Is().EqualTo(1u)); }); it("should cut high edge on restricted node, if it goes past the next label", [&]() { @@ -1246,14 +1246,14 @@ go_bandit([]() { / \/ \ F T T */ - shared_levelized_file in; + shared_levelized_file in; - node n6 = node(3, node::MAX_ID, terminal_T, terminal_T); - node n5 = node(3, node::MAX_ID-1, terminal_F, terminal_T); - node n4 = node(2, node::MAX_ID, n5.uid(), n6.uid()); - node n3 = node(1, node::MAX_ID, n5.uid(), n4.uid()); - node n2 = node(1, node::MAX_ID-1, terminal_T, n5.uid()); - node n1 = node(0, node::MAX_ID, n2.uid(), n3.uid()); + node n6 = node(3, node::max_id, terminal_T, terminal_T); + node n5 = node(3, node::max_id-1, terminal_F, terminal_T); + node n4 = node(2, node::max_id, n5.uid(), n6.uid()); + node n3 = node(1, node::max_id, n5.uid(), n4.uid()); + node n2 = node(1, node::max_id-1, terminal_T, n5.uid()); + node n1 = node(0, node::max_id, n2.uid(), n3.uid()); { // Garbage collect writer to free write-lock node_writer w(in); @@ -1311,10 +1311,10 @@ go_bandit([]() { AssertThat(meta_arcs.can_pull(), Is().False()); - AssertThat(out.get<__zdd::shared_arcs_t>()->max_1level_cut, Is().GreaterThanOrEqualTo(1u)); + AssertThat(out.get<__zdd::shared_arc_file_type>()->max_1level_cut, Is().GreaterThanOrEqualTo(1u)); - AssertThat(out.get<__zdd::shared_arcs_t>()->number_of_terminals[false], Is().EqualTo(3u)); - AssertThat(out.get<__zdd::shared_arcs_t>()->number_of_terminals[true], Is().EqualTo(2u)); + AssertThat(out.get<__zdd::shared_arc_file_type>()->number_of_terminals[false], Is().EqualTo(3u)); + AssertThat(out.get<__zdd::shared_arc_file_type>()->number_of_terminals[true], Is().EqualTo(2u)); }); }); }); diff --git a/test/adiar/zdd/test_zdd.cpp b/test/adiar/zdd/test_zdd.cpp index 5399de3e8..8f5d56b22 100644 --- a/test/adiar/zdd/test_zdd.cpp +++ b/test/adiar/zdd/test_zdd.cpp @@ -2,42 +2,42 @@ go_bandit([]() { describe("adiar/zdd/zdd.h", [&]() { - shared_levelized_file x0_nf; + shared_levelized_file x0_nf; { node_writer nw_0(x0_nf); - nw_0 << node(0, node::MAX_ID, + nw_0 << node(0, node::max_id, ptr_uint64(false), ptr_uint64(true)); } zdd x0(x0_nf); - shared_levelized_file x1_nf; + shared_levelized_file x1_nf; { node_writer nw_1(x1_nf); - nw_1 << node(1, node::MAX_ID, + nw_1 << node(1, node::max_id, ptr_uint64(false), ptr_uint64(true)); } zdd x1(x1_nf); - shared_levelized_file x0_or_x1_nf; + shared_levelized_file x0_or_x1_nf; { node_writer nw_01(x0_or_x1_nf); - nw_01 << node(1, node::MAX_ID, + nw_01 << node(1, node::max_id, ptr_uint64(false), ptr_uint64(true)); - nw_01 << node(0, node::MAX_ID, - ptr_uint64(1, ptr_uint64::MAX_ID), + nw_01 << node(0, node::max_id, + ptr_uint64(1, ptr_uint64::max_id), ptr_uint64(true)); } zdd x0_or_x1(x0_or_x1_nf); - shared_levelized_file terminal_T_nf; + shared_levelized_file terminal_T_nf; { node_writer nw_T(terminal_T_nf); nw_T << node(true); @@ -45,7 +45,7 @@ go_bandit([]() { zdd terminal_T(terminal_T_nf); - shared_levelized_file terminal_F_nf; + shared_levelized_file terminal_F_nf; { node_writer nw_F(terminal_F_nf); nw_F << node(false); @@ -56,27 +56,27 @@ go_bandit([]() { describe("__zdd class", [&]() { it("should copy-construct values from zdd", [&]() { __zdd t1 = x0_or_x1; - AssertThat(t1.has>(), Is().True()); - AssertThat(t1.get>(), Is().EqualTo(x0_or_x1_nf)); + AssertThat(t1.has>(), Is().True()); + AssertThat(t1.get>(), Is().EqualTo(x0_or_x1_nf)); AssertThat(t1.negate, Is().False()); }); it("should copy-construct values from __zdd", [&]() { __zdd t1 = x0_or_x1; __zdd t2 = t1; - AssertThat(t2.has>(), Is().True()); - AssertThat(t2.get>(), Is().EqualTo(x0_or_x1_nf)); + AssertThat(t2.has>(), Is().True()); + AssertThat(t2.get>(), Is().EqualTo(x0_or_x1_nf)); AssertThat(t2.negate, Is().False()); }); - it("should copy-construct values from shared_levelized_file", [&]() { + it("should copy-construct values from shared_levelized_file", [&]() { __zdd t1 = x0_or_x1; - AssertThat(t1.has>(), Is().True()); - AssertThat(t1.get>(), Is().EqualTo(x0_or_x1_nf)); + AssertThat(t1.has>(), Is().True()); + AssertThat(t1.get>(), Is().EqualTo(x0_or_x1_nf)); AssertThat(t1.negate, Is().False()); }); - __zdd::shared_arcs_t af; + __zdd::shared_arc_file_type af; { arc_writer aw(af); @@ -92,14 +92,14 @@ go_bandit([]() { af->max_1level_cut = 1; - it("should copy-construct values from __zdd::shared_arcs_t", [&]() { + it("should copy-construct values from __zdd::shared_arc_file_type", [&]() { __zdd t1 = af; - AssertThat(t1.has<__zdd::shared_arcs_t>(), Is().True()); - AssertThat(t1.get<__zdd::shared_arcs_t>(), Is().EqualTo(af)); + AssertThat(t1.has<__zdd::shared_arc_file_type>(), Is().True()); + AssertThat(t1.get<__zdd::shared_arc_file_type>(), Is().EqualTo(af)); AssertThat(t1.negate, Is().False()); }); - it("should reduce on copy construct to zdd with __zdd::shared_arcs_t", [&]() { + it("should reduce on copy construct to zdd with __zdd::shared_arc_file_type", [&]() { zdd out = __zdd(af); AssertThat(out, Is().EqualTo(x0_or_x1)); }); @@ -111,10 +111,10 @@ go_bandit([]() { }); it("should accept {{0}} == {{0}} (different files)", [&]() { - shared_levelized_file x0_nf_2; + shared_levelized_file x0_nf_2; { node_writer nw_0(x0_nf_2); - nw_0 << node(0, node::MAX_ID, + nw_0 << node(0, node::max_id, ptr_uint64(false), ptr_uint64(true)); } @@ -137,19 +137,19 @@ go_bandit([]() { }); it("should compute {{0},{1}}' == {Ø,{0,1}} with dom {0,1}", [&]() { - adiar::shared_file dom; + adiar::shared_file dom; { label_writer lw(dom); lw << 0 << 1; } - adiar_set_domain(dom); + domain_set(dom); - shared_levelized_file expected; + shared_levelized_file expected; { node_writer nw(expected); - nw << node(1, node::MAX_ID, ptr_uint64(false), ptr_uint64(true)) - << node(0, node::MAX_ID, ptr_uint64(true), ptr_uint64(1, ptr_uint64::MAX_ID)); + nw << node(1, node::max_id, ptr_uint64(false), ptr_uint64(true)) + << node(0, node::max_id, ptr_uint64(true), ptr_uint64(1, ptr_uint64::max_id)); } AssertThat(~x0_or_x1 == zdd(expected), Is().True()); @@ -161,13 +161,13 @@ go_bandit([]() { }); it("should compute with __zdd&& operators [|,~,-,]", [&]() { - adiar::shared_file dom; + adiar::shared_file dom; { label_writer lw(dom); lw << 0 << 1; } - adiar_set_domain(dom); + domain_set(dom); zdd out = ~(~(x0 | x1) - terminal_T); zdd expected = x0 | x1 | terminal_T; @@ -197,7 +197,7 @@ go_bandit([]() { }); }); - it("should copy-construct shared_levelized_file and negation back to zdd", [&]() { + it("should copy-construct shared_levelized_file and negation back to zdd", [&]() { zdd t2 = zdd(__zdd(x0_or_x1)); AssertThat(t2.file_ptr(), Is().EqualTo(x0_or_x1_nf)); AssertThat(t2.is_negated(), Is().False()); diff --git a/test/test.cpp b/test/test.cpp index 866f616d5..7522f62da 100644 --- a/test/test.cpp +++ b/test/test.cpp @@ -16,8 +16,8 @@ go_bandit([]() { AssertThrows(invalid_argument, adiar_init(0)); }); - it("throws exception when given 'MINIMUM_MEMORY - 1' memory", [&]() { - AssertThrows(invalid_argument, adiar_init(MINIMUM_MEMORY - 1)); + it("throws exception when given 'minimum_memory - 1' memory", [&]() { + AssertThrows(invalid_argument, adiar_init(minimum_memory - 1)); }); it("can run 'adiar_init()'", [&]() { @@ -44,7 +44,7 @@ go_bandit([]() { go_bandit([]() { describe("adiar/domain.h", []() { it("initially as no domain", [&]() { - AssertThat(adiar_has_domain(), Is().False()); + AssertThat(domain_isset(), Is().False()); }); }); }); @@ -122,17 +122,17 @@ go_bandit([]() { AssertThat(adiar_initialized(), Is().True()); // TODO: enforce being true independent of above unit tests - AssertThat(adiar_has_domain(), Is().True()); + AssertThat(domain_isset(), Is().True()); adiar_deinit(); AssertThat(adiar_initialized(), Is().False()); - AssertThat(adiar_has_domain(), Is().False()); + AssertThat(domain_isset(), Is().False()); }); it("throws exception when reinitialized", [&]() { // TODO: remove when 'github.com/thomasmoelhave/tpie/issues/265' is fixed. - AssertThrows(runtime_error, adiar_init(MINIMUM_MEMORY)); + AssertThrows(runtime_error, adiar_init(minimum_memory)); }); }); }); diff --git a/test/test.h b/test/test.h index 13a8d3905..cfbc5b035 100644 --- a/test/test.h +++ b/test/test.h @@ -28,7 +28,7 @@ using level_info_test_stream = level_info_stream; class node_test_stream: public node_stream { public: - node_test_stream(const shared_levelized_file &f) + node_test_stream(const shared_levelized_file &f) : node_stream(f) { } @@ -37,7 +37,7 @@ class node_test_stream: public node_stream { } node_test_stream(const __bdd &f) - : node_stream(f.get<__bdd::shared_nodes_t>(), f.negate) + : node_stream(f.get<__bdd::shared_node_file_type>(), f.negate) { } node_test_stream(const zdd &f) @@ -45,7 +45,7 @@ class node_test_stream: public node_stream { } node_test_stream(const __zdd &f) - : node_stream(f.get<__zdd::shared_nodes_t>(), f.negate) + : node_stream(f.get<__zdd::shared_node_file_type>(), f.negate) { } }; @@ -57,11 +57,11 @@ class arc_test_stream: public arc_stream { } arc_test_stream(const __bdd &bdd) - : arc_stream(bdd.get<__bdd::shared_arcs_t>()) + : arc_stream(bdd.get<__bdd::shared_arc_file_type>()) { } arc_test_stream(const __zdd &zdd) - : arc_stream(zdd.get<__zdd::shared_arcs_t>()) + : arc_stream(zdd.get<__zdd::shared_arc_file_type>()) { } }; @@ -75,7 +75,7 @@ namespace snowhouse { std::stringstream stream; if (p.is_nil()) { - stream << "NIL"; + stream << "nil"; } else if (p.is_terminal()) { stream << p.value(); } else { // p.is_node() @@ -153,9 +153,9 @@ namespace snowhouse }; template<> - struct Stringizer> + struct Stringizer> { - static std::string ToString(const adiar::map_pair& a) + static std::string ToString(const adiar::map_pair& a) { std::stringstream stream; stream << "assignment: [x" << a.key() << "|->" << static_cast(a.value()) << "]"; @@ -197,7 +197,7 @@ int main(int argc, char* argv[]) { // Output statistics #ifdef ADIAR_TEST_PRINT_STATS - adiar::adiar_printstat(); + adiar::statistics_print(); #endif #ifndef ADIAR_TEST_NO_INIT