test_that("Testing CreateItemBody DirectedPair", { dp <- new("DirectedPair", rows = c("Lion", "Flower", "Mushrooms"), rows_identifiers = c("ID_1", "ID_2", "ID_3"), cols = c("Animal", "Plant", "Fungi"), cols_identifiers = c("IDT_1", "IDT_2", "IDT_3"), answers_identifiers = c("ID_3 IDT_3", "ID_1 IDT_1", "ID_2 IDT_2"), points = 5, title = "directed_pair", orientation = "horizontal", prompt = "Associated left elements with the right category" ) # The example was based on OPAL question type "Match Interaction" because # qti does not provide it example <- ' Associated left elements with the right category Lion Flower Mushrooms Animal Plant Fungi ' sut <- xml2::read_xml(toString(createItemBody(dp))) expected <- xml2::read_xml(example) expect_equal(sut, expected) }) test_that("Testing createResponseDeclaration() method in DirectedPair class where its slots answer_score and points are undefined", { dp <- new("DirectedPair", rows = c("Lion", "Flower", "Mushrooms"), rows_identifiers = c("ID_1", "ID_2", "ID_3"), cols = c("Animal", "Plant", "Fungi"), cols_identifiers = c("IDT_1", "IDT_2", "IDT_3"), answers_identifiers = c("ID_3 IDT_3", "ID_1 IDT_1", "ID_2 IDT_2"), title = "directed_pair", prompt = "Associated left elements with the right category" ) # The example was based on OPAL question type "Match Interaction" because # qti does not provide it example <- ' ID_3 IDT_3 ID_1 IDT_1 ID_2 IDT_2 ' sut <- xml2::read_xml(toString(createResponseDeclaration(dp))) expected <- xml2::read_xml(example) expect_equal(sut, expected) }) test_that("Testing OutcomeDeclaration DirectedPair", { dp <- new("DirectedPair", rows = c("Lion", "Flower", "Mushrooms"), rows_identifiers = c("ID_1", "ID_2", "ID_3"), cols = c("Animal", "Plant", "Fungi"), cols_identifiers = c("IDT_1", "IDT_2", "IDT_3"), answers_identifiers = c("ID_3 IDT_3", "ID_1 IDT_1", "ID_2 IDT_2"), points = 5, title = "directed_pair", prompt = "Associated left elements with the right category" ) # The example was based on OPAL question type "Match Interaction" because # qti does not provide it example <- ' 0 5 0 ' responseDe <- as.character(htmltools::tag("additionalTag", list(createOutcomeDeclaration(dp)))) sut <- xml2::read_xml(responseDe) expected <- xml2::read_xml(example) expect_equal(sut, expected) })