<commit_before>// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#include <vespa/vespalib/testkit/test_kit.h>
#include <vespa/searchlib/docstore/visitcache.h>

using namespace search;
using namespace search::docstore;

TEST("require that KeySet compares well") {
    KeySet a({2,1,4,3,9,6});
    EXPECT_TRUE(a.contains(1));
    EXPECT_TRUE(a.contains(2));
    EXPECT_TRUE(a.contains(3));
    EXPECT_TRUE(a.contains(4));
    EXPECT_TRUE(a.contains(6));
    EXPECT_TRUE(a.contains(9));
    EXPECT_EQUAL(1u, a.hash());
    EXPECT_TRUE(a.contains(KeySet({4,1,9})));
    EXPECT_FALSE(a.contains(KeySet({4,1,9,5})));
    EXPECT_TRUE(a.contains(KeySet({4,1,9,2,3,6})));
    EXPECT_FALSE(a.contains(KeySet({11,4,1,9,2,3,6})));

    EXPECT_TRUE(KeySet({1,5,7}) == KeySet({7,1,5}));
    EXPECT_FALSE(KeySet({1,5,7}) == KeySet({7,1,5,4}));
    EXPECT_FALSE(KeySet({1,5,7}) == KeySet({7,1,5,9}));
    EXPECT_FALSE(KeySet({1,5,7,9}) == KeySet({7,1,5}));
<commit_msg>Also add false test with equal set sizes, as you could take the other simply checking sizes.<commit_after>// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#include <vespa/vespalib/testkit/test_kit.h>
#include <vespa/searchlib/docstore/visitcache.h>

using namespace search;
using namespace search::docstore;

TEST("require that KeySet compares well") {
    KeySet a({2,1,4,3,9,6});
    EXPECT_TRUE(a.contains(1));
    EXPECT_TRUE(a.contains(2));
    EXPECT_TRUE(a.contains(3));
    EXPECT_TRUE(a.contains(4));
    EXPECT_TRUE(a.contains(6));
    EXPECT_TRUE(a.contains(9));
    EXPECT_EQUAL(1u, a.hash());
    EXPECT_TRUE(a.contains(KeySet({4,1,9})));
    EXPECT_FALSE(a.contains(KeySet({4,1,9,5})));
    EXPECT_TRUE(a.contains(KeySet({4,1,9,2,3,6})));
    EXPECT_FALSE(a.contains(KeySet({11,4,1,9,2,3,6})));

    EXPECT_TRUE(KeySet({1,5,7}) == KeySet({7,1,5}));
    EXPECT_FALSE(KeySet({1,5,7}) == KeySet({7,1,5,4}));
    EXPECT_FALSE(KeySet({1,5,7}) == KeySet({7,1,5,9}));
    EXPECT_FALSE(KeySet({1,5,7,9}) == KeySet({7,1,5}));
    EXPECT_FALSE(KeySet({1,5,7,9}) == KeySet({7,1,5,8}));

{'fraction_non_alphanumeric': 0.20497466605251036, 'fraction_numerical': 0.0654076462459696, 'mean_word_length': 5.5225225225225225, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, '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': '3951353', 'n_tokens_mistral': 881, 'n_tokens_neox': 892, 'n_words': 132}