<commit_before>#include <stan/math/error_handling/check_consistent_size.hpp>
#include <gtest/gtest.h>

TEST(MathMatrixErrorHandling, checkConsistentSize) {
  using Eigen::Matrix;
  using Eigen::Dynamic;
  using stan::math::check_consistent_size;
  using stan::size_of;

  const char* function = "checkConsistentSize(%1%)";
  const char* name1 = "name1";
  
  double result;

  Matrix<double,Dynamic,1> v1(4);
  EXPECT_EQ(4U, size_of(v1));
  EXPECT_TRUE(check_consistent_size(4U, function, v1, name1, &result));
  EXPECT_THROW(check_consistent_size(2U, function, v1, name1, &result), std::domain_error);
}<commit_msg>added NaN test for check_consistent_size<commit_after>#include <stan/math/error_handling/check_consistent_size.hpp>
#include <gtest/gtest.h>

TEST(MathMatrixErrorHandling, checkConsistentSize) {
  using Eigen::Matrix;
  using Eigen::Dynamic;
  using stan::math::check_consistent_size;
  using stan::size_of;

  const char* function = "checkConsistentSize(%1%)";
  const char* name1 = "name1";
  
  double result;

  Matrix<double,Dynamic,1> v1(4);
  EXPECT_EQ(4U, size_of(v1));
  EXPECT_TRUE(check_consistent_size(4U, function, v1, name1, &result));
  EXPECT_THROW(check_consistent_size(2U, function, v1, name1, &result), std::domain_error);
}

TEST(MathMatrixErrorHandling, checkConsistentSize_nan) {
  using Eigen::Matrix;
  using Eigen::Dynamic;
  using stan::math::check_consistent_size;
  using stan::size_of;

  const char* function = "checkConsistentSize(%1%)";
  const char* name1 = "name1";
  
  double result;
  double nan = std::numeric_limits<double>::quiet_NaN();

  Matrix<double,Dynamic,1> v1(4);
  v1 << nan,nan,4,nan;
  EXPECT_EQ(4U, size_of(v1));
  EXPECT_TRUE(check_consistent_size(4U, function, v1, name1, &result));
  EXPECT_THROW(check_consistent_size(2U, function, v1, name1, &result), std::domain_error);
}
{'fraction_non_alphanumeric': 0.13867822318526543, 'fraction_numerical': 0.023835319609967497, 'mean_word_length': 6.859574468085106, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 11, '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': '5395652', 'n_tokens_mistral': 684, 'n_tokens_neox': 669, 'n_words': 122}