Ad
  • Custom User Avatar

    Replace the contents of the Sample Tests pane with this

    test_that("basic tests", {
      expect_equal(tribonacci(c(1, 1, 1), 10), c(1, 1, 1, 3, 5, 9, 17, 31, 57, 105))
      expect_equal(tribonacci(c(0, 0, 1), 10), c(0, 0, 1, 1, 2, 4, 7, 13, 24, 44))
      expect_equal(tribonacci(c(0, 1, 1), 10), c(0, 1, 1, 2, 4, 7, 13, 24, 44, 81))
      expect_equal(tribonacci(c(1, 0, 0), 10), c(1, 0, 0, 1, 1, 2, 4, 7, 13, 24))
      expect_equal(tribonacci(c(0, 0, 0), 10), c(0, 0, 0, 0, 0, 0, 0, 0, 0, 0))
      expect_equal(tribonacci(c(1, 2, 3), 10), c(1, 2, 3, 6, 11, 20, 37, 68, 125, 230))
      expect_equal(tribonacci(c(3, 2, 1), 10), c(3, 2, 1, 6, 9, 16, 31, 56, 103, 190))
      expect_equal(tribonacci(c(1, 1, 1), 1), c(1))
      expect_equal(tribonacci(c(300, 200, 100), 0), c())
      expect_equal(tribonacci(c(0.5, 0.5, 0.5), 30), c(0.5, 0.5, 0.5, 1.5, 2.5, 4.5, 8.5, 15.5, 28.5, 52.5, 96.5, 177.5, 326.5, 600.5, 1104.5, 2031.5, 3736.5, 6872.5, 12640.5, 23249.5, 42762.5, 78652.5, 144664.5, 266079.5, 489396.5, 900140.5, 1655616.5, 3045153.5, 5600910.5, 10301680.5))
    })