tests/testthat/test-dotproduct.r

context("dotproduct")

test_that("dotproduct functions properly with two iterators", {
  it <- iterators::iter(1:5)
  it2 <- iterators::iter(1:5)
  expect_equal(dotproduct(it, it2), 55)
})

test_that("dotproduct functions properly with two numeric vectors", {
  vec1 <- c(10, 10)
  vec2 <- c(20, 20)
  expect_equal(dotproduct(vec1, vec2), 400)
})

Try the itertools2 package in your browser

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

itertools2 documentation built on May 2, 2019, 3:37 p.m.