# agridatasets - A Comprehensive Collection of Agricultural and Agronomic Datasets # Version 0.1.0 # Copyright (C) 2026 Renzo Caceres Rossi # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . # tomato_insecticides library(testthat) # Test 1: Check that the object is a tibble/data.frame and has 4 columns test_that("tomato_insecticides is a tibble data.frame with 4 columns", { expect_s3_class(tomato_insecticides, "spec_tbl_df") expect_s3_class(tomato_insecticides, "tbl_df") expect_s3_class(tomato_insecticides, "tbl") expect_s3_class(tomato_insecticides, "data.frame") expect_equal(ncol(tomato_insecticides), 4) expect_equal(length(tomato_insecticides), 4) }) # Test 2: Check the number of rows test_that("tomato_insecticides has 15 rows", { expect_equal(nrow(tomato_insecticides), 15) }) # Test 3: Validate column names test_that("tomato_insecticides has correct column names", { expect_named( tomato_insecticides, c("insecticide_id", "product_name", "active_ingredient", "target_pest") ) }) # Test 4: Check data types test_that("tomato_insecticides has correct data types", { expect_type(tomato_insecticides$insecticide_id, "character") expect_type(tomato_insecticides$product_name, "character") expect_type(tomato_insecticides$active_ingredient, "character") expect_type(tomato_insecticides$target_pest, "character") })