Skip to content

Commit

Permalink
Add test cases #19
Browse files Browse the repository at this point in the history
  • Loading branch information
hauselin committed Jul 29, 2024
1 parent 14172b9 commit a82e7c3
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions tests/testthat/test-options.R
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,36 @@ library(ollamar)

test_that("model options", {

# check_option_valid
expect_true(check_option_valid("mirostat"))
expect_false(check_option_valid("sdfadsfdf"))

# check options
test1 <- check_options(c("a", "b", "temperature"))
expect_type(check_options(c("a", "b", "temperature")), "list")
expect_true(length(test1$valid_options) == 1)
expect_true(length(test1$invalid_options) == 2)

test2 <- check_options(c("mirostat_tau", "temperature"))
expect_true(length(test2$valid_options) == 2)
expect_true(length(test2$invalid_options) == 0)

# search_options
test1 <- search_options("learning rate")
expect_type(test1, "list")
expect_true(length(test1) > 0)
expect_true(names(test1) == "mirostat_eta")

test1 <- search_options("abcsfsdfdaf")
expect_type(test1, "list")
expect_true(length(test1) == 0)

# validate_options
test1 <- validate_options(mirostat = 1, mirostat_eta = 0.2, num_ctx = 1024)
expect_true(test1)
test2 <- validate_options(mirostat = 1, mirostat_eta = 0.2, invalid_opt = 1024)
expect_false(test2)
test3 <- validate_options()
expect_true(test3)

})

0 comments on commit a82e7c3

Please sign in to comment.