Skip to content
Browse files

Ensure that create_idx_expr is tested like create_index_expression

  • Loading branch information...
1 parent 0da30b7 commit e7be46f6529ecb0e261b699559c70925fbdb55c7 @mcmire committed Aug 5, 2012
Showing with 43 additions and 0 deletions.
  1. +43 −0 test/cassandra_test.rb
View
43 test/cassandra_test.rb
@@ -996,6 +996,14 @@ def test_create_index_expression
assert_equal 'x', ie.value
assert_equal CassandraThrift::IndexOperator::EQ, ie.op
end
+ # alias
+ [nil, "EQ", "eq", "=="].each do |op|
+ ie = @twitter.create_idx_expr('foo', 'x', op)
+ assert_instance_of CassandraThrift::IndexExpression, ie
+ assert_equal 'foo', ie.column_name
+ assert_equal 'x', ie.value
+ assert_equal CassandraThrift::IndexOperator::EQ, ie.op
+ end
# GTE operator
["GTE", "gte", ">="].each do |op|
@@ -1005,6 +1013,14 @@ def test_create_index_expression
assert_equal 'x', ie.value
assert_equal CassandraThrift::IndexOperator::GTE, ie.op
end
+ # alias
+ ["GTE", "gte", ">="].each do |op|
+ ie = @twitter.create_idx_expr('foo', 'x', op)
+ assert_instance_of CassandraThrift::IndexExpression, ie
+ assert_equal 'foo', ie.column_name
+ assert_equal 'x', ie.value
+ assert_equal CassandraThrift::IndexOperator::GTE, ie.op
+ end
# GT operator
["GT", "gt", ">"].each do |op|
@@ -1014,6 +1030,14 @@ def test_create_index_expression
assert_equal 'x', ie.value
assert_equal CassandraThrift::IndexOperator::GT, ie.op
end
+ # alias
+ ["GT", "gt", ">"].each do |op|
+ ie = @twitter.create_idx_expr('foo', 'x', op)
+ assert_instance_of CassandraThrift::IndexExpression, ie
+ assert_equal 'foo', ie.column_name
+ assert_equal 'x', ie.value
+ assert_equal CassandraThrift::IndexOperator::GT, ie.op
+ end
# LTE operator
["LTE", "lte", "<="].each do |op|
@@ -1023,6 +1047,14 @@ def test_create_index_expression
assert_equal 'x', ie.value
assert_equal CassandraThrift::IndexOperator::LTE, ie.op
end
+ # alias
+ ["LTE", "lte", "<="].each do |op|
+ ie = @twitter.create_idx_expr('foo', 'x', op)
+ assert_instance_of CassandraThrift::IndexExpression, ie
+ assert_equal 'foo', ie.column_name
+ assert_equal 'x', ie.value
+ assert_equal CassandraThrift::IndexOperator::LTE, ie.op
+ end
# LT operator
["LT", "lt", "<"].each do |op|
@@ -1032,10 +1064,21 @@ def test_create_index_expression
assert_equal 'x', ie.value
assert_equal CassandraThrift::IndexOperator::LT, ie.op
end
+ # alias
+ ["LT", "lt", "<"].each do |op|
+ ie = @twitter.create_idx_expr('foo', 'x', op)
+ assert_instance_of CassandraThrift::IndexExpression, ie
+ assert_equal 'foo', ie.column_name
+ assert_equal 'x', ie.value
+ assert_equal CassandraThrift::IndexOperator::LT, ie.op
+ end
# unknown operator
ie = @twitter.create_index_expression('foo', 'x', '~$')
assert_equal nil, ie.op
+ # alias
+ ie = @twitter.create_idx_expr('foo', 'x', '~$')
+ assert_equal nil, ie.op
end
def test_column_family_mutation

0 comments on commit e7be46f

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