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)
})
ramhiser/itertools2 documentation built on May 26, 2019, 10:09 p.m.