Mise en place projet R
This commit is contained in:
Executable
+26
@@ -0,0 +1,26 @@
|
||||
# Exécuter tous les tests avec: testthat::test_dir('tests/testthat')
|
||||
library(testthat)
|
||||
test_dir('tests/testthat')
|
||||
|
||||
source(here::here("R/project/ecow_calculations.R"))
|
||||
|
||||
# 1 pour juste vaches, 2 = vaches + taureaux, 3 = vaches + taureaux + lignees
|
||||
calcul_ecow_by_chep('FR03142115', 1) # DIDOU
|
||||
calcul_ecow_by_chep('FR71499477', 1) # JEANNOT
|
||||
calcul_ecow_by_chep('FR71082042', 1) # test embryons
|
||||
calcul_ecow_by_chep('FR03320016', 1) # MICAUD
|
||||
|
||||
# Cheptels tests éCow
|
||||
calcul_ecow_by_chep('FR49373240', 1) #21s
|
||||
calcul_ecow_by_chep('FR79296901', 1) #25s
|
||||
calcul_ecow_by_chep('FR42338149', 1) #21s
|
||||
calcul_ecow_by_chep('FR71424024', 1) #11s
|
||||
calcul_ecow_by_chep('FR71499477', 1) #13s
|
||||
calcul_ecow_by_chep('FR58123075', 1) #24s
|
||||
calcul_ecow_by_chep('FR71531193', 1) #29s
|
||||
calcul_ecow_by_chep('FR12124049', 1) #24s
|
||||
calcul_ecow_by_chep('FR69262063', 1) #22s
|
||||
calcul_ecow_by_chep('FR72154002', 1) #21
|
||||
|
||||
|
||||
|
||||
Executable
+9
@@ -0,0 +1,9 @@
|
||||
suppressPackageStartupMessages({ library(testthat) })
|
||||
source(file.path('R','project','calculations.R'), local = TRUE)
|
||||
|
||||
test_that('compute_metrics calcule correctement la moyenne', {
|
||||
df <- data.frame(value = c(1,2,3,4))
|
||||
res <- compute_metrics(df)
|
||||
expect_equal(res$mean, 2.5)
|
||||
expect_equal(res$n, 4)
|
||||
})
|
||||
Executable
+3
@@ -0,0 +1,3 @@
|
||||
# Placeholder pour tests DB (mockez ou utilisez une DB de test)
|
||||
suppressPackageStartupMessages({ library(testthat) })
|
||||
test_that('placeholder db', { expect_true(TRUE) })
|
||||
Executable
+3
@@ -0,0 +1,3 @@
|
||||
# Placeholder pour tests de webservices génériques
|
||||
suppressPackageStartupMessages({ library(testthat) })
|
||||
test_that('placeholder ws', { expect_true(TRUE) })
|
||||
Reference in New Issue
Block a user