Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'node_modules/chroma-js/test/analyze-test.coffee')
-rw-r--r--node_modules/chroma-js/test/analyze-test.coffee42
1 files changed, 42 insertions, 0 deletions
diff --git a/node_modules/chroma-js/test/analyze-test.coffee b/node_modules/chroma-js/test/analyze-test.coffee
new file mode 100644
index 0000000000..b5c4d080c7
--- /dev/null
+++ b/node_modules/chroma-js/test/analyze-test.coffee
@@ -0,0 +1,42 @@
+require 'es6-shim'
+vows = require 'vows'
+assert = require 'assert'
+chroma = require '../chroma'
+
+vows
+ .describe('Some tests for chroma.analyze()')
+
+ .addBatch
+ 'analyze an array of numbers':
+ topic: -> chroma.analyze [1,2,2,3,4,5]
+ 'sum is 17': (topic) -> assert.equal topic.sum, 17
+ 'count is 6': (topic) -> assert.equal topic.count, 6
+ 'maximum is 5': (topic) -> assert.equal topic.max, 5
+ 'minumum is 1': (topic) -> assert.equal topic.min, 1
+ 'domain is [1,5]': (topic) -> assert.deepEqual topic.domain, [1,5]
+
+ 'analyze an object of numbers':
+ topic: -> chroma.analyze {a: 1, b: 2, c: 2, d: 3, e: 4, f: 5}
+ 'sum is 17': (topic) -> assert.equal topic.sum, 17
+ 'count is 6': (topic) -> assert.equal topic.count, 6
+ 'maximum is 5': (topic) -> assert.equal topic.max, 5
+ 'minumum is 1': (topic) -> assert.equal topic.min, 1
+ 'domain is [1,5]': (topic) -> assert.deepEqual topic.domain, [1,5]
+
+ 'analyze an array of objects':
+ topic: -> chroma.analyze [{ k: 1 }, { k: 2 }, { k: 2 }, { k: 3 }, { k: 4 }, { k: 5 }], 'k'
+ 'sum is 17': (topic) -> assert.equal topic.sum, 17
+ 'count is 6': (topic) -> assert.equal topic.count, 6
+ 'maximum is 5': (topic) -> assert.equal topic.max, 5
+ 'minumum is 1': (topic) -> assert.equal topic.min, 1
+ 'domain is [1,5]': (topic) -> assert.deepEqual topic.domain, [1,5]
+
+ 'analyze an object of objects':
+ topic: -> chroma.analyze { a: { k: 1 }, b: { k: 2 }, c: { k: 2 }, d: { k: 3 }, e: { k: 4 }, f: { k: 5 }}, 'k'
+ 'sum is 17': (topic) -> assert.equal topic.sum, 17
+ 'count is 6': (topic) -> assert.equal topic.count, 6
+ 'maximum is 5': (topic) -> assert.equal topic.max, 5
+ 'minumum is 1': (topic) -> assert.equal topic.min, 1
+ 'domain is [1,5]': (topic) -> assert.deepEqual topic.domain, [1,5]
+
+ .export(module) \ No newline at end of file