Skip to content

Commit 07cfb20

Browse files
author
SymbolixAU
committed
last test...
1 parent 8150e00 commit 07cfb20

File tree

3 files changed

+26
-4
lines changed

3 files changed

+26
-4
lines changed

cran-comments.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11

22
* updates v0.0.2 to v0.1.0
3-
* three new functions and a bug fix
43

54
## Test environments
65

tests/testthat/test-df.R

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,16 @@ test_that("sfg objectse convereted to data.frames", {
100100
, m = c(1)
101101
)
102102

103-
mp <- sfg_multipolygon( df2, x = "x", y = "y", z = "z", polygon_id = "polygon_id", linestring_id = "line_id" )
103+
104+
mpz <- sfg_multipolygon(
105+
df2, x = "x", y = "y", z = "z"
106+
, polygon_id = "polygon_id", linestring_id = "line_id"
107+
)
108+
109+
mpzm <- sfg_multipolygon(
110+
df2, x = "x", y = "y", z = "z", m = "m"
111+
, polygon_id = "polygon_id", linestring_id = "line_id"
112+
)
104113

105114
df_pt <- sfheaders::sfg_to_df( pt )
106115
expect_equal( df_pt$x, 1 )
@@ -122,10 +131,14 @@ test_that("sfg objectse convereted to data.frames", {
122131
expect_equal( df_p$x, m[,1] )
123132
expect_equal( df_p$y, m[,2] )
124133

125-
df_mp <- sfheaders::sfg_to_df( mp )
134+
df_mp <- sfheaders::sfg_to_df( mpz )
126135
expect_equal( df_mp$x, df2$x )
127136
expect_equal( df_mp$y, df2$y )
128137

138+
df_mpzm <- sfheaders::sfg_to_df( mpzm )
139+
expect_equal( df_mpzm$z, df2$z )
140+
expect_equal( df_mpzm$m, df2$m )
141+
129142
expect_true( inherits( df_pt, "data.frame") )
130143
expect_true( inherits( df_mpt, "data.frame") )
131144
expect_true( inherits( df_ls, "data.frame") )
@@ -146,7 +159,7 @@ test_that("sfg objectse convereted to data.frames", {
146159
, linestring_id = "linestring_id"
147160
)
148161

149-
expect_equal( mp, res )
162+
expect_equal( mpz, res )
150163

151164
})
152165

tests/testthat/test-sfc_point.R

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,16 @@ test_that("after refactoring issue14 I haven't lost anything",{
134134
expect_equal( attr( res, "class" ), c("sfc_POINT", "sfc") )
135135
expect_true( is_point( res ) )
136136

137+
m <- matrix(c(1.1,2), ncol = 2)
138+
res <- sfc_point( m[0,], x = 1, y = 2 )
139+
expect_equal( attr( res, "class" ), c("sfc_POINT", "sfc") )
140+
expect_true( is_point( res ) )
141+
142+
m <- matrix(as.integer( c(1,2) ), ncol = 2)
143+
res <- sfc_point( m[0,], x = 1, y = 2)
144+
expect_equal( attr( res, "class" ), c("sfc_POINT", "sfc") )
145+
expect_true( is_point( res ) )
146+
137147
})
138148

139149
test_that("vectorised version works",{

0 commit comments

Comments
 (0)