Support for debug_string method for testing

This commit is contained in:
2021-07-21 00:50:06 -04:00
parent 4ba0471bde
commit c2a69b5b23
6 changed files with 197 additions and 150 deletions

View File

@@ -49,6 +49,7 @@
#include <string>
#include <deque>
#include <cassert>
#include <ostream>
#include <unordered_map>
#include "streambuffer.hpp"
#include "util.hpp"
@@ -155,8 +156,15 @@ public:
// Verify that this step echoes the previous step.
bool echoes(const AnimStep &prev) const;
// Convert to a string for debugging purposes.
std::string debug_string() const;
// Convert a string to an animstep (for testing only).
bool from_string(const std::string &s);
};
class AnimQueue {
private:
util::WorldType world_type_;
@@ -174,6 +182,7 @@ public:
const AnimStep &nth(int n) const { return steps_[n]; }
size_t size() const { return steps_.size(); }
int32_t size_limit() const { return size_limit_; }
int64_t version_number() const { return version_number_; }
// Return true if the size limit and steps are identical.
bool size_and_steps_equal(const AnimQueue &aq) const;
@@ -199,10 +208,14 @@ public:
const AnimStep &back() const;
// (For testing): change the size limit.
void set_size_limit(int32_t n);
void full_clear_and_set_limit(int szl);
void set_limit(int szl);
// (For testing): make sure the invariants are preserved.
bool valid() const;
// Convert to a string for debugging purposes.
std::string debug_string() const;
};
#endif // ANIMQUEUE_HPP