forked from stryker-mutator/stryker-mutator.github.io
-
Notifications
You must be signed in to change notification settings - Fork 0
/
mutators.html
11 lines (11 loc) · 6.57 KB
/
mutators.html
1
2
3
4
5
6
7
8
9
10
11
<!DOCTYPE html><html><head><meta charset="utf8"><meta http-equiv="X-UA-Compatible" content="chrome=1"><meta name="description" content="Stryker - The JavaScript mutation testing framework: Measure the effectiveness of JavaScript tests."><title>Supported mutators - Stryker - The JavaScript mutation testing framework</title><link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png"><link rel="icon" type="image/png" href="/favicon-32x32.png" sizes="32x32"><link rel="icon" type="image/png" href="/favicon-16x16.png" sizes="16x16"><link rel="manifest" href="/manifest.json"><meta name="theme-color" content="#b74934"><meta name="google-site-verification" content="dcR3wjiLytpKDUxRuQskHBDnuZmrf58jOUjMANVpOn0"><meta name="viewport" content="width=device-width, initial-scale=1"><link rel="stylesheet" href="/stylesheets/bootstrap/css/bootstrap.min.css"><link rel="stylesheet" href="/stylesheets/bootstrap/css/bootstrap-theme.min.css"><link rel="stylesheet" href="/stylesheets/stryker.css"><link rel="stylesheet" href="/stylesheets/font-awesome-4.6.3/css/font-awesome.min.css"><link rel="stylesheet" href="/stylesheets/highlightjs/styles/solarized-light.css"></head><body><nav class="navbar navbar-default navbar-fixed-top"><div class="container"><div class="navbar-header"><a class="navbar-brand" href="/"><img src="/images/stryker_205x205.png" alt="Stryker" width="20" height="20"></a><button class="pull-left navbar-toggle collapsed" type="button" data-toggle="collapse" data-target="#navbar" aria-expanded="false"><span class="sr-only">Toggle navigation</span><span class="icon-bar"></span><span class="icon-bar"></span><span class="icon-bar"></span></button></div><div class="collapse navbar-collapse" id="navbar"><ul class="nav navbar-nav"><li><a href="/" title="Home">Home</a></li><li><a href="/quickstart.html" title="Quickstart">Quickstart</a></li><li><a href="/blog.html" title="Blog">Blog</a></li><li><a href="/plugins.html" title="Plugins">Plugins</a></li><li class="active"><a href="/mutators.html" title="Supported mutators">Supported mutators</a></li><li><a href="/faq.html" title="FAQ">FAQ</a></li><li><a href="/technical-reference.html" title="Technical reference">Technical reference</a></li></ul></div><a href="https://github.com/stryker-mutator/stryker" id="forkme_banner">View me on GitHub</a></div></nav><div class="container"><div class="row"><div class="col-md-12"><h1 id="supported-mutators">Supported mutators</h1>
<p>Stryker supports a variety of mutators, which are listed below. Do you have a suggestion for a (new) mutator? Feel free to create an <a href="https://github.com/stryker-mutator/stryker/issues">issue</a>!</p>
<h3>Binary operator</h3><table class="table table-striped"><thead><tr><th>Original</th><th>Mutated</th></tr></thead><tbody><tr><td>a + b</td><td>a - b</td></tr><tr><td>a - b</td><td>a + b</td></tr><tr><td>a * b</td><td>a / b</td></tr><tr><td>a / b</td><td>a * b</td></tr><tr><td>a % b</td><td>a * b</td></tr><tr><td>a < b</td><td>a <= b</td></tr><tr><td>a < b</td><td>a >= b</td></tr><tr><td>a <= b</td><td>a < b</td></tr><tr><td>a <= b</td><td>a > b</td></tr><tr><td>a > b</td><td>a >= b</td></tr><tr><td>a > b</td><td>a <= b</td></tr><tr><td>a >= b</td><td>a > b</td></tr><tr><td>a >= b</td><td>a < b</td></tr><tr><td>a == b</td><td>a != b</td></tr><tr><td>a != b</td><td>a == b</td></tr><tr><td>a === b</td><td>a !== b</td></tr><tr><td>a !== b</td><td>a === b</td></tr></tbody></table><h3>Boolean Substitutions</h3><table class="table table-striped"><thead><tr><th>Original</th><th>Mutated</th></tr></thead><tbody><tr><td>true</td><td>false</td></tr><tr><td>false</td><td>true</td></tr><tr><td>!</td><td></td></tr></tbody></table><h3>Logical operator</h3><table class="table table-striped"><thead><tr><th>Original</th><th>Mutated</th></tr></thead><tbody><tr><td>a && b</td><td>a || b</td></tr><tr><td>a || b</td><td>a && b</td></tr></tbody></table><h3>Unary operator</h3><table class="table table-striped"><thead><tr><th>Original</th><th>Mutated</th></tr></thead><tbody><tr><td>+a</td><td>-a</td></tr><tr><td>-a</td><td>+a</td></tr></tbody></table><h3>Update operator</h3><table class="table table-striped"><thead><tr><th>Original</th><th>Mutated</th></tr></thead><tbody><tr><td>a++</td><td>a--</td></tr><tr><td>a--</td><td>a++</td></tr><tr><td>++a</td><td>--a</td></tr><tr><td>--a</td><td>++a</td></tr></tbody></table><h3>Remove conditionals</h3><table class="table table-striped"><thead><tr><th>Original</th><th>Mutated</th></tr></thead><tbody><tr><td>for (var i = 0; i < 10; i++) { }</td><td>for (var i = 0; false; i++) { }</td></tr><tr><td>while (a > b) { }</td><td>while (false) { }</td></tr><tr><td>do { } while (a > b);</td><td>do { } while (false);</td></tr><tr><td>if (a > b) { } </td><td>if (true) { }</td></tr><tr><td>if (a > b) { } </td><td>if (false) { }</td></tr><tr><td>var x = a > b ? 1 : 2;</td><td>var x = true ? 1 : 2;</td></tr><tr><td>var x = a > b ? 1 : 2; </td><td>var x = false ? 1 : 2;</td></tr></tbody></table><h3>Array Declarator</h3><table class="table table-striped"><thead><tr><th>Original</th><th>Mutated</th></tr></thead><tbody><tr><td>new Array(1, 2, 3, 4)</td><td>new Array()</td></tr><tr><td>[1, 2, 3, 4]</td><td>[ ]</td></tr></tbody></table><h3>Block statement</h3><p>This mutator removes the content of every block statement. For example the code:</p><pre><code>function saySomething() {
console.log('Hello world!');
}</code></pre><p>becomes:</p><pre><code>function saySomething() {
}</code></pre></div></div><footer class="navbar navbar-footer"><div class="container"><p class="navbar-text">Stryker is released under the Apache 2.0 license. Site by Nico Jansen, Simon de Lang and Alex van Assem. Logo by Selina van den Top.</p></div></footer><script src="/javascripts/jquery-2.2.4.min.js"></script><script src="/stylesheets/bootstrap/js/bootstrap.min.js"></script><script src="/stylesheets/highlightjs/highlight.pack.js"></script><script src="/javascripts/main.js"></script><script>hljs.initHighlightingOnLoad();</script><script>(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-104444094-1', 'auto');
ga('send', 'pageview');</script><div class="gitter-open-chat-button">Need help?</div><script>((window.gitter = {}).chat = {}).options = { room: 'stryker-mutator/stryker', activationElement: '.gitter-open-chat-button' };</script><script async defer src="https://sidecar.gitter.im/dist/sidecar.v1.js"></script></div></body></html>