1#   IGraph R package
2#   Copyright (C) 2005-2013  Gabor Csardi <csardi.gabor@gmail.com>
3#   334 Harvard street, Cambridge, MA 02139 USA
4#
5#   This program is free software; you can redistribute it and/or modify
6#   it under the terms of the GNU General Public License as published by
7#   the Free Software Foundation; either version 2 of the License, or
8#   (at your option) any later version.
9#
10#   This program is distributed in the hope that it will be useful,
11#   but WITHOUT ANY WARRANTY; without even the implied warranty of
12#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13#   GNU General Public License for more details.
14#
15#   You should have received a copy of the GNU General Public License
16#   along with this program; if not, write to the Free Software
17#   Foundation, Inc.,  51 Franklin Street, Fifth Floor, Boston, MA
18#   02110-1301 USA
19#
20###################################################################
21
22
23
24#' Run package tests
25#'
26#' Runs all package tests.
27#'
28#' The \code{testthat} package is needed to run all tests. The location tests
29#' themselves can be extracted from the package via \code{system.file("tests",
30#' package="igraph")}.
31#'
32#' This function simply calls the \code{test_dir} function from the
33#' \code{testthat} package on the test directory.
34#'
35#' @aliases igraphtest
36#' @return Whatever is returned by \code{test_dir} from the \code{testthat}
37#' package.
38#' @author Gabor Csardi \email{csardi.gabor@@gmail.com}
39#' @keywords graphs
40#' @export
41
42igraph_test <- function() {
43  do.call(require, list("testthat"))
44  tdir <- system.file("tests", package="igraph")
45  do.call("test_dir", list(tdir))
46}
47
48
49
50#' Query igraph's version string
51#'
52#' Queries igraph's original version string. See details below.
53#'
54#' The igraph version string is the same as the version of the R package for
55#' all released igraph versions. For development versions and nightly builds,
56#' they might differ however.
57#'
58#' The reason for this is, that R package version numbers are not flexible
59#' enough to cover in-between releases versions, e.g. alpha and beta versions,
60#' release candidates, etc.
61#'
62#' @aliases igraph.version
63#' @return A character scalar, the igraph version string.
64#' @author Gabor Csardi \email{csardi.gabor@@gmail.com}
65#' @keywords graphs
66#' @export
67#' @examples
68#'
69#' ## Compare to the package version
70#' packageDescription("igraph")$Version
71#' igraph_version()
72
73igraph_version <- function() {
74  on.exit( .Call(C_R_igraph_finalizer) )
75  .Call(C_R_igraph_version)
76}
77
78checkpkg <- function(package_file, args=character()) {
79  package_file <- as.character(package_file)
80  args <- as.character(args)
81  do.call(":::", list("tools", ".check_packages"))(c(package_file, args))
82}
83