tests/testthat/test-plot_API.R

sourcedata("v0", "cluster_lists")

test_that("df_full_join() works", {
    test_df <- getdata("plot_API", "df_full_join_test_df")

    expect_equal(
        df_full_join(
            list(c1, c1_shifted_by_4_5, c1_shifted_to_9_0, c2, c3)
        ),
        test_df
    )

    expect_equal(
        df_full_join(list(c1)),
        test_df[1:9, ]
    )

    expect_equal(df_full_join(list(c1, list())), test_df[1:9, ])

    test_df_rows_1_till_9_with_label_1 <- test_df[1:9,]
    test_df_rows_1_till_9_with_label_1[[1]] <- rep("cluster 1", 9)

    expect_equal(
        df_full_join(list(list(), c1)),
        test_df_rows_1_till_9_with_label_1
    )

    expect_equal(
        test_df_rows_1_till_9_with_label_1,
        df_full_join(list(list(), c1, list()))
    )

})

# TODO plot_clusters by itself
# TODO more tests

Try the APackOfTheClones package in your browser

Any scripts or data that you put into this service are public.

APackOfTheClones documentation built on Oct. 11, 2024, 1:08 a.m.