~ubuntu-branches/ubuntu/precise/whoopsie-daisy/precise-proposed

« back to all changes in this revision

Viewing changes to backend/stats/static/js/d3/test/core/ascending-test.js

  • Committer: Package Import Robot
  • Author(s): Evan Dandrea
  • Date: 2012-04-10 14:28:58 UTC
  • Revision ID: package-import@ubuntu.com-20120410142858-nk453o1z7t7py3bs
Tags: 0.1.26
* Take ownership of the NetworkManager state variant on setup and
  unref it, plugging a memory leak.
* Log the reason the server rejected the submitted crash report.
* Send the Whoopsie version with each crash submission.
* Delete both .upload and .uploaded files after 14 days. Thanks
  Marc Deslauriers (LP: #973687).

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
require("../env");
 
2
 
 
3
var vows = require("vows"),
 
4
    assert = require("assert");
 
5
 
 
6
var suite = vows.describe("d3.ascending");
 
7
 
 
8
suite.addBatch({
 
9
  "numbers": {
 
10
    "returns a negative number if a < b": function() {
 
11
      assert.isTrue(d3.ascending(0, 1) < 0);
 
12
    },
 
13
    "returns a positive number if a > b": function() {
 
14
      assert.isTrue(d3.ascending(1, 0) > 0);
 
15
    },
 
16
    "returns zero if a == b": function() {
 
17
      assert.equal(d3.ascending(0, 0), 0);
 
18
    },
 
19
    "returns NaN if a or b is undefined": function() {
 
20
      assert.isNaN(d3.ascending(0, undefined));
 
21
      assert.isNaN(d3.ascending(undefined, 0));
 
22
      assert.isNaN(d3.ascending(undefined, undefined));
 
23
    },
 
24
    "returns NaN if a or b is NaN": function() {
 
25
      assert.isNaN(d3.ascending(0, NaN));
 
26
      assert.isNaN(d3.ascending(NaN, 0));
 
27
      assert.isNaN(d3.ascending(NaN, NaN));
 
28
    }
 
29
  }
 
30
});
 
31
 
 
32
suite.addBatch({
 
33
  "strings": {
 
34
    "returns a negative number if a < b": function() {
 
35
      assert.isTrue(d3.ascending("a", "b") < 0);
 
36
    },
 
37
    "returns a positive number if a > b": function() {
 
38
      assert.isTrue(d3.ascending("b", "a") > 0);
 
39
    },
 
40
    "returns zero if a == b": function() {
 
41
      assert.equal(d3.ascending("a", "a"), 0);
 
42
    }
 
43
  }
 
44
});
 
45
 
 
46
suite.export(module);