// from QUnit homepage and api documentation.
QUnit.test("hello test", function (assert) {
assert.ok(1 == "1", "Passed!");
});
// http://api.qunitjs.com/equal/
QUnit.test("equal test", function (assert) {
assert.equal(1, "1", "String '1' and number 1 have the same value");
assert.equal(1, 1.000000000000000000001, "Number 1, Floating 1.0...01 have the same value");
assert.equal(0, 0, "Zero, Zero; equal succeeds");
assert.equal("", 0, "Empty, Zero; equal succeeds");
assert.equal("", "", "Empty, Empty; equal succeeds");
assert.equal(null, undefined, "null, undefined; equal succeeds");
assert.equal(false, [], "false, empty Array; equal suceeds");
});
// http://api.qunitjs.com/notEqual/
QUnit.test("notEqual test", function (assert) {
assert.notEqual(1, "2", "String '2' and number 1 don't have the same value");
assert.notEqual(1, 1.000001, "Number 1, Floating 1.0...01 don't have the same value");
assert.notEqual("three", 3, "String 'three' is not equal to number 3");
assert.notEqual(null, false, "null is not equal to false");
assert.notEqual(true, {}, "true is not equal to empty Object");
assert.notEqual(false, {}, "false is not equal to empty Object");
});
// http://api.qunitjs.com/ok/
QUnit.test("ok test", function (assert) {
assert.ok(true, "true succeeds");
assert.ok(1, "Number 1 succeeds");
assert.ok(0.001, "Number 0.001 succeeds");
assert.ok(-1, "Number minus 1 succeeds");
assert.ok("non-empty", "non-empty string succeeds");
assert.ok(!(false), "false fails");
assert.ok(!(0), "0 fails");
assert.ok(!(NaN), "NaN fails");
assert.ok(!(""), "empty string fails");
assert.ok(!(null), "null fails");
assert.ok(!(undefined), "undefined fails");
});
// http://api.qunitjs.com/notStrictEqual/
QUnit.test("notStrictEqual test", function (assert) {
assert.notStrictEqual(1, "1", "String '1' and number 1 have the same value but not the same type");
...
Please Whitelist JSFiddle in your content blocker.
Help keep JSFiddle free for always by one of two ways:
Whitelist JSFiddle in your content blocker (two clicks)
Go PRO and get access to additional PRO features →
Join the 4+ million users, and keep the JSFiddle dream alive.
Ad-free
All ads in the editor and listing pages are turned completely off.
Fiddle Pages
Your fiddles accessible under a custom domain and a vanity path - the simplest hosting for your personal project.
Use pre-released features
You get to try and use features (like the Palette Color Generator) months before everyone else.
Fiddle collections
Sort and categorize your Fiddles into multiple collections.
Private collections and fiddles
You can make as many Private Fiddles, and Private Collections as you wish!
Get Fiddle Pages with PRO
Your fiddles accessible under a custom domain and a vanity path - the simplest hosting for your personal project.