<commit_before>#include "catch.hpp"
#include "matrix.h"

TEST_CASE( "Test matrix resize", "[matrix][modifiers]" ) {
  SECTION("Compare empty matrixes"){
    matrix<int> m1 = {{1,2},{3,4}};
    matrix<int> m2 = {{1,2,0},{3,4,0}};
    REQUIRE( m1.rows() == 2);
    REQUIRE( m1.columns() == 2);
    m1.resize(2,3);
    REQUIRE( m1.rows() == 2);
    REQUIRE( m1.columns() == 3);
    REQUIRE( m1 == m2 );
  }
}
<commit_msg>Add more resizing test cases.<commit_after>#include "catch.hpp"
#include "matrix.h"

TEST_CASE( "Test matrix resize", "[matrix][modifiers]" ) {
  SECTION("Add column to matrix"){
    matrix<int> m1 = {{1,2},{3,4}};
    matrix<int> m2 = {{1,2,0},{3,4,0}};
    REQUIRE( m1.rows() == 2);
    REQUIRE( m1.columns() == 2);
    m1.resize(2,3);
    REQUIRE( m1.rows() == 2);
    REQUIRE( m1.columns() == 3);
    REQUIRE( m1 == m2 );
  }
  SECTION("Add row to matrix"){
    matrix<int> m1 = {{1,2},{3,4}};
    matrix<int> m2 = {{1,2},{3,4},{0,0}};
    REQUIRE( m1.rows() == 2);
    REQUIRE( m1.columns() == 2);
    m1.resize(3,2);
    REQUIRE( m1.rows() == 3);
    REQUIRE( m1.columns() == 2);
    REQUIRE( m1 == m2 );
  }
  SECTION("Add row and column to matrix"){
    matrix<int> m1 = {{1,2},{3,4}};
    matrix<int> m2 = {{1,2,0},{3,4,0},{0,0,0}};
    REQUIRE( m1.rows() == 2);
    REQUIRE( m1.columns() == 2);
    m1.resize(3,3);
    REQUIRE( m1.rows() == 3);
    REQUIRE( m1.columns() == 3);
    REQUIRE( m1 == m2 );
  }
  SECTION("Remove column from matrix"){
    matrix<int> m1 = {{1,2},{3,4}};
    matrix<int> m2 = {{1},{3}};
    REQUIRE( m1.rows() == 2);
    REQUIRE( m1.columns() == 2);
    m1.resize(2,1);
    REQUIRE( m1.rows() == 2);
    REQUIRE( m1.columns() == 1);
    REQUIRE( m1 == m2 );
  }
  SECTION("Remove row from matrix"){
    matrix<int> m1 = {{1,2},{3,4}};
    matrix<int> m2 = {{1,2}};
    REQUIRE( m1.rows() == 2);
    REQUIRE( m1.columns() == 2);
    m1.resize(1,2);
    REQUIRE( m1.rows() == 1);
    REQUIRE( m1.columns() == 2);
    REQUIRE( m1 == m2 );
  }
  SECTION("Add row and column to matrix"){
    matrix<int> m1 = {{1,2},{3,4}};
    matrix<int> m2 = {{1}};
    REQUIRE( m1.rows() == 2);
    REQUIRE( m1.columns() == 2);
    m1.resize(1,1);
    REQUIRE( m1.rows() == 1);
    REQUIRE( m1.columns() == 1);
    REQUIRE( m1 == m2 );
  }
}

{'fraction_non_alphanumeric': 0.25043859649122807, 'fraction_numerical': 0.07236842105263158, 'mean_word_length': 2.9947460595446587, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5425562', 'n_tokens_mistral': 1092, 'n_tokens_neox': 1017, 'n_words': 207}