Nothing
# Tests for the internal read.c.string helper that reads fixed-size, NUL-padded
# C strings from the Quake file formats without triggering the
# "truncating string with embedded nuls" warning.
testthat::test_that("read.c.string returns the string up to the first NUL byte.", {
# 12-byte field: 'abc' + 9 NUL bytes, followed by 'xyz'.
raw_data = c(charToRaw("abc"), rep(as.raw(0), 9L), charToRaw("xyz"));
con = rawConnection(raw_data, open = "rb");
on.exit(close(con));
s = wal:::read.c.string(con, 12L);
testthat::expect_identical(s, "abc");
})
testthat::test_that("read.c.string advances the connection by the full field size.", {
# 12-byte field: 'abc' + 9 NUL bytes, followed by 'xyz'.
raw_data = c(charToRaw("abc"), rep(as.raw(0), 9L), charToRaw("xyz"));
con = rawConnection(raw_data, open = "rb");
on.exit(close(con));
wal:::read.c.string(con, 12L);
rest = readBin(con, "raw", n = 3L);
testthat::expect_identical(rest, charToRaw("xyz")); # 'xyz' follows the 12-byte field.
})
testthat::test_that("read.c.string returns an empty string for an all-NUL field.", {
con = rawConnection(rep(as.raw(0), 8L), open = "rb");
on.exit(close(con));
s = wal:::read.c.string(con, 8L);
testthat::expect_identical(s, "");
})
testthat::test_that("read.c.string returns the full string when the field has no NUL byte.", {
con = rawConnection(charToRaw("PACK"), open = "rb");
on.exit(close(con));
s = wal:::read.c.string(con, 4L);
testthat::expect_identical(s, "PACK");
})
testthat::test_that("read.wal reads the header name fields correctly.", {
walf = system.file("extdata", "bricks.wal", package = "wal", mustWork = TRUE);
wal = wal::read.wal(walf);
testthat::expect_identical(wal$header$tex_name, "e1u1/black");
testthat::expect_identical(wal$header$anim_name, "");
})
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.