<commit_before>#include <memory>

#include "gtest/gtest.h"

#include "../../lib/common.hpp"
#include "../../lib/storage/base_column.hpp"
#include "../../lib/storage/chunk.hpp"
#include "../../lib/types.hpp"

class StorageChunkTest : public ::testing::Test {
 protected:
  virtual void SetUp() {
    vc_int = opossum::make_shared_by_column_type<opossum::BaseColumn, opossum::ValueColumn>("int");
    vc_int->append(4);
    vc_int->append(6);
    vc_int->append(3);

    vc_str = opossum::make_shared_by_column_type<opossum::BaseColumn, opossum::ValueColumn>("string");
    vc_str->append("Hello,");
    vc_str->append("world");
    vc_str->append("!");
  }

  opossum::Chunk c;
  std::shared_ptr<opossum::BaseColumn> vc_int = nullptr;
  std::shared_ptr<opossum::BaseColumn> vc_str = nullptr;
};

TEST_F(StorageChunkTest, AddColumnToChunk) {
  EXPECT_EQ(c.size(), 0u);
  c.add_column(vc_int);
  c.add_column(vc_str);
  EXPECT_EQ(c.size(), 3u);
}

TEST_F(StorageChunkTest, AddValuesToChunk) {
  c.add_column(vc_int);
  c.add_column(vc_str);
  c.append({2, "two"});
  EXPECT_EQ(c.size(), 4u);

  if (IS_DEBUG) {
    EXPECT_THROW(c.append({}), std::exception);
    EXPECT_THROW(c.append({4, "val", 3}), std::exception);
    EXPECT_EQ(c.size(), 4u);
  }
}

TEST_F(StorageChunkTest, RetrieveColumn) {
  c.add_column(vc_int);
  c.add_column(vc_str);
  c.append({2, "two"});

  auto base_col = c.get_column(0);
  EXPECT_EQ(base_col->size(), 4u);
}<commit_msg>Test for creating unknown column type<commit_after>#include <memory>

#include "gtest/gtest.h"

#include "../../lib/common.hpp"
#include "../../lib/storage/base_column.hpp"
#include "../../lib/storage/chunk.hpp"
#include "../../lib/types.hpp"

class StorageChunkTest : public ::testing::Test {
 protected:
  virtual void SetUp() {
    vc_int = opossum::make_shared_by_column_type<opossum::BaseColumn, opossum::ValueColumn>("int");
    vc_int->append(4);
    vc_int->append(6);
    vc_int->append(3);

    vc_str = opossum::make_shared_by_column_type<opossum::BaseColumn, opossum::ValueColumn>("string");
    vc_str->append("Hello,");
    vc_str->append("world");
    vc_str->append("!");
  }

  opossum::Chunk c;
  std::shared_ptr<opossum::BaseColumn> vc_int = nullptr;
  std::shared_ptr<opossum::BaseColumn> vc_str = nullptr;
};

TEST_F(StorageChunkTest, AddColumnToChunk) {
  EXPECT_EQ(c.size(), 0u);
  c.add_column(vc_int);
  c.add_column(vc_str);
  EXPECT_EQ(c.size(), 3u);
}

TEST_F(StorageChunkTest, AddValuesToChunk) {
  c.add_column(vc_int);
  c.add_column(vc_str);
  c.append({2, "two"});
  EXPECT_EQ(c.size(), 4u);

  if (IS_DEBUG) {
    EXPECT_THROW(c.append({}), std::exception);
    EXPECT_THROW(c.append({4, "val", 3}), std::exception);
    EXPECT_EQ(c.size(), 4u);
  }
}

TEST_F(StorageChunkTest, RetrieveColumn) {
  c.add_column(vc_int);
  c.add_column(vc_str);
  c.append({2, "two"});

  auto base_col = c.get_column(0);
  EXPECT_EQ(base_col->size(), 4u);
}

TEST_F(StorageChunkTest, UnknownColumnType) {
  // Exception will only be thrown in debug builds
  if (IS_DEBUG) {
    auto wrapper = []() {
      opossum::make_shared_by_column_type<opossum::BaseColumn, opossum::ValueColumn>("weird_type");
    };
    EXPECT_THROW(wrapper(), std::runtime_error);
  }
}
{'fraction_non_alphanumeric': 0.1892812887236679, 'fraction_numerical': 0.0080545229244114, 'mean_word_length': 4.828519855595668, 'pattern_counts': {'":': 0, '<': 14, '<?xml version=': 0, '>': 28, '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': '6178560', 'n_tokens_mistral': 1280, 'n_tokens_neox': 1266, 'n_words': 177}