<commit_before>#include "process_splitters/Alignment.hpp"

#include <sam.h>

#include <gtest/gtest.h>

TEST(TestAlignment, create_from_bam) {

}

TEST(TestAlignment, create_from_sa) {

}

TEST(TestAlignment, calculate_additional_offsets) {

}

TEST(TestAlignment, start_diagonal) {

}

TEST(TestAlignment, end_diagonal) {

}

TEST(TestAlignment, mno) {

}

TEST(TestAlignment, desert) {

}

TEST(TestAlignment, insert_size) {

}

TEST(TestAlignment, should_check) {

}
<commit_msg>add tests using test data<commit_after>#include "process_splitters/Alignment.hpp"
#include "TestData.hpp"
#include "testing/TestBamRecords.hpp"

#include <sam.h>

#include <stdint.h>
#include <gtest/gtest.h>
#include <string>
#include <stdexcept>

class TestAlignment : public ::testing::Test {
    public:
        bam1_t *record1;
        bam1_t *record2;
        TestBamRecords records;

        TestAlignment() {
            record1 = records.record;
            record2 = records.record2;
        }
};

TEST_F(TestAlignment, create_from_bam) {
    Alignment test_obj(record1, records.header);
    ASSERT_EQ(test_obj.chrom, "chr21");
    ASSERT_EQ(test_obj.strand, '+');
    ASSERT_EQ(test_obj.rapos, 44877125u);
    // TODO add additional tests once we're certain about the values
}

TEST_F(TestAlignment, create_from_sa) {
    uint8_t *sa_ptr = bam_aux_get(record2, "SA") + 1; //skipping the type field
    std::string data = (char const*) sa_ptr;
    char const* beg = data.data();
    char const* end = data.data() + data.size() - 1; //subtracting off the semicolon
    Alignment test_obj(beg, end);
    ASSERT_EQ(test_obj.chrom, "chr21");
    ASSERT_EQ(test_obj.strand, '+');
    ASSERT_EQ(test_obj.rapos, 44877125u);
}

TEST_F(TestAlignment, create_from_truncated_sa) {
    uint8_t *sa_ptr = bam_aux_get(record2, "SA") + 1; //skipping the type field
    std::string data((char const*) sa_ptr, 28); //truncate the string
    ASSERT_EQ(data, "chr21,44877125,+,101S41M9S,3");
    char const* beg = data.data();
    char const* end = data.data() + data.size();

    ASSERT_THROW(Alignment test_obj(beg, end), std::runtime_error);
}

TEST_F(TestAlignment, calculate_additional_offsets) {

}

TEST_F(TestAlignment, start_diagonal) {

}

TEST_F(TestAlignment, end_diagonal) {

}

TEST_F(TestAlignment, mno) {

}

TEST_F(TestAlignment, desert) {

}

TEST_F(TestAlignment, insert_size) {

}

TEST_F(TestAlignment, should_check) {

}

{'fraction_non_alphanumeric': 0.13214581607290804, 'fraction_numerical': 0.02236951118475559, 'mean_word_length': 4.33112582781457, 'pattern_counts': {'":': 0, '<': 10, '<?xml version=': 0, '>': 10, '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': '2130744', 'n_tokens_mistral': 930, 'n_tokens_neox': 879, 'n_words': 166}