#include #include #include #include "rand.hpp" #include "scratchpad/amitmatrix.hpp" #include "worldbuilder.hpp" #include #include #include using namespace fmt; using std::string; inline void random_matrix(amt::Matrix &out) { for(size_t y = 0; y < out.rows(); y++) { for(size_t x = 0; x < out.cols(); x++) { out[y][x] = Random::uniform(-10,10); } } } TEST_CASE("basic matrix iterator", "[matrix2:basic]") { size_t width = Random::uniform(5, 11); size_t height = Random::uniform(3, 13); amt::Matrix test{height,width,0}; random_matrix(test); println("FIRST RANDOM"); std::cout << test << std::endl; for(auto cell : test) { print("{} ", cell); } println("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! DIRECT ACCESS operator() has a bug."); auto filled = test; std::fill(filled.begin(), filled.end(), 8); println("SECOND FILLED"); std::cout << filled << std::endl; auto iota_style = filled; std::iota(iota_style.begin(), iota_style.end(), 0); println("THIRD IOTA"); std::cout << iota_style << std::endl; }