<commit_before>/******************************************************************************
 *                    _   _____   __________                                  *
 *                   | | / / _ | / __/_  __/     Visibility                   *
 *                   | |/ / __ |_\ \  / /          Across                     *
 *                   |___/_/ |_/___/ /_/       Space and Time                 *
 *                                                                            *
 * This file is part of VAST. It is subject to the license terms in the       *
 * LICENSE file found in the top-level directory of this distribution and at  *
 * http://vast.io/license. No part of VAST, including this file, may be       *
 * copied, modified, propagated, or distributed except according to the terms *
 * contained in the LICENSE file.                                             *
 ******************************************************************************/

#include "fixtures/table_slices.hpp"

#include <caf/all.hpp>

#include "vast/chunk.hpp"
#include <vast/concept/parseable/to.hpp>
#include <vast/concept/parseable/vast/data.hpp>
#include "vast/span.hpp"
#include "vast/value_index.hpp"

using namespace vast;

namespace fixtures {

namespace {

} // namespace <anonymous>

table_slices::table_slices() : sink{sys, buf} {
  // Define our test layout.
  layout = record_type{
    {"a", boolean_type{}},
    {"b", integer_type{}},
    {"c", count_type{}},
    {"d", real_type{}},
    {"e", timespan_type{}},
    {"f", timestamp_type{}},
    {"g", string_type{}},
    {"h", pattern_type{}},
    {"i", address_type{}},
    {"j", subnet_type{}},
    {"k", port_type{}},
    {"l", vector_type{count_type{}}},
    {"m", set_type{boolean_type{}}},
    {"n", map_type{count_type{}, boolean_type{}}},
  };
  // Initialize test data.
  auto rows = std::vector<std::string>{
    "[T, +7, 42, 4.2, 1337ms, 2018-12-24, \"foo\", /foo.*bar/, 127.0.0.1,"
    " 10.0.0.0/8, 80/tcp, [1, 2, 3], {T, F}, {1 -> T, 2 -> F, 3 -> T}]",
    "[F, -7, 43, 0.42, -1337ms, 2018-12-25, \"bar\", nil, ::1, 64:ff9b::/96,"
    " 53/udp, [42], {T}, nil]",
  };
  for (auto& row : rows) {
    auto xs = unbox(to<data>(row));
    test_data.push_back(caf::get<vector>(xs));
  }
}

void table_slices::run() {
  if (builder == nullptr)
    FAIL("no valid builder found; missing fixture initialization?");
  test_add();
  test_equality();
  test_copy();
  test_manual_serialization();
  test_smart_pointer_serialization();<commit_msg>Use empty containers for improved coverage<commit_after>/******************************************************************************
 *                    _   _____   __________                                  *
 *                   | | / / _ | / __/_  __/     Visibility                   *
 *                   | |/ / __ |_\ \  / /          Across                     *
 *                   |___/_/ |_/___/ /_/       Space and Time                 *
 *                                                                            *
 * This file is part of VAST. It is subject to the license terms in the       *
 * LICENSE file found in the top-level directory of this distribution and at  *
 * http://vast.io/license. No part of VAST, including this file, may be       *
 * copied, modified, propagated, or distributed except according to the terms *
 * contained in the LICENSE file.                                             *
 ******************************************************************************/

#include "fixtures/table_slices.hpp"

#include <caf/all.hpp>

#include "vast/chunk.hpp"
#include <vast/concept/parseable/to.hpp>
#include <vast/concept/parseable/vast/data.hpp>
#include "vast/span.hpp"
#include "vast/value_index.hpp"

using namespace vast;

namespace fixtures {

namespace {

} // namespace <anonymous>

table_slices::table_slices() : sink{sys, buf} {
  // Define our test layout.
  layout = record_type{
    {"a", boolean_type{}},
    {"b", integer_type{}},
    {"c", count_type{}},
    {"d", real_type{}},
    {"e", timespan_type{}},
    {"f", timestamp_type{}},
    {"g", string_type{}},
    {"h", pattern_type{}},
    {"i", address_type{}},
    {"j", subnet_type{}},
    {"k", port_type{}},
    {"l", vector_type{count_type{}}},
    {"m", set_type{boolean_type{}}},
    {"n", map_type{count_type{}, boolean_type{}}},
  };
  // Initialize test data.
  auto rows = std::vector<std::string>{
    "[T, +7, 42, 4.2, 1337ms, 2018-12-24, \"foo\", /foo.*bar/, 127.0.0.1,"
    " 10.0.0.0/8, 80/tcp, [1, 2, 3], {T, F}, {1 -> T, 2 -> F, 3 -> T}]",
    "[F, -7, 43, 0.42, -1337ms, 2018-12-25, \"bar\", nil, ::1, 64:ff9b::/96,"
    " 53/udp, [], {}, {-}]",
  };
  for (auto& row : rows) {
    auto xs = unbox(to<data>(row));
    test_data.push_back(caf::get<vector>(xs));
  }
}

void table_slices::run() {
  if (builder == nullptr)
    FAIL("no valid builder found; missing fixture initialization?");
  test_add();
  test_equality();
  test_copy();
  test_manual_serialization();
  test_smart_pointer_serialization();
{'fraction_non_alphanumeric': 0.22628458498023715, 'fraction_numerical': 0.025296442687747035, 'mean_word_length': 2.2133333333333334, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 23, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 4, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 12, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2470520', 'n_tokens_mistral': 1705, 'n_tokens_neox': 1560, 'n_words': 371}