Skip to content
This repository
Browse code

add (failing) tests for negative integers in CQL3

  • Loading branch information...
commit 581aa1758f181d42902a2d9a06a1039a133ecf3e 1 parent 154790c
Pieter Bos authored
20  test/cql3.js
@@ -221,6 +221,26 @@ module.exports = {
221 221
     assert.strictEqual(res[0].get('body').value, 'body text 1');
222 222
     assert.strictEqual(res[0].get('posted_by').value, 'author1');
223 223
   }),
  224
+  
  225
+  'test cql integers CF create column family':testResultless(config['integers_create_cf#cql']),
  226
+  'test cql integers CF update 1':testResultless(config['integers_update#cql'], config['integers_update#vals1']),
  227
+  'test cql integers CF update 2':testResultless(config['integers_update#cql'], config['integers_update#vals2']),
  228
+  'test cql integers CF select positive numbers':testCql(config['integers_select1#cql'], function(test, assert, err, res){
  229
+    assert.strictEqual(res.length, 1);
  230
+    assert.ok(res[0] instanceof Helenus.Row);
  231
+    assert.strictEqual(res[0].length, 3);
  232
+    assert.strictEqual(res[0].get('number').value, 1);
  233
+    assert.strictEqual(res[0].get('longnumber').value, 25);
  234
+    assert.strictEqual(res[0].get('varnumber').value, 36);
  235
+  }),
  236
+  'test cql integers CF select negative numbers':testCql(config['integers_select2#cql'], function(test, assert, err, res){
  237
+    assert.strictEqual(res.length, 1);
  238
+    assert.ok(res[0] instanceof Helenus.Row);
  239
+    assert.strictEqual(res[0].length, 3);
  240
+    assert.strictEqual(res[0].get('number').value, -1);
  241
+    assert.strictEqual(res[0].get('longnumber').value, -25);
  242
+    assert.strictEqual(res[0].get('varnumber').value, -36);
  243
+  }),
224 244
 
225 245
   'test cql drop keyspace':testResultless(config['drop_ks#cql']),
226 246
 
8  test/helpers/cql3.json
@@ -40,6 +40,14 @@
40 40
   "sparse_update#vals3"  : ["body text 3", "author3", 10, "2012-03-02 00:00:00+0000"],
41 41
   "sparse_select1#cql"   : "SELECT posted_at, body, posted_by FROM timeline WHERE userid = 10 AND posted_at > '2012-03-01 00:00:00+0000'",
42 42
   "sparse_select2#cql"   : "SELECT body, posted_by FROM timeline WHERE userid = 10 AND posted_at = '2012-03-01 00:00:00+0000'",
  43
+  
  44
+  "integers_create_cf#cql"    : "CREATE TABLE integers (number int, longnumber bigint, varnumber varint, PRIMARY KEY (number))",
  45
+  "integers_update#cql"       : "UPDATE integers set longnumber = ?, varnumber = ? where number = ?",
  46
+  "integers_update#vals1"     : [25, 36, 1],
  47
+  "integers_update#vals2"     : [-25, -36, -1],  
  48
+  "integers_select1#cql"      : "SELECT * FROM integers where number = 1",
  49
+  "integers_select2#cql"      : "SELECT * FROM integers where number = -1",
  50
+  
43 51
 
44 52
   "prepare#cql"   : "SELECT * FROM ? WHERE KEY = ?",
45 53
   "error#cql"     : "SOME INVALID CQL"

0 notes on commit 581aa17

Please sign in to comment.
Something went wrong with that request. Please try again.