<commit_before>#include "factorize/BigInt.h"
#include "factorize/QuadraticSieve.h"

#include <gtest/gtest.h>
#include <sstream>
#include <iostream>
#include <stdexcept>
#include <string>
#include <chrono>
#include <functional>
#include <utility>
#include <bitset>
#include <map>
#include <memory>
#include <algorithm>
#include <random>

using namespace std;
using namespace chrono;
using namespace testing;



TEST(BigIntTest, testFactorizationQuadraticSieve)
{
    //BigInt p("551226983117");
    //BigInt q("554724632351");
    BigInt p("1313839");
    BigInt q("1327901");
    BigInt n = p*q; 


    QuadraticSieve qs(n);

    auto start = high_resolution_clock::now();

    auto pq = qs.factorize();

    auto end = high_resolution_clock::now();
    milliseconds elapsed = duration_cast<milliseconds>(end - start);
    std::cout << "total time: " << elapsed.count() / 1000.0 << " seconds" << endl;  


    cout << "Solution found! :-D" << endl;
    cout << " N  = " << n << endl;
    cout << " p  = " << pq.first << endl;
    cout << " q  = " << pq.second << endl;
    cout << "p*q = " << pq.first * pq.second << endl;
}

<commit_msg>quadratic sieve test now checks the result (ASSERT_EQ), instead of just printing it out<commit_after>#include "factorize/BigInt.h"
#include "factorize/QuadraticSieve.h"

#include <gtest/gtest.h>
#include <sstream>
#include <iostream>
#include <stdexcept>
#include <string>
#include <chrono>
#include <functional>
#include <utility>
#include <bitset>
#include <map>
#include <memory>
#include <algorithm>
#include <random>

using namespace std;
using namespace chrono;
using namespace testing;



TEST(BigIntTest, testFactorizationQuadraticSieve)
{
    //BigInt p("551226983117");
    //BigInt q("554724632351");
    BigInt p("1313839");
    BigInt q("1327901");
    BigInt n = p*q; 


    QuadraticSieve qs(n);

    auto start = high_resolution_clock::now();

    auto pq = qs.factorize();

    auto end = high_resolution_clock::now();
    milliseconds elapsed = duration_cast<milliseconds>(end - start);
    std::cout << "total time: " << elapsed.count() / 1000.0 << " seconds" << endl;  


    BigInt actualP = pq.first;
    BigInt actualQ = pq.second;

    if(actualP > actualQ)
        swap(actualP, actualQ);

    ASSERT_EQ(p, actualP);
    ASSERT_EQ(q, actualQ);
}


{'fraction_non_alphanumeric': 0.15324675324675324, 'fraction_numerical': 0.03722943722943723, 'mean_word_length': 3.948608137044968, 'pattern_counts': {'":': 0, '<': 75, '<?xml version=': 0, '>': 32, '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': '2206103', 'n_tokens_mistral': 892, 'n_tokens_neox': 806, 'n_words': 197}