Mise en place projet R

This commit is contained in:
2026-06-08 16:16:27 +02:00
commit 265e5f1db6
27 changed files with 12697 additions and 0 deletions
+26
View File
@@ -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
+9
View File
@@ -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)
})
+3
View File
@@ -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) })
+3
View File
@@ -0,0 +1,3 @@
# Placeholder pour tests de webservices génériques
suppressPackageStartupMessages({ library(testthat) })
test_that('placeholder ws', { expect_true(TRUE) })