test-read-log.R 802 Bytes
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
test_that("Read rcl file without error", {
  expect_no_error(read_log(test_path("20220405162804-HELIOS_base_3-vs-enemy_2.rcl")))
})

test_that("Read rcg file without error", {
  expect_no_error(read_log(test_path("20220405162804-HELIOS_base_3-vs-enemy_2.rcg")))
})

test_that("All items in rcg file must be retained", {
  rcg <- read_log(test_path("20220405162804-HELIOS_base_3-vs-enemy_2.rcg"))
  expect_true("header" %in% names(rcg))
  expect_true("server_param" %in% names(rcg))
  expect_true("player_param" %in% names(rcg))
  expect_true("player_type" %in% names(rcg))
  expect_true("team" %in% names(rcg))
  expect_true("show" %in% names(rcg))
  expect_true("msg" %in% names(rcg))
})

test_that("Do not read file that is not log file", {
  expect_error(read_log(test_path("not_log_file.txt")))
})