<commit_before>#![feature(test)]

extern crate bio;
extern crate genomic_fx;
extern crate linked_hash_map;
extern crate test;

use test::Bencher;

use bio::utils::{Interval, Strand};
use linked_hash_map::LinkedHashMap;

use genomic_fx::{ExonFeature, ExonFeatureKind, EBuilder, TBuilder, GBuilder, RefFlatReader};
use ExonFeatureKind::*;


#[cfg(test)]
mod tests {
    use super::*;

    #[bench]
    fn ebuilder_no_features(b: &mut Bencher) {
        b.iter(|| {
            EBuilder::new("chrT", 100, 500)
                .strand(Strand::Forward)
                .build()
        });
    }

    #[bench]
    fn ebuiler_5_features(b: &mut Bencher) {
        b.iter(|| {
            EBuilder::new("chrT", 100, 300)
                .strand(Strand::Forward)
                .features(vec![
                    ExonFeature {
                        interval: Interval::new(100..150).unwrap(),
                        kind: UTR5,
                    },
                    ExonFeature {
                        interval: Interval::new(150..153).unwrap(),
                        kind: StartCodon { frame: Some(0) },
                    },
                    ExonFeature {
                        interval: Interval::new(150..300).unwrap(),
                        kind: CDS { frame: Some(0) },
                    },
                    ExonFeature {
                        interval: Interval::new(300..303).unwrap(),
                        kind: StopCodon { frame: Some(0) },
                    },
                    ExonFeature {
                        interval: Interval::new(300..500).unwrap(),
                        kind: UTR3,
                    },
                ])
                .build()
        });
    }

    #[bench]
    fn tbuilder_1_exon_no_cds(b: &mut Bencher) {
        b.iter(|| {
            TBuilder::new("chrT", 100, 10000)
                .strand(Strand::Forward)<commit_msg>Fix ExonFeature creation in benches<commit_after>#![feature(test)]

extern crate bio;
extern crate genomic_fx;
extern crate linked_hash_map;
extern crate test;

use test::Bencher;

use bio::utils::{Interval, Strand};
use linked_hash_map::LinkedHashMap;

use genomic_fx::{ExonFeature, ExonFeatureKind, EBuilder, TBuilder, GBuilder, RefFlatReader};
use ExonFeatureKind::*;


#[cfg(test)]
mod tests {
    use super::*;

    #[bench]
    fn ebuilder_no_features(b: &mut Bencher) {
        b.iter(|| {
            EBuilder::new("chrT", 100, 500)
                .strand(Strand::Forward)
                .build()
        });
    }

    #[bench]
    fn ebuiler_5_features(b: &mut Bencher) {
        b.iter(|| {
            EBuilder::new("chrT", 100, 300)
                .strand(Strand::Forward)
                .features(vec![
                    ExonFeature::new(Interval::new(100..150).unwrap(), UTR5),
                    ExonFeature::new(Interval::new(150..153).unwrap(),
                                     StartCodon { frame: Some(0) }),
                    ExonFeature::new(Interval::new(150..300).unwrap(),
                                     CDS { frame: Some(0) }),
                    ExonFeature::new(Interval::new(300..303).unwrap(),
                                     StopCodon { frame: Some(0) }),
                    ExonFeature::new(Interval::new(303..500).unwrap(),
                                     UTR3),
                ])
                .build()
        });
    }

    #[bench]
    fn tbuilder_1_exon_no_cds(b: &mut Bencher) {
        b.iter(|| {
            TBuilder::new("chrT", 100, 10000)
                .strand(Strand::Forward)
{'fraction_non_alphanumeric': 0.13571227872998032, 'fraction_numerical': 0.0320314695139084, 'mean_word_length': 1.4860335195530727, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 5, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2987035', 'n_tokens_mistral': 1143, 'n_tokens_neox': 1024, 'n_words': 184}