if (1 == 0) {

    library("testthat"); library("STITCH"); library("rrbgen")
    ##    dir <- "/data/smew1/rdavies/stitch_development/STITCH_github_latest/STITCH"
    dir <- "~/proj/STITCH/"
    setwd(paste0(dir, "/STITCH/R"))
    a <- dir(pattern = "*R")
    b <- grep("~", a)
    if (length(b) > 0) {
        a <- a[-b]
    }
    o <- sapply(a, source)
    setwd(dir)
    Sys.setenv(PATH = paste0(getwd(), ":", Sys.getenv("PATH")))
    
    refpack <- make_reference_package(
        n_snps = 40,
        n_samples_per_pop = 4,
        reference_populations = c("CEU", "GBR", "CHB")
    )
    
    out <- get_haplotypes_from_reference(
        reference_haplotype_file = refpack$reference_haplotype_file,
        reference_legend_file = refpack$reference_legend_file,
        reference_sample_file = refpack$reference_sample_file,
        reference_populations = refpack$reference_populations,
        pos = refpack$pos,
        tempdir = tempdir(),
        regionName = "test"
    )

    reference_haps <- out[["reference_haps"]]    
    dim(reference_haps)
    ## this is 40 rows = SNPs, and 24 columns = haps

    ## all versions returned should be the same
    rhb_t <- t(out[["rhb1"]])

    ## so top left entry = hap 1, first grid
    expect_equal(rhb_t[1, 1], rcpp_int_contract(reference_haps[1:32, 1]))
    ## top right entry = hap1, second grid (incomplete)
    expect_equal(rhb_t[1, 2], rcpp_int_contract(reference_haps[33:40, 1]))

    ## compare against
    rcpp_int_contract
    ## vs
    int_contract
    

}
