summaryrefslogtreecommitdiff
path: root/tests/testthat/test_pai.R
blob: f38672d771998d22535f7c83bf1c3c82a80cea05 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# For manual use of this file
require(chents)
require(testthat)

context("Generation of pai objects")

test_that("a pai object is correctly generated", {
  skip_on_travis() # server certificate verification failed in curl_fetch_memory()
  glyphosate <- pai$new("glyphosate")
  
  # This did not give results at BCPC in previous times, so it was used to test
  # the corresponding warning.
  #bc <- pai$new("benzalkonium chloride") 

  expect_equivalent(glyphosate$bcpc$cas, "1071-83-6")
  expect_equivalent(glyphosate$bcpc$formula, "C3H8NO5P")
  expect_equivalent(glyphosate$bcpc$iupac_name, "N-(phosphonomethyl)glycine")
  expect_equal(names(glyphosate$identifier), "glyphosate")
  ik = "XDDAORKBJWWYJS-UHFFFAOYSA-N"
  attr(ik, "source") <- c("bcpc", "pubchem")
  expect_equal(glyphosate$inchikey, ik)
  expect_equivalent(round(glyphosate$mw, 2), 169.07)
  smiles <- "C(C(=O)O)NCP(=O)(O)O"
  expect_equal(glyphosate$smiles[["PubChem"]], smiles)
})

Contact - Imprint