EVOLUTION-MANAGER
Edit File: expect_setequal.html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><title>R: Does code return a vector containing the expected values?</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <link rel="stylesheet" type="text/css" href="R.css" /> </head><body> <table width="100%" summary="page for expect_setequal {testthat}"><tr><td>expect_setequal {testthat}</td><td style="text-align: right;">R Documentation</td></tr></table> <h2>Does code return a vector containing the expected values?</h2> <h3>Description</h3> <ul> <li> <p><code>expect_setequal(x, y)</code> tests that every element of <code>x</code> occurs in <code>y</code>, and that every element of <code>y</code> occurs in <code>x</code>. </p> </li> <li> <p><code>expect_mapequal(x, y)</code> tests that <code>x</code> and <code>y</code> have the same names, and that <code>x[names(y)]</code> equals <code>y</code>. </p> </li></ul> <h3>Usage</h3> <pre> expect_setequal(object, expected) expect_mapequal(object, expected) </pre> <h3>Arguments</h3> <table summary="R argblock"> <tr valign="top"><td><code>object, expected</code></td> <td> <p>Computation and value to compare it to. </p> <p>Both arguments supports limited unquoting to make it easier to generate readable failures within a function or for loop. See <a href="quasi_label.html">quasi_label</a> for more details.</p> </td></tr> </table> <h3>Details</h3> <p>Note that <code>expect_setequal()</code> ignores names, and you will be warned if both <code>object</code> and <code>expected</code> have them. </p> <h3>Examples</h3> <pre> expect_setequal(letters, rev(letters)) show_failure(expect_setequal(letters[-1], rev(letters))) x <- list(b = 2, a = 1) expect_mapequal(x, list(a = 1, b = 2)) show_failure(expect_mapequal(x, list(a = 1))) show_failure(expect_mapequal(x, list(a = 1, b = "x"))) show_failure(expect_mapequal(x, list(a = 1, b = 2, c = 3))) </pre> <hr /><div style="text-align: center;">[Package <em>testthat</em> version 3.1.5 <a href="00Index.html">Index</a>]</div> </body></html>