<commit_before>
#include <type_traits>

#include "catch.hpp"

#include "variant.hpp"
#include "variant_io.hpp"

using variant_type = mapbox::util::variant<int, double>;

struct add_visitor
{
    add_visitor() {}

    template <typename A, typename B>
    double operator()(A a, B b) const {
        return a + b;
    }
};

TEST_CASE( "const binary visitor works on const variants", "[visitor][binary visitor]" ) {
    const variant_type a = 7;
    const variant_type b = 3;
    const variant_type c = 7.1;
    const variant_type d = 2.9;

    const add_visitor v;

    REQUIRE(mapbox::util::apply_visitor(v, a, b) == Approx(10));
    REQUIRE(mapbox::util::apply_visitor(v, c, d) == Approx(10));
    REQUIRE(mapbox::util::apply_visitor(v, a, c) == Approx(14.1));
    REQUIRE(mapbox::util::apply_visitor(v, a, d) == Approx(9.9));

    REQUIRE(mapbox::util::apply_visitor(v, b, a) == Approx(10));<commit_msg>Test more branches in binary visitor code.<commit_after>
#include <type_traits>

#include "catch.hpp"

#include "variant.hpp"
#include "variant_io.hpp"

using variant_type = mapbox::util::variant<bool, int, double>;

struct add_visitor
{
    add_visitor() {}

    template <typename A, typename B>
    double operator()(A a, B b) const {
        return a + b;
    }
};

TEST_CASE( "const binary visitor works on const variants", "[visitor][binary visitor]" ) {
    const variant_type a = 7;
    const variant_type b = 3;
    const variant_type c = 7.1;
    const variant_type d = 2.9;

    const add_visitor v;

    REQUIRE(mapbox::util::apply_visitor(v, a, b) == Approx(10));
    REQUIRE(mapbox::util::apply_visitor(v, c, d) == Approx(10));
    REQUIRE(mapbox::util::apply_visitor(v, a, c) == Approx(14.1));
    REQUIRE(mapbox::util::apply_visitor(v, a, d) == Approx(9.9));

    REQUIRE(mapbox::util::apply_visitor(v, b, a) == Approx(10));
{'fraction_non_alphanumeric': 0.15934959349593497, 'fraction_numerical': 0.01842818428184282, 'mean_word_length': 4.113573407202216, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, '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': '4521936', 'n_tokens_mistral': 723, 'n_tokens_neox': 680, 'n_words': 164}