From c209fd3e6ce74aa52470a31d40bdb21b0ba2c0f8 Mon Sep 17 00:00:00 2001 From: Derek Chiang Date: Tue, 3 Feb 2015 19:55:46 -0500 Subject: [PATCH 1/7] Successfully generating tests for Rust --- maint/generate-bindings-tests.py | 192 ++++++++++++++++++ test/rust/.Basic.rs.swp | Bin 0 -> 12288 bytes test/rust/Basic.rs | 75 +++++++ test/rust/BasicSearch.rs | 33 +++ test/rust/CondPut.rs | 63 ++++++ test/rust/DataTypeFloat.rs | 41 ++++ test/rust/DataTypeInt.rs | 101 +++++++++ test/rust/DataTypeListFloat.rs | 56 +++++ test/rust/DataTypeListInt.rs | 56 +++++ test/rust/DataTypeListString.rs | 56 +++++ test/rust/DataTypeMapFloatFloat.rs | 56 +++++ test/rust/DataTypeMapFloatInt.rs | 56 +++++ test/rust/DataTypeMapFloatString.rs | 56 +++++ test/rust/DataTypeMapIntFloat.rs | 56 +++++ test/rust/DataTypeMapIntInt.rs | 56 +++++ test/rust/DataTypeMapIntString.rs | 56 +++++ test/rust/DataTypeMapStringFloat.rs | 56 +++++ test/rust/DataTypeMapStringInt.rs | 56 +++++ test/rust/DataTypeMapStringString.rs | 56 +++++ test/rust/DataTypeSetFloat.rs | 56 +++++ test/rust/DataTypeSetInt.rs | 56 +++++ test/rust/DataTypeSetString.rs | 56 +++++ test/rust/DataTypeString.rs | 56 +++++ test/rust/LengthString.rs | 64 ++++++ test/rust/MultiAttribute.rs | 58 ++++++ test/rust/RangeSearchInt.rs | 76 +++++++ test/rust/RangeSearchString.rs | 76 +++++++ test/rust/RegexSearch.rs | 158 ++++++++++++++ test/sh/bindings.rust.Basic.sh | 5 + test/sh/bindings.rust.BasicSearch.sh | 5 + test/sh/bindings.rust.CondPut.sh | 5 + test/sh/bindings.rust.DataTypeFloat.sh | 5 + test/sh/bindings.rust.DataTypeInt.sh | 5 + test/sh/bindings.rust.DataTypeListFloat.sh | 5 + test/sh/bindings.rust.DataTypeListInt.sh | 5 + test/sh/bindings.rust.DataTypeListString.sh | 5 + .../sh/bindings.rust.DataTypeMapFloatFloat.sh | 5 + test/sh/bindings.rust.DataTypeMapFloatInt.sh | 5 + .../bindings.rust.DataTypeMapFloatString.sh | 5 + test/sh/bindings.rust.DataTypeMapIntFloat.sh | 5 + test/sh/bindings.rust.DataTypeMapIntInt.sh | 5 + test/sh/bindings.rust.DataTypeMapIntString.sh | 5 + .../bindings.rust.DataTypeMapStringFloat.sh | 5 + test/sh/bindings.rust.DataTypeMapStringInt.sh | 5 + .../bindings.rust.DataTypeMapStringString.sh | 5 + test/sh/bindings.rust.DataTypeSetFloat.sh | 5 + test/sh/bindings.rust.DataTypeSetInt.sh | 5 + test/sh/bindings.rust.DataTypeSetString.sh | 5 + test/sh/bindings.rust.DataTypeString.sh | 5 + test/sh/bindings.rust.LengthString.sh | 5 + test/sh/bindings.rust.MultiAttribute.sh | 5 + test/sh/bindings.rust.RangeSearchInt.sh | 5 + test/sh/bindings.rust.RangeSearchString.sh | 5 + test/sh/bindings.rust.RegexSearch.sh | 5 + 54 files changed, 1963 insertions(+) create mode 100644 test/rust/.Basic.rs.swp create mode 100644 test/rust/Basic.rs create mode 100644 test/rust/BasicSearch.rs create mode 100644 test/rust/CondPut.rs create mode 100644 test/rust/DataTypeFloat.rs create mode 100644 test/rust/DataTypeInt.rs create mode 100644 test/rust/DataTypeListFloat.rs create mode 100644 test/rust/DataTypeListInt.rs create mode 100644 test/rust/DataTypeListString.rs create mode 100644 test/rust/DataTypeMapFloatFloat.rs create mode 100644 test/rust/DataTypeMapFloatInt.rs create mode 100644 test/rust/DataTypeMapFloatString.rs create mode 100644 test/rust/DataTypeMapIntFloat.rs create mode 100644 test/rust/DataTypeMapIntInt.rs create mode 100644 test/rust/DataTypeMapIntString.rs create mode 100644 test/rust/DataTypeMapStringFloat.rs create mode 100644 test/rust/DataTypeMapStringInt.rs create mode 100644 test/rust/DataTypeMapStringString.rs create mode 100644 test/rust/DataTypeSetFloat.rs create mode 100644 test/rust/DataTypeSetInt.rs create mode 100644 test/rust/DataTypeSetString.rs create mode 100644 test/rust/DataTypeString.rs create mode 100644 test/rust/LengthString.rs create mode 100644 test/rust/MultiAttribute.rs create mode 100644 test/rust/RangeSearchInt.rs create mode 100644 test/rust/RangeSearchString.rs create mode 100644 test/rust/RegexSearch.rs create mode 100755 test/sh/bindings.rust.Basic.sh create mode 100755 test/sh/bindings.rust.BasicSearch.sh create mode 100755 test/sh/bindings.rust.CondPut.sh create mode 100755 test/sh/bindings.rust.DataTypeFloat.sh create mode 100755 test/sh/bindings.rust.DataTypeInt.sh create mode 100755 test/sh/bindings.rust.DataTypeListFloat.sh create mode 100755 test/sh/bindings.rust.DataTypeListInt.sh create mode 100755 test/sh/bindings.rust.DataTypeListString.sh create mode 100755 test/sh/bindings.rust.DataTypeMapFloatFloat.sh create mode 100755 test/sh/bindings.rust.DataTypeMapFloatInt.sh create mode 100755 test/sh/bindings.rust.DataTypeMapFloatString.sh create mode 100755 test/sh/bindings.rust.DataTypeMapIntFloat.sh create mode 100755 test/sh/bindings.rust.DataTypeMapIntInt.sh create mode 100755 test/sh/bindings.rust.DataTypeMapIntString.sh create mode 100755 test/sh/bindings.rust.DataTypeMapStringFloat.sh create mode 100755 test/sh/bindings.rust.DataTypeMapStringInt.sh create mode 100755 test/sh/bindings.rust.DataTypeMapStringString.sh create mode 100755 test/sh/bindings.rust.DataTypeSetFloat.sh create mode 100755 test/sh/bindings.rust.DataTypeSetInt.sh create mode 100755 test/sh/bindings.rust.DataTypeSetString.sh create mode 100755 test/sh/bindings.rust.DataTypeString.sh create mode 100755 test/sh/bindings.rust.LengthString.sh create mode 100755 test/sh/bindings.rust.MultiAttribute.sh create mode 100755 test/sh/bindings.rust.RangeSearchInt.sh create mode 100755 test/sh/bindings.rust.RangeSearchString.sh create mode 100755 test/sh/bindings.rust.RegexSearch.sh diff --git a/maint/generate-bindings-tests.py b/maint/generate-bindings-tests.py index 4418b803d..30a5a244e 100644 --- a/maint/generate-bindings-tests.py +++ b/maint/generate-bindings-tests.py @@ -759,6 +759,198 @@ def to_go(self, x): else: raise RuntimeError("Cannot convert {0!r} to go".format(x)) + +class RustGenerator(BindingGenerator): + def __init__(self): + self.f = None + + def test(self, name, space): + assert self.f is None + self.count = 0 + self.path = 'test/rust/{0}.rs'.format(name) + precmd = 'rustc --out-dir "${{HYPERDEX_BUILDDIR}}"/test/rust -o {0} "${{HYPERDEX_SRCDIR}}"/test/rust/{0}.rs'.format(name) + cmd = '"${{HYPERDEX_BUILDDIR}}"/{0}'.format(name) + gen_shell('rust', name, cmd, space, precmd=precmd) + self.f = open(self.path, 'w') + self.f.write(''' +extern crate hyperdex; + +use std::os; + +use hyperdex::{Client, NewHyperObject}; + +fn main() { + let args = os::args(); + let mut client = Client::new(from_str(format!("{}:{}", args[1], args[2])).unwrap()).unwrap(); +''') + + def finish(self): + self.f.write('}\n') + self.f.flush() + self.f.close() + self.f = None + + def get(self, space, key, expected): + self.f.write('let expected = {0};'.format(self.to_rust(expected))) + if expected is None: + self.f.write(''' + match client.get({0}, {1}) {{ + Ok(obj) => {{ + panic!("this object should not be found!"); + }}, + Err(err) => (), + }} + '''.format(self.to_rust(space), self.to_rust(key))) + else: + self.f.write(''' + match client.get({0}, {1}) {{ + Ok(obj) => {{ + if obj != expected {{ + panic!("expected: {{:?}}\nactual: {{:?}}", expected, obj); + }} + }}, + Err(err) => panic!(err), + }} + '''.format(self.to_rust(space), self.to_rust(key))) + + def get_partial(self, space, key, attrs, expected): + self.f.write('let expected = {0};'.format(self.to_rust(expected))) + if expected is None: + self.f.write(''' + match client.get_partial({0}, {1}, {2}) {{ + Ok(obj) => {{ + panic!("this object should not be found!"); + }}, + Err(err) => (), + }} + '''.format(self.to_rust(space), self.to_rust(key), self.to_rust(attrs))) + else: + self.f.write(''' + match client.get_partial({0}, {1}, {2}) {{ + Ok(obj) => {{ + if obj != expected {{ + panic!("expected: {{:?}}\nactual: {{:?}}", expected, obj); + }} + }}, + Err(err) => panic!(err), + }} + '''.format(self.to_rust(space), self.to_rust(key), self.to_rust(attrs))) + + def put(self, space, key, value, expected): + if expected: + self.f.write(''' + match client.put({0}, {1}, {2}) {{ + Ok(()) => (), + Err(err) => panic!(err), + }} + '''.format(self.to_rust(space), self.to_rust(key), self.to_rust(value))) + else: + self.f.write(''' + match client.put({0}, {1}, {2}) {{ + Ok(()) => panic!("this PUT operation should have failed"), + Err(err) => (), + }} + '''.format(self.to_rust(space), self.to_rust(key), self.to_rust(value))) + + def cond_put(self, space, key, pred, value, expected): + if expected: + self.f.write(''' + match client.cond_put({0}, {1}, {2}, {3}) {{ + Ok(()) => (), + Err(err) => panic!(err), + }} + '''.format(self.to_rust(space), self.to_rust(key), self.to_rust(pred), self.to_rust(value))) + else: + self.f.write(''' + match client.put({0}, {1}, {2}, {3}) {{ + Ok(()) => panic!("this CONDPUT operation should have failed"), + Err(err) => (), + }} + '''.format(self.to_rust(space), self.to_rust(key), self.to_rust(pred), self.to_rust(value))) + + def delete(self, space, key, expected): + self.f.write(''' + match client.del({0}, {1}) {{ + Ok(()) => (), + Err(err) => panic!(err), + }} + '''.format(self.to_rust(space), self.to_rust(key))) + + def search(self, space, pred, expected): + self.f.write(''' + let res = client.search({0}, {1}); + let elems = res.iter().collect(); + assert!(elems.len() == {2}.len()); + '''.format(self.to_rust(space), self.to_preds(pred), self.to_rust(expected))) + + def to_preds(self, preds): + preds_as_strs = [] + for name, val in preds.iteritems(): + pred = 'EQUALS' + if isinstance(val, Range): + preds_as_strs.append('HyperPredicate::new({0}, {1}, {2})'.format(self.to_rust(name), self.to_rust(val.x), 'GREATER_EQUAL')) + preds_as_strs.append('HyperPredicate::new({0}, {1}, {2})'.format(self.to_rust(name), self.to_rust(val.y), 'LESS_EQUAL')) + continue + elif isinstance(val, LessEqual): + val = val.x + pred = 'LESS_EQUAL' + elif isinstance(val, GreaterEqual): + val = val.x + pred = 'GREATER_EQUAL' + elif isinstance(val, LessThan): + val = val.x + pred = 'LESS_THAN' + elif isinstance(val, GreaterThan): + val = val.x + pred = 'GREATER_THAN' + elif isinstance(val, Regex): + val = val.x + pred = 'REGEX' + elif isinstance(val, LengthEquals): + val = val.x + pred = 'LENGTH_EQUALS' + elif isinstance(val, LengthLessEqual): + val = val.x + pred = 'LENGTH_LESS_EQUAL' + elif isinstance(val, LengthGreaterEqual): + val = val.x + pred = 'LENGTH_GREATER_EQUAL' + preds_as_strs.append('HyperPredicate::new({0}, {1}, {2})'.format(self.to_rust(name), pred, self.to_rust(val))) + return 'vec!(' + ', '.join(preds_as_strs) + ')' + + def to_rust(self, x): + if x is True: + return 'true' + elif x is False: + return 'false' + elif x is None: + return 'nil' + elif isinstance(x, str): + return double_quote(x) + elif isinstance(x, long) or isinstance(x, int): + return '%s as i64' % str(x) + elif isinstance(x, float): + return '%s as f64' % str(x) + elif isinstance(x, list): + s = 'vec!(' + s += ', '.join(['{0}'.format(self.to_rust(v)) for v in x]) + s += ');' + return s + elif isinstance(x, set): + s = 'BTreeSet::from_iter(vec!(' + s += ', '.join(['{0}'.format(self.to_rust(v)) for v in sorted(x)]) + s += ').iter());' + return s + elif isinstance(x, dict): + s = 'NewHyperObject!(' + s += ', '.join(['{0}, {1}'.format(self.to_rust(k), self.to_rust(v)) + for k, v in sorted(x.items())]) + s += ')' + return s + else: + raise RuntimeError("Cannot convert {0!r} to rust".format(x)) + + class TestGenerator(object): def __init__(self): diff --git a/test/rust/.Basic.rs.swp b/test/rust/.Basic.rs.swp new file mode 100644 index 0000000000000000000000000000000000000000..f69d39d007d7df8dd8bdad81cd0acd35efefc2ab GIT binary patch literal 12288 zcmeI2O=uHA6vwA3T5GFf@t|0k#;*-F{YXodEmg1;6|wE1iXydab|=l6WH;CfT3(>ES+AMytsaly&huB5ROR7_CFNgE;5-gt>lDeL@xA2Ml>g8Tal<` z1iN1M4SRIk5Iv`^W`r{;aw`>2xL%Kw#pSr>ntHe62K!Q-6d(oGsz4j-kM{LSFMC6s zynV;HwK}B!qyQ;E3XlS%04YEUkOHItDbPR)c$p?Pk9gM=V?I;7H=65Ihfa2cEgyFoMfu?6FS z+aLxez%KB)g|S!QE=YqhFaSEh*UgMAf(38`2yg@(0AHFJdj{?S7mR>?pap!}#Mle) z7(4(4FbxKQ0$RZ$^mz($Km)_z5Rkg<0aQo27A{-~o zhmUe4+{Jv;vP+?Qvu~BrEK~1PLSDjjxgEPAbdS3UJDW1NWqUj(c-+ofMrSBIRMq!* zQb8|&_~TTm~ZxgAa4dOsyWOa^k^B z7bhS!sGKIEQ^HlXSrwWgQq@C~5>?EqG9GF6*D*=s->gW1X}XuyQYz1@#|luZBu$rG zo*Jtlee%*$mO3nXVE$)SE@oUhD zTB6lK@!FXnV_TICnQS0YyLjzDgGnsCFnI}b$xQfmRCjglz{lrkmwXMy@Z{Z8p? zluSXOb;y(kI|h{P3(MQTY)@ys;_(3ogAxB6p{kacQ{s-Do_0M)iQ5joys>@c3u<0& zmzp!T&0?W0f1BM(yn!~s4s;aCi*kI!p_5;&Wi`^Mqq@-O;?2{%HRN%ukDp literal 0 HcmV?d00001 diff --git a/test/rust/Basic.rs b/test/rust/Basic.rs new file mode 100644 index 000000000..a52271e21 --- /dev/null +++ b/test/rust/Basic.rs @@ -0,0 +1,75 @@ + +extern crate hyperdex; + +use std::os; + +use hyperdex::{Client, NewHyperObject}; + +fn main() { + let args = os::args(); + let mut client = Client::new(from_str(format!("{}:{}", args[1], args[2])).unwrap()).unwrap(); +let expected = nil; + match client.get("kv", "k") { + Ok(obj) => { + panic!("this object should not be found!"); + }, + Err(err) => (), + } + + match client.put("kv", "k", NewHyperObject!("v", "v1")) { + Ok(()) => (), + Err(err) => panic!(err), + } + let expected = NewHyperObject!("v", "v1"); + match client.get("kv", "k") { + Ok(obj) => { + if obj != expected { + panic!("expected: {:?} +actual: {:?}", expected, obj); + } + }, + Err(err) => panic!(err), + } + + match client.put("kv", "k", NewHyperObject!("v", "v2")) { + Ok(()) => (), + Err(err) => panic!(err), + } + let expected = NewHyperObject!("v", "v2"); + match client.get("kv", "k") { + Ok(obj) => { + if obj != expected { + panic!("expected: {:?} +actual: {:?}", expected, obj); + } + }, + Err(err) => panic!(err), + } + + match client.put("kv", "k", NewHyperObject!("v", "v3")) { + Ok(()) => (), + Err(err) => panic!(err), + } + let expected = NewHyperObject!("v", "v3"); + match client.get("kv", "k") { + Ok(obj) => { + if obj != expected { + panic!("expected: {:?} +actual: {:?}", expected, obj); + } + }, + Err(err) => panic!(err), + } + + match client.del("kv", "k") { + Ok(()) => (), + Err(err) => panic!(err), + } + let expected = nil; + match client.get("kv", "k") { + Ok(obj) => { + panic!("this object should not be found!"); + }, + Err(err) => (), + } + } diff --git a/test/rust/BasicSearch.rs b/test/rust/BasicSearch.rs new file mode 100644 index 000000000..4a9d51498 --- /dev/null +++ b/test/rust/BasicSearch.rs @@ -0,0 +1,33 @@ + +extern crate hyperdex; + +use std::os; + +use hyperdex::{Client, NewHyperObject}; + +fn main() { + let args = os::args(); + let mut client = Client::new(from_str(format!("{}:{}", args[1], args[2])).unwrap()).unwrap(); + + let res = client.search("kv", vec!(HyperPredicate::new("v", EQUALS, "v1"))); + let elems = res.iter().collect(); + assert!(elems.len() == BTreeSet::from_iter(vec!().iter());.len()); + + match client.put("kv", "k1", NewHyperObject!("v", "v1")) { + Ok(()) => (), + Err(err) => panic!(err), + } + + let res = client.search("kv", vec!(HyperPredicate::new("v", EQUALS, "v1"))); + let elems = res.iter().collect(); + assert!(elems.len() == vec!(NewHyperObject!("k", "k1", "v", "v1"));.len()); + + match client.put("kv", "k2", NewHyperObject!("v", "v1")) { + Ok(()) => (), + Err(err) => panic!(err), + } + + let res = client.search("kv", vec!(HyperPredicate::new("v", EQUALS, "v1"))); + let elems = res.iter().collect(); + assert!(elems.len() == vec!(NewHyperObject!("k", "k1", "v", "v1"), NewHyperObject!("k", "k2", "v", "v1"));.len()); + } diff --git a/test/rust/CondPut.rs b/test/rust/CondPut.rs new file mode 100644 index 000000000..71842a712 --- /dev/null +++ b/test/rust/CondPut.rs @@ -0,0 +1,63 @@ + +extern crate hyperdex; + +use std::os; + +use hyperdex::{Client, NewHyperObject}; + +fn main() { + let args = os::args(); + let mut client = Client::new(from_str(format!("{}:{}", args[1], args[2])).unwrap()).unwrap(); +let expected = nil; + match client.get("kv", "k") { + Ok(obj) => { + panic!("this object should not be found!"); + }, + Err(err) => (), + } + + match client.put("kv", "k", NewHyperObject!("v", "v1")) { + Ok(()) => (), + Err(err) => panic!(err), + } + let expected = NewHyperObject!("v", "v1"); + match client.get("kv", "k") { + Ok(obj) => { + if obj != expected { + panic!("expected: {:?} +actual: {:?}", expected, obj); + } + }, + Err(err) => panic!(err), + } + + match client.put("kv", "k", NewHyperObject!("v", "v2"), NewHyperObject!("v", "v3")) { + Ok(()) => panic!("this CONDPUT operation should have failed"), + Err(err) => (), + } + let expected = NewHyperObject!("v", "v1"); + match client.get("kv", "k") { + Ok(obj) => { + if obj != expected { + panic!("expected: {:?} +actual: {:?}", expected, obj); + } + }, + Err(err) => panic!(err), + } + + match client.cond_put("kv", "k", NewHyperObject!("v", "v1"), NewHyperObject!("v", "v3")) { + Ok(()) => (), + Err(err) => panic!(err), + } + let expected = NewHyperObject!("v", "v3"); + match client.get("kv", "k") { + Ok(obj) => { + if obj != expected { + panic!("expected: {:?} +actual: {:?}", expected, obj); + } + }, + Err(err) => panic!(err), + } + } diff --git a/test/rust/DataTypeFloat.rs b/test/rust/DataTypeFloat.rs new file mode 100644 index 000000000..732e5be1f --- /dev/null +++ b/test/rust/DataTypeFloat.rs @@ -0,0 +1,41 @@ + +extern crate hyperdex; + +use std::os; + +use hyperdex::{Client, NewHyperObject}; + +fn main() { + let args = os::args(); + let mut client = Client::new(from_str(format!("{}:{}", args[1], args[2])).unwrap()).unwrap(); + + match client.put("kv", "k", NewHyperObject!()) { + Ok(()) => (), + Err(err) => panic!(err), + } + let expected = NewHyperObject!("v", 0.0 as f64); + match client.get("kv", "k") { + Ok(obj) => { + if obj != expected { + panic!("expected: {:?} +actual: {:?}", expected, obj); + } + }, + Err(err) => panic!(err), + } + + match client.put("kv", "k", NewHyperObject!("v", 3.14 as f64)) { + Ok(()) => (), + Err(err) => panic!(err), + } + let expected = NewHyperObject!("v", 3.14 as f64); + match client.get("kv", "k") { + Ok(obj) => { + if obj != expected { + panic!("expected: {:?} +actual: {:?}", expected, obj); + } + }, + Err(err) => panic!(err), + } + } diff --git a/test/rust/DataTypeInt.rs b/test/rust/DataTypeInt.rs new file mode 100644 index 000000000..0ca12deef --- /dev/null +++ b/test/rust/DataTypeInt.rs @@ -0,0 +1,101 @@ + +extern crate hyperdex; + +use std::os; + +use hyperdex::{Client, NewHyperObject}; + +fn main() { + let args = os::args(); + let mut client = Client::new(from_str(format!("{}:{}", args[1], args[2])).unwrap()).unwrap(); + + match client.put("kv", "k", NewHyperObject!()) { + Ok(()) => (), + Err(err) => panic!(err), + } + let expected = NewHyperObject!("v", 0 as i64); + match client.get("kv", "k") { + Ok(obj) => { + if obj != expected { + panic!("expected: {:?} +actual: {:?}", expected, obj); + } + }, + Err(err) => panic!(err), + } + + match client.put("kv", "k", NewHyperObject!("v", 1 as i64)) { + Ok(()) => (), + Err(err) => panic!(err), + } + let expected = NewHyperObject!("v", 1 as i64); + match client.get("kv", "k") { + Ok(obj) => { + if obj != expected { + panic!("expected: {:?} +actual: {:?}", expected, obj); + } + }, + Err(err) => panic!(err), + } + + match client.put("kv", "k", NewHyperObject!("v", -1 as i64)) { + Ok(()) => (), + Err(err) => panic!(err), + } + let expected = NewHyperObject!("v", -1 as i64); + match client.get("kv", "k") { + Ok(obj) => { + if obj != expected { + panic!("expected: {:?} +actual: {:?}", expected, obj); + } + }, + Err(err) => panic!(err), + } + + match client.put("kv", "k", NewHyperObject!("v", 0 as i64)) { + Ok(()) => (), + Err(err) => panic!(err), + } + let expected = NewHyperObject!("v", 0 as i64); + match client.get("kv", "k") { + Ok(obj) => { + if obj != expected { + panic!("expected: {:?} +actual: {:?}", expected, obj); + } + }, + Err(err) => panic!(err), + } + + match client.put("kv", "k", NewHyperObject!("v", 9223372036854775807 as i64)) { + Ok(()) => (), + Err(err) => panic!(err), + } + let expected = NewHyperObject!("v", 9223372036854775807 as i64); + match client.get("kv", "k") { + Ok(obj) => { + if obj != expected { + panic!("expected: {:?} +actual: {:?}", expected, obj); + } + }, + Err(err) => panic!(err), + } + + match client.put("kv", "k", NewHyperObject!("v", -9223372036854775808 as i64)) { + Ok(()) => (), + Err(err) => panic!(err), + } + let expected = NewHyperObject!("v", -9223372036854775808 as i64); + match client.get("kv", "k") { + Ok(obj) => { + if obj != expected { + panic!("expected: {:?} +actual: {:?}", expected, obj); + } + }, + Err(err) => panic!(err), + } + } diff --git a/test/rust/DataTypeListFloat.rs b/test/rust/DataTypeListFloat.rs new file mode 100644 index 000000000..134521ddd --- /dev/null +++ b/test/rust/DataTypeListFloat.rs @@ -0,0 +1,56 @@ + +extern crate hyperdex; + +use std::os; + +use hyperdex::{Client, NewHyperObject}; + +fn main() { + let args = os::args(); + let mut client = Client::new(from_str(format!("{}:{}", args[1], args[2])).unwrap()).unwrap(); + + match client.put("kv", "k", NewHyperObject!()) { + Ok(()) => (), + Err(err) => panic!(err), + } + let expected = NewHyperObject!("v", vec!();); + match client.get("kv", "k") { + Ok(obj) => { + if obj != expected { + panic!("expected: {:?} +actual: {:?}", expected, obj); + } + }, + Err(err) => panic!(err), + } + + match client.put("kv", "k", NewHyperObject!("v", vec!(3.14 as f64, 0.25 as f64, 1.0 as f64);)) { + Ok(()) => (), + Err(err) => panic!(err), + } + let expected = NewHyperObject!("v", vec!(3.14 as f64, 0.25 as f64, 1.0 as f64);); + match client.get("kv", "k") { + Ok(obj) => { + if obj != expected { + panic!("expected: {:?} +actual: {:?}", expected, obj); + } + }, + Err(err) => panic!(err), + } + + match client.put("kv", "k", NewHyperObject!("v", vec!();)) { + Ok(()) => (), + Err(err) => panic!(err), + } + let expected = NewHyperObject!("v", vec!();); + match client.get("kv", "k") { + Ok(obj) => { + if obj != expected { + panic!("expected: {:?} +actual: {:?}", expected, obj); + } + }, + Err(err) => panic!(err), + } + } diff --git a/test/rust/DataTypeListInt.rs b/test/rust/DataTypeListInt.rs new file mode 100644 index 000000000..27a93bcdc --- /dev/null +++ b/test/rust/DataTypeListInt.rs @@ -0,0 +1,56 @@ + +extern crate hyperdex; + +use std::os; + +use hyperdex::{Client, NewHyperObject}; + +fn main() { + let args = os::args(); + let mut client = Client::new(from_str(format!("{}:{}", args[1], args[2])).unwrap()).unwrap(); + + match client.put("kv", "k", NewHyperObject!()) { + Ok(()) => (), + Err(err) => panic!(err), + } + let expected = NewHyperObject!("v", vec!();); + match client.get("kv", "k") { + Ok(obj) => { + if obj != expected { + panic!("expected: {:?} +actual: {:?}", expected, obj); + } + }, + Err(err) => panic!(err), + } + + match client.put("kv", "k", NewHyperObject!("v", vec!(1 as i64, 2 as i64, 3 as i64);)) { + Ok(()) => (), + Err(err) => panic!(err), + } + let expected = NewHyperObject!("v", vec!(1 as i64, 2 as i64, 3 as i64);); + match client.get("kv", "k") { + Ok(obj) => { + if obj != expected { + panic!("expected: {:?} +actual: {:?}", expected, obj); + } + }, + Err(err) => panic!(err), + } + + match client.put("kv", "k", NewHyperObject!("v", vec!();)) { + Ok(()) => (), + Err(err) => panic!(err), + } + let expected = NewHyperObject!("v", vec!();); + match client.get("kv", "k") { + Ok(obj) => { + if obj != expected { + panic!("expected: {:?} +actual: {:?}", expected, obj); + } + }, + Err(err) => panic!(err), + } + } diff --git a/test/rust/DataTypeListString.rs b/test/rust/DataTypeListString.rs new file mode 100644 index 000000000..dc1d563da --- /dev/null +++ b/test/rust/DataTypeListString.rs @@ -0,0 +1,56 @@ + +extern crate hyperdex; + +use std::os; + +use hyperdex::{Client, NewHyperObject}; + +fn main() { + let args = os::args(); + let mut client = Client::new(from_str(format!("{}:{}", args[1], args[2])).unwrap()).unwrap(); + + match client.put("kv", "k", NewHyperObject!()) { + Ok(()) => (), + Err(err) => panic!(err), + } + let expected = NewHyperObject!("v", vec!();); + match client.get("kv", "k") { + Ok(obj) => { + if obj != expected { + panic!("expected: {:?} +actual: {:?}", expected, obj); + } + }, + Err(err) => panic!(err), + } + + match client.put("kv", "k", NewHyperObject!("v", vec!("A", "B", "C");)) { + Ok(()) => (), + Err(err) => panic!(err), + } + let expected = NewHyperObject!("v", vec!("A", "B", "C");); + match client.get("kv", "k") { + Ok(obj) => { + if obj != expected { + panic!("expected: {:?} +actual: {:?}", expected, obj); + } + }, + Err(err) => panic!(err), + } + + match client.put("kv", "k", NewHyperObject!("v", vec!();)) { + Ok(()) => (), + Err(err) => panic!(err), + } + let expected = NewHyperObject!("v", vec!();); + match client.get("kv", "k") { + Ok(obj) => { + if obj != expected { + panic!("expected: {:?} +actual: {:?}", expected, obj); + } + }, + Err(err) => panic!(err), + } + } diff --git a/test/rust/DataTypeMapFloatFloat.rs b/test/rust/DataTypeMapFloatFloat.rs new file mode 100644 index 000000000..b26819b50 --- /dev/null +++ b/test/rust/DataTypeMapFloatFloat.rs @@ -0,0 +1,56 @@ + +extern crate hyperdex; + +use std::os; + +use hyperdex::{Client, NewHyperObject}; + +fn main() { + let args = os::args(); + let mut client = Client::new(from_str(format!("{}:{}", args[1], args[2])).unwrap()).unwrap(); + + match client.put("kv", "k", NewHyperObject!()) { + Ok(()) => (), + Err(err) => panic!(err), + } + let expected = NewHyperObject!("v", NewHyperObject!()); + match client.get("kv", "k") { + Ok(obj) => { + if obj != expected { + panic!("expected: {:?} +actual: {:?}", expected, obj); + } + }, + Err(err) => panic!(err), + } + + match client.put("kv", "k", NewHyperObject!("v", NewHyperObject!(0.25 as f64, 2.0 as f64, 1.0 as f64, 3.0 as f64, 3.14 as f64, 1.0 as f64))) { + Ok(()) => (), + Err(err) => panic!(err), + } + let expected = NewHyperObject!("v", NewHyperObject!(0.25 as f64, 2.0 as f64, 1.0 as f64, 3.0 as f64, 3.14 as f64, 1.0 as f64)); + match client.get("kv", "k") { + Ok(obj) => { + if obj != expected { + panic!("expected: {:?} +actual: {:?}", expected, obj); + } + }, + Err(err) => panic!(err), + } + + match client.put("kv", "k", NewHyperObject!("v", NewHyperObject!())) { + Ok(()) => (), + Err(err) => panic!(err), + } + let expected = NewHyperObject!("v", NewHyperObject!()); + match client.get("kv", "k") { + Ok(obj) => { + if obj != expected { + panic!("expected: {:?} +actual: {:?}", expected, obj); + } + }, + Err(err) => panic!(err), + } + } diff --git a/test/rust/DataTypeMapFloatInt.rs b/test/rust/DataTypeMapFloatInt.rs new file mode 100644 index 000000000..73cfb9c6e --- /dev/null +++ b/test/rust/DataTypeMapFloatInt.rs @@ -0,0 +1,56 @@ + +extern crate hyperdex; + +use std::os; + +use hyperdex::{Client, NewHyperObject}; + +fn main() { + let args = os::args(); + let mut client = Client::new(from_str(format!("{}:{}", args[1], args[2])).unwrap()).unwrap(); + + match client.put("kv", "k", NewHyperObject!()) { + Ok(()) => (), + Err(err) => panic!(err), + } + let expected = NewHyperObject!("v", NewHyperObject!()); + match client.get("kv", "k") { + Ok(obj) => { + if obj != expected { + panic!("expected: {:?} +actual: {:?}", expected, obj); + } + }, + Err(err) => panic!(err), + } + + match client.put("kv", "k", NewHyperObject!("v", NewHyperObject!(0.25 as f64, 2 as i64, 1.0 as f64, 3 as i64, 3.14 as f64, 1 as i64))) { + Ok(()) => (), + Err(err) => panic!(err), + } + let expected = NewHyperObject!("v", NewHyperObject!(0.25 as f64, 2 as i64, 1.0 as f64, 3 as i64, 3.14 as f64, 1 as i64)); + match client.get("kv", "k") { + Ok(obj) => { + if obj != expected { + panic!("expected: {:?} +actual: {:?}", expected, obj); + } + }, + Err(err) => panic!(err), + } + + match client.put("kv", "k", NewHyperObject!("v", NewHyperObject!())) { + Ok(()) => (), + Err(err) => panic!(err), + } + let expected = NewHyperObject!("v", NewHyperObject!()); + match client.get("kv", "k") { + Ok(obj) => { + if obj != expected { + panic!("expected: {:?} +actual: {:?}", expected, obj); + } + }, + Err(err) => panic!(err), + } + } diff --git a/test/rust/DataTypeMapFloatString.rs b/test/rust/DataTypeMapFloatString.rs new file mode 100644 index 000000000..15a373b71 --- /dev/null +++ b/test/rust/DataTypeMapFloatString.rs @@ -0,0 +1,56 @@ + +extern crate hyperdex; + +use std::os; + +use hyperdex::{Client, NewHyperObject}; + +fn main() { + let args = os::args(); + let mut client = Client::new(from_str(format!("{}:{}", args[1], args[2])).unwrap()).unwrap(); + + match client.put("kv", "k", NewHyperObject!()) { + Ok(()) => (), + Err(err) => panic!(err), + } + let expected = NewHyperObject!("v", NewHyperObject!()); + match client.get("kv", "k") { + Ok(obj) => { + if obj != expected { + panic!("expected: {:?} +actual: {:?}", expected, obj); + } + }, + Err(err) => panic!(err), + } + + match client.put("kv", "k", NewHyperObject!("v", NewHyperObject!(0.25 as f64, "Y", 1.0 as f64, "Z", 3.14 as f64, "X"))) { + Ok(()) => (), + Err(err) => panic!(err), + } + let expected = NewHyperObject!("v", NewHyperObject!(0.25 as f64, "Y", 1.0 as f64, "Z", 3.14 as f64, "X")); + match client.get("kv", "k") { + Ok(obj) => { + if obj != expected { + panic!("expected: {:?} +actual: {:?}", expected, obj); + } + }, + Err(err) => panic!(err), + } + + match client.put("kv", "k", NewHyperObject!("v", NewHyperObject!())) { + Ok(()) => (), + Err(err) => panic!(err), + } + let expected = NewHyperObject!("v", NewHyperObject!()); + match client.get("kv", "k") { + Ok(obj) => { + if obj != expected { + panic!("expected: {:?} +actual: {:?}", expected, obj); + } + }, + Err(err) => panic!(err), + } + } diff --git a/test/rust/DataTypeMapIntFloat.rs b/test/rust/DataTypeMapIntFloat.rs new file mode 100644 index 000000000..1daf3cccb --- /dev/null +++ b/test/rust/DataTypeMapIntFloat.rs @@ -0,0 +1,56 @@ + +extern crate hyperdex; + +use std::os; + +use hyperdex::{Client, NewHyperObject}; + +fn main() { + let args = os::args(); + let mut client = Client::new(from_str(format!("{}:{}", args[1], args[2])).unwrap()).unwrap(); + + match client.put("kv", "k", NewHyperObject!()) { + Ok(()) => (), + Err(err) => panic!(err), + } + let expected = NewHyperObject!("v", NewHyperObject!()); + match client.get("kv", "k") { + Ok(obj) => { + if obj != expected { + panic!("expected: {:?} +actual: {:?}", expected, obj); + } + }, + Err(err) => panic!(err), + } + + match client.put("kv", "k", NewHyperObject!("v", NewHyperObject!(1 as i64, 3.14 as f64, 2 as i64, 0.25 as f64, 3 as i64, 1.0 as f64))) { + Ok(()) => (), + Err(err) => panic!(err), + } + let expected = NewHyperObject!("v", NewHyperObject!(1 as i64, 3.14 as f64, 2 as i64, 0.25 as f64, 3 as i64, 1.0 as f64)); + match client.get("kv", "k") { + Ok(obj) => { + if obj != expected { + panic!("expected: {:?} +actual: {:?}", expected, obj); + } + }, + Err(err) => panic!(err), + } + + match client.put("kv", "k", NewHyperObject!("v", NewHyperObject!())) { + Ok(()) => (), + Err(err) => panic!(err), + } + let expected = NewHyperObject!("v", NewHyperObject!()); + match client.get("kv", "k") { + Ok(obj) => { + if obj != expected { + panic!("expected: {:?} +actual: {:?}", expected, obj); + } + }, + Err(err) => panic!(err), + } + } diff --git a/test/rust/DataTypeMapIntInt.rs b/test/rust/DataTypeMapIntInt.rs new file mode 100644 index 000000000..41dd9f7dc --- /dev/null +++ b/test/rust/DataTypeMapIntInt.rs @@ -0,0 +1,56 @@ + +extern crate hyperdex; + +use std::os; + +use hyperdex::{Client, NewHyperObject}; + +fn main() { + let args = os::args(); + let mut client = Client::new(from_str(format!("{}:{}", args[1], args[2])).unwrap()).unwrap(); + + match client.put("kv", "k", NewHyperObject!()) { + Ok(()) => (), + Err(err) => panic!(err), + } + let expected = NewHyperObject!("v", NewHyperObject!()); + match client.get("kv", "k") { + Ok(obj) => { + if obj != expected { + panic!("expected: {:?} +actual: {:?}", expected, obj); + } + }, + Err(err) => panic!(err), + } + + match client.put("kv", "k", NewHyperObject!("v", NewHyperObject!(1 as i64, 7 as i64, 2 as i64, 8 as i64, 3 as i64, 9 as i64))) { + Ok(()) => (), + Err(err) => panic!(err), + } + let expected = NewHyperObject!("v", NewHyperObject!(1 as i64, 7 as i64, 2 as i64, 8 as i64, 3 as i64, 9 as i64)); + match client.get("kv", "k") { + Ok(obj) => { + if obj != expected { + panic!("expected: {:?} +actual: {:?}", expected, obj); + } + }, + Err(err) => panic!(err), + } + + match client.put("kv", "k", NewHyperObject!("v", NewHyperObject!())) { + Ok(()) => (), + Err(err) => panic!(err), + } + let expected = NewHyperObject!("v", NewHyperObject!()); + match client.get("kv", "k") { + Ok(obj) => { + if obj != expected { + panic!("expected: {:?} +actual: {:?}", expected, obj); + } + }, + Err(err) => panic!(err), + } + } diff --git a/test/rust/DataTypeMapIntString.rs b/test/rust/DataTypeMapIntString.rs new file mode 100644 index 000000000..269f66057 --- /dev/null +++ b/test/rust/DataTypeMapIntString.rs @@ -0,0 +1,56 @@ + +extern crate hyperdex; + +use std::os; + +use hyperdex::{Client, NewHyperObject}; + +fn main() { + let args = os::args(); + let mut client = Client::new(from_str(format!("{}:{}", args[1], args[2])).unwrap()).unwrap(); + + match client.put("kv", "k", NewHyperObject!()) { + Ok(()) => (), + Err(err) => panic!(err), + } + let expected = NewHyperObject!("v", NewHyperObject!()); + match client.get("kv", "k") { + Ok(obj) => { + if obj != expected { + panic!("expected: {:?} +actual: {:?}", expected, obj); + } + }, + Err(err) => panic!(err), + } + + match client.put("kv", "k", NewHyperObject!("v", NewHyperObject!(1 as i64, "X", 2 as i64, "Y", 3 as i64, "Z"))) { + Ok(()) => (), + Err(err) => panic!(err), + } + let expected = NewHyperObject!("v", NewHyperObject!(1 as i64, "X", 2 as i64, "Y", 3 as i64, "Z")); + match client.get("kv", "k") { + Ok(obj) => { + if obj != expected { + panic!("expected: {:?} +actual: {:?}", expected, obj); + } + }, + Err(err) => panic!(err), + } + + match client.put("kv", "k", NewHyperObject!("v", NewHyperObject!())) { + Ok(()) => (), + Err(err) => panic!(err), + } + let expected = NewHyperObject!("v", NewHyperObject!()); + match client.get("kv", "k") { + Ok(obj) => { + if obj != expected { + panic!("expected: {:?} +actual: {:?}", expected, obj); + } + }, + Err(err) => panic!(err), + } + } diff --git a/test/rust/DataTypeMapStringFloat.rs b/test/rust/DataTypeMapStringFloat.rs new file mode 100644 index 000000000..00457e691 --- /dev/null +++ b/test/rust/DataTypeMapStringFloat.rs @@ -0,0 +1,56 @@ + +extern crate hyperdex; + +use std::os; + +use hyperdex::{Client, NewHyperObject}; + +fn main() { + let args = os::args(); + let mut client = Client::new(from_str(format!("{}:{}", args[1], args[2])).unwrap()).unwrap(); + + match client.put("kv", "k", NewHyperObject!()) { + Ok(()) => (), + Err(err) => panic!(err), + } + let expected = NewHyperObject!("v", NewHyperObject!()); + match client.get("kv", "k") { + Ok(obj) => { + if obj != expected { + panic!("expected: {:?} +actual: {:?}", expected, obj); + } + }, + Err(err) => panic!(err), + } + + match client.put("kv", "k", NewHyperObject!("v", NewHyperObject!("A", 3.14 as f64, "B", 0.25 as f64, "C", 1.0 as f64))) { + Ok(()) => (), + Err(err) => panic!(err), + } + let expected = NewHyperObject!("v", NewHyperObject!("A", 3.14 as f64, "B", 0.25 as f64, "C", 1.0 as f64)); + match client.get("kv", "k") { + Ok(obj) => { + if obj != expected { + panic!("expected: {:?} +actual: {:?}", expected, obj); + } + }, + Err(err) => panic!(err), + } + + match client.put("kv", "k", NewHyperObject!("v", NewHyperObject!())) { + Ok(()) => (), + Err(err) => panic!(err), + } + let expected = NewHyperObject!("v", NewHyperObject!()); + match client.get("kv", "k") { + Ok(obj) => { + if obj != expected { + panic!("expected: {:?} +actual: {:?}", expected, obj); + } + }, + Err(err) => panic!(err), + } + } diff --git a/test/rust/DataTypeMapStringInt.rs b/test/rust/DataTypeMapStringInt.rs new file mode 100644 index 000000000..1412af001 --- /dev/null +++ b/test/rust/DataTypeMapStringInt.rs @@ -0,0 +1,56 @@ + +extern crate hyperdex; + +use std::os; + +use hyperdex::{Client, NewHyperObject}; + +fn main() { + let args = os::args(); + let mut client = Client::new(from_str(format!("{}:{}", args[1], args[2])).unwrap()).unwrap(); + + match client.put("kv", "k", NewHyperObject!()) { + Ok(()) => (), + Err(err) => panic!(err), + } + let expected = NewHyperObject!("v", NewHyperObject!()); + match client.get("kv", "k") { + Ok(obj) => { + if obj != expected { + panic!("expected: {:?} +actual: {:?}", expected, obj); + } + }, + Err(err) => panic!(err), + } + + match client.put("kv", "k", NewHyperObject!("v", NewHyperObject!("A", 1 as i64, "B", 2 as i64, "C", 3 as i64))) { + Ok(()) => (), + Err(err) => panic!(err), + } + let expected = NewHyperObject!("v", NewHyperObject!("A", 1 as i64, "B", 2 as i64, "C", 3 as i64)); + match client.get("kv", "k") { + Ok(obj) => { + if obj != expected { + panic!("expected: {:?} +actual: {:?}", expected, obj); + } + }, + Err(err) => panic!(err), + } + + match client.put("kv", "k", NewHyperObject!("v", NewHyperObject!())) { + Ok(()) => (), + Err(err) => panic!(err), + } + let expected = NewHyperObject!("v", NewHyperObject!()); + match client.get("kv", "k") { + Ok(obj) => { + if obj != expected { + panic!("expected: {:?} +actual: {:?}", expected, obj); + } + }, + Err(err) => panic!(err), + } + } diff --git a/test/rust/DataTypeMapStringString.rs b/test/rust/DataTypeMapStringString.rs new file mode 100644 index 000000000..58a71617d --- /dev/null +++ b/test/rust/DataTypeMapStringString.rs @@ -0,0 +1,56 @@ + +extern crate hyperdex; + +use std::os; + +use hyperdex::{Client, NewHyperObject}; + +fn main() { + let args = os::args(); + let mut client = Client::new(from_str(format!("{}:{}", args[1], args[2])).unwrap()).unwrap(); + + match client.put("kv", "k", NewHyperObject!()) { + Ok(()) => (), + Err(err) => panic!(err), + } + let expected = NewHyperObject!("v", NewHyperObject!()); + match client.get("kv", "k") { + Ok(obj) => { + if obj != expected { + panic!("expected: {:?} +actual: {:?}", expected, obj); + } + }, + Err(err) => panic!(err), + } + + match client.put("kv", "k", NewHyperObject!("v", NewHyperObject!("A", "X", "B", "Y", "C", "Z"))) { + Ok(()) => (), + Err(err) => panic!(err), + } + let expected = NewHyperObject!("v", NewHyperObject!("A", "X", "B", "Y", "C", "Z")); + match client.get("kv", "k") { + Ok(obj) => { + if obj != expected { + panic!("expected: {:?} +actual: {:?}", expected, obj); + } + }, + Err(err) => panic!(err), + } + + match client.put("kv", "k", NewHyperObject!("v", NewHyperObject!())) { + Ok(()) => (), + Err(err) => panic!(err), + } + let expected = NewHyperObject!("v", NewHyperObject!()); + match client.get("kv", "k") { + Ok(obj) => { + if obj != expected { + panic!("expected: {:?} +actual: {:?}", expected, obj); + } + }, + Err(err) => panic!(err), + } + } diff --git a/test/rust/DataTypeSetFloat.rs b/test/rust/DataTypeSetFloat.rs new file mode 100644 index 000000000..85205fef3 --- /dev/null +++ b/test/rust/DataTypeSetFloat.rs @@ -0,0 +1,56 @@ + +extern crate hyperdex; + +use std::os; + +use hyperdex::{Client, NewHyperObject}; + +fn main() { + let args = os::args(); + let mut client = Client::new(from_str(format!("{}:{}", args[1], args[2])).unwrap()).unwrap(); + + match client.put("kv", "k", NewHyperObject!()) { + Ok(()) => (), + Err(err) => panic!(err), + } + let expected = NewHyperObject!("v", BTreeSet::from_iter(vec!().iter());); + match client.get("kv", "k") { + Ok(obj) => { + if obj != expected { + panic!("expected: {:?} +actual: {:?}", expected, obj); + } + }, + Err(err) => panic!(err), + } + + match client.put("kv", "k", NewHyperObject!("v", BTreeSet::from_iter(vec!(0.25 as f64, 1.0 as f64, 3.14 as f64).iter());)) { + Ok(()) => (), + Err(err) => panic!(err), + } + let expected = NewHyperObject!("v", BTreeSet::from_iter(vec!(0.25 as f64, 1.0 as f64, 3.14 as f64).iter());); + match client.get("kv", "k") { + Ok(obj) => { + if obj != expected { + panic!("expected: {:?} +actual: {:?}", expected, obj); + } + }, + Err(err) => panic!(err), + } + + match client.put("kv", "k", NewHyperObject!("v", BTreeSet::from_iter(vec!().iter());)) { + Ok(()) => (), + Err(err) => panic!(err), + } + let expected = NewHyperObject!("v", BTreeSet::from_iter(vec!().iter());); + match client.get("kv", "k") { + Ok(obj) => { + if obj != expected { + panic!("expected: {:?} +actual: {:?}", expected, obj); + } + }, + Err(err) => panic!(err), + } + } diff --git a/test/rust/DataTypeSetInt.rs b/test/rust/DataTypeSetInt.rs new file mode 100644 index 000000000..4702c0803 --- /dev/null +++ b/test/rust/DataTypeSetInt.rs @@ -0,0 +1,56 @@ + +extern crate hyperdex; + +use std::os; + +use hyperdex::{Client, NewHyperObject}; + +fn main() { + let args = os::args(); + let mut client = Client::new(from_str(format!("{}:{}", args[1], args[2])).unwrap()).unwrap(); + + match client.put("kv", "k", NewHyperObject!()) { + Ok(()) => (), + Err(err) => panic!(err), + } + let expected = NewHyperObject!("v", BTreeSet::from_iter(vec!().iter());); + match client.get("kv", "k") { + Ok(obj) => { + if obj != expected { + panic!("expected: {:?} +actual: {:?}", expected, obj); + } + }, + Err(err) => panic!(err), + } + + match client.put("kv", "k", NewHyperObject!("v", BTreeSet::from_iter(vec!(1 as i64, 2 as i64, 3 as i64).iter());)) { + Ok(()) => (), + Err(err) => panic!(err), + } + let expected = NewHyperObject!("v", BTreeSet::from_iter(vec!(1 as i64, 2 as i64, 3 as i64).iter());); + match client.get("kv", "k") { + Ok(obj) => { + if obj != expected { + panic!("expected: {:?} +actual: {:?}", expected, obj); + } + }, + Err(err) => panic!(err), + } + + match client.put("kv", "k", NewHyperObject!("v", BTreeSet::from_iter(vec!().iter());)) { + Ok(()) => (), + Err(err) => panic!(err), + } + let expected = NewHyperObject!("v", BTreeSet::from_iter(vec!().iter());); + match client.get("kv", "k") { + Ok(obj) => { + if obj != expected { + panic!("expected: {:?} +actual: {:?}", expected, obj); + } + }, + Err(err) => panic!(err), + } + } diff --git a/test/rust/DataTypeSetString.rs b/test/rust/DataTypeSetString.rs new file mode 100644 index 000000000..d8e6b4daa --- /dev/null +++ b/test/rust/DataTypeSetString.rs @@ -0,0 +1,56 @@ + +extern crate hyperdex; + +use std::os; + +use hyperdex::{Client, NewHyperObject}; + +fn main() { + let args = os::args(); + let mut client = Client::new(from_str(format!("{}:{}", args[1], args[2])).unwrap()).unwrap(); + + match client.put("kv", "k", NewHyperObject!()) { + Ok(()) => (), + Err(err) => panic!(err), + } + let expected = NewHyperObject!("v", BTreeSet::from_iter(vec!().iter());); + match client.get("kv", "k") { + Ok(obj) => { + if obj != expected { + panic!("expected: {:?} +actual: {:?}", expected, obj); + } + }, + Err(err) => panic!(err), + } + + match client.put("kv", "k", NewHyperObject!("v", BTreeSet::from_iter(vec!("A", "B", "C").iter());)) { + Ok(()) => (), + Err(err) => panic!(err), + } + let expected = NewHyperObject!("v", BTreeSet::from_iter(vec!("A", "B", "C").iter());); + match client.get("kv", "k") { + Ok(obj) => { + if obj != expected { + panic!("expected: {:?} +actual: {:?}", expected, obj); + } + }, + Err(err) => panic!(err), + } + + match client.put("kv", "k", NewHyperObject!("v", BTreeSet::from_iter(vec!().iter());)) { + Ok(()) => (), + Err(err) => panic!(err), + } + let expected = NewHyperObject!("v", BTreeSet::from_iter(vec!().iter());); + match client.get("kv", "k") { + Ok(obj) => { + if obj != expected { + panic!("expected: {:?} +actual: {:?}", expected, obj); + } + }, + Err(err) => panic!(err), + } + } diff --git a/test/rust/DataTypeString.rs b/test/rust/DataTypeString.rs new file mode 100644 index 000000000..42fdc44ea --- /dev/null +++ b/test/rust/DataTypeString.rs @@ -0,0 +1,56 @@ + +extern crate hyperdex; + +use std::os; + +use hyperdex::{Client, NewHyperObject}; + +fn main() { + let args = os::args(); + let mut client = Client::new(from_str(format!("{}:{}", args[1], args[2])).unwrap()).unwrap(); + + match client.put("kv", "k", NewHyperObject!()) { + Ok(()) => (), + Err(err) => panic!(err), + } + let expected = NewHyperObject!("v", ""); + match client.get("kv", "k") { + Ok(obj) => { + if obj != expected { + panic!("expected: {:?} +actual: {:?}", expected, obj); + } + }, + Err(err) => panic!(err), + } + + match client.put("kv", "k", NewHyperObject!("v", "xxx")) { + Ok(()) => (), + Err(err) => panic!(err), + } + let expected = NewHyperObject!("v", "xxx"); + match client.get("kv", "k") { + Ok(obj) => { + if obj != expected { + panic!("expected: {:?} +actual: {:?}", expected, obj); + } + }, + Err(err) => panic!(err), + } + + match client.put("kv", "k", NewHyperObject!("v", "\xde\xad\xbe\xef")) { + Ok(()) => (), + Err(err) => panic!(err), + } + let expected = NewHyperObject!("v", "\xde\xad\xbe\xef"); + match client.get("kv", "k") { + Ok(obj) => { + if obj != expected { + panic!("expected: {:?} +actual: {:?}", expected, obj); + } + }, + Err(err) => panic!(err), + } + } diff --git a/test/rust/LengthString.rs b/test/rust/LengthString.rs new file mode 100644 index 000000000..3fcdc79b6 --- /dev/null +++ b/test/rust/LengthString.rs @@ -0,0 +1,64 @@ + +extern crate hyperdex; + +use std::os; + +use hyperdex::{Client, NewHyperObject}; + +fn main() { + let args = os::args(); + let mut client = Client::new(from_str(format!("{}:{}", args[1], args[2])).unwrap()).unwrap(); + + match client.put("kv", "A", NewHyperObject!()) { + Ok(()) => (), + Err(err) => panic!(err), + } + + match client.put("kv", "AB", NewHyperObject!()) { + Ok(()) => (), + Err(err) => panic!(err), + } + + match client.put("kv", "ABC", NewHyperObject!()) { + Ok(()) => (), + Err(err) => panic!(err), + } + + match client.put("kv", "ABCD", NewHyperObject!()) { + Ok(()) => (), + Err(err) => panic!(err), + } + + match client.put("kv", "ABCDE", NewHyperObject!()) { + Ok(()) => (), + Err(err) => panic!(err), + } + + let res = client.search("kv", vec!(HyperPredicate::new("k", LENGTH_EQUALS, 1 as i64))); + let elems = res.iter().collect(); + assert!(elems.len() == vec!(NewHyperObject!("k", "A"));.len()); + + let res = client.search("kv", vec!(HyperPredicate::new("k", LENGTH_EQUALS, 2 as i64))); + let elems = res.iter().collect(); + assert!(elems.len() == vec!(NewHyperObject!("k", "AB"));.len()); + + let res = client.search("kv", vec!(HyperPredicate::new("k", LENGTH_EQUALS, 3 as i64))); + let elems = res.iter().collect(); + assert!(elems.len() == vec!(NewHyperObject!("k", "ABC"));.len()); + + let res = client.search("kv", vec!(HyperPredicate::new("k", LENGTH_EQUALS, 4 as i64))); + let elems = res.iter().collect(); + assert!(elems.len() == vec!(NewHyperObject!("k", "ABCD"));.len()); + + let res = client.search("kv", vec!(HyperPredicate::new("k", LENGTH_EQUALS, 5 as i64))); + let elems = res.iter().collect(); + assert!(elems.len() == vec!(NewHyperObject!("k", "ABCDE"));.len()); + + let res = client.search("kv", vec!(HyperPredicate::new("k", LENGTH_LESS_EQUAL, 3 as i64))); + let elems = res.iter().collect(); + assert!(elems.len() == vec!(NewHyperObject!("k", "A"), NewHyperObject!("k", "AB"), NewHyperObject!("k", "ABC"));.len()); + + let res = client.search("kv", vec!(HyperPredicate::new("k", LENGTH_GREATER_EQUAL, 3 as i64))); + let elems = res.iter().collect(); + assert!(elems.len() == vec!(NewHyperObject!("k", "ABC"), NewHyperObject!("k", "ABCD"), NewHyperObject!("k", "ABCDE"));.len()); + } diff --git a/test/rust/MultiAttribute.rs b/test/rust/MultiAttribute.rs new file mode 100644 index 000000000..cbbef4636 --- /dev/null +++ b/test/rust/MultiAttribute.rs @@ -0,0 +1,58 @@ + +extern crate hyperdex; + +use std::os; + +use hyperdex::{Client, NewHyperObject}; + +fn main() { + let args = os::args(); + let mut client = Client::new(from_str(format!("{}:{}", args[1], args[2])).unwrap()).unwrap(); +let expected = nil; + match client.get("kv", "k") { + Ok(obj) => { + panic!("this object should not be found!"); + }, + Err(err) => (), + } + + match client.put("kv", "k", NewHyperObject!("v1", "ABC")) { + Ok(()) => (), + Err(err) => panic!(err), + } + let expected = NewHyperObject!("v1", "ABC", "v2", ""); + match client.get("kv", "k") { + Ok(obj) => { + if obj != expected { + panic!("expected: {:?} +actual: {:?}", expected, obj); + } + }, + Err(err) => panic!(err), + } + + match client.put("kv", "k", NewHyperObject!("v2", "123")) { + Ok(()) => (), + Err(err) => panic!(err), + } + let expected = NewHyperObject!("v1", "ABC", "v2", "123"); + match client.get("kv", "k") { + Ok(obj) => { + if obj != expected { + panic!("expected: {:?} +actual: {:?}", expected, obj); + } + }, + Err(err) => panic!(err), + } + let expected = NewHyperObject!("v1", "ABC"); + match client.get_partial("kv", "k", vec!("v1");) { + Ok(obj) => { + if obj != expected { + panic!("expected: {:?} +actual: {:?}", expected, obj); + } + }, + Err(err) => panic!(err), + } + } diff --git a/test/rust/RangeSearchInt.rs b/test/rust/RangeSearchInt.rs new file mode 100644 index 000000000..08d56436a --- /dev/null +++ b/test/rust/RangeSearchInt.rs @@ -0,0 +1,76 @@ + +extern crate hyperdex; + +use std::os; + +use hyperdex::{Client, NewHyperObject}; + +fn main() { + let args = os::args(); + let mut client = Client::new(from_str(format!("{}:{}", args[1], args[2])).unwrap()).unwrap(); + + match client.put("kv", -2 as i64, NewHyperObject!("v", -2 as i64)) { + Ok(()) => (), + Err(err) => panic!(err), + } + + match client.put("kv", -1 as i64, NewHyperObject!("v", -1 as i64)) { + Ok(()) => (), + Err(err) => panic!(err), + } + + match client.put("kv", 0 as i64, NewHyperObject!("v", 0 as i64)) { + Ok(()) => (), + Err(err) => panic!(err), + } + + match client.put("kv", 1 as i64, NewHyperObject!("v", 1 as i64)) { + Ok(()) => (), + Err(err) => panic!(err), + } + + match client.put("kv", 2 as i64, NewHyperObject!("v", 2 as i64)) { + Ok(()) => (), + Err(err) => panic!(err), + } + + let res = client.search("kv", vec!(HyperPredicate::new("k", LESS_EQUAL, 0 as i64))); + let elems = res.iter().collect(); + assert!(elems.len() == vec!(NewHyperObject!("k", -2 as i64, "v", -2 as i64), NewHyperObject!("k", -1 as i64, "v", -1 as i64), NewHyperObject!("k", 0 as i64, "v", 0 as i64));.len()); + + let res = client.search("kv", vec!(HyperPredicate::new("v", LESS_EQUAL, 0 as i64))); + let elems = res.iter().collect(); + assert!(elems.len() == vec!(NewHyperObject!("k", -2 as i64, "v", -2 as i64), NewHyperObject!("k", -1 as i64, "v", -1 as i64), NewHyperObject!("k", 0 as i64, "v", 0 as i64));.len()); + + let res = client.search("kv", vec!(HyperPredicate::new("k", GREATER_EQUAL, 0 as i64))); + let elems = res.iter().collect(); + assert!(elems.len() == vec!(NewHyperObject!("k", 0 as i64, "v", 0 as i64), NewHyperObject!("k", 1 as i64, "v", 1 as i64), NewHyperObject!("k", 2 as i64, "v", 2 as i64));.len()); + + let res = client.search("kv", vec!(HyperPredicate::new("v", GREATER_EQUAL, 0 as i64))); + let elems = res.iter().collect(); + assert!(elems.len() == vec!(NewHyperObject!("k", 0 as i64, "v", 0 as i64), NewHyperObject!("k", 1 as i64, "v", 1 as i64), NewHyperObject!("k", 2 as i64, "v", 2 as i64));.len()); + + let res = client.search("kv", vec!(HyperPredicate::new("k", LESS_THAN, 0 as i64))); + let elems = res.iter().collect(); + assert!(elems.len() == vec!(NewHyperObject!("k", -2 as i64, "v", -2 as i64), NewHyperObject!("k", -1 as i64, "v", -1 as i64));.len()); + + let res = client.search("kv", vec!(HyperPredicate::new("v", LESS_THAN, 0 as i64))); + let elems = res.iter().collect(); + assert!(elems.len() == vec!(NewHyperObject!("k", -2 as i64, "v", -2 as i64), NewHyperObject!("k", -1 as i64, "v", -1 as i64));.len()); + + let res = client.search("kv", vec!(HyperPredicate::new("k", GREATER_THAN, 0 as i64))); + let elems = res.iter().collect(); + assert!(elems.len() == vec!(NewHyperObject!("k", 1 as i64, "v", 1 as i64), NewHyperObject!("k", 2 as i64, "v", 2 as i64));.len()); + + let res = client.search("kv", vec!(HyperPredicate::new("v", GREATER_THAN, 0 as i64))); + let elems = res.iter().collect(); + assert!(elems.len() == vec!(NewHyperObject!("k", 1 as i64, "v", 1 as i64), NewHyperObject!("k", 2 as i64, "v", 2 as i64));.len()); + + let res = client.search("kv", vec!(HyperPredicate::new("k", -1 as i64, GREATER_EQUAL), HyperPredicate::new("k", 1 as i64, LESS_EQUAL))); + let elems = res.iter().collect(); + assert!(elems.len() == vec!(NewHyperObject!("k", -1 as i64, "v", -1 as i64), NewHyperObject!("k", 0 as i64, "v", 0 as i64), NewHyperObject!("k", 1 as i64, "v", 1 as i64));.len()); + + let res = client.search("kv", vec!(HyperPredicate::new("v", -1 as i64, GREATER_EQUAL), HyperPredicate::new("v", 1 as i64, LESS_EQUAL))); + let elems = res.iter().collect(); + assert!(elems.len() == vec!(NewHyperObject!("k", -1 as i64, "v", -1 as i64), NewHyperObject!("k", 0 as i64, "v", 0 as i64), NewHyperObject!("k", 1 as i64, "v", 1 as i64));.len()); + } diff --git a/test/rust/RangeSearchString.rs b/test/rust/RangeSearchString.rs new file mode 100644 index 000000000..82af204e9 --- /dev/null +++ b/test/rust/RangeSearchString.rs @@ -0,0 +1,76 @@ + +extern crate hyperdex; + +use std::os; + +use hyperdex::{Client, NewHyperObject}; + +fn main() { + let args = os::args(); + let mut client = Client::new(from_str(format!("{}:{}", args[1], args[2])).unwrap()).unwrap(); + + match client.put("kv", "A", NewHyperObject!("v", "A")) { + Ok(()) => (), + Err(err) => panic!(err), + } + + match client.put("kv", "B", NewHyperObject!("v", "B")) { + Ok(()) => (), + Err(err) => panic!(err), + } + + match client.put("kv", "C", NewHyperObject!("v", "C")) { + Ok(()) => (), + Err(err) => panic!(err), + } + + match client.put("kv", "D", NewHyperObject!("v", "D")) { + Ok(()) => (), + Err(err) => panic!(err), + } + + match client.put("kv", "E", NewHyperObject!("v", "E")) { + Ok(()) => (), + Err(err) => panic!(err), + } + + let res = client.search("kv", vec!(HyperPredicate::new("k", LESS_EQUAL, "C"))); + let elems = res.iter().collect(); + assert!(elems.len() == vec!(NewHyperObject!("k", "A", "v", "A"), NewHyperObject!("k", "B", "v", "B"), NewHyperObject!("k", "C", "v", "C"));.len()); + + let res = client.search("kv", vec!(HyperPredicate::new("v", LESS_EQUAL, "C"))); + let elems = res.iter().collect(); + assert!(elems.len() == vec!(NewHyperObject!("k", "A", "v", "A"), NewHyperObject!("k", "B", "v", "B"), NewHyperObject!("k", "C", "v", "C"));.len()); + + let res = client.search("kv", vec!(HyperPredicate::new("k", GREATER_EQUAL, "C"))); + let elems = res.iter().collect(); + assert!(elems.len() == vec!(NewHyperObject!("k", "C", "v", "C"), NewHyperObject!("k", "D", "v", "D"), NewHyperObject!("k", "E", "v", "E"));.len()); + + let res = client.search("kv", vec!(HyperPredicate::new("v", GREATER_EQUAL, "C"))); + let elems = res.iter().collect(); + assert!(elems.len() == vec!(NewHyperObject!("k", "C", "v", "C"), NewHyperObject!("k", "D", "v", "D"), NewHyperObject!("k", "E", "v", "E"));.len()); + + let res = client.search("kv", vec!(HyperPredicate::new("k", LESS_THAN, "C"))); + let elems = res.iter().collect(); + assert!(elems.len() == vec!(NewHyperObject!("k", "A", "v", "A"), NewHyperObject!("k", "B", "v", "B"));.len()); + + let res = client.search("kv", vec!(HyperPredicate::new("v", LESS_THAN, "C"))); + let elems = res.iter().collect(); + assert!(elems.len() == vec!(NewHyperObject!("k", "A", "v", "A"), NewHyperObject!("k", "B", "v", "B"));.len()); + + let res = client.search("kv", vec!(HyperPredicate::new("k", GREATER_THAN, "C"))); + let elems = res.iter().collect(); + assert!(elems.len() == vec!(NewHyperObject!("k", "D", "v", "D"), NewHyperObject!("k", "E", "v", "E"));.len()); + + let res = client.search("kv", vec!(HyperPredicate::new("v", GREATER_THAN, "C"))); + let elems = res.iter().collect(); + assert!(elems.len() == vec!(NewHyperObject!("k", "D", "v", "D"), NewHyperObject!("k", "E", "v", "E"));.len()); + + let res = client.search("kv", vec!(HyperPredicate::new("k", "B", GREATER_EQUAL), HyperPredicate::new("k", "D", LESS_EQUAL))); + let elems = res.iter().collect(); + assert!(elems.len() == vec!(NewHyperObject!("k", "B", "v", "B"), NewHyperObject!("k", "C", "v", "C"), NewHyperObject!("k", "D", "v", "D"));.len()); + + let res = client.search("kv", vec!(HyperPredicate::new("v", "B", GREATER_EQUAL), HyperPredicate::new("v", "D", LESS_EQUAL))); + let elems = res.iter().collect(); + assert!(elems.len() == vec!(NewHyperObject!("k", "B", "v", "B"), NewHyperObject!("k", "C", "v", "C"), NewHyperObject!("k", "D", "v", "D"));.len()); + } diff --git a/test/rust/RegexSearch.rs b/test/rust/RegexSearch.rs new file mode 100644 index 000000000..b2a8840df --- /dev/null +++ b/test/rust/RegexSearch.rs @@ -0,0 +1,158 @@ + +extern crate hyperdex; + +use std::os; + +use hyperdex::{Client, NewHyperObject}; + +fn main() { + let args = os::args(); + let mut client = Client::new(from_str(format!("{}:{}", args[1], args[2])).unwrap()).unwrap(); + + match client.put("kv", "foo/foo/foo", NewHyperObject!()) { + Ok(()) => (), + Err(err) => panic!(err), + } + + match client.put("kv", "foo/foo/bar", NewHyperObject!()) { + Ok(()) => (), + Err(err) => panic!(err), + } + + match client.put("kv", "foo/foo/baz", NewHyperObject!()) { + Ok(()) => (), + Err(err) => panic!(err), + } + + match client.put("kv", "foo/bar/foo", NewHyperObject!()) { + Ok(()) => (), + Err(err) => panic!(err), + } + + match client.put("kv", "foo/bar/bar", NewHyperObject!()) { + Ok(()) => (), + Err(err) => panic!(err), + } + + match client.put("kv", "foo/bar/baz", NewHyperObject!()) { + Ok(()) => (), + Err(err) => panic!(err), + } + + match client.put("kv", "foo/baz/foo", NewHyperObject!()) { + Ok(()) => (), + Err(err) => panic!(err), + } + + match client.put("kv", "foo/baz/bar", NewHyperObject!()) { + Ok(()) => (), + Err(err) => panic!(err), + } + + match client.put("kv", "foo/baz/baz", NewHyperObject!()) { + Ok(()) => (), + Err(err) => panic!(err), + } + + match client.put("kv", "bar/foo/foo", NewHyperObject!()) { + Ok(()) => (), + Err(err) => panic!(err), + } + + match client.put("kv", "bar/foo/bar", NewHyperObject!()) { + Ok(()) => (), + Err(err) => panic!(err), + } + + match client.put("kv", "bar/foo/baz", NewHyperObject!()) { + Ok(()) => (), + Err(err) => panic!(err), + } + + match client.put("kv", "bar/bar/foo", NewHyperObject!()) { + Ok(()) => (), + Err(err) => panic!(err), + } + + match client.put("kv", "bar/bar/bar", NewHyperObject!()) { + Ok(()) => (), + Err(err) => panic!(err), + } + + match client.put("kv", "bar/bar/baz", NewHyperObject!()) { + Ok(()) => (), + Err(err) => panic!(err), + } + + match client.put("kv", "bar/baz/foo", NewHyperObject!()) { + Ok(()) => (), + Err(err) => panic!(err), + } + + match client.put("kv", "bar/baz/bar", NewHyperObject!()) { + Ok(()) => (), + Err(err) => panic!(err), + } + + match client.put("kv", "bar/baz/baz", NewHyperObject!()) { + Ok(()) => (), + Err(err) => panic!(err), + } + + match client.put("kv", "baz/foo/foo", NewHyperObject!()) { + Ok(()) => (), + Err(err) => panic!(err), + } + + match client.put("kv", "baz/foo/bar", NewHyperObject!()) { + Ok(()) => (), + Err(err) => panic!(err), + } + + match client.put("kv", "baz/foo/baz", NewHyperObject!()) { + Ok(()) => (), + Err(err) => panic!(err), + } + + match client.put("kv", "baz/bar/foo", NewHyperObject!()) { + Ok(()) => (), + Err(err) => panic!(err), + } + + match client.put("kv", "baz/bar/bar", NewHyperObject!()) { + Ok(()) => (), + Err(err) => panic!(err), + } + + match client.put("kv", "baz/bar/baz", NewHyperObject!()) { + Ok(()) => (), + Err(err) => panic!(err), + } + + match client.put("kv", "baz/baz/foo", NewHyperObject!()) { + Ok(()) => (), + Err(err) => panic!(err), + } + + match client.put("kv", "baz/baz/bar", NewHyperObject!()) { + Ok(()) => (), + Err(err) => panic!(err), + } + + match client.put("kv", "baz/baz/baz", NewHyperObject!()) { + Ok(()) => (), + Err(err) => panic!(err), + } + + let res = client.search("kv", vec!(HyperPredicate::new("k", REGEX, "^foo"))); + let elems = res.iter().collect(); + assert!(elems.len() == vec!(NewHyperObject!("k", "foo/foo/foo"), NewHyperObject!("k", "foo/foo/bar"), NewHyperObject!("k", "foo/foo/baz"), NewHyperObject!("k", "foo/bar/foo"), NewHyperObject!("k", "foo/bar/bar"), NewHyperObject!("k", "foo/bar/baz"), NewHyperObject!("k", "foo/baz/foo"), NewHyperObject!("k", "foo/baz/bar"), NewHyperObject!("k", "foo/baz/baz"));.len()); + + let res = client.search("kv", vec!(HyperPredicate::new("k", REGEX, "foo$"))); + let elems = res.iter().collect(); + assert!(elems.len() == vec!(NewHyperObject!("k", "foo/foo/foo"), NewHyperObject!("k", "foo/bar/foo"), NewHyperObject!("k", "foo/baz/foo"), NewHyperObject!("k", "bar/foo/foo"), NewHyperObject!("k", "bar/bar/foo"), NewHyperObject!("k", "bar/baz/foo"), NewHyperObject!("k", "baz/foo/foo"), NewHyperObject!("k", "baz/bar/foo"), NewHyperObject!("k", "baz/baz/foo"));.len()); + + let res = client.search("kv", vec!(HyperPredicate::new("k", REGEX, "^b.*/foo/.*$"))); + let elems = res.iter().collect(); + assert!(elems.len() == vec!(NewHyperObject!("k", "bar/foo/foo"), NewHyperObject!("k", "bar/foo/bar"), NewHyperObject!("k", "bar/foo/baz"), NewHyperObject!("k", "baz/foo/foo"), NewHyperObject!("k", "baz/foo/bar"), NewHyperObject!("k", "baz/foo/baz"));.len()); + } diff --git a/test/sh/bindings.rust.Basic.sh b/test/sh/bindings.rust.Basic.sh new file mode 100755 index 000000000..19d07637a --- /dev/null +++ b/test/sh/bindings.rust.Basic.sh @@ -0,0 +1,5 @@ +#!/bin/sh +rustc --out-dir "${HYPERDEX_BUILDDIR}"/test/rust -o Basic "${HYPERDEX_SRCDIR}"/test/rust/Basic.rs + +python2 "${HYPERDEX_SRCDIR}"/test/runner.py --space="space kv key k attribute v" --daemons=1 -- \ + "${HYPERDEX_BUILDDIR}"/Basic {HOST} {PORT} diff --git a/test/sh/bindings.rust.BasicSearch.sh b/test/sh/bindings.rust.BasicSearch.sh new file mode 100755 index 000000000..15426e79c --- /dev/null +++ b/test/sh/bindings.rust.BasicSearch.sh @@ -0,0 +1,5 @@ +#!/bin/sh +rustc --out-dir "${HYPERDEX_BUILDDIR}"/test/rust -o BasicSearch "${HYPERDEX_SRCDIR}"/test/rust/BasicSearch.rs + +python2 "${HYPERDEX_SRCDIR}"/test/runner.py --space="space kv key k attribute v" --daemons=1 -- \ + "${HYPERDEX_BUILDDIR}"/BasicSearch {HOST} {PORT} diff --git a/test/sh/bindings.rust.CondPut.sh b/test/sh/bindings.rust.CondPut.sh new file mode 100755 index 000000000..f6e0d0c52 --- /dev/null +++ b/test/sh/bindings.rust.CondPut.sh @@ -0,0 +1,5 @@ +#!/bin/sh +rustc --out-dir "${HYPERDEX_BUILDDIR}"/test/rust -o CondPut "${HYPERDEX_SRCDIR}"/test/rust/CondPut.rs + +python2 "${HYPERDEX_SRCDIR}"/test/runner.py --space="space kv key k attribute v" --daemons=1 -- \ + "${HYPERDEX_BUILDDIR}"/CondPut {HOST} {PORT} diff --git a/test/sh/bindings.rust.DataTypeFloat.sh b/test/sh/bindings.rust.DataTypeFloat.sh new file mode 100755 index 000000000..141c0fe9e --- /dev/null +++ b/test/sh/bindings.rust.DataTypeFloat.sh @@ -0,0 +1,5 @@ +#!/bin/sh +rustc --out-dir "${HYPERDEX_BUILDDIR}"/test/rust -o DataTypeFloat "${HYPERDEX_SRCDIR}"/test/rust/DataTypeFloat.rs + +python2 "${HYPERDEX_SRCDIR}"/test/runner.py --space="space kv key k attributes float v" --daemons=1 -- \ + "${HYPERDEX_BUILDDIR}"/DataTypeFloat {HOST} {PORT} diff --git a/test/sh/bindings.rust.DataTypeInt.sh b/test/sh/bindings.rust.DataTypeInt.sh new file mode 100755 index 000000000..63742da43 --- /dev/null +++ b/test/sh/bindings.rust.DataTypeInt.sh @@ -0,0 +1,5 @@ +#!/bin/sh +rustc --out-dir "${HYPERDEX_BUILDDIR}"/test/rust -o DataTypeInt "${HYPERDEX_SRCDIR}"/test/rust/DataTypeInt.rs + +python2 "${HYPERDEX_SRCDIR}"/test/runner.py --space="space kv key k attributes int v" --daemons=1 -- \ + "${HYPERDEX_BUILDDIR}"/DataTypeInt {HOST} {PORT} diff --git a/test/sh/bindings.rust.DataTypeListFloat.sh b/test/sh/bindings.rust.DataTypeListFloat.sh new file mode 100755 index 000000000..1d8875f57 --- /dev/null +++ b/test/sh/bindings.rust.DataTypeListFloat.sh @@ -0,0 +1,5 @@ +#!/bin/sh +rustc --out-dir "${HYPERDEX_BUILDDIR}"/test/rust -o DataTypeListFloat "${HYPERDEX_SRCDIR}"/test/rust/DataTypeListFloat.rs + +python2 "${HYPERDEX_SRCDIR}"/test/runner.py --space="space kv key k attributes list(float) v" --daemons=1 -- \ + "${HYPERDEX_BUILDDIR}"/DataTypeListFloat {HOST} {PORT} diff --git a/test/sh/bindings.rust.DataTypeListInt.sh b/test/sh/bindings.rust.DataTypeListInt.sh new file mode 100755 index 000000000..4b45aa210 --- /dev/null +++ b/test/sh/bindings.rust.DataTypeListInt.sh @@ -0,0 +1,5 @@ +#!/bin/sh +rustc --out-dir "${HYPERDEX_BUILDDIR}"/test/rust -o DataTypeListInt "${HYPERDEX_SRCDIR}"/test/rust/DataTypeListInt.rs + +python2 "${HYPERDEX_SRCDIR}"/test/runner.py --space="space kv key k attributes list(int) v" --daemons=1 -- \ + "${HYPERDEX_BUILDDIR}"/DataTypeListInt {HOST} {PORT} diff --git a/test/sh/bindings.rust.DataTypeListString.sh b/test/sh/bindings.rust.DataTypeListString.sh new file mode 100755 index 000000000..f143810bc --- /dev/null +++ b/test/sh/bindings.rust.DataTypeListString.sh @@ -0,0 +1,5 @@ +#!/bin/sh +rustc --out-dir "${HYPERDEX_BUILDDIR}"/test/rust -o DataTypeListString "${HYPERDEX_SRCDIR}"/test/rust/DataTypeListString.rs + +python2 "${HYPERDEX_SRCDIR}"/test/runner.py --space="space kv key k attributes list(string) v" --daemons=1 -- \ + "${HYPERDEX_BUILDDIR}"/DataTypeListString {HOST} {PORT} diff --git a/test/sh/bindings.rust.DataTypeMapFloatFloat.sh b/test/sh/bindings.rust.DataTypeMapFloatFloat.sh new file mode 100755 index 000000000..7209bc201 --- /dev/null +++ b/test/sh/bindings.rust.DataTypeMapFloatFloat.sh @@ -0,0 +1,5 @@ +#!/bin/sh +rustc --out-dir "${HYPERDEX_BUILDDIR}"/test/rust -o DataTypeMapFloatFloat "${HYPERDEX_SRCDIR}"/test/rust/DataTypeMapFloatFloat.rs + +python2 "${HYPERDEX_SRCDIR}"/test/runner.py --space="space kv key k attributes map(float, float) v" --daemons=1 -- \ + "${HYPERDEX_BUILDDIR}"/DataTypeMapFloatFloat {HOST} {PORT} diff --git a/test/sh/bindings.rust.DataTypeMapFloatInt.sh b/test/sh/bindings.rust.DataTypeMapFloatInt.sh new file mode 100755 index 000000000..5b00948f2 --- /dev/null +++ b/test/sh/bindings.rust.DataTypeMapFloatInt.sh @@ -0,0 +1,5 @@ +#!/bin/sh +rustc --out-dir "${HYPERDEX_BUILDDIR}"/test/rust -o DataTypeMapFloatInt "${HYPERDEX_SRCDIR}"/test/rust/DataTypeMapFloatInt.rs + +python2 "${HYPERDEX_SRCDIR}"/test/runner.py --space="space kv key k attributes map(float, int) v" --daemons=1 -- \ + "${HYPERDEX_BUILDDIR}"/DataTypeMapFloatInt {HOST} {PORT} diff --git a/test/sh/bindings.rust.DataTypeMapFloatString.sh b/test/sh/bindings.rust.DataTypeMapFloatString.sh new file mode 100755 index 000000000..cd668d55e --- /dev/null +++ b/test/sh/bindings.rust.DataTypeMapFloatString.sh @@ -0,0 +1,5 @@ +#!/bin/sh +rustc --out-dir "${HYPERDEX_BUILDDIR}"/test/rust -o DataTypeMapFloatString "${HYPERDEX_SRCDIR}"/test/rust/DataTypeMapFloatString.rs + +python2 "${HYPERDEX_SRCDIR}"/test/runner.py --space="space kv key k attributes map(float, string) v" --daemons=1 -- \ + "${HYPERDEX_BUILDDIR}"/DataTypeMapFloatString {HOST} {PORT} diff --git a/test/sh/bindings.rust.DataTypeMapIntFloat.sh b/test/sh/bindings.rust.DataTypeMapIntFloat.sh new file mode 100755 index 000000000..35c00612e --- /dev/null +++ b/test/sh/bindings.rust.DataTypeMapIntFloat.sh @@ -0,0 +1,5 @@ +#!/bin/sh +rustc --out-dir "${HYPERDEX_BUILDDIR}"/test/rust -o DataTypeMapIntFloat "${HYPERDEX_SRCDIR}"/test/rust/DataTypeMapIntFloat.rs + +python2 "${HYPERDEX_SRCDIR}"/test/runner.py --space="space kv key k attributes map(int, float) v" --daemons=1 -- \ + "${HYPERDEX_BUILDDIR}"/DataTypeMapIntFloat {HOST} {PORT} diff --git a/test/sh/bindings.rust.DataTypeMapIntInt.sh b/test/sh/bindings.rust.DataTypeMapIntInt.sh new file mode 100755 index 000000000..cb006f579 --- /dev/null +++ b/test/sh/bindings.rust.DataTypeMapIntInt.sh @@ -0,0 +1,5 @@ +#!/bin/sh +rustc --out-dir "${HYPERDEX_BUILDDIR}"/test/rust -o DataTypeMapIntInt "${HYPERDEX_SRCDIR}"/test/rust/DataTypeMapIntInt.rs + +python2 "${HYPERDEX_SRCDIR}"/test/runner.py --space="space kv key k attributes map(int, int) v" --daemons=1 -- \ + "${HYPERDEX_BUILDDIR}"/DataTypeMapIntInt {HOST} {PORT} diff --git a/test/sh/bindings.rust.DataTypeMapIntString.sh b/test/sh/bindings.rust.DataTypeMapIntString.sh new file mode 100755 index 000000000..c9d9a03ab --- /dev/null +++ b/test/sh/bindings.rust.DataTypeMapIntString.sh @@ -0,0 +1,5 @@ +#!/bin/sh +rustc --out-dir "${HYPERDEX_BUILDDIR}"/test/rust -o DataTypeMapIntString "${HYPERDEX_SRCDIR}"/test/rust/DataTypeMapIntString.rs + +python2 "${HYPERDEX_SRCDIR}"/test/runner.py --space="space kv key k attributes map(int, string) v" --daemons=1 -- \ + "${HYPERDEX_BUILDDIR}"/DataTypeMapIntString {HOST} {PORT} diff --git a/test/sh/bindings.rust.DataTypeMapStringFloat.sh b/test/sh/bindings.rust.DataTypeMapStringFloat.sh new file mode 100755 index 000000000..2a8e0153c --- /dev/null +++ b/test/sh/bindings.rust.DataTypeMapStringFloat.sh @@ -0,0 +1,5 @@ +#!/bin/sh +rustc --out-dir "${HYPERDEX_BUILDDIR}"/test/rust -o DataTypeMapStringFloat "${HYPERDEX_SRCDIR}"/test/rust/DataTypeMapStringFloat.rs + +python2 "${HYPERDEX_SRCDIR}"/test/runner.py --space="space kv key k attributes map(string, float) v" --daemons=1 -- \ + "${HYPERDEX_BUILDDIR}"/DataTypeMapStringFloat {HOST} {PORT} diff --git a/test/sh/bindings.rust.DataTypeMapStringInt.sh b/test/sh/bindings.rust.DataTypeMapStringInt.sh new file mode 100755 index 000000000..dcdf17c9c --- /dev/null +++ b/test/sh/bindings.rust.DataTypeMapStringInt.sh @@ -0,0 +1,5 @@ +#!/bin/sh +rustc --out-dir "${HYPERDEX_BUILDDIR}"/test/rust -o DataTypeMapStringInt "${HYPERDEX_SRCDIR}"/test/rust/DataTypeMapStringInt.rs + +python2 "${HYPERDEX_SRCDIR}"/test/runner.py --space="space kv key k attributes map(string, int) v" --daemons=1 -- \ + "${HYPERDEX_BUILDDIR}"/DataTypeMapStringInt {HOST} {PORT} diff --git a/test/sh/bindings.rust.DataTypeMapStringString.sh b/test/sh/bindings.rust.DataTypeMapStringString.sh new file mode 100755 index 000000000..635c8fc81 --- /dev/null +++ b/test/sh/bindings.rust.DataTypeMapStringString.sh @@ -0,0 +1,5 @@ +#!/bin/sh +rustc --out-dir "${HYPERDEX_BUILDDIR}"/test/rust -o DataTypeMapStringString "${HYPERDEX_SRCDIR}"/test/rust/DataTypeMapStringString.rs + +python2 "${HYPERDEX_SRCDIR}"/test/runner.py --space="space kv key k attributes map(string, string) v" --daemons=1 -- \ + "${HYPERDEX_BUILDDIR}"/DataTypeMapStringString {HOST} {PORT} diff --git a/test/sh/bindings.rust.DataTypeSetFloat.sh b/test/sh/bindings.rust.DataTypeSetFloat.sh new file mode 100755 index 000000000..d7bb6ee72 --- /dev/null +++ b/test/sh/bindings.rust.DataTypeSetFloat.sh @@ -0,0 +1,5 @@ +#!/bin/sh +rustc --out-dir "${HYPERDEX_BUILDDIR}"/test/rust -o DataTypeSetFloat "${HYPERDEX_SRCDIR}"/test/rust/DataTypeSetFloat.rs + +python2 "${HYPERDEX_SRCDIR}"/test/runner.py --space="space kv key k attributes set(float) v" --daemons=1 -- \ + "${HYPERDEX_BUILDDIR}"/DataTypeSetFloat {HOST} {PORT} diff --git a/test/sh/bindings.rust.DataTypeSetInt.sh b/test/sh/bindings.rust.DataTypeSetInt.sh new file mode 100755 index 000000000..2572c2519 --- /dev/null +++ b/test/sh/bindings.rust.DataTypeSetInt.sh @@ -0,0 +1,5 @@ +#!/bin/sh +rustc --out-dir "${HYPERDEX_BUILDDIR}"/test/rust -o DataTypeSetInt "${HYPERDEX_SRCDIR}"/test/rust/DataTypeSetInt.rs + +python2 "${HYPERDEX_SRCDIR}"/test/runner.py --space="space kv key k attributes set(int) v" --daemons=1 -- \ + "${HYPERDEX_BUILDDIR}"/DataTypeSetInt {HOST} {PORT} diff --git a/test/sh/bindings.rust.DataTypeSetString.sh b/test/sh/bindings.rust.DataTypeSetString.sh new file mode 100755 index 000000000..88e2ad40b --- /dev/null +++ b/test/sh/bindings.rust.DataTypeSetString.sh @@ -0,0 +1,5 @@ +#!/bin/sh +rustc --out-dir "${HYPERDEX_BUILDDIR}"/test/rust -o DataTypeSetString "${HYPERDEX_SRCDIR}"/test/rust/DataTypeSetString.rs + +python2 "${HYPERDEX_SRCDIR}"/test/runner.py --space="space kv key k attributes set(string) v" --daemons=1 -- \ + "${HYPERDEX_BUILDDIR}"/DataTypeSetString {HOST} {PORT} diff --git a/test/sh/bindings.rust.DataTypeString.sh b/test/sh/bindings.rust.DataTypeString.sh new file mode 100755 index 000000000..41d50adb3 --- /dev/null +++ b/test/sh/bindings.rust.DataTypeString.sh @@ -0,0 +1,5 @@ +#!/bin/sh +rustc --out-dir "${HYPERDEX_BUILDDIR}"/test/rust -o DataTypeString "${HYPERDEX_SRCDIR}"/test/rust/DataTypeString.rs + +python2 "${HYPERDEX_SRCDIR}"/test/runner.py --space="space kv key k attributes v" --daemons=1 -- \ + "${HYPERDEX_BUILDDIR}"/DataTypeString {HOST} {PORT} diff --git a/test/sh/bindings.rust.LengthString.sh b/test/sh/bindings.rust.LengthString.sh new file mode 100755 index 000000000..19137132c --- /dev/null +++ b/test/sh/bindings.rust.LengthString.sh @@ -0,0 +1,5 @@ +#!/bin/sh +rustc --out-dir "${HYPERDEX_BUILDDIR}"/test/rust -o LengthString "${HYPERDEX_SRCDIR}"/test/rust/LengthString.rs + +python2 "${HYPERDEX_SRCDIR}"/test/runner.py --space="space kv key k" --daemons=1 -- \ + "${HYPERDEX_BUILDDIR}"/LengthString {HOST} {PORT} diff --git a/test/sh/bindings.rust.MultiAttribute.sh b/test/sh/bindings.rust.MultiAttribute.sh new file mode 100755 index 000000000..b25075dd7 --- /dev/null +++ b/test/sh/bindings.rust.MultiAttribute.sh @@ -0,0 +1,5 @@ +#!/bin/sh +rustc --out-dir "${HYPERDEX_BUILDDIR}"/test/rust -o MultiAttribute "${HYPERDEX_SRCDIR}"/test/rust/MultiAttribute.rs + +python2 "${HYPERDEX_SRCDIR}"/test/runner.py --space="space kv key k attributes v1, v2" --daemons=1 -- \ + "${HYPERDEX_BUILDDIR}"/MultiAttribute {HOST} {PORT} diff --git a/test/sh/bindings.rust.RangeSearchInt.sh b/test/sh/bindings.rust.RangeSearchInt.sh new file mode 100755 index 000000000..7eae21fcf --- /dev/null +++ b/test/sh/bindings.rust.RangeSearchInt.sh @@ -0,0 +1,5 @@ +#!/bin/sh +rustc --out-dir "${HYPERDEX_BUILDDIR}"/test/rust -o RangeSearchInt "${HYPERDEX_SRCDIR}"/test/rust/RangeSearchInt.rs + +python2 "${HYPERDEX_SRCDIR}"/test/runner.py --space="space kv key int k attribute int v" --daemons=1 -- \ + "${HYPERDEX_BUILDDIR}"/RangeSearchInt {HOST} {PORT} diff --git a/test/sh/bindings.rust.RangeSearchString.sh b/test/sh/bindings.rust.RangeSearchString.sh new file mode 100755 index 000000000..7f27f0ac9 --- /dev/null +++ b/test/sh/bindings.rust.RangeSearchString.sh @@ -0,0 +1,5 @@ +#!/bin/sh +rustc --out-dir "${HYPERDEX_BUILDDIR}"/test/rust -o RangeSearchString "${HYPERDEX_SRCDIR}"/test/rust/RangeSearchString.rs + +python2 "${HYPERDEX_SRCDIR}"/test/runner.py --space="space kv key k attribute v" --daemons=1 -- \ + "${HYPERDEX_BUILDDIR}"/RangeSearchString {HOST} {PORT} diff --git a/test/sh/bindings.rust.RegexSearch.sh b/test/sh/bindings.rust.RegexSearch.sh new file mode 100755 index 000000000..c2b330096 --- /dev/null +++ b/test/sh/bindings.rust.RegexSearch.sh @@ -0,0 +1,5 @@ +#!/bin/sh +rustc --out-dir "${HYPERDEX_BUILDDIR}"/test/rust -o RegexSearch "${HYPERDEX_SRCDIR}"/test/rust/RegexSearch.rs + +python2 "${HYPERDEX_SRCDIR}"/test/runner.py --space="space kv key k" --daemons=1 -- \ + "${HYPERDEX_BUILDDIR}"/RegexSearch {HOST} {PORT} From 6bfb69ffaa51c8714989c1b3d86756ce3d42c1eb Mon Sep 17 00:00:00 2001 From: Derek Chiang Date: Wed, 4 Feb 2015 17:42:25 -0500 Subject: [PATCH 2/7] Update makefile to include rust tests --- Makefile.am | 33 +++++++++++++++++++++++++++++++++ configure.ac | 8 ++++++++ 2 files changed, 41 insertions(+) diff --git a/Makefile.am b/Makefile.am index 7dd6a8c09..8f31da1fe 100644 --- a/Makefile.am +++ b/Makefile.am @@ -963,6 +963,35 @@ go_wrappers += test/sh/bindings.go.RangeSearchString.sh go_wrappers += test/sh/bindings.go.RegexSearch.sh shell_wrappers += $(go_wrappers) +rust_wrappers = +rust_wrappers += test/sh/bindings.rs.Basic.sh +rust_wrappers += test/sh/bindings.rs.BasicSearch.sh +rust_wrappers += test/sh/bindings.rs.CondPut.sh +rust_wrappers += test/sh/bindings.rs.DataTypeFloat.sh +rust_wrappers += test/sh/bindings.rs.DataTypeInt.sh +rust_wrappers += test/sh/bindings.rs.DataTypeListFloat.sh +rust_wrappers += test/sh/bindings.rs.DataTypeListInt.sh +rust_wrappers += test/sh/bindings.rs.DataTypeListString.sh +rust_wrappers += test/sh/bindings.rs.DataTypeMapFloatFloat.sh +rust_wrappers += test/sh/bindings.rs.DataTypeMapFloatInt.sh +rust_wrappers += test/sh/bindings.rs.DataTypeMapFloatString.sh +rust_wrappers += test/sh/bindings.rs.DataTypeMapIntFloat.sh +rust_wrappers += test/sh/bindings.rs.DataTypeMapIntInt.sh +rust_wrappers += test/sh/bindings.rs.DataTypeMapIntString.sh +rust_wrappers += test/sh/bindings.rs.DataTypeMapStringFloat.sh +rust_wrappers += test/sh/bindings.rs.DataTypeMapStringInt.sh +rust_wrappers += test/sh/bindings.rs.DataTypeMapStringString.sh +rust_wrappers += test/sh/bindings.rs.DataTypeSetFloat.sh +rust_wrappers += test/sh/bindings.rs.DataTypeSetInt.sh +rust_wrappers += test/sh/bindings.rs.DataTypeSetString.sh +rust_wrappers += test/sh/bindings.rs.DataTypeString.sh +rust_wrappers += test/sh/bindings.rs.LengthString.sh +rust_wrappers += test/sh/bindings.rs.MultiAttribute.sh +rust_wrappers += test/sh/bindings.rs.RangeSearchInt.sh +rust_wrappers += test/sh/bindings.rs.RangeSearchString.sh +rust_wrappers += test/sh/bindings.rs.RegexSearch.sh +shell_wrappers += $(rust_wrappers) + if ENABLE_ADMIN if ENABLE_CLIENT if ENABLE_PYTHON_BINDINGS @@ -984,6 +1013,10 @@ if ENABLE_RUBY_BINDINGS TESTS += $(ruby_wrappers) endif +if ENABLE_RUST_BINDINGS +TESTS += $(rust_wrappers) +endif + endif # ENABLE_PYTHON_BINDINGS endif # ENABLE_CLIENT endif # ENABLE_ADMIN diff --git a/configure.ac b/configure.ac index 3b7e76f43..21be65ccc 100755 --- a/configure.ac +++ b/configure.ac @@ -210,6 +210,13 @@ if test x"${ruby_bindings}" = xyes; then AX_RUBY_EXT fi +AC_ARG_ENABLE([rust_bindings], [AS_HELP_STRING([--enable-rust-bindings], + [build Rust bindings @<:@default: no@:>@])], + [rust_bindings=${enableval}], [rust_bindings=no]) +if test x"${rust_bindings}" = xyes; then + AX_RUST_EXT +fi + AC_ARG_ENABLE([log-all-messages], [AS_HELP_STRING([--enable-log-all-messages], [enable code to log all messages @<:@default: no@:>@])], [enable_logall=${enableval}], [enable_logall=no]) @@ -220,6 +227,7 @@ fi AM_CONDITIONAL([ENABLE_JAVA_BINDINGS], [test x"${java_bindings}" = xyes]) AM_CONDITIONAL([ENABLE_PYTHON_BINDINGS], [test x"${python_bindings}" = xyes]) AM_CONDITIONAL([ENABLE_RUBY_BINDINGS], [test x"${ruby_bindings}" = xyes]) +AM_CONDITIONAL([ENABLE_RUST_BINDINGS], [test x"${rust_bindings}" = xyes]) AM_CONDITIONAL([ENABLE_YCSB], [test x"${enable_ycsb}" = xyes]) # Optional components From 435b1363a45d8e504b2f02beabb932fcd642a2c6 Mon Sep 17 00:00:00 2001 From: Derek Chiang Date: Thu, 12 Feb 2015 03:33:41 -0500 Subject: [PATCH 3/7] Rust tests are now running --- Makefile.am | 52 +++++------ maint/generate-bindings-tests.py | 83 ++++++++++++------ test/rust/.Basic.rs.swp | Bin 12288 -> 0 bytes test/rust/Basic.rs | 27 +++--- test/rust/BasicSearch.rs | 27 +++--- test/rust/CondPut.rs | 25 +++--- test/rust/DataTypeFloat.rs | 19 ++-- test/rust/DataTypeInt.rs | 35 ++++---- test/rust/DataTypeListFloat.rs | 23 +++-- test/rust/DataTypeListInt.rs | 23 +++-- test/rust/DataTypeListString.rs | 23 +++-- test/rust/DataTypeMapFloatFloat.rs | 37 ++++++-- test/rust/DataTypeMapFloatInt.rs | 37 ++++++-- test/rust/DataTypeMapFloatString.rs | 37 ++++++-- test/rust/DataTypeMapIntFloat.rs | 37 ++++++-- test/rust/DataTypeMapIntInt.rs | 37 ++++++-- test/rust/DataTypeMapIntString.rs | 37 ++++++-- test/rust/DataTypeMapStringFloat.rs | 37 ++++++-- test/rust/DataTypeMapStringInt.rs | 37 ++++++-- test/rust/DataTypeMapStringString.rs | 37 ++++++-- test/rust/DataTypeSetFloat.rs | 37 ++++++-- test/rust/DataTypeSetInt.rs | 37 ++++++-- test/rust/DataTypeSetString.rs | 37 ++++++-- test/rust/DataTypeString.rs | 23 +++-- test/rust/LengthString.rs | 49 ++++++----- test/rust/MultiAttribute.rs | 25 +++--- test/rust/RangeSearchInt.rs | 65 +++++++------- test/rust/RangeSearchString.rs | 65 +++++++------- test/rust/RegexSearch.rs | 77 ++++++++-------- test/sh/bindings.rust.Basic.sh | 4 +- test/sh/bindings.rust.BasicSearch.sh | 4 +- test/sh/bindings.rust.CondPut.sh | 4 +- test/sh/bindings.rust.DataTypeFloat.sh | 4 +- test/sh/bindings.rust.DataTypeInt.sh | 4 +- test/sh/bindings.rust.DataTypeListFloat.sh | 4 +- test/sh/bindings.rust.DataTypeListInt.sh | 4 +- test/sh/bindings.rust.DataTypeListString.sh | 4 +- .../sh/bindings.rust.DataTypeMapFloatFloat.sh | 4 +- test/sh/bindings.rust.DataTypeMapFloatInt.sh | 4 +- .../bindings.rust.DataTypeMapFloatString.sh | 4 +- test/sh/bindings.rust.DataTypeMapIntFloat.sh | 4 +- test/sh/bindings.rust.DataTypeMapIntInt.sh | 4 +- test/sh/bindings.rust.DataTypeMapIntString.sh | 4 +- .../bindings.rust.DataTypeMapStringFloat.sh | 4 +- test/sh/bindings.rust.DataTypeMapStringInt.sh | 4 +- .../bindings.rust.DataTypeMapStringString.sh | 4 +- test/sh/bindings.rust.DataTypeSetFloat.sh | 4 +- test/sh/bindings.rust.DataTypeSetInt.sh | 4 +- test/sh/bindings.rust.DataTypeSetString.sh | 4 +- test/sh/bindings.rust.DataTypeString.sh | 4 +- test/sh/bindings.rust.LengthString.sh | 4 +- test/sh/bindings.rust.MultiAttribute.sh | 4 +- test/sh/bindings.rust.RangeSearchInt.sh | 4 +- test/sh/bindings.rust.RangeSearchString.sh | 4 +- test/sh/bindings.rust.RegexSearch.sh | 4 +- 55 files changed, 759 insertions(+), 430 deletions(-) delete mode 100644 test/rust/.Basic.rs.swp diff --git a/Makefile.am b/Makefile.am index 8f31da1fe..544c9927e 100644 --- a/Makefile.am +++ b/Makefile.am @@ -964,32 +964,32 @@ go_wrappers += test/sh/bindings.go.RegexSearch.sh shell_wrappers += $(go_wrappers) rust_wrappers = -rust_wrappers += test/sh/bindings.rs.Basic.sh -rust_wrappers += test/sh/bindings.rs.BasicSearch.sh -rust_wrappers += test/sh/bindings.rs.CondPut.sh -rust_wrappers += test/sh/bindings.rs.DataTypeFloat.sh -rust_wrappers += test/sh/bindings.rs.DataTypeInt.sh -rust_wrappers += test/sh/bindings.rs.DataTypeListFloat.sh -rust_wrappers += test/sh/bindings.rs.DataTypeListInt.sh -rust_wrappers += test/sh/bindings.rs.DataTypeListString.sh -rust_wrappers += test/sh/bindings.rs.DataTypeMapFloatFloat.sh -rust_wrappers += test/sh/bindings.rs.DataTypeMapFloatInt.sh -rust_wrappers += test/sh/bindings.rs.DataTypeMapFloatString.sh -rust_wrappers += test/sh/bindings.rs.DataTypeMapIntFloat.sh -rust_wrappers += test/sh/bindings.rs.DataTypeMapIntInt.sh -rust_wrappers += test/sh/bindings.rs.DataTypeMapIntString.sh -rust_wrappers += test/sh/bindings.rs.DataTypeMapStringFloat.sh -rust_wrappers += test/sh/bindings.rs.DataTypeMapStringInt.sh -rust_wrappers += test/sh/bindings.rs.DataTypeMapStringString.sh -rust_wrappers += test/sh/bindings.rs.DataTypeSetFloat.sh -rust_wrappers += test/sh/bindings.rs.DataTypeSetInt.sh -rust_wrappers += test/sh/bindings.rs.DataTypeSetString.sh -rust_wrappers += test/sh/bindings.rs.DataTypeString.sh -rust_wrappers += test/sh/bindings.rs.LengthString.sh -rust_wrappers += test/sh/bindings.rs.MultiAttribute.sh -rust_wrappers += test/sh/bindings.rs.RangeSearchInt.sh -rust_wrappers += test/sh/bindings.rs.RangeSearchString.sh -rust_wrappers += test/sh/bindings.rs.RegexSearch.sh +rust_wrappers += test/sh/bindings.rust.Basic.sh +rust_wrappers += test/sh/bindings.rust.BasicSearch.sh +rust_wrappers += test/sh/bindings.rust.CondPut.sh +rust_wrappers += test/sh/bindings.rust.DataTypeFloat.sh +rust_wrappers += test/sh/bindings.rust.DataTypeInt.sh +rust_wrappers += test/sh/bindings.rust.DataTypeListFloat.sh +rust_wrappers += test/sh/bindings.rust.DataTypeListInt.sh +rust_wrappers += test/sh/bindings.rust.DataTypeListString.sh +rust_wrappers += test/sh/bindings.rust.DataTypeMapFloatFloat.sh +rust_wrappers += test/sh/bindings.rust.DataTypeMapFloatInt.sh +rust_wrappers += test/sh/bindings.rust.DataTypeMapFloatString.sh +rust_wrappers += test/sh/bindings.rust.DataTypeMapIntFloat.sh +rust_wrappers += test/sh/bindings.rust.DataTypeMapIntInt.sh +rust_wrappers += test/sh/bindings.rust.DataTypeMapIntString.sh +rust_wrappers += test/sh/bindings.rust.DataTypeMapStringFloat.sh +rust_wrappers += test/sh/bindings.rust.DataTypeMapStringInt.sh +rust_wrappers += test/sh/bindings.rust.DataTypeMapStringString.sh +rust_wrappers += test/sh/bindings.rust.DataTypeSetFloat.sh +rust_wrappers += test/sh/bindings.rust.DataTypeSetInt.sh +rust_wrappers += test/sh/bindings.rust.DataTypeSetString.sh +rust_wrappers += test/sh/bindings.rust.DataTypeString.sh +rust_wrappers += test/sh/bindings.rust.LengthString.sh +rust_wrappers += test/sh/bindings.rust.MultiAttribute.sh +rust_wrappers += test/sh/bindings.rust.RangeSearchInt.sh +rust_wrappers += test/sh/bindings.rust.RangeSearchString.sh +rust_wrappers += test/sh/bindings.rust.RegexSearch.sh shell_wrappers += $(rust_wrappers) if ENABLE_ADMIN diff --git a/maint/generate-bindings-tests.py b/maint/generate-bindings-tests.py index 30a5a244e..9e141d527 100644 --- a/maint/generate-bindings-tests.py +++ b/maint/generate-bindings-tests.py @@ -29,6 +29,7 @@ import collections import os import sys +import subprocess def double_quote(x): y = repr(x) @@ -761,27 +762,36 @@ def to_go(self, x): class RustGenerator(BindingGenerator): + def __init__(self): self.f = None + self.lib_dir = 'rust_hyperdex' + subprocess.call(['git', 'clone', 'https://github.com/derekchiang/rust-hyperdex.git', self.lib_dir]) + subprocess.call(['cargo', 'build'], cwd=self.lib_dir) def test(self, name, space): assert self.f is None self.count = 0 self.path = 'test/rust/{0}.rs'.format(name) - precmd = 'rustc --out-dir "${{HYPERDEX_BUILDDIR}}"/test/rust -o {0} "${{HYPERDEX_SRCDIR}}"/test/rust/{0}.rs'.format(name) - cmd = '"${{HYPERDEX_BUILDDIR}}"/{0}'.format(name) + precmd = 'rustc -L {1} -o "${{HYPERDEX_BUILDDIR}}"/test/rust/{0} "${{HYPERDEX_SRCDIR}}"/test/rust/{0}.rs'.format(name, self.lib_dir + '/target') + cmd = '"${{HYPERDEX_BUILDDIR}}"/test/rust/{0}'.format(name) gen_shell('rust', name, cmd, space, precmd=precmd) self.f = open(self.path, 'w') self.f.write(''' -extern crate hyperdex; +#[macro_use] extern crate hyperdex; use std::os; +use std::str::FromStr; +use std::collections::BTreeSet; +use std::collections::HashMap; +use std::iter::FromIterator; -use hyperdex::{Client, NewHyperObject}; +use hyperdex::*; +use hyperdex::HyperPredicateType::*; fn main() { let args = os::args(); - let mut client = Client::new(from_str(format!("{}:{}", args[1], args[2])).unwrap()).unwrap(); + let mut client = Client::new(FromStr::from_str(format!("{}:{}", args[1], args[2]).as_slice()).unwrap()).unwrap(); ''') def finish(self): @@ -791,7 +801,6 @@ def finish(self): self.f = None def get(self, space, key, expected): - self.f.write('let expected = {0};'.format(self.to_rust(expected))) if expected is None: self.f.write(''' match client.get({0}, {1}) {{ @@ -802,6 +811,7 @@ def get(self, space, key, expected): }} '''.format(self.to_rust(space), self.to_rust(key))) else: + self.f.write('let expected = {0};'.format(self.to_rust(expected))) self.f.write(''' match client.get({0}, {1}) {{ Ok(obj) => {{ @@ -814,7 +824,6 @@ def get(self, space, key, expected): '''.format(self.to_rust(space), self.to_rust(key))) def get_partial(self, space, key, attrs, expected): - self.f.write('let expected = {0};'.format(self.to_rust(expected))) if expected is None: self.f.write(''' match client.get_partial({0}, {1}, {2}) {{ @@ -825,6 +834,7 @@ def get_partial(self, space, key, attrs, expected): }} '''.format(self.to_rust(space), self.to_rust(key), self.to_rust(attrs))) else: + self.f.write('let expected = {0};'.format(self.to_rust(expected))) self.f.write(''' match client.get_partial({0}, {1}, {2}) {{ Ok(obj) => {{ @@ -859,14 +869,14 @@ def cond_put(self, space, key, pred, value, expected): Ok(()) => (), Err(err) => panic!(err), }} - '''.format(self.to_rust(space), self.to_rust(key), self.to_rust(pred), self.to_rust(value))) + '''.format(self.to_rust(space), self.to_rust(key), self.to_preds(pred), self.to_rust(value))) else: self.f.write(''' - match client.put({0}, {1}, {2}, {3}) {{ + match client.cond_put({0}, {1}, {2}, {3}) {{ Ok(()) => panic!("this CONDPUT operation should have failed"), Err(err) => (), }} - '''.format(self.to_rust(space), self.to_rust(key), self.to_rust(pred), self.to_rust(value))) + '''.format(self.to_rust(space), self.to_rust(key), self.to_preds(pred), self.to_rust(value))) def delete(self, space, key, expected): self.f.write(''' @@ -879,7 +889,7 @@ def delete(self, space, key, expected): def search(self, space, pred, expected): self.f.write(''' let res = client.search({0}, {1}); - let elems = res.iter().collect(); + let elems: Vec> = res.iter().collect(); assert!(elems.len() == {2}.len()); '''.format(self.to_rust(space), self.to_preds(pred), self.to_rust(expected))) @@ -888,8 +898,8 @@ def to_preds(self, preds): for name, val in preds.iteritems(): pred = 'EQUALS' if isinstance(val, Range): - preds_as_strs.append('HyperPredicate::new({0}, {1}, {2})'.format(self.to_rust(name), self.to_rust(val.x), 'GREATER_EQUAL')) - preds_as_strs.append('HyperPredicate::new({0}, {1}, {2})'.format(self.to_rust(name), self.to_rust(val.y), 'LESS_EQUAL')) + preds_as_strs.append('HyperPredicate::new({0}, {1}, {2})'.format(self.to_rust(name), 'GREATER_EQUAL', self.to_rust(val.x))) + preds_as_strs.append('HyperPredicate::new({0}, {1}, {2})'.format(self.to_rust(name), 'LESS_EQUAL', self.to_rust(val.y))) continue elif isinstance(val, LessEqual): val = val.x @@ -918,35 +928,56 @@ def to_preds(self, preds): preds_as_strs.append('HyperPredicate::new({0}, {1}, {2})'.format(self.to_rust(name), pred, self.to_rust(val))) return 'vec!(' + ', '.join(preds_as_strs) + ')' - def to_rust(self, x): + def to_rust(self, x, inner=False): if x is True: return 'true' elif x is False: return 'false' elif x is None: - return 'nil' + return 'None' elif isinstance(x, str): return double_quote(x) elif isinstance(x, long) or isinstance(x, int): return '%s as i64' % str(x) elif isinstance(x, float): - return '%s as f64' % str(x) + if inner: + return 'F64(%s as f64)' % str(x) + else: + return '%s as f64' % str(x) elif isinstance(x, list): s = 'vec!(' s += ', '.join(['{0}'.format(self.to_rust(v)) for v in x]) - s += ');' + s += ')' return s elif isinstance(x, set): - s = 'BTreeSet::from_iter(vec!(' - s += ', '.join(['{0}'.format(self.to_rust(v)) for v in sorted(x)]) - s += ').iter());' - return s + if len(x): + s = '{\n' + s += 'let mut s = BTreeSet::new();\n' + for v in x: + s += 's.insert({0});\n'.format(self.to_rust(v)) + s += 's\n}\n' + return s + else: + return 'BTreeSet::>::new()' elif isinstance(x, dict): - s = 'NewHyperObject!(' - s += ', '.join(['{0}, {1}'.format(self.to_rust(k), self.to_rust(v)) - for k, v in sorted(x.items())]) - s += ')' - return s + if inner: + if len(x): + s = '{\n' + s += 'let mut m = HashMap::new();\n' + for k, v in x.items(): + s += 'm.insert({}, {});\n'.format(self.to_rust(k, inner=True), self.to_rust(v)) + s += 'm\n}\n' + else: + s = 'HashMap::, Vec>::new()' + return s + elif len(x): + s = 'NewHyperObject!(' + s += ', '.join(['{0}, {1}'.format(self.to_rust(k), self.to_rust(v, inner=True)) + for k, v in sorted(x.items())]) + s += ',)' + return s + else: + return "HyperObject::new()" else: raise RuntimeError("Cannot convert {0!r} to rust".format(x)) diff --git a/test/rust/.Basic.rs.swp b/test/rust/.Basic.rs.swp deleted file mode 100644 index f69d39d007d7df8dd8bdad81cd0acd35efefc2ab..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 12288 zcmeI2O=uHA6vwA3T5GFf@t|0k#;*-F{YXodEmg1;6|wE1iXydab|=l6WH;CfT3(>ES+AMytsaly&huB5ROR7_CFNgE;5-gt>lDeL@xA2Ml>g8Tal<` z1iN1M4SRIk5Iv`^W`r{;aw`>2xL%Kw#pSr>ntHe62K!Q-6d(oGsz4j-kM{LSFMC6s zynV;HwK}B!qyQ;E3XlS%04YEUkOHItDbPR)c$p?Pk9gM=V?I;7H=65Ihfa2cEgyFoMfu?6FS z+aLxez%KB)g|S!QE=YqhFaSEh*UgMAf(38`2yg@(0AHFJdj{?S7mR>?pap!}#Mle) z7(4(4FbxKQ0$RZ$^mz($Km)_z5Rkg<0aQo27A{-~o zhmUe4+{Jv;vP+?Qvu~BrEK~1PLSDjjxgEPAbdS3UJDW1NWqUj(c-+ofMrSBIRMq!* zQb8|&_~TTm~ZxgAa4dOsyWOa^k^B z7bhS!sGKIEQ^HlXSrwWgQq@C~5>?EqG9GF6*D*=s->gW1X}XuyQYz1@#|luZBu$rG zo*Jtlee%*$mO3nXVE$)SE@oUhD zTB6lK@!FXnV_TICnQS0YyLjzDgGnsCFnI}b$xQfmRCjglz{lrkmwXMy@Z{Z8p? zluSXOb;y(kI|h{P3(MQTY)@ys;_(3ogAxB6p{kacQ{s-Do_0M)iQ5joys>@c3u<0& zmzp!T&0?W0f1BM(yn!~s4s;aCi*kI!p_5;&Wi`^Mqq@-O;?2{%HRN%ukDp diff --git a/test/rust/Basic.rs b/test/rust/Basic.rs index a52271e21..de0439470 100644 --- a/test/rust/Basic.rs +++ b/test/rust/Basic.rs @@ -1,14 +1,19 @@ -extern crate hyperdex; +#[macro_use] extern crate hyperdex; use std::os; +use std::str::FromStr; +use std::collections::BTreeSet; +use std::collections::HashMap; +use std::iter::FromIterator; -use hyperdex::{Client, NewHyperObject}; +use hyperdex::*; +use hyperdex::HyperPredicateType::*; fn main() { let args = os::args(); - let mut client = Client::new(from_str(format!("{}:{}", args[1], args[2])).unwrap()).unwrap(); -let expected = nil; + let mut client = Client::new(FromStr::from_str(format!("{}:{}", args[1], args[2]).as_slice()).unwrap()).unwrap(); + match client.get("kv", "k") { Ok(obj) => { panic!("this object should not be found!"); @@ -16,11 +21,11 @@ let expected = nil; Err(err) => (), } - match client.put("kv", "k", NewHyperObject!("v", "v1")) { + match client.put("kv", "k", NewHyperObject!("v", "v1",)) { Ok(()) => (), Err(err) => panic!(err), } - let expected = NewHyperObject!("v", "v1"); + let expected = NewHyperObject!("v", "v1",); match client.get("kv", "k") { Ok(obj) => { if obj != expected { @@ -31,11 +36,11 @@ actual: {:?}", expected, obj); Err(err) => panic!(err), } - match client.put("kv", "k", NewHyperObject!("v", "v2")) { + match client.put("kv", "k", NewHyperObject!("v", "v2",)) { Ok(()) => (), Err(err) => panic!(err), } - let expected = NewHyperObject!("v", "v2"); + let expected = NewHyperObject!("v", "v2",); match client.get("kv", "k") { Ok(obj) => { if obj != expected { @@ -46,11 +51,11 @@ actual: {:?}", expected, obj); Err(err) => panic!(err), } - match client.put("kv", "k", NewHyperObject!("v", "v3")) { + match client.put("kv", "k", NewHyperObject!("v", "v3",)) { Ok(()) => (), Err(err) => panic!(err), } - let expected = NewHyperObject!("v", "v3"); + let expected = NewHyperObject!("v", "v3",); match client.get("kv", "k") { Ok(obj) => { if obj != expected { @@ -65,7 +70,7 @@ actual: {:?}", expected, obj); Ok(()) => (), Err(err) => panic!(err), } - let expected = nil; + match client.get("kv", "k") { Ok(obj) => { panic!("this object should not be found!"); diff --git a/test/rust/BasicSearch.rs b/test/rust/BasicSearch.rs index 4a9d51498..7baf57a4b 100644 --- a/test/rust/BasicSearch.rs +++ b/test/rust/BasicSearch.rs @@ -1,33 +1,38 @@ -extern crate hyperdex; +#[macro_use] extern crate hyperdex; use std::os; +use std::str::FromStr; +use std::collections::BTreeSet; +use std::collections::HashMap; +use std::iter::FromIterator; -use hyperdex::{Client, NewHyperObject}; +use hyperdex::*; +use hyperdex::HyperPredicateType::*; fn main() { let args = os::args(); - let mut client = Client::new(from_str(format!("{}:{}", args[1], args[2])).unwrap()).unwrap(); + let mut client = Client::new(FromStr::from_str(format!("{}:{}", args[1], args[2]).as_slice()).unwrap()).unwrap(); let res = client.search("kv", vec!(HyperPredicate::new("v", EQUALS, "v1"))); - let elems = res.iter().collect(); - assert!(elems.len() == BTreeSet::from_iter(vec!().iter());.len()); + let elems: Vec> = res.iter().collect(); + assert!(elems.len() == BTreeSet::>::new().len()); - match client.put("kv", "k1", NewHyperObject!("v", "v1")) { + match client.put("kv", "k1", NewHyperObject!("v", "v1",)) { Ok(()) => (), Err(err) => panic!(err), } let res = client.search("kv", vec!(HyperPredicate::new("v", EQUALS, "v1"))); - let elems = res.iter().collect(); - assert!(elems.len() == vec!(NewHyperObject!("k", "k1", "v", "v1"));.len()); + let elems: Vec> = res.iter().collect(); + assert!(elems.len() == vec!(NewHyperObject!("k", "k1", "v", "v1",)).len()); - match client.put("kv", "k2", NewHyperObject!("v", "v1")) { + match client.put("kv", "k2", NewHyperObject!("v", "v1",)) { Ok(()) => (), Err(err) => panic!(err), } let res = client.search("kv", vec!(HyperPredicate::new("v", EQUALS, "v1"))); - let elems = res.iter().collect(); - assert!(elems.len() == vec!(NewHyperObject!("k", "k1", "v", "v1"), NewHyperObject!("k", "k2", "v", "v1"));.len()); + let elems: Vec> = res.iter().collect(); + assert!(elems.len() == vec!(NewHyperObject!("k", "k1", "v", "v1",), NewHyperObject!("k", "k2", "v", "v1",)).len()); } diff --git a/test/rust/CondPut.rs b/test/rust/CondPut.rs index 71842a712..e71417e61 100644 --- a/test/rust/CondPut.rs +++ b/test/rust/CondPut.rs @@ -1,14 +1,19 @@ -extern crate hyperdex; +#[macro_use] extern crate hyperdex; use std::os; +use std::str::FromStr; +use std::collections::BTreeSet; +use std::collections::HashMap; +use std::iter::FromIterator; -use hyperdex::{Client, NewHyperObject}; +use hyperdex::*; +use hyperdex::HyperPredicateType::*; fn main() { let args = os::args(); - let mut client = Client::new(from_str(format!("{}:{}", args[1], args[2])).unwrap()).unwrap(); -let expected = nil; + let mut client = Client::new(FromStr::from_str(format!("{}:{}", args[1], args[2]).as_slice()).unwrap()).unwrap(); + match client.get("kv", "k") { Ok(obj) => { panic!("this object should not be found!"); @@ -16,11 +21,11 @@ let expected = nil; Err(err) => (), } - match client.put("kv", "k", NewHyperObject!("v", "v1")) { + match client.put("kv", "k", NewHyperObject!("v", "v1",)) { Ok(()) => (), Err(err) => panic!(err), } - let expected = NewHyperObject!("v", "v1"); + let expected = NewHyperObject!("v", "v1",); match client.get("kv", "k") { Ok(obj) => { if obj != expected { @@ -31,11 +36,11 @@ actual: {:?}", expected, obj); Err(err) => panic!(err), } - match client.put("kv", "k", NewHyperObject!("v", "v2"), NewHyperObject!("v", "v3")) { + match client.cond_put("kv", "k", vec!(HyperPredicate::new("v", EQUALS, "v2")), NewHyperObject!("v", "v3",)) { Ok(()) => panic!("this CONDPUT operation should have failed"), Err(err) => (), } - let expected = NewHyperObject!("v", "v1"); + let expected = NewHyperObject!("v", "v1",); match client.get("kv", "k") { Ok(obj) => { if obj != expected { @@ -46,11 +51,11 @@ actual: {:?}", expected, obj); Err(err) => panic!(err), } - match client.cond_put("kv", "k", NewHyperObject!("v", "v1"), NewHyperObject!("v", "v3")) { + match client.cond_put("kv", "k", vec!(HyperPredicate::new("v", EQUALS, "v1")), NewHyperObject!("v", "v3",)) { Ok(()) => (), Err(err) => panic!(err), } - let expected = NewHyperObject!("v", "v3"); + let expected = NewHyperObject!("v", "v3",); match client.get("kv", "k") { Ok(obj) => { if obj != expected { diff --git a/test/rust/DataTypeFloat.rs b/test/rust/DataTypeFloat.rs index 732e5be1f..4ab54a366 100644 --- a/test/rust/DataTypeFloat.rs +++ b/test/rust/DataTypeFloat.rs @@ -1,19 +1,24 @@ -extern crate hyperdex; +#[macro_use] extern crate hyperdex; use std::os; +use std::str::FromStr; +use std::collections::BTreeSet; +use std::collections::HashMap; +use std::iter::FromIterator; -use hyperdex::{Client, NewHyperObject}; +use hyperdex::*; +use hyperdex::HyperPredicateType::*; fn main() { let args = os::args(); - let mut client = Client::new(from_str(format!("{}:{}", args[1], args[2])).unwrap()).unwrap(); + let mut client = Client::new(FromStr::from_str(format!("{}:{}", args[1], args[2]).as_slice()).unwrap()).unwrap(); - match client.put("kv", "k", NewHyperObject!()) { + match client.put("kv", "k", HyperObject::new()) { Ok(()) => (), Err(err) => panic!(err), } - let expected = NewHyperObject!("v", 0.0 as f64); + let expected = NewHyperObject!("v", F64(0.0 as f64),); match client.get("kv", "k") { Ok(obj) => { if obj != expected { @@ -24,11 +29,11 @@ actual: {:?}", expected, obj); Err(err) => panic!(err), } - match client.put("kv", "k", NewHyperObject!("v", 3.14 as f64)) { + match client.put("kv", "k", NewHyperObject!("v", F64(3.14 as f64),)) { Ok(()) => (), Err(err) => panic!(err), } - let expected = NewHyperObject!("v", 3.14 as f64); + let expected = NewHyperObject!("v", F64(3.14 as f64),); match client.get("kv", "k") { Ok(obj) => { if obj != expected { diff --git a/test/rust/DataTypeInt.rs b/test/rust/DataTypeInt.rs index 0ca12deef..770d7b934 100644 --- a/test/rust/DataTypeInt.rs +++ b/test/rust/DataTypeInt.rs @@ -1,19 +1,24 @@ -extern crate hyperdex; +#[macro_use] extern crate hyperdex; use std::os; +use std::str::FromStr; +use std::collections::BTreeSet; +use std::collections::HashMap; +use std::iter::FromIterator; -use hyperdex::{Client, NewHyperObject}; +use hyperdex::*; +use hyperdex::HyperPredicateType::*; fn main() { let args = os::args(); - let mut client = Client::new(from_str(format!("{}:{}", args[1], args[2])).unwrap()).unwrap(); + let mut client = Client::new(FromStr::from_str(format!("{}:{}", args[1], args[2]).as_slice()).unwrap()).unwrap(); - match client.put("kv", "k", NewHyperObject!()) { + match client.put("kv", "k", HyperObject::new()) { Ok(()) => (), Err(err) => panic!(err), } - let expected = NewHyperObject!("v", 0 as i64); + let expected = NewHyperObject!("v", 0 as i64,); match client.get("kv", "k") { Ok(obj) => { if obj != expected { @@ -24,11 +29,11 @@ actual: {:?}", expected, obj); Err(err) => panic!(err), } - match client.put("kv", "k", NewHyperObject!("v", 1 as i64)) { + match client.put("kv", "k", NewHyperObject!("v", 1 as i64,)) { Ok(()) => (), Err(err) => panic!(err), } - let expected = NewHyperObject!("v", 1 as i64); + let expected = NewHyperObject!("v", 1 as i64,); match client.get("kv", "k") { Ok(obj) => { if obj != expected { @@ -39,11 +44,11 @@ actual: {:?}", expected, obj); Err(err) => panic!(err), } - match client.put("kv", "k", NewHyperObject!("v", -1 as i64)) { + match client.put("kv", "k", NewHyperObject!("v", -1 as i64,)) { Ok(()) => (), Err(err) => panic!(err), } - let expected = NewHyperObject!("v", -1 as i64); + let expected = NewHyperObject!("v", -1 as i64,); match client.get("kv", "k") { Ok(obj) => { if obj != expected { @@ -54,11 +59,11 @@ actual: {:?}", expected, obj); Err(err) => panic!(err), } - match client.put("kv", "k", NewHyperObject!("v", 0 as i64)) { + match client.put("kv", "k", NewHyperObject!("v", 0 as i64,)) { Ok(()) => (), Err(err) => panic!(err), } - let expected = NewHyperObject!("v", 0 as i64); + let expected = NewHyperObject!("v", 0 as i64,); match client.get("kv", "k") { Ok(obj) => { if obj != expected { @@ -69,11 +74,11 @@ actual: {:?}", expected, obj); Err(err) => panic!(err), } - match client.put("kv", "k", NewHyperObject!("v", 9223372036854775807 as i64)) { + match client.put("kv", "k", NewHyperObject!("v", 9223372036854775807 as i64,)) { Ok(()) => (), Err(err) => panic!(err), } - let expected = NewHyperObject!("v", 9223372036854775807 as i64); + let expected = NewHyperObject!("v", 9223372036854775807 as i64,); match client.get("kv", "k") { Ok(obj) => { if obj != expected { @@ -84,11 +89,11 @@ actual: {:?}", expected, obj); Err(err) => panic!(err), } - match client.put("kv", "k", NewHyperObject!("v", -9223372036854775808 as i64)) { + match client.put("kv", "k", NewHyperObject!("v", -9223372036854775808 as i64,)) { Ok(()) => (), Err(err) => panic!(err), } - let expected = NewHyperObject!("v", -9223372036854775808 as i64); + let expected = NewHyperObject!("v", -9223372036854775808 as i64,); match client.get("kv", "k") { Ok(obj) => { if obj != expected { diff --git a/test/rust/DataTypeListFloat.rs b/test/rust/DataTypeListFloat.rs index 134521ddd..866421a5a 100644 --- a/test/rust/DataTypeListFloat.rs +++ b/test/rust/DataTypeListFloat.rs @@ -1,19 +1,24 @@ -extern crate hyperdex; +#[macro_use] extern crate hyperdex; use std::os; +use std::str::FromStr; +use std::collections::BTreeSet; +use std::collections::HashMap; +use std::iter::FromIterator; -use hyperdex::{Client, NewHyperObject}; +use hyperdex::*; +use hyperdex::HyperPredicateType::*; fn main() { let args = os::args(); - let mut client = Client::new(from_str(format!("{}:{}", args[1], args[2])).unwrap()).unwrap(); + let mut client = Client::new(FromStr::from_str(format!("{}:{}", args[1], args[2]).as_slice()).unwrap()).unwrap(); - match client.put("kv", "k", NewHyperObject!()) { + match client.put("kv", "k", HyperObject::new()) { Ok(()) => (), Err(err) => panic!(err), } - let expected = NewHyperObject!("v", vec!();); + let expected = NewHyperObject!("v", vec!(),); match client.get("kv", "k") { Ok(obj) => { if obj != expected { @@ -24,11 +29,11 @@ actual: {:?}", expected, obj); Err(err) => panic!(err), } - match client.put("kv", "k", NewHyperObject!("v", vec!(3.14 as f64, 0.25 as f64, 1.0 as f64);)) { + match client.put("kv", "k", NewHyperObject!("v", vec!(3.14 as f64, 0.25 as f64, 1.0 as f64),)) { Ok(()) => (), Err(err) => panic!(err), } - let expected = NewHyperObject!("v", vec!(3.14 as f64, 0.25 as f64, 1.0 as f64);); + let expected = NewHyperObject!("v", vec!(3.14 as f64, 0.25 as f64, 1.0 as f64),); match client.get("kv", "k") { Ok(obj) => { if obj != expected { @@ -39,11 +44,11 @@ actual: {:?}", expected, obj); Err(err) => panic!(err), } - match client.put("kv", "k", NewHyperObject!("v", vec!();)) { + match client.put("kv", "k", NewHyperObject!("v", vec!(),)) { Ok(()) => (), Err(err) => panic!(err), } - let expected = NewHyperObject!("v", vec!();); + let expected = NewHyperObject!("v", vec!(),); match client.get("kv", "k") { Ok(obj) => { if obj != expected { diff --git a/test/rust/DataTypeListInt.rs b/test/rust/DataTypeListInt.rs index 27a93bcdc..9b772e328 100644 --- a/test/rust/DataTypeListInt.rs +++ b/test/rust/DataTypeListInt.rs @@ -1,19 +1,24 @@ -extern crate hyperdex; +#[macro_use] extern crate hyperdex; use std::os; +use std::str::FromStr; +use std::collections::BTreeSet; +use std::collections::HashMap; +use std::iter::FromIterator; -use hyperdex::{Client, NewHyperObject}; +use hyperdex::*; +use hyperdex::HyperPredicateType::*; fn main() { let args = os::args(); - let mut client = Client::new(from_str(format!("{}:{}", args[1], args[2])).unwrap()).unwrap(); + let mut client = Client::new(FromStr::from_str(format!("{}:{}", args[1], args[2]).as_slice()).unwrap()).unwrap(); - match client.put("kv", "k", NewHyperObject!()) { + match client.put("kv", "k", HyperObject::new()) { Ok(()) => (), Err(err) => panic!(err), } - let expected = NewHyperObject!("v", vec!();); + let expected = NewHyperObject!("v", vec!(),); match client.get("kv", "k") { Ok(obj) => { if obj != expected { @@ -24,11 +29,11 @@ actual: {:?}", expected, obj); Err(err) => panic!(err), } - match client.put("kv", "k", NewHyperObject!("v", vec!(1 as i64, 2 as i64, 3 as i64);)) { + match client.put("kv", "k", NewHyperObject!("v", vec!(1 as i64, 2 as i64, 3 as i64),)) { Ok(()) => (), Err(err) => panic!(err), } - let expected = NewHyperObject!("v", vec!(1 as i64, 2 as i64, 3 as i64);); + let expected = NewHyperObject!("v", vec!(1 as i64, 2 as i64, 3 as i64),); match client.get("kv", "k") { Ok(obj) => { if obj != expected { @@ -39,11 +44,11 @@ actual: {:?}", expected, obj); Err(err) => panic!(err), } - match client.put("kv", "k", NewHyperObject!("v", vec!();)) { + match client.put("kv", "k", NewHyperObject!("v", vec!(),)) { Ok(()) => (), Err(err) => panic!(err), } - let expected = NewHyperObject!("v", vec!();); + let expected = NewHyperObject!("v", vec!(),); match client.get("kv", "k") { Ok(obj) => { if obj != expected { diff --git a/test/rust/DataTypeListString.rs b/test/rust/DataTypeListString.rs index dc1d563da..2bc9b6038 100644 --- a/test/rust/DataTypeListString.rs +++ b/test/rust/DataTypeListString.rs @@ -1,19 +1,24 @@ -extern crate hyperdex; +#[macro_use] extern crate hyperdex; use std::os; +use std::str::FromStr; +use std::collections::BTreeSet; +use std::collections::HashMap; +use std::iter::FromIterator; -use hyperdex::{Client, NewHyperObject}; +use hyperdex::*; +use hyperdex::HyperPredicateType::*; fn main() { let args = os::args(); - let mut client = Client::new(from_str(format!("{}:{}", args[1], args[2])).unwrap()).unwrap(); + let mut client = Client::new(FromStr::from_str(format!("{}:{}", args[1], args[2]).as_slice()).unwrap()).unwrap(); - match client.put("kv", "k", NewHyperObject!()) { + match client.put("kv", "k", HyperObject::new()) { Ok(()) => (), Err(err) => panic!(err), } - let expected = NewHyperObject!("v", vec!();); + let expected = NewHyperObject!("v", vec!(),); match client.get("kv", "k") { Ok(obj) => { if obj != expected { @@ -24,11 +29,11 @@ actual: {:?}", expected, obj); Err(err) => panic!(err), } - match client.put("kv", "k", NewHyperObject!("v", vec!("A", "B", "C");)) { + match client.put("kv", "k", NewHyperObject!("v", vec!("A", "B", "C"),)) { Ok(()) => (), Err(err) => panic!(err), } - let expected = NewHyperObject!("v", vec!("A", "B", "C");); + let expected = NewHyperObject!("v", vec!("A", "B", "C"),); match client.get("kv", "k") { Ok(obj) => { if obj != expected { @@ -39,11 +44,11 @@ actual: {:?}", expected, obj); Err(err) => panic!(err), } - match client.put("kv", "k", NewHyperObject!("v", vec!();)) { + match client.put("kv", "k", NewHyperObject!("v", vec!(),)) { Ok(()) => (), Err(err) => panic!(err), } - let expected = NewHyperObject!("v", vec!();); + let expected = NewHyperObject!("v", vec!(),); match client.get("kv", "k") { Ok(obj) => { if obj != expected { diff --git a/test/rust/DataTypeMapFloatFloat.rs b/test/rust/DataTypeMapFloatFloat.rs index b26819b50..e55bb786a 100644 --- a/test/rust/DataTypeMapFloatFloat.rs +++ b/test/rust/DataTypeMapFloatFloat.rs @@ -1,19 +1,24 @@ -extern crate hyperdex; +#[macro_use] extern crate hyperdex; use std::os; +use std::str::FromStr; +use std::collections::BTreeSet; +use std::collections::HashMap; +use std::iter::FromIterator; -use hyperdex::{Client, NewHyperObject}; +use hyperdex::*; +use hyperdex::HyperPredicateType::*; fn main() { let args = os::args(); - let mut client = Client::new(from_str(format!("{}:{}", args[1], args[2])).unwrap()).unwrap(); + let mut client = Client::new(FromStr::from_str(format!("{}:{}", args[1], args[2]).as_slice()).unwrap()).unwrap(); - match client.put("kv", "k", NewHyperObject!()) { + match client.put("kv", "k", HyperObject::new()) { Ok(()) => (), Err(err) => panic!(err), } - let expected = NewHyperObject!("v", NewHyperObject!()); + let expected = NewHyperObject!("v", HashMap::, Vec>::new(),); match client.get("kv", "k") { Ok(obj) => { if obj != expected { @@ -24,11 +29,25 @@ actual: {:?}", expected, obj); Err(err) => panic!(err), } - match client.put("kv", "k", NewHyperObject!("v", NewHyperObject!(0.25 as f64, 2.0 as f64, 1.0 as f64, 3.0 as f64, 3.14 as f64, 1.0 as f64))) { + match client.put("kv", "k", NewHyperObject!("v", { +let mut m = HashMap::new(); +m.insert(F64(0.25 as f64), 2.0 as f64); +m.insert(F64(1.0 as f64), 3.0 as f64); +m.insert(F64(3.14 as f64), 1.0 as f64); +m +} +,)) { Ok(()) => (), Err(err) => panic!(err), } - let expected = NewHyperObject!("v", NewHyperObject!(0.25 as f64, 2.0 as f64, 1.0 as f64, 3.0 as f64, 3.14 as f64, 1.0 as f64)); + let expected = NewHyperObject!("v", { +let mut m = HashMap::new(); +m.insert(F64(0.25 as f64), 2.0 as f64); +m.insert(F64(1.0 as f64), 3.0 as f64); +m.insert(F64(3.14 as f64), 1.0 as f64); +m +} +,); match client.get("kv", "k") { Ok(obj) => { if obj != expected { @@ -39,11 +58,11 @@ actual: {:?}", expected, obj); Err(err) => panic!(err), } - match client.put("kv", "k", NewHyperObject!("v", NewHyperObject!())) { + match client.put("kv", "k", NewHyperObject!("v", HashMap::, Vec>::new(),)) { Ok(()) => (), Err(err) => panic!(err), } - let expected = NewHyperObject!("v", NewHyperObject!()); + let expected = NewHyperObject!("v", HashMap::, Vec>::new(),); match client.get("kv", "k") { Ok(obj) => { if obj != expected { diff --git a/test/rust/DataTypeMapFloatInt.rs b/test/rust/DataTypeMapFloatInt.rs index 73cfb9c6e..c83152cda 100644 --- a/test/rust/DataTypeMapFloatInt.rs +++ b/test/rust/DataTypeMapFloatInt.rs @@ -1,19 +1,24 @@ -extern crate hyperdex; +#[macro_use] extern crate hyperdex; use std::os; +use std::str::FromStr; +use std::collections::BTreeSet; +use std::collections::HashMap; +use std::iter::FromIterator; -use hyperdex::{Client, NewHyperObject}; +use hyperdex::*; +use hyperdex::HyperPredicateType::*; fn main() { let args = os::args(); - let mut client = Client::new(from_str(format!("{}:{}", args[1], args[2])).unwrap()).unwrap(); + let mut client = Client::new(FromStr::from_str(format!("{}:{}", args[1], args[2]).as_slice()).unwrap()).unwrap(); - match client.put("kv", "k", NewHyperObject!()) { + match client.put("kv", "k", HyperObject::new()) { Ok(()) => (), Err(err) => panic!(err), } - let expected = NewHyperObject!("v", NewHyperObject!()); + let expected = NewHyperObject!("v", HashMap::, Vec>::new(),); match client.get("kv", "k") { Ok(obj) => { if obj != expected { @@ -24,11 +29,25 @@ actual: {:?}", expected, obj); Err(err) => panic!(err), } - match client.put("kv", "k", NewHyperObject!("v", NewHyperObject!(0.25 as f64, 2 as i64, 1.0 as f64, 3 as i64, 3.14 as f64, 1 as i64))) { + match client.put("kv", "k", NewHyperObject!("v", { +let mut m = HashMap::new(); +m.insert(F64(0.25 as f64), 2 as i64); +m.insert(F64(1.0 as f64), 3 as i64); +m.insert(F64(3.14 as f64), 1 as i64); +m +} +,)) { Ok(()) => (), Err(err) => panic!(err), } - let expected = NewHyperObject!("v", NewHyperObject!(0.25 as f64, 2 as i64, 1.0 as f64, 3 as i64, 3.14 as f64, 1 as i64)); + let expected = NewHyperObject!("v", { +let mut m = HashMap::new(); +m.insert(F64(0.25 as f64), 2 as i64); +m.insert(F64(1.0 as f64), 3 as i64); +m.insert(F64(3.14 as f64), 1 as i64); +m +} +,); match client.get("kv", "k") { Ok(obj) => { if obj != expected { @@ -39,11 +58,11 @@ actual: {:?}", expected, obj); Err(err) => panic!(err), } - match client.put("kv", "k", NewHyperObject!("v", NewHyperObject!())) { + match client.put("kv", "k", NewHyperObject!("v", HashMap::, Vec>::new(),)) { Ok(()) => (), Err(err) => panic!(err), } - let expected = NewHyperObject!("v", NewHyperObject!()); + let expected = NewHyperObject!("v", HashMap::, Vec>::new(),); match client.get("kv", "k") { Ok(obj) => { if obj != expected { diff --git a/test/rust/DataTypeMapFloatString.rs b/test/rust/DataTypeMapFloatString.rs index 15a373b71..63682a9df 100644 --- a/test/rust/DataTypeMapFloatString.rs +++ b/test/rust/DataTypeMapFloatString.rs @@ -1,19 +1,24 @@ -extern crate hyperdex; +#[macro_use] extern crate hyperdex; use std::os; +use std::str::FromStr; +use std::collections::BTreeSet; +use std::collections::HashMap; +use std::iter::FromIterator; -use hyperdex::{Client, NewHyperObject}; +use hyperdex::*; +use hyperdex::HyperPredicateType::*; fn main() { let args = os::args(); - let mut client = Client::new(from_str(format!("{}:{}", args[1], args[2])).unwrap()).unwrap(); + let mut client = Client::new(FromStr::from_str(format!("{}:{}", args[1], args[2]).as_slice()).unwrap()).unwrap(); - match client.put("kv", "k", NewHyperObject!()) { + match client.put("kv", "k", HyperObject::new()) { Ok(()) => (), Err(err) => panic!(err), } - let expected = NewHyperObject!("v", NewHyperObject!()); + let expected = NewHyperObject!("v", HashMap::, Vec>::new(),); match client.get("kv", "k") { Ok(obj) => { if obj != expected { @@ -24,11 +29,25 @@ actual: {:?}", expected, obj); Err(err) => panic!(err), } - match client.put("kv", "k", NewHyperObject!("v", NewHyperObject!(0.25 as f64, "Y", 1.0 as f64, "Z", 3.14 as f64, "X"))) { + match client.put("kv", "k", NewHyperObject!("v", { +let mut m = HashMap::new(); +m.insert(F64(0.25 as f64), "Y"); +m.insert(F64(1.0 as f64), "Z"); +m.insert(F64(3.14 as f64), "X"); +m +} +,)) { Ok(()) => (), Err(err) => panic!(err), } - let expected = NewHyperObject!("v", NewHyperObject!(0.25 as f64, "Y", 1.0 as f64, "Z", 3.14 as f64, "X")); + let expected = NewHyperObject!("v", { +let mut m = HashMap::new(); +m.insert(F64(0.25 as f64), "Y"); +m.insert(F64(1.0 as f64), "Z"); +m.insert(F64(3.14 as f64), "X"); +m +} +,); match client.get("kv", "k") { Ok(obj) => { if obj != expected { @@ -39,11 +58,11 @@ actual: {:?}", expected, obj); Err(err) => panic!(err), } - match client.put("kv", "k", NewHyperObject!("v", NewHyperObject!())) { + match client.put("kv", "k", NewHyperObject!("v", HashMap::, Vec>::new(),)) { Ok(()) => (), Err(err) => panic!(err), } - let expected = NewHyperObject!("v", NewHyperObject!()); + let expected = NewHyperObject!("v", HashMap::, Vec>::new(),); match client.get("kv", "k") { Ok(obj) => { if obj != expected { diff --git a/test/rust/DataTypeMapIntFloat.rs b/test/rust/DataTypeMapIntFloat.rs index 1daf3cccb..5f21b5741 100644 --- a/test/rust/DataTypeMapIntFloat.rs +++ b/test/rust/DataTypeMapIntFloat.rs @@ -1,19 +1,24 @@ -extern crate hyperdex; +#[macro_use] extern crate hyperdex; use std::os; +use std::str::FromStr; +use std::collections::BTreeSet; +use std::collections::HashMap; +use std::iter::FromIterator; -use hyperdex::{Client, NewHyperObject}; +use hyperdex::*; +use hyperdex::HyperPredicateType::*; fn main() { let args = os::args(); - let mut client = Client::new(from_str(format!("{}:{}", args[1], args[2])).unwrap()).unwrap(); + let mut client = Client::new(FromStr::from_str(format!("{}:{}", args[1], args[2]).as_slice()).unwrap()).unwrap(); - match client.put("kv", "k", NewHyperObject!()) { + match client.put("kv", "k", HyperObject::new()) { Ok(()) => (), Err(err) => panic!(err), } - let expected = NewHyperObject!("v", NewHyperObject!()); + let expected = NewHyperObject!("v", HashMap::, Vec>::new(),); match client.get("kv", "k") { Ok(obj) => { if obj != expected { @@ -24,11 +29,25 @@ actual: {:?}", expected, obj); Err(err) => panic!(err), } - match client.put("kv", "k", NewHyperObject!("v", NewHyperObject!(1 as i64, 3.14 as f64, 2 as i64, 0.25 as f64, 3 as i64, 1.0 as f64))) { + match client.put("kv", "k", NewHyperObject!("v", { +let mut m = HashMap::new(); +m.insert(1 as i64, 3.14 as f64); +m.insert(2 as i64, 0.25 as f64); +m.insert(3 as i64, 1.0 as f64); +m +} +,)) { Ok(()) => (), Err(err) => panic!(err), } - let expected = NewHyperObject!("v", NewHyperObject!(1 as i64, 3.14 as f64, 2 as i64, 0.25 as f64, 3 as i64, 1.0 as f64)); + let expected = NewHyperObject!("v", { +let mut m = HashMap::new(); +m.insert(1 as i64, 3.14 as f64); +m.insert(2 as i64, 0.25 as f64); +m.insert(3 as i64, 1.0 as f64); +m +} +,); match client.get("kv", "k") { Ok(obj) => { if obj != expected { @@ -39,11 +58,11 @@ actual: {:?}", expected, obj); Err(err) => panic!(err), } - match client.put("kv", "k", NewHyperObject!("v", NewHyperObject!())) { + match client.put("kv", "k", NewHyperObject!("v", HashMap::, Vec>::new(),)) { Ok(()) => (), Err(err) => panic!(err), } - let expected = NewHyperObject!("v", NewHyperObject!()); + let expected = NewHyperObject!("v", HashMap::, Vec>::new(),); match client.get("kv", "k") { Ok(obj) => { if obj != expected { diff --git a/test/rust/DataTypeMapIntInt.rs b/test/rust/DataTypeMapIntInt.rs index 41dd9f7dc..bf35f9a51 100644 --- a/test/rust/DataTypeMapIntInt.rs +++ b/test/rust/DataTypeMapIntInt.rs @@ -1,19 +1,24 @@ -extern crate hyperdex; +#[macro_use] extern crate hyperdex; use std::os; +use std::str::FromStr; +use std::collections::BTreeSet; +use std::collections::HashMap; +use std::iter::FromIterator; -use hyperdex::{Client, NewHyperObject}; +use hyperdex::*; +use hyperdex::HyperPredicateType::*; fn main() { let args = os::args(); - let mut client = Client::new(from_str(format!("{}:{}", args[1], args[2])).unwrap()).unwrap(); + let mut client = Client::new(FromStr::from_str(format!("{}:{}", args[1], args[2]).as_slice()).unwrap()).unwrap(); - match client.put("kv", "k", NewHyperObject!()) { + match client.put("kv", "k", HyperObject::new()) { Ok(()) => (), Err(err) => panic!(err), } - let expected = NewHyperObject!("v", NewHyperObject!()); + let expected = NewHyperObject!("v", HashMap::, Vec>::new(),); match client.get("kv", "k") { Ok(obj) => { if obj != expected { @@ -24,11 +29,25 @@ actual: {:?}", expected, obj); Err(err) => panic!(err), } - match client.put("kv", "k", NewHyperObject!("v", NewHyperObject!(1 as i64, 7 as i64, 2 as i64, 8 as i64, 3 as i64, 9 as i64))) { + match client.put("kv", "k", NewHyperObject!("v", { +let mut m = HashMap::new(); +m.insert(1 as i64, 7 as i64); +m.insert(2 as i64, 8 as i64); +m.insert(3 as i64, 9 as i64); +m +} +,)) { Ok(()) => (), Err(err) => panic!(err), } - let expected = NewHyperObject!("v", NewHyperObject!(1 as i64, 7 as i64, 2 as i64, 8 as i64, 3 as i64, 9 as i64)); + let expected = NewHyperObject!("v", { +let mut m = HashMap::new(); +m.insert(1 as i64, 7 as i64); +m.insert(2 as i64, 8 as i64); +m.insert(3 as i64, 9 as i64); +m +} +,); match client.get("kv", "k") { Ok(obj) => { if obj != expected { @@ -39,11 +58,11 @@ actual: {:?}", expected, obj); Err(err) => panic!(err), } - match client.put("kv", "k", NewHyperObject!("v", NewHyperObject!())) { + match client.put("kv", "k", NewHyperObject!("v", HashMap::, Vec>::new(),)) { Ok(()) => (), Err(err) => panic!(err), } - let expected = NewHyperObject!("v", NewHyperObject!()); + let expected = NewHyperObject!("v", HashMap::, Vec>::new(),); match client.get("kv", "k") { Ok(obj) => { if obj != expected { diff --git a/test/rust/DataTypeMapIntString.rs b/test/rust/DataTypeMapIntString.rs index 269f66057..bc8338dfa 100644 --- a/test/rust/DataTypeMapIntString.rs +++ b/test/rust/DataTypeMapIntString.rs @@ -1,19 +1,24 @@ -extern crate hyperdex; +#[macro_use] extern crate hyperdex; use std::os; +use std::str::FromStr; +use std::collections::BTreeSet; +use std::collections::HashMap; +use std::iter::FromIterator; -use hyperdex::{Client, NewHyperObject}; +use hyperdex::*; +use hyperdex::HyperPredicateType::*; fn main() { let args = os::args(); - let mut client = Client::new(from_str(format!("{}:{}", args[1], args[2])).unwrap()).unwrap(); + let mut client = Client::new(FromStr::from_str(format!("{}:{}", args[1], args[2]).as_slice()).unwrap()).unwrap(); - match client.put("kv", "k", NewHyperObject!()) { + match client.put("kv", "k", HyperObject::new()) { Ok(()) => (), Err(err) => panic!(err), } - let expected = NewHyperObject!("v", NewHyperObject!()); + let expected = NewHyperObject!("v", HashMap::, Vec>::new(),); match client.get("kv", "k") { Ok(obj) => { if obj != expected { @@ -24,11 +29,25 @@ actual: {:?}", expected, obj); Err(err) => panic!(err), } - match client.put("kv", "k", NewHyperObject!("v", NewHyperObject!(1 as i64, "X", 2 as i64, "Y", 3 as i64, "Z"))) { + match client.put("kv", "k", NewHyperObject!("v", { +let mut m = HashMap::new(); +m.insert(1 as i64, "X"); +m.insert(2 as i64, "Y"); +m.insert(3 as i64, "Z"); +m +} +,)) { Ok(()) => (), Err(err) => panic!(err), } - let expected = NewHyperObject!("v", NewHyperObject!(1 as i64, "X", 2 as i64, "Y", 3 as i64, "Z")); + let expected = NewHyperObject!("v", { +let mut m = HashMap::new(); +m.insert(1 as i64, "X"); +m.insert(2 as i64, "Y"); +m.insert(3 as i64, "Z"); +m +} +,); match client.get("kv", "k") { Ok(obj) => { if obj != expected { @@ -39,11 +58,11 @@ actual: {:?}", expected, obj); Err(err) => panic!(err), } - match client.put("kv", "k", NewHyperObject!("v", NewHyperObject!())) { + match client.put("kv", "k", NewHyperObject!("v", HashMap::, Vec>::new(),)) { Ok(()) => (), Err(err) => panic!(err), } - let expected = NewHyperObject!("v", NewHyperObject!()); + let expected = NewHyperObject!("v", HashMap::, Vec>::new(),); match client.get("kv", "k") { Ok(obj) => { if obj != expected { diff --git a/test/rust/DataTypeMapStringFloat.rs b/test/rust/DataTypeMapStringFloat.rs index 00457e691..9a80b37b3 100644 --- a/test/rust/DataTypeMapStringFloat.rs +++ b/test/rust/DataTypeMapStringFloat.rs @@ -1,19 +1,24 @@ -extern crate hyperdex; +#[macro_use] extern crate hyperdex; use std::os; +use std::str::FromStr; +use std::collections::BTreeSet; +use std::collections::HashMap; +use std::iter::FromIterator; -use hyperdex::{Client, NewHyperObject}; +use hyperdex::*; +use hyperdex::HyperPredicateType::*; fn main() { let args = os::args(); - let mut client = Client::new(from_str(format!("{}:{}", args[1], args[2])).unwrap()).unwrap(); + let mut client = Client::new(FromStr::from_str(format!("{}:{}", args[1], args[2]).as_slice()).unwrap()).unwrap(); - match client.put("kv", "k", NewHyperObject!()) { + match client.put("kv", "k", HyperObject::new()) { Ok(()) => (), Err(err) => panic!(err), } - let expected = NewHyperObject!("v", NewHyperObject!()); + let expected = NewHyperObject!("v", HashMap::, Vec>::new(),); match client.get("kv", "k") { Ok(obj) => { if obj != expected { @@ -24,11 +29,25 @@ actual: {:?}", expected, obj); Err(err) => panic!(err), } - match client.put("kv", "k", NewHyperObject!("v", NewHyperObject!("A", 3.14 as f64, "B", 0.25 as f64, "C", 1.0 as f64))) { + match client.put("kv", "k", NewHyperObject!("v", { +let mut m = HashMap::new(); +m.insert("A", 3.14 as f64); +m.insert("C", 1.0 as f64); +m.insert("B", 0.25 as f64); +m +} +,)) { Ok(()) => (), Err(err) => panic!(err), } - let expected = NewHyperObject!("v", NewHyperObject!("A", 3.14 as f64, "B", 0.25 as f64, "C", 1.0 as f64)); + let expected = NewHyperObject!("v", { +let mut m = HashMap::new(); +m.insert("A", 3.14 as f64); +m.insert("C", 1.0 as f64); +m.insert("B", 0.25 as f64); +m +} +,); match client.get("kv", "k") { Ok(obj) => { if obj != expected { @@ -39,11 +58,11 @@ actual: {:?}", expected, obj); Err(err) => panic!(err), } - match client.put("kv", "k", NewHyperObject!("v", NewHyperObject!())) { + match client.put("kv", "k", NewHyperObject!("v", HashMap::, Vec>::new(),)) { Ok(()) => (), Err(err) => panic!(err), } - let expected = NewHyperObject!("v", NewHyperObject!()); + let expected = NewHyperObject!("v", HashMap::, Vec>::new(),); match client.get("kv", "k") { Ok(obj) => { if obj != expected { diff --git a/test/rust/DataTypeMapStringInt.rs b/test/rust/DataTypeMapStringInt.rs index 1412af001..39b8f3540 100644 --- a/test/rust/DataTypeMapStringInt.rs +++ b/test/rust/DataTypeMapStringInt.rs @@ -1,19 +1,24 @@ -extern crate hyperdex; +#[macro_use] extern crate hyperdex; use std::os; +use std::str::FromStr; +use std::collections::BTreeSet; +use std::collections::HashMap; +use std::iter::FromIterator; -use hyperdex::{Client, NewHyperObject}; +use hyperdex::*; +use hyperdex::HyperPredicateType::*; fn main() { let args = os::args(); - let mut client = Client::new(from_str(format!("{}:{}", args[1], args[2])).unwrap()).unwrap(); + let mut client = Client::new(FromStr::from_str(format!("{}:{}", args[1], args[2]).as_slice()).unwrap()).unwrap(); - match client.put("kv", "k", NewHyperObject!()) { + match client.put("kv", "k", HyperObject::new()) { Ok(()) => (), Err(err) => panic!(err), } - let expected = NewHyperObject!("v", NewHyperObject!()); + let expected = NewHyperObject!("v", HashMap::, Vec>::new(),); match client.get("kv", "k") { Ok(obj) => { if obj != expected { @@ -24,11 +29,25 @@ actual: {:?}", expected, obj); Err(err) => panic!(err), } - match client.put("kv", "k", NewHyperObject!("v", NewHyperObject!("A", 1 as i64, "B", 2 as i64, "C", 3 as i64))) { + match client.put("kv", "k", NewHyperObject!("v", { +let mut m = HashMap::new(); +m.insert("A", 1 as i64); +m.insert("C", 3 as i64); +m.insert("B", 2 as i64); +m +} +,)) { Ok(()) => (), Err(err) => panic!(err), } - let expected = NewHyperObject!("v", NewHyperObject!("A", 1 as i64, "B", 2 as i64, "C", 3 as i64)); + let expected = NewHyperObject!("v", { +let mut m = HashMap::new(); +m.insert("A", 1 as i64); +m.insert("C", 3 as i64); +m.insert("B", 2 as i64); +m +} +,); match client.get("kv", "k") { Ok(obj) => { if obj != expected { @@ -39,11 +58,11 @@ actual: {:?}", expected, obj); Err(err) => panic!(err), } - match client.put("kv", "k", NewHyperObject!("v", NewHyperObject!())) { + match client.put("kv", "k", NewHyperObject!("v", HashMap::, Vec>::new(),)) { Ok(()) => (), Err(err) => panic!(err), } - let expected = NewHyperObject!("v", NewHyperObject!()); + let expected = NewHyperObject!("v", HashMap::, Vec>::new(),); match client.get("kv", "k") { Ok(obj) => { if obj != expected { diff --git a/test/rust/DataTypeMapStringString.rs b/test/rust/DataTypeMapStringString.rs index 58a71617d..1454e55a6 100644 --- a/test/rust/DataTypeMapStringString.rs +++ b/test/rust/DataTypeMapStringString.rs @@ -1,19 +1,24 @@ -extern crate hyperdex; +#[macro_use] extern crate hyperdex; use std::os; +use std::str::FromStr; +use std::collections::BTreeSet; +use std::collections::HashMap; +use std::iter::FromIterator; -use hyperdex::{Client, NewHyperObject}; +use hyperdex::*; +use hyperdex::HyperPredicateType::*; fn main() { let args = os::args(); - let mut client = Client::new(from_str(format!("{}:{}", args[1], args[2])).unwrap()).unwrap(); + let mut client = Client::new(FromStr::from_str(format!("{}:{}", args[1], args[2]).as_slice()).unwrap()).unwrap(); - match client.put("kv", "k", NewHyperObject!()) { + match client.put("kv", "k", HyperObject::new()) { Ok(()) => (), Err(err) => panic!(err), } - let expected = NewHyperObject!("v", NewHyperObject!()); + let expected = NewHyperObject!("v", HashMap::, Vec>::new(),); match client.get("kv", "k") { Ok(obj) => { if obj != expected { @@ -24,11 +29,25 @@ actual: {:?}", expected, obj); Err(err) => panic!(err), } - match client.put("kv", "k", NewHyperObject!("v", NewHyperObject!("A", "X", "B", "Y", "C", "Z"))) { + match client.put("kv", "k", NewHyperObject!("v", { +let mut m = HashMap::new(); +m.insert("A", "X"); +m.insert("C", "Z"); +m.insert("B", "Y"); +m +} +,)) { Ok(()) => (), Err(err) => panic!(err), } - let expected = NewHyperObject!("v", NewHyperObject!("A", "X", "B", "Y", "C", "Z")); + let expected = NewHyperObject!("v", { +let mut m = HashMap::new(); +m.insert("A", "X"); +m.insert("C", "Z"); +m.insert("B", "Y"); +m +} +,); match client.get("kv", "k") { Ok(obj) => { if obj != expected { @@ -39,11 +58,11 @@ actual: {:?}", expected, obj); Err(err) => panic!(err), } - match client.put("kv", "k", NewHyperObject!("v", NewHyperObject!())) { + match client.put("kv", "k", NewHyperObject!("v", HashMap::, Vec>::new(),)) { Ok(()) => (), Err(err) => panic!(err), } - let expected = NewHyperObject!("v", NewHyperObject!()); + let expected = NewHyperObject!("v", HashMap::, Vec>::new(),); match client.get("kv", "k") { Ok(obj) => { if obj != expected { diff --git a/test/rust/DataTypeSetFloat.rs b/test/rust/DataTypeSetFloat.rs index 85205fef3..ca9dccb21 100644 --- a/test/rust/DataTypeSetFloat.rs +++ b/test/rust/DataTypeSetFloat.rs @@ -1,19 +1,24 @@ -extern crate hyperdex; +#[macro_use] extern crate hyperdex; use std::os; +use std::str::FromStr; +use std::collections::BTreeSet; +use std::collections::HashMap; +use std::iter::FromIterator; -use hyperdex::{Client, NewHyperObject}; +use hyperdex::*; +use hyperdex::HyperPredicateType::*; fn main() { let args = os::args(); - let mut client = Client::new(from_str(format!("{}:{}", args[1], args[2])).unwrap()).unwrap(); + let mut client = Client::new(FromStr::from_str(format!("{}:{}", args[1], args[2]).as_slice()).unwrap()).unwrap(); - match client.put("kv", "k", NewHyperObject!()) { + match client.put("kv", "k", HyperObject::new()) { Ok(()) => (), Err(err) => panic!(err), } - let expected = NewHyperObject!("v", BTreeSet::from_iter(vec!().iter());); + let expected = NewHyperObject!("v", BTreeSet::>::new(),); match client.get("kv", "k") { Ok(obj) => { if obj != expected { @@ -24,11 +29,25 @@ actual: {:?}", expected, obj); Err(err) => panic!(err), } - match client.put("kv", "k", NewHyperObject!("v", BTreeSet::from_iter(vec!(0.25 as f64, 1.0 as f64, 3.14 as f64).iter());)) { + match client.put("kv", "k", NewHyperObject!("v", { +let mut s = BTreeSet::new(); +s.insert(0.25 as f64); +s.insert(1.0 as f64); +s.insert(3.14 as f64); +s +} +,)) { Ok(()) => (), Err(err) => panic!(err), } - let expected = NewHyperObject!("v", BTreeSet::from_iter(vec!(0.25 as f64, 1.0 as f64, 3.14 as f64).iter());); + let expected = NewHyperObject!("v", { +let mut s = BTreeSet::new(); +s.insert(0.25 as f64); +s.insert(1.0 as f64); +s.insert(3.14 as f64); +s +} +,); match client.get("kv", "k") { Ok(obj) => { if obj != expected { @@ -39,11 +58,11 @@ actual: {:?}", expected, obj); Err(err) => panic!(err), } - match client.put("kv", "k", NewHyperObject!("v", BTreeSet::from_iter(vec!().iter());)) { + match client.put("kv", "k", NewHyperObject!("v", BTreeSet::>::new(),)) { Ok(()) => (), Err(err) => panic!(err), } - let expected = NewHyperObject!("v", BTreeSet::from_iter(vec!().iter());); + let expected = NewHyperObject!("v", BTreeSet::>::new(),); match client.get("kv", "k") { Ok(obj) => { if obj != expected { diff --git a/test/rust/DataTypeSetInt.rs b/test/rust/DataTypeSetInt.rs index 4702c0803..642407b7d 100644 --- a/test/rust/DataTypeSetInt.rs +++ b/test/rust/DataTypeSetInt.rs @@ -1,19 +1,24 @@ -extern crate hyperdex; +#[macro_use] extern crate hyperdex; use std::os; +use std::str::FromStr; +use std::collections::BTreeSet; +use std::collections::HashMap; +use std::iter::FromIterator; -use hyperdex::{Client, NewHyperObject}; +use hyperdex::*; +use hyperdex::HyperPredicateType::*; fn main() { let args = os::args(); - let mut client = Client::new(from_str(format!("{}:{}", args[1], args[2])).unwrap()).unwrap(); + let mut client = Client::new(FromStr::from_str(format!("{}:{}", args[1], args[2]).as_slice()).unwrap()).unwrap(); - match client.put("kv", "k", NewHyperObject!()) { + match client.put("kv", "k", HyperObject::new()) { Ok(()) => (), Err(err) => panic!(err), } - let expected = NewHyperObject!("v", BTreeSet::from_iter(vec!().iter());); + let expected = NewHyperObject!("v", BTreeSet::>::new(),); match client.get("kv", "k") { Ok(obj) => { if obj != expected { @@ -24,11 +29,25 @@ actual: {:?}", expected, obj); Err(err) => panic!(err), } - match client.put("kv", "k", NewHyperObject!("v", BTreeSet::from_iter(vec!(1 as i64, 2 as i64, 3 as i64).iter());)) { + match client.put("kv", "k", NewHyperObject!("v", { +let mut s = BTreeSet::new(); +s.insert(1 as i64); +s.insert(2 as i64); +s.insert(3 as i64); +s +} +,)) { Ok(()) => (), Err(err) => panic!(err), } - let expected = NewHyperObject!("v", BTreeSet::from_iter(vec!(1 as i64, 2 as i64, 3 as i64).iter());); + let expected = NewHyperObject!("v", { +let mut s = BTreeSet::new(); +s.insert(1 as i64); +s.insert(2 as i64); +s.insert(3 as i64); +s +} +,); match client.get("kv", "k") { Ok(obj) => { if obj != expected { @@ -39,11 +58,11 @@ actual: {:?}", expected, obj); Err(err) => panic!(err), } - match client.put("kv", "k", NewHyperObject!("v", BTreeSet::from_iter(vec!().iter());)) { + match client.put("kv", "k", NewHyperObject!("v", BTreeSet::>::new(),)) { Ok(()) => (), Err(err) => panic!(err), } - let expected = NewHyperObject!("v", BTreeSet::from_iter(vec!().iter());); + let expected = NewHyperObject!("v", BTreeSet::>::new(),); match client.get("kv", "k") { Ok(obj) => { if obj != expected { diff --git a/test/rust/DataTypeSetString.rs b/test/rust/DataTypeSetString.rs index d8e6b4daa..c3ce5e9f3 100644 --- a/test/rust/DataTypeSetString.rs +++ b/test/rust/DataTypeSetString.rs @@ -1,19 +1,24 @@ -extern crate hyperdex; +#[macro_use] extern crate hyperdex; use std::os; +use std::str::FromStr; +use std::collections::BTreeSet; +use std::collections::HashMap; +use std::iter::FromIterator; -use hyperdex::{Client, NewHyperObject}; +use hyperdex::*; +use hyperdex::HyperPredicateType::*; fn main() { let args = os::args(); - let mut client = Client::new(from_str(format!("{}:{}", args[1], args[2])).unwrap()).unwrap(); + let mut client = Client::new(FromStr::from_str(format!("{}:{}", args[1], args[2]).as_slice()).unwrap()).unwrap(); - match client.put("kv", "k", NewHyperObject!()) { + match client.put("kv", "k", HyperObject::new()) { Ok(()) => (), Err(err) => panic!(err), } - let expected = NewHyperObject!("v", BTreeSet::from_iter(vec!().iter());); + let expected = NewHyperObject!("v", BTreeSet::>::new(),); match client.get("kv", "k") { Ok(obj) => { if obj != expected { @@ -24,11 +29,25 @@ actual: {:?}", expected, obj); Err(err) => panic!(err), } - match client.put("kv", "k", NewHyperObject!("v", BTreeSet::from_iter(vec!("A", "B", "C").iter());)) { + match client.put("kv", "k", NewHyperObject!("v", { +let mut s = BTreeSet::new(); +s.insert("A"); +s.insert("C"); +s.insert("B"); +s +} +,)) { Ok(()) => (), Err(err) => panic!(err), } - let expected = NewHyperObject!("v", BTreeSet::from_iter(vec!("A", "B", "C").iter());); + let expected = NewHyperObject!("v", { +let mut s = BTreeSet::new(); +s.insert("A"); +s.insert("C"); +s.insert("B"); +s +} +,); match client.get("kv", "k") { Ok(obj) => { if obj != expected { @@ -39,11 +58,11 @@ actual: {:?}", expected, obj); Err(err) => panic!(err), } - match client.put("kv", "k", NewHyperObject!("v", BTreeSet::from_iter(vec!().iter());)) { + match client.put("kv", "k", NewHyperObject!("v", BTreeSet::>::new(),)) { Ok(()) => (), Err(err) => panic!(err), } - let expected = NewHyperObject!("v", BTreeSet::from_iter(vec!().iter());); + let expected = NewHyperObject!("v", BTreeSet::>::new(),); match client.get("kv", "k") { Ok(obj) => { if obj != expected { diff --git a/test/rust/DataTypeString.rs b/test/rust/DataTypeString.rs index 42fdc44ea..5e9651ff2 100644 --- a/test/rust/DataTypeString.rs +++ b/test/rust/DataTypeString.rs @@ -1,19 +1,24 @@ -extern crate hyperdex; +#[macro_use] extern crate hyperdex; use std::os; +use std::str::FromStr; +use std::collections::BTreeSet; +use std::collections::HashMap; +use std::iter::FromIterator; -use hyperdex::{Client, NewHyperObject}; +use hyperdex::*; +use hyperdex::HyperPredicateType::*; fn main() { let args = os::args(); - let mut client = Client::new(from_str(format!("{}:{}", args[1], args[2])).unwrap()).unwrap(); + let mut client = Client::new(FromStr::from_str(format!("{}:{}", args[1], args[2]).as_slice()).unwrap()).unwrap(); - match client.put("kv", "k", NewHyperObject!()) { + match client.put("kv", "k", HyperObject::new()) { Ok(()) => (), Err(err) => panic!(err), } - let expected = NewHyperObject!("v", ""); + let expected = NewHyperObject!("v", "",); match client.get("kv", "k") { Ok(obj) => { if obj != expected { @@ -24,11 +29,11 @@ actual: {:?}", expected, obj); Err(err) => panic!(err), } - match client.put("kv", "k", NewHyperObject!("v", "xxx")) { + match client.put("kv", "k", NewHyperObject!("v", "xxx",)) { Ok(()) => (), Err(err) => panic!(err), } - let expected = NewHyperObject!("v", "xxx"); + let expected = NewHyperObject!("v", "xxx",); match client.get("kv", "k") { Ok(obj) => { if obj != expected { @@ -39,11 +44,11 @@ actual: {:?}", expected, obj); Err(err) => panic!(err), } - match client.put("kv", "k", NewHyperObject!("v", "\xde\xad\xbe\xef")) { + match client.put("kv", "k", NewHyperObject!("v", "\xde\xad\xbe\xef",)) { Ok(()) => (), Err(err) => panic!(err), } - let expected = NewHyperObject!("v", "\xde\xad\xbe\xef"); + let expected = NewHyperObject!("v", "\xde\xad\xbe\xef",); match client.get("kv", "k") { Ok(obj) => { if obj != expected { diff --git a/test/rust/LengthString.rs b/test/rust/LengthString.rs index 3fcdc79b6..3e34ed3de 100644 --- a/test/rust/LengthString.rs +++ b/test/rust/LengthString.rs @@ -1,64 +1,69 @@ -extern crate hyperdex; +#[macro_use] extern crate hyperdex; use std::os; +use std::str::FromStr; +use std::collections::BTreeSet; +use std::collections::HashMap; +use std::iter::FromIterator; -use hyperdex::{Client, NewHyperObject}; +use hyperdex::*; +use hyperdex::HyperPredicateType::*; fn main() { let args = os::args(); - let mut client = Client::new(from_str(format!("{}:{}", args[1], args[2])).unwrap()).unwrap(); + let mut client = Client::new(FromStr::from_str(format!("{}:{}", args[1], args[2]).as_slice()).unwrap()).unwrap(); - match client.put("kv", "A", NewHyperObject!()) { + match client.put("kv", "A", HyperObject::new()) { Ok(()) => (), Err(err) => panic!(err), } - match client.put("kv", "AB", NewHyperObject!()) { + match client.put("kv", "AB", HyperObject::new()) { Ok(()) => (), Err(err) => panic!(err), } - match client.put("kv", "ABC", NewHyperObject!()) { + match client.put("kv", "ABC", HyperObject::new()) { Ok(()) => (), Err(err) => panic!(err), } - match client.put("kv", "ABCD", NewHyperObject!()) { + match client.put("kv", "ABCD", HyperObject::new()) { Ok(()) => (), Err(err) => panic!(err), } - match client.put("kv", "ABCDE", NewHyperObject!()) { + match client.put("kv", "ABCDE", HyperObject::new()) { Ok(()) => (), Err(err) => panic!(err), } let res = client.search("kv", vec!(HyperPredicate::new("k", LENGTH_EQUALS, 1 as i64))); - let elems = res.iter().collect(); - assert!(elems.len() == vec!(NewHyperObject!("k", "A"));.len()); + let elems: Vec> = res.iter().collect(); + assert!(elems.len() == vec!(NewHyperObject!("k", "A",)).len()); let res = client.search("kv", vec!(HyperPredicate::new("k", LENGTH_EQUALS, 2 as i64))); - let elems = res.iter().collect(); - assert!(elems.len() == vec!(NewHyperObject!("k", "AB"));.len()); + let elems: Vec> = res.iter().collect(); + assert!(elems.len() == vec!(NewHyperObject!("k", "AB",)).len()); let res = client.search("kv", vec!(HyperPredicate::new("k", LENGTH_EQUALS, 3 as i64))); - let elems = res.iter().collect(); - assert!(elems.len() == vec!(NewHyperObject!("k", "ABC"));.len()); + let elems: Vec> = res.iter().collect(); + assert!(elems.len() == vec!(NewHyperObject!("k", "ABC",)).len()); let res = client.search("kv", vec!(HyperPredicate::new("k", LENGTH_EQUALS, 4 as i64))); - let elems = res.iter().collect(); - assert!(elems.len() == vec!(NewHyperObject!("k", "ABCD"));.len()); + let elems: Vec> = res.iter().collect(); + assert!(elems.len() == vec!(NewHyperObject!("k", "ABCD",)).len()); let res = client.search("kv", vec!(HyperPredicate::new("k", LENGTH_EQUALS, 5 as i64))); - let elems = res.iter().collect(); - assert!(elems.len() == vec!(NewHyperObject!("k", "ABCDE"));.len()); + let elems: Vec> = res.iter().collect(); + assert!(elems.len() == vec!(NewHyperObject!("k", "ABCDE",)).len()); let res = client.search("kv", vec!(HyperPredicate::new("k", LENGTH_LESS_EQUAL, 3 as i64))); - let elems = res.iter().collect(); - assert!(elems.len() == vec!(NewHyperObject!("k", "A"), NewHyperObject!("k", "AB"), NewHyperObject!("k", "ABC"));.len()); + let elems: Vec> = res.iter().collect(); + assert!(elems.len() == vec!(NewHyperObject!("k", "A",), NewHyperObject!("k", "AB",), NewHyperObject!("k", "ABC",)).len()); let res = client.search("kv", vec!(HyperPredicate::new("k", LENGTH_GREATER_EQUAL, 3 as i64))); - let elems = res.iter().collect(); - assert!(elems.len() == vec!(NewHyperObject!("k", "ABC"), NewHyperObject!("k", "ABCD"), NewHyperObject!("k", "ABCDE"));.len()); + let elems: Vec> = res.iter().collect(); + assert!(elems.len() == vec!(NewHyperObject!("k", "ABC",), NewHyperObject!("k", "ABCD",), NewHyperObject!("k", "ABCDE",)).len()); } diff --git a/test/rust/MultiAttribute.rs b/test/rust/MultiAttribute.rs index cbbef4636..89fe6640b 100644 --- a/test/rust/MultiAttribute.rs +++ b/test/rust/MultiAttribute.rs @@ -1,14 +1,19 @@ -extern crate hyperdex; +#[macro_use] extern crate hyperdex; use std::os; +use std::str::FromStr; +use std::collections::BTreeSet; +use std::collections::HashMap; +use std::iter::FromIterator; -use hyperdex::{Client, NewHyperObject}; +use hyperdex::*; +use hyperdex::HyperPredicateType::*; fn main() { let args = os::args(); - let mut client = Client::new(from_str(format!("{}:{}", args[1], args[2])).unwrap()).unwrap(); -let expected = nil; + let mut client = Client::new(FromStr::from_str(format!("{}:{}", args[1], args[2]).as_slice()).unwrap()).unwrap(); + match client.get("kv", "k") { Ok(obj) => { panic!("this object should not be found!"); @@ -16,11 +21,11 @@ let expected = nil; Err(err) => (), } - match client.put("kv", "k", NewHyperObject!("v1", "ABC")) { + match client.put("kv", "k", NewHyperObject!("v1", "ABC",)) { Ok(()) => (), Err(err) => panic!(err), } - let expected = NewHyperObject!("v1", "ABC", "v2", ""); + let expected = NewHyperObject!("v1", "ABC", "v2", "",); match client.get("kv", "k") { Ok(obj) => { if obj != expected { @@ -31,11 +36,11 @@ actual: {:?}", expected, obj); Err(err) => panic!(err), } - match client.put("kv", "k", NewHyperObject!("v2", "123")) { + match client.put("kv", "k", NewHyperObject!("v2", "123",)) { Ok(()) => (), Err(err) => panic!(err), } - let expected = NewHyperObject!("v1", "ABC", "v2", "123"); + let expected = NewHyperObject!("v1", "ABC", "v2", "123",); match client.get("kv", "k") { Ok(obj) => { if obj != expected { @@ -45,8 +50,8 @@ actual: {:?}", expected, obj); }, Err(err) => panic!(err), } - let expected = NewHyperObject!("v1", "ABC"); - match client.get_partial("kv", "k", vec!("v1");) { + let expected = NewHyperObject!("v1", "ABC",); + match client.get_partial("kv", "k", vec!("v1")) { Ok(obj) => { if obj != expected { panic!("expected: {:?} diff --git a/test/rust/RangeSearchInt.rs b/test/rust/RangeSearchInt.rs index 08d56436a..ff12bfa2d 100644 --- a/test/rust/RangeSearchInt.rs +++ b/test/rust/RangeSearchInt.rs @@ -1,76 +1,81 @@ -extern crate hyperdex; +#[macro_use] extern crate hyperdex; use std::os; +use std::str::FromStr; +use std::collections::BTreeSet; +use std::collections::HashMap; +use std::iter::FromIterator; -use hyperdex::{Client, NewHyperObject}; +use hyperdex::*; +use hyperdex::HyperPredicateType::*; fn main() { let args = os::args(); - let mut client = Client::new(from_str(format!("{}:{}", args[1], args[2])).unwrap()).unwrap(); + let mut client = Client::new(FromStr::from_str(format!("{}:{}", args[1], args[2]).as_slice()).unwrap()).unwrap(); - match client.put("kv", -2 as i64, NewHyperObject!("v", -2 as i64)) { + match client.put("kv", -2 as i64, NewHyperObject!("v", -2 as i64,)) { Ok(()) => (), Err(err) => panic!(err), } - match client.put("kv", -1 as i64, NewHyperObject!("v", -1 as i64)) { + match client.put("kv", -1 as i64, NewHyperObject!("v", -1 as i64,)) { Ok(()) => (), Err(err) => panic!(err), } - match client.put("kv", 0 as i64, NewHyperObject!("v", 0 as i64)) { + match client.put("kv", 0 as i64, NewHyperObject!("v", 0 as i64,)) { Ok(()) => (), Err(err) => panic!(err), } - match client.put("kv", 1 as i64, NewHyperObject!("v", 1 as i64)) { + match client.put("kv", 1 as i64, NewHyperObject!("v", 1 as i64,)) { Ok(()) => (), Err(err) => panic!(err), } - match client.put("kv", 2 as i64, NewHyperObject!("v", 2 as i64)) { + match client.put("kv", 2 as i64, NewHyperObject!("v", 2 as i64,)) { Ok(()) => (), Err(err) => panic!(err), } let res = client.search("kv", vec!(HyperPredicate::new("k", LESS_EQUAL, 0 as i64))); - let elems = res.iter().collect(); - assert!(elems.len() == vec!(NewHyperObject!("k", -2 as i64, "v", -2 as i64), NewHyperObject!("k", -1 as i64, "v", -1 as i64), NewHyperObject!("k", 0 as i64, "v", 0 as i64));.len()); + let elems: Vec> = res.iter().collect(); + assert!(elems.len() == vec!(NewHyperObject!("k", -2 as i64, "v", -2 as i64,), NewHyperObject!("k", -1 as i64, "v", -1 as i64,), NewHyperObject!("k", 0 as i64, "v", 0 as i64,)).len()); let res = client.search("kv", vec!(HyperPredicate::new("v", LESS_EQUAL, 0 as i64))); - let elems = res.iter().collect(); - assert!(elems.len() == vec!(NewHyperObject!("k", -2 as i64, "v", -2 as i64), NewHyperObject!("k", -1 as i64, "v", -1 as i64), NewHyperObject!("k", 0 as i64, "v", 0 as i64));.len()); + let elems: Vec> = res.iter().collect(); + assert!(elems.len() == vec!(NewHyperObject!("k", -2 as i64, "v", -2 as i64,), NewHyperObject!("k", -1 as i64, "v", -1 as i64,), NewHyperObject!("k", 0 as i64, "v", 0 as i64,)).len()); let res = client.search("kv", vec!(HyperPredicate::new("k", GREATER_EQUAL, 0 as i64))); - let elems = res.iter().collect(); - assert!(elems.len() == vec!(NewHyperObject!("k", 0 as i64, "v", 0 as i64), NewHyperObject!("k", 1 as i64, "v", 1 as i64), NewHyperObject!("k", 2 as i64, "v", 2 as i64));.len()); + let elems: Vec> = res.iter().collect(); + assert!(elems.len() == vec!(NewHyperObject!("k", 0 as i64, "v", 0 as i64,), NewHyperObject!("k", 1 as i64, "v", 1 as i64,), NewHyperObject!("k", 2 as i64, "v", 2 as i64,)).len()); let res = client.search("kv", vec!(HyperPredicate::new("v", GREATER_EQUAL, 0 as i64))); - let elems = res.iter().collect(); - assert!(elems.len() == vec!(NewHyperObject!("k", 0 as i64, "v", 0 as i64), NewHyperObject!("k", 1 as i64, "v", 1 as i64), NewHyperObject!("k", 2 as i64, "v", 2 as i64));.len()); + let elems: Vec> = res.iter().collect(); + assert!(elems.len() == vec!(NewHyperObject!("k", 0 as i64, "v", 0 as i64,), NewHyperObject!("k", 1 as i64, "v", 1 as i64,), NewHyperObject!("k", 2 as i64, "v", 2 as i64,)).len()); let res = client.search("kv", vec!(HyperPredicate::new("k", LESS_THAN, 0 as i64))); - let elems = res.iter().collect(); - assert!(elems.len() == vec!(NewHyperObject!("k", -2 as i64, "v", -2 as i64), NewHyperObject!("k", -1 as i64, "v", -1 as i64));.len()); + let elems: Vec> = res.iter().collect(); + assert!(elems.len() == vec!(NewHyperObject!("k", -2 as i64, "v", -2 as i64,), NewHyperObject!("k", -1 as i64, "v", -1 as i64,)).len()); let res = client.search("kv", vec!(HyperPredicate::new("v", LESS_THAN, 0 as i64))); - let elems = res.iter().collect(); - assert!(elems.len() == vec!(NewHyperObject!("k", -2 as i64, "v", -2 as i64), NewHyperObject!("k", -1 as i64, "v", -1 as i64));.len()); + let elems: Vec> = res.iter().collect(); + assert!(elems.len() == vec!(NewHyperObject!("k", -2 as i64, "v", -2 as i64,), NewHyperObject!("k", -1 as i64, "v", -1 as i64,)).len()); let res = client.search("kv", vec!(HyperPredicate::new("k", GREATER_THAN, 0 as i64))); - let elems = res.iter().collect(); - assert!(elems.len() == vec!(NewHyperObject!("k", 1 as i64, "v", 1 as i64), NewHyperObject!("k", 2 as i64, "v", 2 as i64));.len()); + let elems: Vec> = res.iter().collect(); + assert!(elems.len() == vec!(NewHyperObject!("k", 1 as i64, "v", 1 as i64,), NewHyperObject!("k", 2 as i64, "v", 2 as i64,)).len()); let res = client.search("kv", vec!(HyperPredicate::new("v", GREATER_THAN, 0 as i64))); - let elems = res.iter().collect(); - assert!(elems.len() == vec!(NewHyperObject!("k", 1 as i64, "v", 1 as i64), NewHyperObject!("k", 2 as i64, "v", 2 as i64));.len()); + let elems: Vec> = res.iter().collect(); + assert!(elems.len() == vec!(NewHyperObject!("k", 1 as i64, "v", 1 as i64,), NewHyperObject!("k", 2 as i64, "v", 2 as i64,)).len()); - let res = client.search("kv", vec!(HyperPredicate::new("k", -1 as i64, GREATER_EQUAL), HyperPredicate::new("k", 1 as i64, LESS_EQUAL))); - let elems = res.iter().collect(); - assert!(elems.len() == vec!(NewHyperObject!("k", -1 as i64, "v", -1 as i64), NewHyperObject!("k", 0 as i64, "v", 0 as i64), NewHyperObject!("k", 1 as i64, "v", 1 as i64));.len()); + let res = client.search("kv", vec!(HyperPredicate::new("k", GREATER_EQUAL, -1 as i64), HyperPredicate::new("k", LESS_EQUAL, 1 as i64))); + let elems: Vec> = res.iter().collect(); + assert!(elems.len() == vec!(NewHyperObject!("k", -1 as i64, "v", -1 as i64,), NewHyperObject!("k", 0 as i64, "v", 0 as i64,), NewHyperObject!("k", 1 as i64, "v", 1 as i64,)).len()); - let res = client.search("kv", vec!(HyperPredicate::new("v", -1 as i64, GREATER_EQUAL), HyperPredicate::new("v", 1 as i64, LESS_EQUAL))); - let elems = res.iter().collect(); - assert!(elems.len() == vec!(NewHyperObject!("k", -1 as i64, "v", -1 as i64), NewHyperObject!("k", 0 as i64, "v", 0 as i64), NewHyperObject!("k", 1 as i64, "v", 1 as i64));.len()); + let res = client.search("kv", vec!(HyperPredicate::new("v", GREATER_EQUAL, -1 as i64), HyperPredicate::new("v", LESS_EQUAL, 1 as i64))); + let elems: Vec> = res.iter().collect(); + assert!(elems.len() == vec!(NewHyperObject!("k", -1 as i64, "v", -1 as i64,), NewHyperObject!("k", 0 as i64, "v", 0 as i64,), NewHyperObject!("k", 1 as i64, "v", 1 as i64,)).len()); } diff --git a/test/rust/RangeSearchString.rs b/test/rust/RangeSearchString.rs index 82af204e9..c27c16086 100644 --- a/test/rust/RangeSearchString.rs +++ b/test/rust/RangeSearchString.rs @@ -1,76 +1,81 @@ -extern crate hyperdex; +#[macro_use] extern crate hyperdex; use std::os; +use std::str::FromStr; +use std::collections::BTreeSet; +use std::collections::HashMap; +use std::iter::FromIterator; -use hyperdex::{Client, NewHyperObject}; +use hyperdex::*; +use hyperdex::HyperPredicateType::*; fn main() { let args = os::args(); - let mut client = Client::new(from_str(format!("{}:{}", args[1], args[2])).unwrap()).unwrap(); + let mut client = Client::new(FromStr::from_str(format!("{}:{}", args[1], args[2]).as_slice()).unwrap()).unwrap(); - match client.put("kv", "A", NewHyperObject!("v", "A")) { + match client.put("kv", "A", NewHyperObject!("v", "A",)) { Ok(()) => (), Err(err) => panic!(err), } - match client.put("kv", "B", NewHyperObject!("v", "B")) { + match client.put("kv", "B", NewHyperObject!("v", "B",)) { Ok(()) => (), Err(err) => panic!(err), } - match client.put("kv", "C", NewHyperObject!("v", "C")) { + match client.put("kv", "C", NewHyperObject!("v", "C",)) { Ok(()) => (), Err(err) => panic!(err), } - match client.put("kv", "D", NewHyperObject!("v", "D")) { + match client.put("kv", "D", NewHyperObject!("v", "D",)) { Ok(()) => (), Err(err) => panic!(err), } - match client.put("kv", "E", NewHyperObject!("v", "E")) { + match client.put("kv", "E", NewHyperObject!("v", "E",)) { Ok(()) => (), Err(err) => panic!(err), } let res = client.search("kv", vec!(HyperPredicate::new("k", LESS_EQUAL, "C"))); - let elems = res.iter().collect(); - assert!(elems.len() == vec!(NewHyperObject!("k", "A", "v", "A"), NewHyperObject!("k", "B", "v", "B"), NewHyperObject!("k", "C", "v", "C"));.len()); + let elems: Vec> = res.iter().collect(); + assert!(elems.len() == vec!(NewHyperObject!("k", "A", "v", "A",), NewHyperObject!("k", "B", "v", "B",), NewHyperObject!("k", "C", "v", "C",)).len()); let res = client.search("kv", vec!(HyperPredicate::new("v", LESS_EQUAL, "C"))); - let elems = res.iter().collect(); - assert!(elems.len() == vec!(NewHyperObject!("k", "A", "v", "A"), NewHyperObject!("k", "B", "v", "B"), NewHyperObject!("k", "C", "v", "C"));.len()); + let elems: Vec> = res.iter().collect(); + assert!(elems.len() == vec!(NewHyperObject!("k", "A", "v", "A",), NewHyperObject!("k", "B", "v", "B",), NewHyperObject!("k", "C", "v", "C",)).len()); let res = client.search("kv", vec!(HyperPredicate::new("k", GREATER_EQUAL, "C"))); - let elems = res.iter().collect(); - assert!(elems.len() == vec!(NewHyperObject!("k", "C", "v", "C"), NewHyperObject!("k", "D", "v", "D"), NewHyperObject!("k", "E", "v", "E"));.len()); + let elems: Vec> = res.iter().collect(); + assert!(elems.len() == vec!(NewHyperObject!("k", "C", "v", "C",), NewHyperObject!("k", "D", "v", "D",), NewHyperObject!("k", "E", "v", "E",)).len()); let res = client.search("kv", vec!(HyperPredicate::new("v", GREATER_EQUAL, "C"))); - let elems = res.iter().collect(); - assert!(elems.len() == vec!(NewHyperObject!("k", "C", "v", "C"), NewHyperObject!("k", "D", "v", "D"), NewHyperObject!("k", "E", "v", "E"));.len()); + let elems: Vec> = res.iter().collect(); + assert!(elems.len() == vec!(NewHyperObject!("k", "C", "v", "C",), NewHyperObject!("k", "D", "v", "D",), NewHyperObject!("k", "E", "v", "E",)).len()); let res = client.search("kv", vec!(HyperPredicate::new("k", LESS_THAN, "C"))); - let elems = res.iter().collect(); - assert!(elems.len() == vec!(NewHyperObject!("k", "A", "v", "A"), NewHyperObject!("k", "B", "v", "B"));.len()); + let elems: Vec> = res.iter().collect(); + assert!(elems.len() == vec!(NewHyperObject!("k", "A", "v", "A",), NewHyperObject!("k", "B", "v", "B",)).len()); let res = client.search("kv", vec!(HyperPredicate::new("v", LESS_THAN, "C"))); - let elems = res.iter().collect(); - assert!(elems.len() == vec!(NewHyperObject!("k", "A", "v", "A"), NewHyperObject!("k", "B", "v", "B"));.len()); + let elems: Vec> = res.iter().collect(); + assert!(elems.len() == vec!(NewHyperObject!("k", "A", "v", "A",), NewHyperObject!("k", "B", "v", "B",)).len()); let res = client.search("kv", vec!(HyperPredicate::new("k", GREATER_THAN, "C"))); - let elems = res.iter().collect(); - assert!(elems.len() == vec!(NewHyperObject!("k", "D", "v", "D"), NewHyperObject!("k", "E", "v", "E"));.len()); + let elems: Vec> = res.iter().collect(); + assert!(elems.len() == vec!(NewHyperObject!("k", "D", "v", "D",), NewHyperObject!("k", "E", "v", "E",)).len()); let res = client.search("kv", vec!(HyperPredicate::new("v", GREATER_THAN, "C"))); - let elems = res.iter().collect(); - assert!(elems.len() == vec!(NewHyperObject!("k", "D", "v", "D"), NewHyperObject!("k", "E", "v", "E"));.len()); + let elems: Vec> = res.iter().collect(); + assert!(elems.len() == vec!(NewHyperObject!("k", "D", "v", "D",), NewHyperObject!("k", "E", "v", "E",)).len()); - let res = client.search("kv", vec!(HyperPredicate::new("k", "B", GREATER_EQUAL), HyperPredicate::new("k", "D", LESS_EQUAL))); - let elems = res.iter().collect(); - assert!(elems.len() == vec!(NewHyperObject!("k", "B", "v", "B"), NewHyperObject!("k", "C", "v", "C"), NewHyperObject!("k", "D", "v", "D"));.len()); + let res = client.search("kv", vec!(HyperPredicate::new("k", GREATER_EQUAL, "B"), HyperPredicate::new("k", LESS_EQUAL, "D"))); + let elems: Vec> = res.iter().collect(); + assert!(elems.len() == vec!(NewHyperObject!("k", "B", "v", "B",), NewHyperObject!("k", "C", "v", "C",), NewHyperObject!("k", "D", "v", "D",)).len()); - let res = client.search("kv", vec!(HyperPredicate::new("v", "B", GREATER_EQUAL), HyperPredicate::new("v", "D", LESS_EQUAL))); - let elems = res.iter().collect(); - assert!(elems.len() == vec!(NewHyperObject!("k", "B", "v", "B"), NewHyperObject!("k", "C", "v", "C"), NewHyperObject!("k", "D", "v", "D"));.len()); + let res = client.search("kv", vec!(HyperPredicate::new("v", GREATER_EQUAL, "B"), HyperPredicate::new("v", LESS_EQUAL, "D"))); + let elems: Vec> = res.iter().collect(); + assert!(elems.len() == vec!(NewHyperObject!("k", "B", "v", "B",), NewHyperObject!("k", "C", "v", "C",), NewHyperObject!("k", "D", "v", "D",)).len()); } diff --git a/test/rust/RegexSearch.rs b/test/rust/RegexSearch.rs index b2a8840df..b761c6c5b 100644 --- a/test/rust/RegexSearch.rs +++ b/test/rust/RegexSearch.rs @@ -1,158 +1,163 @@ -extern crate hyperdex; +#[macro_use] extern crate hyperdex; use std::os; +use std::str::FromStr; +use std::collections::BTreeSet; +use std::collections::HashMap; +use std::iter::FromIterator; -use hyperdex::{Client, NewHyperObject}; +use hyperdex::*; +use hyperdex::HyperPredicateType::*; fn main() { let args = os::args(); - let mut client = Client::new(from_str(format!("{}:{}", args[1], args[2])).unwrap()).unwrap(); + let mut client = Client::new(FromStr::from_str(format!("{}:{}", args[1], args[2]).as_slice()).unwrap()).unwrap(); - match client.put("kv", "foo/foo/foo", NewHyperObject!()) { + match client.put("kv", "foo/foo/foo", HyperObject::new()) { Ok(()) => (), Err(err) => panic!(err), } - match client.put("kv", "foo/foo/bar", NewHyperObject!()) { + match client.put("kv", "foo/foo/bar", HyperObject::new()) { Ok(()) => (), Err(err) => panic!(err), } - match client.put("kv", "foo/foo/baz", NewHyperObject!()) { + match client.put("kv", "foo/foo/baz", HyperObject::new()) { Ok(()) => (), Err(err) => panic!(err), } - match client.put("kv", "foo/bar/foo", NewHyperObject!()) { + match client.put("kv", "foo/bar/foo", HyperObject::new()) { Ok(()) => (), Err(err) => panic!(err), } - match client.put("kv", "foo/bar/bar", NewHyperObject!()) { + match client.put("kv", "foo/bar/bar", HyperObject::new()) { Ok(()) => (), Err(err) => panic!(err), } - match client.put("kv", "foo/bar/baz", NewHyperObject!()) { + match client.put("kv", "foo/bar/baz", HyperObject::new()) { Ok(()) => (), Err(err) => panic!(err), } - match client.put("kv", "foo/baz/foo", NewHyperObject!()) { + match client.put("kv", "foo/baz/foo", HyperObject::new()) { Ok(()) => (), Err(err) => panic!(err), } - match client.put("kv", "foo/baz/bar", NewHyperObject!()) { + match client.put("kv", "foo/baz/bar", HyperObject::new()) { Ok(()) => (), Err(err) => panic!(err), } - match client.put("kv", "foo/baz/baz", NewHyperObject!()) { + match client.put("kv", "foo/baz/baz", HyperObject::new()) { Ok(()) => (), Err(err) => panic!(err), } - match client.put("kv", "bar/foo/foo", NewHyperObject!()) { + match client.put("kv", "bar/foo/foo", HyperObject::new()) { Ok(()) => (), Err(err) => panic!(err), } - match client.put("kv", "bar/foo/bar", NewHyperObject!()) { + match client.put("kv", "bar/foo/bar", HyperObject::new()) { Ok(()) => (), Err(err) => panic!(err), } - match client.put("kv", "bar/foo/baz", NewHyperObject!()) { + match client.put("kv", "bar/foo/baz", HyperObject::new()) { Ok(()) => (), Err(err) => panic!(err), } - match client.put("kv", "bar/bar/foo", NewHyperObject!()) { + match client.put("kv", "bar/bar/foo", HyperObject::new()) { Ok(()) => (), Err(err) => panic!(err), } - match client.put("kv", "bar/bar/bar", NewHyperObject!()) { + match client.put("kv", "bar/bar/bar", HyperObject::new()) { Ok(()) => (), Err(err) => panic!(err), } - match client.put("kv", "bar/bar/baz", NewHyperObject!()) { + match client.put("kv", "bar/bar/baz", HyperObject::new()) { Ok(()) => (), Err(err) => panic!(err), } - match client.put("kv", "bar/baz/foo", NewHyperObject!()) { + match client.put("kv", "bar/baz/foo", HyperObject::new()) { Ok(()) => (), Err(err) => panic!(err), } - match client.put("kv", "bar/baz/bar", NewHyperObject!()) { + match client.put("kv", "bar/baz/bar", HyperObject::new()) { Ok(()) => (), Err(err) => panic!(err), } - match client.put("kv", "bar/baz/baz", NewHyperObject!()) { + match client.put("kv", "bar/baz/baz", HyperObject::new()) { Ok(()) => (), Err(err) => panic!(err), } - match client.put("kv", "baz/foo/foo", NewHyperObject!()) { + match client.put("kv", "baz/foo/foo", HyperObject::new()) { Ok(()) => (), Err(err) => panic!(err), } - match client.put("kv", "baz/foo/bar", NewHyperObject!()) { + match client.put("kv", "baz/foo/bar", HyperObject::new()) { Ok(()) => (), Err(err) => panic!(err), } - match client.put("kv", "baz/foo/baz", NewHyperObject!()) { + match client.put("kv", "baz/foo/baz", HyperObject::new()) { Ok(()) => (), Err(err) => panic!(err), } - match client.put("kv", "baz/bar/foo", NewHyperObject!()) { + match client.put("kv", "baz/bar/foo", HyperObject::new()) { Ok(()) => (), Err(err) => panic!(err), } - match client.put("kv", "baz/bar/bar", NewHyperObject!()) { + match client.put("kv", "baz/bar/bar", HyperObject::new()) { Ok(()) => (), Err(err) => panic!(err), } - match client.put("kv", "baz/bar/baz", NewHyperObject!()) { + match client.put("kv", "baz/bar/baz", HyperObject::new()) { Ok(()) => (), Err(err) => panic!(err), } - match client.put("kv", "baz/baz/foo", NewHyperObject!()) { + match client.put("kv", "baz/baz/foo", HyperObject::new()) { Ok(()) => (), Err(err) => panic!(err), } - match client.put("kv", "baz/baz/bar", NewHyperObject!()) { + match client.put("kv", "baz/baz/bar", HyperObject::new()) { Ok(()) => (), Err(err) => panic!(err), } - match client.put("kv", "baz/baz/baz", NewHyperObject!()) { + match client.put("kv", "baz/baz/baz", HyperObject::new()) { Ok(()) => (), Err(err) => panic!(err), } let res = client.search("kv", vec!(HyperPredicate::new("k", REGEX, "^foo"))); - let elems = res.iter().collect(); - assert!(elems.len() == vec!(NewHyperObject!("k", "foo/foo/foo"), NewHyperObject!("k", "foo/foo/bar"), NewHyperObject!("k", "foo/foo/baz"), NewHyperObject!("k", "foo/bar/foo"), NewHyperObject!("k", "foo/bar/bar"), NewHyperObject!("k", "foo/bar/baz"), NewHyperObject!("k", "foo/baz/foo"), NewHyperObject!("k", "foo/baz/bar"), NewHyperObject!("k", "foo/baz/baz"));.len()); + let elems: Vec> = res.iter().collect(); + assert!(elems.len() == vec!(NewHyperObject!("k", "foo/foo/foo",), NewHyperObject!("k", "foo/foo/bar",), NewHyperObject!("k", "foo/foo/baz",), NewHyperObject!("k", "foo/bar/foo",), NewHyperObject!("k", "foo/bar/bar",), NewHyperObject!("k", "foo/bar/baz",), NewHyperObject!("k", "foo/baz/foo",), NewHyperObject!("k", "foo/baz/bar",), NewHyperObject!("k", "foo/baz/baz",)).len()); let res = client.search("kv", vec!(HyperPredicate::new("k", REGEX, "foo$"))); - let elems = res.iter().collect(); - assert!(elems.len() == vec!(NewHyperObject!("k", "foo/foo/foo"), NewHyperObject!("k", "foo/bar/foo"), NewHyperObject!("k", "foo/baz/foo"), NewHyperObject!("k", "bar/foo/foo"), NewHyperObject!("k", "bar/bar/foo"), NewHyperObject!("k", "bar/baz/foo"), NewHyperObject!("k", "baz/foo/foo"), NewHyperObject!("k", "baz/bar/foo"), NewHyperObject!("k", "baz/baz/foo"));.len()); + let elems: Vec> = res.iter().collect(); + assert!(elems.len() == vec!(NewHyperObject!("k", "foo/foo/foo",), NewHyperObject!("k", "foo/bar/foo",), NewHyperObject!("k", "foo/baz/foo",), NewHyperObject!("k", "bar/foo/foo",), NewHyperObject!("k", "bar/bar/foo",), NewHyperObject!("k", "bar/baz/foo",), NewHyperObject!("k", "baz/foo/foo",), NewHyperObject!("k", "baz/bar/foo",), NewHyperObject!("k", "baz/baz/foo",)).len()); let res = client.search("kv", vec!(HyperPredicate::new("k", REGEX, "^b.*/foo/.*$"))); - let elems = res.iter().collect(); - assert!(elems.len() == vec!(NewHyperObject!("k", "bar/foo/foo"), NewHyperObject!("k", "bar/foo/bar"), NewHyperObject!("k", "bar/foo/baz"), NewHyperObject!("k", "baz/foo/foo"), NewHyperObject!("k", "baz/foo/bar"), NewHyperObject!("k", "baz/foo/baz"));.len()); + let elems: Vec> = res.iter().collect(); + assert!(elems.len() == vec!(NewHyperObject!("k", "bar/foo/foo",), NewHyperObject!("k", "bar/foo/bar",), NewHyperObject!("k", "bar/foo/baz",), NewHyperObject!("k", "baz/foo/foo",), NewHyperObject!("k", "baz/foo/bar",), NewHyperObject!("k", "baz/foo/baz",)).len()); } diff --git a/test/sh/bindings.rust.Basic.sh b/test/sh/bindings.rust.Basic.sh index 19d07637a..e695f4064 100755 --- a/test/sh/bindings.rust.Basic.sh +++ b/test/sh/bindings.rust.Basic.sh @@ -1,5 +1,5 @@ #!/bin/sh -rustc --out-dir "${HYPERDEX_BUILDDIR}"/test/rust -o Basic "${HYPERDEX_SRCDIR}"/test/rust/Basic.rs +rustc -L rust_hyperdex/target -o "${HYPERDEX_BUILDDIR}"/test/rust/Basic "${HYPERDEX_SRCDIR}"/test/rust/Basic.rs python2 "${HYPERDEX_SRCDIR}"/test/runner.py --space="space kv key k attribute v" --daemons=1 -- \ - "${HYPERDEX_BUILDDIR}"/Basic {HOST} {PORT} + "${HYPERDEX_BUILDDIR}"/test/rust/Basic {HOST} {PORT} diff --git a/test/sh/bindings.rust.BasicSearch.sh b/test/sh/bindings.rust.BasicSearch.sh index 15426e79c..5f9cfe199 100755 --- a/test/sh/bindings.rust.BasicSearch.sh +++ b/test/sh/bindings.rust.BasicSearch.sh @@ -1,5 +1,5 @@ #!/bin/sh -rustc --out-dir "${HYPERDEX_BUILDDIR}"/test/rust -o BasicSearch "${HYPERDEX_SRCDIR}"/test/rust/BasicSearch.rs +rustc -L rust_hyperdex/target -o "${HYPERDEX_BUILDDIR}"/test/rust/BasicSearch "${HYPERDEX_SRCDIR}"/test/rust/BasicSearch.rs python2 "${HYPERDEX_SRCDIR}"/test/runner.py --space="space kv key k attribute v" --daemons=1 -- \ - "${HYPERDEX_BUILDDIR}"/BasicSearch {HOST} {PORT} + "${HYPERDEX_BUILDDIR}"/test/rust/BasicSearch {HOST} {PORT} diff --git a/test/sh/bindings.rust.CondPut.sh b/test/sh/bindings.rust.CondPut.sh index f6e0d0c52..57c9c3c4d 100755 --- a/test/sh/bindings.rust.CondPut.sh +++ b/test/sh/bindings.rust.CondPut.sh @@ -1,5 +1,5 @@ #!/bin/sh -rustc --out-dir "${HYPERDEX_BUILDDIR}"/test/rust -o CondPut "${HYPERDEX_SRCDIR}"/test/rust/CondPut.rs +rustc -L rust_hyperdex/target -o "${HYPERDEX_BUILDDIR}"/test/rust/CondPut "${HYPERDEX_SRCDIR}"/test/rust/CondPut.rs python2 "${HYPERDEX_SRCDIR}"/test/runner.py --space="space kv key k attribute v" --daemons=1 -- \ - "${HYPERDEX_BUILDDIR}"/CondPut {HOST} {PORT} + "${HYPERDEX_BUILDDIR}"/test/rust/CondPut {HOST} {PORT} diff --git a/test/sh/bindings.rust.DataTypeFloat.sh b/test/sh/bindings.rust.DataTypeFloat.sh index 141c0fe9e..a84b38022 100755 --- a/test/sh/bindings.rust.DataTypeFloat.sh +++ b/test/sh/bindings.rust.DataTypeFloat.sh @@ -1,5 +1,5 @@ #!/bin/sh -rustc --out-dir "${HYPERDEX_BUILDDIR}"/test/rust -o DataTypeFloat "${HYPERDEX_SRCDIR}"/test/rust/DataTypeFloat.rs +rustc -L rust_hyperdex/target -o "${HYPERDEX_BUILDDIR}"/test/rust/DataTypeFloat "${HYPERDEX_SRCDIR}"/test/rust/DataTypeFloat.rs python2 "${HYPERDEX_SRCDIR}"/test/runner.py --space="space kv key k attributes float v" --daemons=1 -- \ - "${HYPERDEX_BUILDDIR}"/DataTypeFloat {HOST} {PORT} + "${HYPERDEX_BUILDDIR}"/test/rust/DataTypeFloat {HOST} {PORT} diff --git a/test/sh/bindings.rust.DataTypeInt.sh b/test/sh/bindings.rust.DataTypeInt.sh index 63742da43..d20a298aa 100755 --- a/test/sh/bindings.rust.DataTypeInt.sh +++ b/test/sh/bindings.rust.DataTypeInt.sh @@ -1,5 +1,5 @@ #!/bin/sh -rustc --out-dir "${HYPERDEX_BUILDDIR}"/test/rust -o DataTypeInt "${HYPERDEX_SRCDIR}"/test/rust/DataTypeInt.rs +rustc -L rust_hyperdex/target -o "${HYPERDEX_BUILDDIR}"/test/rust/DataTypeInt "${HYPERDEX_SRCDIR}"/test/rust/DataTypeInt.rs python2 "${HYPERDEX_SRCDIR}"/test/runner.py --space="space kv key k attributes int v" --daemons=1 -- \ - "${HYPERDEX_BUILDDIR}"/DataTypeInt {HOST} {PORT} + "${HYPERDEX_BUILDDIR}"/test/rust/DataTypeInt {HOST} {PORT} diff --git a/test/sh/bindings.rust.DataTypeListFloat.sh b/test/sh/bindings.rust.DataTypeListFloat.sh index 1d8875f57..3d55c41ff 100755 --- a/test/sh/bindings.rust.DataTypeListFloat.sh +++ b/test/sh/bindings.rust.DataTypeListFloat.sh @@ -1,5 +1,5 @@ #!/bin/sh -rustc --out-dir "${HYPERDEX_BUILDDIR}"/test/rust -o DataTypeListFloat "${HYPERDEX_SRCDIR}"/test/rust/DataTypeListFloat.rs +rustc -L rust_hyperdex/target -o "${HYPERDEX_BUILDDIR}"/test/rust/DataTypeListFloat "${HYPERDEX_SRCDIR}"/test/rust/DataTypeListFloat.rs python2 "${HYPERDEX_SRCDIR}"/test/runner.py --space="space kv key k attributes list(float) v" --daemons=1 -- \ - "${HYPERDEX_BUILDDIR}"/DataTypeListFloat {HOST} {PORT} + "${HYPERDEX_BUILDDIR}"/test/rust/DataTypeListFloat {HOST} {PORT} diff --git a/test/sh/bindings.rust.DataTypeListInt.sh b/test/sh/bindings.rust.DataTypeListInt.sh index 4b45aa210..ca89bbdb9 100755 --- a/test/sh/bindings.rust.DataTypeListInt.sh +++ b/test/sh/bindings.rust.DataTypeListInt.sh @@ -1,5 +1,5 @@ #!/bin/sh -rustc --out-dir "${HYPERDEX_BUILDDIR}"/test/rust -o DataTypeListInt "${HYPERDEX_SRCDIR}"/test/rust/DataTypeListInt.rs +rustc -L rust_hyperdex/target -o "${HYPERDEX_BUILDDIR}"/test/rust/DataTypeListInt "${HYPERDEX_SRCDIR}"/test/rust/DataTypeListInt.rs python2 "${HYPERDEX_SRCDIR}"/test/runner.py --space="space kv key k attributes list(int) v" --daemons=1 -- \ - "${HYPERDEX_BUILDDIR}"/DataTypeListInt {HOST} {PORT} + "${HYPERDEX_BUILDDIR}"/test/rust/DataTypeListInt {HOST} {PORT} diff --git a/test/sh/bindings.rust.DataTypeListString.sh b/test/sh/bindings.rust.DataTypeListString.sh index f143810bc..408b78294 100755 --- a/test/sh/bindings.rust.DataTypeListString.sh +++ b/test/sh/bindings.rust.DataTypeListString.sh @@ -1,5 +1,5 @@ #!/bin/sh -rustc --out-dir "${HYPERDEX_BUILDDIR}"/test/rust -o DataTypeListString "${HYPERDEX_SRCDIR}"/test/rust/DataTypeListString.rs +rustc -L rust_hyperdex/target -o "${HYPERDEX_BUILDDIR}"/test/rust/DataTypeListString "${HYPERDEX_SRCDIR}"/test/rust/DataTypeListString.rs python2 "${HYPERDEX_SRCDIR}"/test/runner.py --space="space kv key k attributes list(string) v" --daemons=1 -- \ - "${HYPERDEX_BUILDDIR}"/DataTypeListString {HOST} {PORT} + "${HYPERDEX_BUILDDIR}"/test/rust/DataTypeListString {HOST} {PORT} diff --git a/test/sh/bindings.rust.DataTypeMapFloatFloat.sh b/test/sh/bindings.rust.DataTypeMapFloatFloat.sh index 7209bc201..e1ec288e8 100755 --- a/test/sh/bindings.rust.DataTypeMapFloatFloat.sh +++ b/test/sh/bindings.rust.DataTypeMapFloatFloat.sh @@ -1,5 +1,5 @@ #!/bin/sh -rustc --out-dir "${HYPERDEX_BUILDDIR}"/test/rust -o DataTypeMapFloatFloat "${HYPERDEX_SRCDIR}"/test/rust/DataTypeMapFloatFloat.rs +rustc -L rust_hyperdex/target -o "${HYPERDEX_BUILDDIR}"/test/rust/DataTypeMapFloatFloat "${HYPERDEX_SRCDIR}"/test/rust/DataTypeMapFloatFloat.rs python2 "${HYPERDEX_SRCDIR}"/test/runner.py --space="space kv key k attributes map(float, float) v" --daemons=1 -- \ - "${HYPERDEX_BUILDDIR}"/DataTypeMapFloatFloat {HOST} {PORT} + "${HYPERDEX_BUILDDIR}"/test/rust/DataTypeMapFloatFloat {HOST} {PORT} diff --git a/test/sh/bindings.rust.DataTypeMapFloatInt.sh b/test/sh/bindings.rust.DataTypeMapFloatInt.sh index 5b00948f2..a982027f0 100755 --- a/test/sh/bindings.rust.DataTypeMapFloatInt.sh +++ b/test/sh/bindings.rust.DataTypeMapFloatInt.sh @@ -1,5 +1,5 @@ #!/bin/sh -rustc --out-dir "${HYPERDEX_BUILDDIR}"/test/rust -o DataTypeMapFloatInt "${HYPERDEX_SRCDIR}"/test/rust/DataTypeMapFloatInt.rs +rustc -L rust_hyperdex/target -o "${HYPERDEX_BUILDDIR}"/test/rust/DataTypeMapFloatInt "${HYPERDEX_SRCDIR}"/test/rust/DataTypeMapFloatInt.rs python2 "${HYPERDEX_SRCDIR}"/test/runner.py --space="space kv key k attributes map(float, int) v" --daemons=1 -- \ - "${HYPERDEX_BUILDDIR}"/DataTypeMapFloatInt {HOST} {PORT} + "${HYPERDEX_BUILDDIR}"/test/rust/DataTypeMapFloatInt {HOST} {PORT} diff --git a/test/sh/bindings.rust.DataTypeMapFloatString.sh b/test/sh/bindings.rust.DataTypeMapFloatString.sh index cd668d55e..158d88cf8 100755 --- a/test/sh/bindings.rust.DataTypeMapFloatString.sh +++ b/test/sh/bindings.rust.DataTypeMapFloatString.sh @@ -1,5 +1,5 @@ #!/bin/sh -rustc --out-dir "${HYPERDEX_BUILDDIR}"/test/rust -o DataTypeMapFloatString "${HYPERDEX_SRCDIR}"/test/rust/DataTypeMapFloatString.rs +rustc -L rust_hyperdex/target -o "${HYPERDEX_BUILDDIR}"/test/rust/DataTypeMapFloatString "${HYPERDEX_SRCDIR}"/test/rust/DataTypeMapFloatString.rs python2 "${HYPERDEX_SRCDIR}"/test/runner.py --space="space kv key k attributes map(float, string) v" --daemons=1 -- \ - "${HYPERDEX_BUILDDIR}"/DataTypeMapFloatString {HOST} {PORT} + "${HYPERDEX_BUILDDIR}"/test/rust/DataTypeMapFloatString {HOST} {PORT} diff --git a/test/sh/bindings.rust.DataTypeMapIntFloat.sh b/test/sh/bindings.rust.DataTypeMapIntFloat.sh index 35c00612e..b32724ba1 100755 --- a/test/sh/bindings.rust.DataTypeMapIntFloat.sh +++ b/test/sh/bindings.rust.DataTypeMapIntFloat.sh @@ -1,5 +1,5 @@ #!/bin/sh -rustc --out-dir "${HYPERDEX_BUILDDIR}"/test/rust -o DataTypeMapIntFloat "${HYPERDEX_SRCDIR}"/test/rust/DataTypeMapIntFloat.rs +rustc -L rust_hyperdex/target -o "${HYPERDEX_BUILDDIR}"/test/rust/DataTypeMapIntFloat "${HYPERDEX_SRCDIR}"/test/rust/DataTypeMapIntFloat.rs python2 "${HYPERDEX_SRCDIR}"/test/runner.py --space="space kv key k attributes map(int, float) v" --daemons=1 -- \ - "${HYPERDEX_BUILDDIR}"/DataTypeMapIntFloat {HOST} {PORT} + "${HYPERDEX_BUILDDIR}"/test/rust/DataTypeMapIntFloat {HOST} {PORT} diff --git a/test/sh/bindings.rust.DataTypeMapIntInt.sh b/test/sh/bindings.rust.DataTypeMapIntInt.sh index cb006f579..d90b0bd58 100755 --- a/test/sh/bindings.rust.DataTypeMapIntInt.sh +++ b/test/sh/bindings.rust.DataTypeMapIntInt.sh @@ -1,5 +1,5 @@ #!/bin/sh -rustc --out-dir "${HYPERDEX_BUILDDIR}"/test/rust -o DataTypeMapIntInt "${HYPERDEX_SRCDIR}"/test/rust/DataTypeMapIntInt.rs +rustc -L rust_hyperdex/target -o "${HYPERDEX_BUILDDIR}"/test/rust/DataTypeMapIntInt "${HYPERDEX_SRCDIR}"/test/rust/DataTypeMapIntInt.rs python2 "${HYPERDEX_SRCDIR}"/test/runner.py --space="space kv key k attributes map(int, int) v" --daemons=1 -- \ - "${HYPERDEX_BUILDDIR}"/DataTypeMapIntInt {HOST} {PORT} + "${HYPERDEX_BUILDDIR}"/test/rust/DataTypeMapIntInt {HOST} {PORT} diff --git a/test/sh/bindings.rust.DataTypeMapIntString.sh b/test/sh/bindings.rust.DataTypeMapIntString.sh index c9d9a03ab..54d4ffa54 100755 --- a/test/sh/bindings.rust.DataTypeMapIntString.sh +++ b/test/sh/bindings.rust.DataTypeMapIntString.sh @@ -1,5 +1,5 @@ #!/bin/sh -rustc --out-dir "${HYPERDEX_BUILDDIR}"/test/rust -o DataTypeMapIntString "${HYPERDEX_SRCDIR}"/test/rust/DataTypeMapIntString.rs +rustc -L rust_hyperdex/target -o "${HYPERDEX_BUILDDIR}"/test/rust/DataTypeMapIntString "${HYPERDEX_SRCDIR}"/test/rust/DataTypeMapIntString.rs python2 "${HYPERDEX_SRCDIR}"/test/runner.py --space="space kv key k attributes map(int, string) v" --daemons=1 -- \ - "${HYPERDEX_BUILDDIR}"/DataTypeMapIntString {HOST} {PORT} + "${HYPERDEX_BUILDDIR}"/test/rust/DataTypeMapIntString {HOST} {PORT} diff --git a/test/sh/bindings.rust.DataTypeMapStringFloat.sh b/test/sh/bindings.rust.DataTypeMapStringFloat.sh index 2a8e0153c..d1fde7b1b 100755 --- a/test/sh/bindings.rust.DataTypeMapStringFloat.sh +++ b/test/sh/bindings.rust.DataTypeMapStringFloat.sh @@ -1,5 +1,5 @@ #!/bin/sh -rustc --out-dir "${HYPERDEX_BUILDDIR}"/test/rust -o DataTypeMapStringFloat "${HYPERDEX_SRCDIR}"/test/rust/DataTypeMapStringFloat.rs +rustc -L rust_hyperdex/target -o "${HYPERDEX_BUILDDIR}"/test/rust/DataTypeMapStringFloat "${HYPERDEX_SRCDIR}"/test/rust/DataTypeMapStringFloat.rs python2 "${HYPERDEX_SRCDIR}"/test/runner.py --space="space kv key k attributes map(string, float) v" --daemons=1 -- \ - "${HYPERDEX_BUILDDIR}"/DataTypeMapStringFloat {HOST} {PORT} + "${HYPERDEX_BUILDDIR}"/test/rust/DataTypeMapStringFloat {HOST} {PORT} diff --git a/test/sh/bindings.rust.DataTypeMapStringInt.sh b/test/sh/bindings.rust.DataTypeMapStringInt.sh index dcdf17c9c..e81354d8a 100755 --- a/test/sh/bindings.rust.DataTypeMapStringInt.sh +++ b/test/sh/bindings.rust.DataTypeMapStringInt.sh @@ -1,5 +1,5 @@ #!/bin/sh -rustc --out-dir "${HYPERDEX_BUILDDIR}"/test/rust -o DataTypeMapStringInt "${HYPERDEX_SRCDIR}"/test/rust/DataTypeMapStringInt.rs +rustc -L rust_hyperdex/target -o "${HYPERDEX_BUILDDIR}"/test/rust/DataTypeMapStringInt "${HYPERDEX_SRCDIR}"/test/rust/DataTypeMapStringInt.rs python2 "${HYPERDEX_SRCDIR}"/test/runner.py --space="space kv key k attributes map(string, int) v" --daemons=1 -- \ - "${HYPERDEX_BUILDDIR}"/DataTypeMapStringInt {HOST} {PORT} + "${HYPERDEX_BUILDDIR}"/test/rust/DataTypeMapStringInt {HOST} {PORT} diff --git a/test/sh/bindings.rust.DataTypeMapStringString.sh b/test/sh/bindings.rust.DataTypeMapStringString.sh index 635c8fc81..cd77f7009 100755 --- a/test/sh/bindings.rust.DataTypeMapStringString.sh +++ b/test/sh/bindings.rust.DataTypeMapStringString.sh @@ -1,5 +1,5 @@ #!/bin/sh -rustc --out-dir "${HYPERDEX_BUILDDIR}"/test/rust -o DataTypeMapStringString "${HYPERDEX_SRCDIR}"/test/rust/DataTypeMapStringString.rs +rustc -L rust_hyperdex/target -o "${HYPERDEX_BUILDDIR}"/test/rust/DataTypeMapStringString "${HYPERDEX_SRCDIR}"/test/rust/DataTypeMapStringString.rs python2 "${HYPERDEX_SRCDIR}"/test/runner.py --space="space kv key k attributes map(string, string) v" --daemons=1 -- \ - "${HYPERDEX_BUILDDIR}"/DataTypeMapStringString {HOST} {PORT} + "${HYPERDEX_BUILDDIR}"/test/rust/DataTypeMapStringString {HOST} {PORT} diff --git a/test/sh/bindings.rust.DataTypeSetFloat.sh b/test/sh/bindings.rust.DataTypeSetFloat.sh index d7bb6ee72..4151fbb38 100755 --- a/test/sh/bindings.rust.DataTypeSetFloat.sh +++ b/test/sh/bindings.rust.DataTypeSetFloat.sh @@ -1,5 +1,5 @@ #!/bin/sh -rustc --out-dir "${HYPERDEX_BUILDDIR}"/test/rust -o DataTypeSetFloat "${HYPERDEX_SRCDIR}"/test/rust/DataTypeSetFloat.rs +rustc -L rust_hyperdex/target -o "${HYPERDEX_BUILDDIR}"/test/rust/DataTypeSetFloat "${HYPERDEX_SRCDIR}"/test/rust/DataTypeSetFloat.rs python2 "${HYPERDEX_SRCDIR}"/test/runner.py --space="space kv key k attributes set(float) v" --daemons=1 -- \ - "${HYPERDEX_BUILDDIR}"/DataTypeSetFloat {HOST} {PORT} + "${HYPERDEX_BUILDDIR}"/test/rust/DataTypeSetFloat {HOST} {PORT} diff --git a/test/sh/bindings.rust.DataTypeSetInt.sh b/test/sh/bindings.rust.DataTypeSetInt.sh index 2572c2519..c8bc1770b 100755 --- a/test/sh/bindings.rust.DataTypeSetInt.sh +++ b/test/sh/bindings.rust.DataTypeSetInt.sh @@ -1,5 +1,5 @@ #!/bin/sh -rustc --out-dir "${HYPERDEX_BUILDDIR}"/test/rust -o DataTypeSetInt "${HYPERDEX_SRCDIR}"/test/rust/DataTypeSetInt.rs +rustc -L rust_hyperdex/target -o "${HYPERDEX_BUILDDIR}"/test/rust/DataTypeSetInt "${HYPERDEX_SRCDIR}"/test/rust/DataTypeSetInt.rs python2 "${HYPERDEX_SRCDIR}"/test/runner.py --space="space kv key k attributes set(int) v" --daemons=1 -- \ - "${HYPERDEX_BUILDDIR}"/DataTypeSetInt {HOST} {PORT} + "${HYPERDEX_BUILDDIR}"/test/rust/DataTypeSetInt {HOST} {PORT} diff --git a/test/sh/bindings.rust.DataTypeSetString.sh b/test/sh/bindings.rust.DataTypeSetString.sh index 88e2ad40b..250a50451 100755 --- a/test/sh/bindings.rust.DataTypeSetString.sh +++ b/test/sh/bindings.rust.DataTypeSetString.sh @@ -1,5 +1,5 @@ #!/bin/sh -rustc --out-dir "${HYPERDEX_BUILDDIR}"/test/rust -o DataTypeSetString "${HYPERDEX_SRCDIR}"/test/rust/DataTypeSetString.rs +rustc -L rust_hyperdex/target -o "${HYPERDEX_BUILDDIR}"/test/rust/DataTypeSetString "${HYPERDEX_SRCDIR}"/test/rust/DataTypeSetString.rs python2 "${HYPERDEX_SRCDIR}"/test/runner.py --space="space kv key k attributes set(string) v" --daemons=1 -- \ - "${HYPERDEX_BUILDDIR}"/DataTypeSetString {HOST} {PORT} + "${HYPERDEX_BUILDDIR}"/test/rust/DataTypeSetString {HOST} {PORT} diff --git a/test/sh/bindings.rust.DataTypeString.sh b/test/sh/bindings.rust.DataTypeString.sh index 41d50adb3..3c42fb537 100755 --- a/test/sh/bindings.rust.DataTypeString.sh +++ b/test/sh/bindings.rust.DataTypeString.sh @@ -1,5 +1,5 @@ #!/bin/sh -rustc --out-dir "${HYPERDEX_BUILDDIR}"/test/rust -o DataTypeString "${HYPERDEX_SRCDIR}"/test/rust/DataTypeString.rs +rustc -L rust_hyperdex/target -o "${HYPERDEX_BUILDDIR}"/test/rust/DataTypeString "${HYPERDEX_SRCDIR}"/test/rust/DataTypeString.rs python2 "${HYPERDEX_SRCDIR}"/test/runner.py --space="space kv key k attributes v" --daemons=1 -- \ - "${HYPERDEX_BUILDDIR}"/DataTypeString {HOST} {PORT} + "${HYPERDEX_BUILDDIR}"/test/rust/DataTypeString {HOST} {PORT} diff --git a/test/sh/bindings.rust.LengthString.sh b/test/sh/bindings.rust.LengthString.sh index 19137132c..6b043c6b1 100755 --- a/test/sh/bindings.rust.LengthString.sh +++ b/test/sh/bindings.rust.LengthString.sh @@ -1,5 +1,5 @@ #!/bin/sh -rustc --out-dir "${HYPERDEX_BUILDDIR}"/test/rust -o LengthString "${HYPERDEX_SRCDIR}"/test/rust/LengthString.rs +rustc -L rust_hyperdex/target -o "${HYPERDEX_BUILDDIR}"/test/rust/LengthString "${HYPERDEX_SRCDIR}"/test/rust/LengthString.rs python2 "${HYPERDEX_SRCDIR}"/test/runner.py --space="space kv key k" --daemons=1 -- \ - "${HYPERDEX_BUILDDIR}"/LengthString {HOST} {PORT} + "${HYPERDEX_BUILDDIR}"/test/rust/LengthString {HOST} {PORT} diff --git a/test/sh/bindings.rust.MultiAttribute.sh b/test/sh/bindings.rust.MultiAttribute.sh index b25075dd7..aa2f900b7 100755 --- a/test/sh/bindings.rust.MultiAttribute.sh +++ b/test/sh/bindings.rust.MultiAttribute.sh @@ -1,5 +1,5 @@ #!/bin/sh -rustc --out-dir "${HYPERDEX_BUILDDIR}"/test/rust -o MultiAttribute "${HYPERDEX_SRCDIR}"/test/rust/MultiAttribute.rs +rustc -L rust_hyperdex/target -o "${HYPERDEX_BUILDDIR}"/test/rust/MultiAttribute "${HYPERDEX_SRCDIR}"/test/rust/MultiAttribute.rs python2 "${HYPERDEX_SRCDIR}"/test/runner.py --space="space kv key k attributes v1, v2" --daemons=1 -- \ - "${HYPERDEX_BUILDDIR}"/MultiAttribute {HOST} {PORT} + "${HYPERDEX_BUILDDIR}"/test/rust/MultiAttribute {HOST} {PORT} diff --git a/test/sh/bindings.rust.RangeSearchInt.sh b/test/sh/bindings.rust.RangeSearchInt.sh index 7eae21fcf..9d4f26f3f 100755 --- a/test/sh/bindings.rust.RangeSearchInt.sh +++ b/test/sh/bindings.rust.RangeSearchInt.sh @@ -1,5 +1,5 @@ #!/bin/sh -rustc --out-dir "${HYPERDEX_BUILDDIR}"/test/rust -o RangeSearchInt "${HYPERDEX_SRCDIR}"/test/rust/RangeSearchInt.rs +rustc -L rust_hyperdex/target -o "${HYPERDEX_BUILDDIR}"/test/rust/RangeSearchInt "${HYPERDEX_SRCDIR}"/test/rust/RangeSearchInt.rs python2 "${HYPERDEX_SRCDIR}"/test/runner.py --space="space kv key int k attribute int v" --daemons=1 -- \ - "${HYPERDEX_BUILDDIR}"/RangeSearchInt {HOST} {PORT} + "${HYPERDEX_BUILDDIR}"/test/rust/RangeSearchInt {HOST} {PORT} diff --git a/test/sh/bindings.rust.RangeSearchString.sh b/test/sh/bindings.rust.RangeSearchString.sh index 7f27f0ac9..e154c34ed 100755 --- a/test/sh/bindings.rust.RangeSearchString.sh +++ b/test/sh/bindings.rust.RangeSearchString.sh @@ -1,5 +1,5 @@ #!/bin/sh -rustc --out-dir "${HYPERDEX_BUILDDIR}"/test/rust -o RangeSearchString "${HYPERDEX_SRCDIR}"/test/rust/RangeSearchString.rs +rustc -L rust_hyperdex/target -o "${HYPERDEX_BUILDDIR}"/test/rust/RangeSearchString "${HYPERDEX_SRCDIR}"/test/rust/RangeSearchString.rs python2 "${HYPERDEX_SRCDIR}"/test/runner.py --space="space kv key k attribute v" --daemons=1 -- \ - "${HYPERDEX_BUILDDIR}"/RangeSearchString {HOST} {PORT} + "${HYPERDEX_BUILDDIR}"/test/rust/RangeSearchString {HOST} {PORT} diff --git a/test/sh/bindings.rust.RegexSearch.sh b/test/sh/bindings.rust.RegexSearch.sh index c2b330096..ee893c4de 100755 --- a/test/sh/bindings.rust.RegexSearch.sh +++ b/test/sh/bindings.rust.RegexSearch.sh @@ -1,5 +1,5 @@ #!/bin/sh -rustc --out-dir "${HYPERDEX_BUILDDIR}"/test/rust -o RegexSearch "${HYPERDEX_SRCDIR}"/test/rust/RegexSearch.rs +rustc -L rust_hyperdex/target -o "${HYPERDEX_BUILDDIR}"/test/rust/RegexSearch "${HYPERDEX_SRCDIR}"/test/rust/RegexSearch.rs python2 "${HYPERDEX_SRCDIR}"/test/runner.py --space="space kv key k" --daemons=1 -- \ - "${HYPERDEX_BUILDDIR}"/RegexSearch {HOST} {PORT} + "${HYPERDEX_BUILDDIR}"/test/rust/RegexSearch {HOST} {PORT} From 3fb53e689b0fb9c9f06831b326fab5ad7e1c78d2 Mon Sep 17 00:00:00 2001 From: Derek Chiang Date: Tue, 17 Feb 2015 17:28:51 -0500 Subject: [PATCH 4/7] Making progress on rust tests --- maint/generate-bindings-tests.py | 154 +++++++++++++++++++++++++-- test/rust/Basic.rs | 143 ++++++++++++++++++++++++- test/rust/BasicSearch.rs | 137 ++++++++++++++++++++++++ test/rust/CondPut.rs | 143 ++++++++++++++++++++++++- test/rust/DataTypeFloat.rs | 147 ++++++++++++++++++++++++- test/rust/DataTypeInt.rs | 149 ++++++++++++++++++++++++-- test/rust/DataTypeListFloat.rs | 149 ++++++++++++++++++++++++-- test/rust/DataTypeListInt.rs | 149 ++++++++++++++++++++++++-- test/rust/DataTypeListString.rs | 149 ++++++++++++++++++++++++-- test/rust/DataTypeMapFloatFloat.rs | 143 ++++++++++++++++++++++++- test/rust/DataTypeMapFloatInt.rs | 143 ++++++++++++++++++++++++- test/rust/DataTypeMapFloatString.rs | 143 ++++++++++++++++++++++++- test/rust/DataTypeMapIntFloat.rs | 143 ++++++++++++++++++++++++- test/rust/DataTypeMapIntInt.rs | 143 ++++++++++++++++++++++++- test/rust/DataTypeMapIntString.rs | 143 ++++++++++++++++++++++++- test/rust/DataTypeMapStringFloat.rs | 143 ++++++++++++++++++++++++- test/rust/DataTypeMapStringInt.rs | 143 ++++++++++++++++++++++++- test/rust/DataTypeMapStringString.rs | 143 ++++++++++++++++++++++++- test/rust/DataTypeSetFloat.rs | 143 ++++++++++++++++++++++++- test/rust/DataTypeSetInt.rs | 143 ++++++++++++++++++++++++- test/rust/DataTypeSetString.rs | 143 ++++++++++++++++++++++++- test/rust/DataTypeString.rs | 143 ++++++++++++++++++++++++- test/rust/LengthString.rs | 137 ++++++++++++++++++++++++ test/rust/MultiAttribute.rs | 143 ++++++++++++++++++++++++- test/rust/RangeSearchInt.rs | 137 ++++++++++++++++++++++++ test/rust/RangeSearchString.rs | 137 ++++++++++++++++++++++++ test/rust/RegexSearch.rs | 137 ++++++++++++++++++++++++ 27 files changed, 3786 insertions(+), 84 deletions(-) diff --git a/maint/generate-bindings-tests.py b/maint/generate-bindings-tests.py index 9e141d527..00853f9aa 100644 --- a/maint/generate-bindings-tests.py +++ b/maint/generate-bindings-tests.py @@ -785,10 +785,147 @@ def test(self, name, space): use std::collections::BTreeSet; use std::collections::HashMap; use std::iter::FromIterator; +use std::mem::transmute; +use std::any::Any; use hyperdex::*; +use hyperdex::HyperValue::*; use hyperdex::HyperPredicateType::*; +macro_rules! sloppyCompare { + ($a: ident, $b: ident) => ( + if $a.len() == 0 && $b.len() == 0 { + true + } else { + if $a.get_type_id() != $b.get_type_id() { + false + } else { + unsafe { + transmute($a) == $b + } + } + } + ); +} + +fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { + for (ak, av) in a.map.iter() { + let bv = match b.map.get(ak) { + None => return false, + Some(x) => x, + }; + + let av = av.clone(); + let bv = bv.clone(); + + // this is dumb but I do not see a better way... fortunately the following lines are generated + // by a python script + match (av, bv) { + (HyperListString(x), HyperListString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperListString(x), HyperListInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperListString(x), HyperListFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperListInt(x), HyperListString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperListInt(x), HyperListInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperListInt(x), HyperListFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperListFloat(x), HyperListString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperListFloat(x), HyperListInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperListFloat(x), HyperListFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperSetString(x), HyperSetString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperSetString(x), HyperSetInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperSetString(x), HyperSetFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperSetInt(x), HyperSetString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperSetInt(x), HyperSetInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperSetInt(x), HyperSetFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperSetFloat(x), HyperSetString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperSetFloat(x), HyperSetInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperSetFloat(x), HyperSetFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringString(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringString(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringString(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringString(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringString(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringString(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringString(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringString(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringString(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringInt(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringInt(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringInt(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringInt(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringInt(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringInt(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringInt(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringInt(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringInt(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringFloat(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringFloat(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringFloat(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringFloat(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringFloat(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringFloat(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringFloat(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringFloat(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringFloat(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntString(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntString(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntString(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntString(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntString(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntString(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntString(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntString(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntString(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntInt(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntInt(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntInt(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntInt(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntInt(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntInt(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntInt(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntInt(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntInt(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntFloat(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntFloat(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntFloat(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntFloat(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntFloat(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntFloat(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntFloat(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntFloat(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntFloat(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatString(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatString(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatString(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatString(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatString(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatString(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatString(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatString(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatString(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatInt(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatInt(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatInt(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatInt(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatInt(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatInt(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatInt(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatInt(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatInt(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatFloat(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatFloat(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatFloat(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatFloat(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatFloat(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatFloat(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatFloat(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatFloat(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatFloat(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (x, y) => if x != y { return false; }, + } + } + return true; +} + fn main() { let args = os::args(); let mut client = Client::new(FromStr::from_str(format!("{}:{}", args[1], args[2]).as_slice()).unwrap()).unwrap(); @@ -815,7 +952,7 @@ def get(self, space, key, expected): self.f.write(''' match client.get({0}, {1}) {{ Ok(obj) => {{ - if obj != expected {{ + if !sloppyCompareHyper(&obj, &expected) {{ panic!("expected: {{:?}}\nactual: {{:?}}", expected, obj); }} }}, @@ -838,7 +975,7 @@ def get_partial(self, space, key, attrs, expected): self.f.write(''' match client.get_partial({0}, {1}, {2}) {{ Ok(obj) => {{ - if obj != expected {{ + if !sloppyCompareHyper(&obj, &expected) {{ panic!("expected: {{:?}}\nactual: {{:?}}", expected, obj); }} }}, @@ -945,10 +1082,13 @@ def to_rust(self, x, inner=False): else: return '%s as f64' % str(x) elif isinstance(x, list): - s = 'vec!(' - s += ', '.join(['{0}'.format(self.to_rust(v)) for v in x]) - s += ')' - return s + if len(x): + s = 'vec!(' + s += ', '.join(['{0}'.format(self.to_rust(v)) for v in x]) + s += ')' + return s + else: + return 'Vec::::new()' elif isinstance(x, set): if len(x): s = '{\n' @@ -972,7 +1112,7 @@ def to_rust(self, x, inner=False): return s elif len(x): s = 'NewHyperObject!(' - s += ', '.join(['{0}, {1}'.format(self.to_rust(k), self.to_rust(v, inner=True)) + s += ', '.join(['{0}, {1}'.format(self.to_rust(k), self.to_rust(v, inner=isinstance(v, dict))) for k, v in sorted(x.items())]) s += ',)' return s diff --git a/test/rust/Basic.rs b/test/rust/Basic.rs index de0439470..6c6021749 100644 --- a/test/rust/Basic.rs +++ b/test/rust/Basic.rs @@ -6,10 +6,147 @@ use std::str::FromStr; use std::collections::BTreeSet; use std::collections::HashMap; use std::iter::FromIterator; +use std::mem::transmute; +use std::any::Any; use hyperdex::*; +use hyperdex::HyperValue::*; use hyperdex::HyperPredicateType::*; +macro_rules! sloppyCompare { + ($a: ident, $b: ident) => ( + if $a.len() == 0 && $b.len() == 0 { + true + } else { + if $a.get_type_id() != $b.get_type_id() { + false + } else { + unsafe { + transmute($a) == $b + } + } + } + ); +} + +fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { + for (ak, av) in a.map.iter() { + let bv = match b.map.get(ak) { + None => return false, + Some(x) => x, + }; + + let av = av.clone(); + let bv = bv.clone(); + + // this is dumb but I do not see a better way... fortunately the following lines are generated + // by a python script + match (av, bv) { + (HyperListString(x), HyperListString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperListString(x), HyperListInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperListString(x), HyperListFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperListInt(x), HyperListString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperListInt(x), HyperListInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperListInt(x), HyperListFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperListFloat(x), HyperListString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperListFloat(x), HyperListInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperListFloat(x), HyperListFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperSetString(x), HyperSetString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperSetString(x), HyperSetInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperSetString(x), HyperSetFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperSetInt(x), HyperSetString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperSetInt(x), HyperSetInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperSetInt(x), HyperSetFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperSetFloat(x), HyperSetString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperSetFloat(x), HyperSetInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperSetFloat(x), HyperSetFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringString(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringString(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringString(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringString(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringString(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringString(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringString(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringString(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringString(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringInt(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringInt(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringInt(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringInt(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringInt(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringInt(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringInt(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringInt(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringInt(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringFloat(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringFloat(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringFloat(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringFloat(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringFloat(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringFloat(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringFloat(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringFloat(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringFloat(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntString(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntString(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntString(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntString(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntString(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntString(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntString(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntString(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntString(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntInt(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntInt(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntInt(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntInt(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntInt(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntInt(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntInt(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntInt(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntInt(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntFloat(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntFloat(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntFloat(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntFloat(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntFloat(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntFloat(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntFloat(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntFloat(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntFloat(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatString(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatString(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatString(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatString(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatString(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatString(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatString(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatString(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatString(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatInt(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatInt(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatInt(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatInt(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatInt(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatInt(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatInt(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatInt(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatInt(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatFloat(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatFloat(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatFloat(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatFloat(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatFloat(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatFloat(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatFloat(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatFloat(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatFloat(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (x, y) => if x != y { return false; }, + } + } + return true; +} + fn main() { let args = os::args(); let mut client = Client::new(FromStr::from_str(format!("{}:{}", args[1], args[2]).as_slice()).unwrap()).unwrap(); @@ -28,7 +165,7 @@ fn main() { let expected = NewHyperObject!("v", "v1",); match client.get("kv", "k") { Ok(obj) => { - if obj != expected { + if !sloppyCompareHyper(&obj, &expected) { panic!("expected: {:?} actual: {:?}", expected, obj); } @@ -43,7 +180,7 @@ actual: {:?}", expected, obj); let expected = NewHyperObject!("v", "v2",); match client.get("kv", "k") { Ok(obj) => { - if obj != expected { + if !sloppyCompareHyper(&obj, &expected) { panic!("expected: {:?} actual: {:?}", expected, obj); } @@ -58,7 +195,7 @@ actual: {:?}", expected, obj); let expected = NewHyperObject!("v", "v3",); match client.get("kv", "k") { Ok(obj) => { - if obj != expected { + if !sloppyCompareHyper(&obj, &expected) { panic!("expected: {:?} actual: {:?}", expected, obj); } diff --git a/test/rust/BasicSearch.rs b/test/rust/BasicSearch.rs index 7baf57a4b..3f890b49f 100644 --- a/test/rust/BasicSearch.rs +++ b/test/rust/BasicSearch.rs @@ -6,10 +6,147 @@ use std::str::FromStr; use std::collections::BTreeSet; use std::collections::HashMap; use std::iter::FromIterator; +use std::mem::transmute; +use std::any::Any; use hyperdex::*; +use hyperdex::HyperValue::*; use hyperdex::HyperPredicateType::*; +macro_rules! sloppyCompare { + ($a: ident, $b: ident) => ( + if $a.len() == 0 && $b.len() == 0 { + true + } else { + if $a.get_type_id() != $b.get_type_id() { + false + } else { + unsafe { + transmute($a) == $b + } + } + } + ); +} + +fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { + for (ak, av) in a.map.iter() { + let bv = match b.map.get(ak) { + None => return false, + Some(x) => x, + }; + + let av = av.clone(); + let bv = bv.clone(); + + // this is dumb but I do not see a better way... fortunately the following lines are generated + // by a python script + match (av, bv) { + (HyperListString(x), HyperListString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperListString(x), HyperListInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperListString(x), HyperListFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperListInt(x), HyperListString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperListInt(x), HyperListInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperListInt(x), HyperListFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperListFloat(x), HyperListString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperListFloat(x), HyperListInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperListFloat(x), HyperListFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperSetString(x), HyperSetString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperSetString(x), HyperSetInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperSetString(x), HyperSetFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperSetInt(x), HyperSetString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperSetInt(x), HyperSetInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperSetInt(x), HyperSetFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperSetFloat(x), HyperSetString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperSetFloat(x), HyperSetInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperSetFloat(x), HyperSetFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringString(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringString(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringString(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringString(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringString(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringString(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringString(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringString(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringString(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringInt(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringInt(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringInt(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringInt(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringInt(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringInt(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringInt(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringInt(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringInt(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringFloat(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringFloat(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringFloat(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringFloat(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringFloat(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringFloat(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringFloat(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringFloat(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringFloat(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntString(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntString(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntString(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntString(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntString(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntString(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntString(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntString(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntString(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntInt(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntInt(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntInt(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntInt(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntInt(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntInt(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntInt(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntInt(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntInt(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntFloat(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntFloat(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntFloat(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntFloat(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntFloat(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntFloat(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntFloat(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntFloat(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntFloat(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatString(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatString(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatString(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatString(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatString(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatString(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatString(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatString(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatString(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatInt(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatInt(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatInt(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatInt(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatInt(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatInt(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatInt(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatInt(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatInt(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatFloat(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatFloat(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatFloat(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatFloat(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatFloat(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatFloat(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatFloat(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatFloat(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatFloat(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (x, y) => if x != y { return false; }, + } + } + return true; +} + fn main() { let args = os::args(); let mut client = Client::new(FromStr::from_str(format!("{}:{}", args[1], args[2]).as_slice()).unwrap()).unwrap(); diff --git a/test/rust/CondPut.rs b/test/rust/CondPut.rs index e71417e61..7bd481255 100644 --- a/test/rust/CondPut.rs +++ b/test/rust/CondPut.rs @@ -6,10 +6,147 @@ use std::str::FromStr; use std::collections::BTreeSet; use std::collections::HashMap; use std::iter::FromIterator; +use std::mem::transmute; +use std::any::Any; use hyperdex::*; +use hyperdex::HyperValue::*; use hyperdex::HyperPredicateType::*; +macro_rules! sloppyCompare { + ($a: ident, $b: ident) => ( + if $a.len() == 0 && $b.len() == 0 { + true + } else { + if $a.get_type_id() != $b.get_type_id() { + false + } else { + unsafe { + transmute($a) == $b + } + } + } + ); +} + +fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { + for (ak, av) in a.map.iter() { + let bv = match b.map.get(ak) { + None => return false, + Some(x) => x, + }; + + let av = av.clone(); + let bv = bv.clone(); + + // this is dumb but I do not see a better way... fortunately the following lines are generated + // by a python script + match (av, bv) { + (HyperListString(x), HyperListString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperListString(x), HyperListInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperListString(x), HyperListFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperListInt(x), HyperListString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperListInt(x), HyperListInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperListInt(x), HyperListFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperListFloat(x), HyperListString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperListFloat(x), HyperListInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperListFloat(x), HyperListFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperSetString(x), HyperSetString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperSetString(x), HyperSetInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperSetString(x), HyperSetFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperSetInt(x), HyperSetString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperSetInt(x), HyperSetInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperSetInt(x), HyperSetFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperSetFloat(x), HyperSetString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperSetFloat(x), HyperSetInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperSetFloat(x), HyperSetFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringString(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringString(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringString(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringString(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringString(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringString(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringString(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringString(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringString(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringInt(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringInt(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringInt(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringInt(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringInt(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringInt(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringInt(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringInt(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringInt(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringFloat(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringFloat(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringFloat(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringFloat(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringFloat(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringFloat(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringFloat(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringFloat(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringFloat(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntString(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntString(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntString(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntString(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntString(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntString(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntString(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntString(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntString(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntInt(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntInt(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntInt(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntInt(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntInt(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntInt(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntInt(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntInt(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntInt(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntFloat(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntFloat(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntFloat(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntFloat(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntFloat(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntFloat(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntFloat(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntFloat(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntFloat(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatString(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatString(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatString(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatString(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatString(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatString(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatString(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatString(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatString(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatInt(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatInt(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatInt(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatInt(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatInt(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatInt(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatInt(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatInt(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatInt(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatFloat(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatFloat(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatFloat(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatFloat(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatFloat(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatFloat(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatFloat(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatFloat(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatFloat(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (x, y) => if x != y { return false; }, + } + } + return true; +} + fn main() { let args = os::args(); let mut client = Client::new(FromStr::from_str(format!("{}:{}", args[1], args[2]).as_slice()).unwrap()).unwrap(); @@ -28,7 +165,7 @@ fn main() { let expected = NewHyperObject!("v", "v1",); match client.get("kv", "k") { Ok(obj) => { - if obj != expected { + if !sloppyCompareHyper(&obj, &expected) { panic!("expected: {:?} actual: {:?}", expected, obj); } @@ -43,7 +180,7 @@ actual: {:?}", expected, obj); let expected = NewHyperObject!("v", "v1",); match client.get("kv", "k") { Ok(obj) => { - if obj != expected { + if !sloppyCompareHyper(&obj, &expected) { panic!("expected: {:?} actual: {:?}", expected, obj); } @@ -58,7 +195,7 @@ actual: {:?}", expected, obj); let expected = NewHyperObject!("v", "v3",); match client.get("kv", "k") { Ok(obj) => { - if obj != expected { + if !sloppyCompareHyper(&obj, &expected) { panic!("expected: {:?} actual: {:?}", expected, obj); } diff --git a/test/rust/DataTypeFloat.rs b/test/rust/DataTypeFloat.rs index 4ab54a366..6c08e23bd 100644 --- a/test/rust/DataTypeFloat.rs +++ b/test/rust/DataTypeFloat.rs @@ -6,10 +6,147 @@ use std::str::FromStr; use std::collections::BTreeSet; use std::collections::HashMap; use std::iter::FromIterator; +use std::mem::transmute; +use std::any::Any; use hyperdex::*; +use hyperdex::HyperValue::*; use hyperdex::HyperPredicateType::*; +macro_rules! sloppyCompare { + ($a: ident, $b: ident) => ( + if $a.len() == 0 && $b.len() == 0 { + true + } else { + if $a.get_type_id() != $b.get_type_id() { + false + } else { + unsafe { + transmute($a) == $b + } + } + } + ); +} + +fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { + for (ak, av) in a.map.iter() { + let bv = match b.map.get(ak) { + None => return false, + Some(x) => x, + }; + + let av = av.clone(); + let bv = bv.clone(); + + // this is dumb but I do not see a better way... fortunately the following lines are generated + // by a python script + match (av, bv) { + (HyperListString(x), HyperListString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperListString(x), HyperListInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperListString(x), HyperListFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperListInt(x), HyperListString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperListInt(x), HyperListInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperListInt(x), HyperListFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperListFloat(x), HyperListString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperListFloat(x), HyperListInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperListFloat(x), HyperListFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperSetString(x), HyperSetString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperSetString(x), HyperSetInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperSetString(x), HyperSetFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperSetInt(x), HyperSetString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperSetInt(x), HyperSetInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperSetInt(x), HyperSetFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperSetFloat(x), HyperSetString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperSetFloat(x), HyperSetInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperSetFloat(x), HyperSetFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringString(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringString(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringString(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringString(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringString(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringString(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringString(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringString(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringString(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringInt(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringInt(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringInt(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringInt(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringInt(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringInt(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringInt(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringInt(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringInt(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringFloat(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringFloat(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringFloat(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringFloat(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringFloat(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringFloat(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringFloat(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringFloat(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringFloat(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntString(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntString(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntString(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntString(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntString(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntString(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntString(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntString(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntString(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntInt(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntInt(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntInt(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntInt(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntInt(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntInt(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntInt(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntInt(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntInt(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntFloat(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntFloat(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntFloat(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntFloat(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntFloat(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntFloat(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntFloat(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntFloat(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntFloat(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatString(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatString(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatString(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatString(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatString(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatString(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatString(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatString(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatString(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatInt(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatInt(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatInt(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatInt(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatInt(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatInt(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatInt(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatInt(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatInt(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatFloat(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatFloat(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatFloat(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatFloat(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatFloat(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatFloat(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatFloat(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatFloat(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatFloat(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (x, y) => if x != y { return false; }, + } + } + return true; +} + fn main() { let args = os::args(); let mut client = Client::new(FromStr::from_str(format!("{}:{}", args[1], args[2]).as_slice()).unwrap()).unwrap(); @@ -18,10 +155,10 @@ fn main() { Ok(()) => (), Err(err) => panic!(err), } - let expected = NewHyperObject!("v", F64(0.0 as f64),); + let expected = NewHyperObject!("v", 0.0 as f64,); match client.get("kv", "k") { Ok(obj) => { - if obj != expected { + if !sloppyCompareHyper(&obj, &expected) { panic!("expected: {:?} actual: {:?}", expected, obj); } @@ -29,14 +166,14 @@ actual: {:?}", expected, obj); Err(err) => panic!(err), } - match client.put("kv", "k", NewHyperObject!("v", F64(3.14 as f64),)) { + match client.put("kv", "k", NewHyperObject!("v", 3.14 as f64,)) { Ok(()) => (), Err(err) => panic!(err), } - let expected = NewHyperObject!("v", F64(3.14 as f64),); + let expected = NewHyperObject!("v", 3.14 as f64,); match client.get("kv", "k") { Ok(obj) => { - if obj != expected { + if !sloppyCompareHyper(&obj, &expected) { panic!("expected: {:?} actual: {:?}", expected, obj); } diff --git a/test/rust/DataTypeInt.rs b/test/rust/DataTypeInt.rs index 770d7b934..8ff19d235 100644 --- a/test/rust/DataTypeInt.rs +++ b/test/rust/DataTypeInt.rs @@ -6,10 +6,147 @@ use std::str::FromStr; use std::collections::BTreeSet; use std::collections::HashMap; use std::iter::FromIterator; +use std::mem::transmute; +use std::any::Any; use hyperdex::*; +use hyperdex::HyperValue::*; use hyperdex::HyperPredicateType::*; +macro_rules! sloppyCompare { + ($a: ident, $b: ident) => ( + if $a.len() == 0 && $b.len() == 0 { + true + } else { + if $a.get_type_id() != $b.get_type_id() { + false + } else { + unsafe { + transmute($a) == $b + } + } + } + ); +} + +fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { + for (ak, av) in a.map.iter() { + let bv = match b.map.get(ak) { + None => return false, + Some(x) => x, + }; + + let av = av.clone(); + let bv = bv.clone(); + + // this is dumb but I do not see a better way... fortunately the following lines are generated + // by a python script + match (av, bv) { + (HyperListString(x), HyperListString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperListString(x), HyperListInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperListString(x), HyperListFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperListInt(x), HyperListString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperListInt(x), HyperListInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperListInt(x), HyperListFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperListFloat(x), HyperListString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperListFloat(x), HyperListInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperListFloat(x), HyperListFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperSetString(x), HyperSetString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperSetString(x), HyperSetInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperSetString(x), HyperSetFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperSetInt(x), HyperSetString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperSetInt(x), HyperSetInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperSetInt(x), HyperSetFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperSetFloat(x), HyperSetString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperSetFloat(x), HyperSetInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperSetFloat(x), HyperSetFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringString(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringString(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringString(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringString(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringString(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringString(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringString(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringString(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringString(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringInt(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringInt(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringInt(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringInt(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringInt(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringInt(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringInt(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringInt(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringInt(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringFloat(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringFloat(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringFloat(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringFloat(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringFloat(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringFloat(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringFloat(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringFloat(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringFloat(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntString(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntString(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntString(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntString(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntString(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntString(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntString(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntString(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntString(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntInt(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntInt(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntInt(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntInt(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntInt(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntInt(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntInt(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntInt(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntInt(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntFloat(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntFloat(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntFloat(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntFloat(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntFloat(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntFloat(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntFloat(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntFloat(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntFloat(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatString(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatString(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatString(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatString(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatString(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatString(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatString(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatString(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatString(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatInt(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatInt(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatInt(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatInt(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatInt(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatInt(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatInt(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatInt(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatInt(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatFloat(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatFloat(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatFloat(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatFloat(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatFloat(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatFloat(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatFloat(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatFloat(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatFloat(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (x, y) => if x != y { return false; }, + } + } + return true; +} + fn main() { let args = os::args(); let mut client = Client::new(FromStr::from_str(format!("{}:{}", args[1], args[2]).as_slice()).unwrap()).unwrap(); @@ -21,7 +158,7 @@ fn main() { let expected = NewHyperObject!("v", 0 as i64,); match client.get("kv", "k") { Ok(obj) => { - if obj != expected { + if !sloppyCompareHyper(&obj, &expected) { panic!("expected: {:?} actual: {:?}", expected, obj); } @@ -36,7 +173,7 @@ actual: {:?}", expected, obj); let expected = NewHyperObject!("v", 1 as i64,); match client.get("kv", "k") { Ok(obj) => { - if obj != expected { + if !sloppyCompareHyper(&obj, &expected) { panic!("expected: {:?} actual: {:?}", expected, obj); } @@ -51,7 +188,7 @@ actual: {:?}", expected, obj); let expected = NewHyperObject!("v", -1 as i64,); match client.get("kv", "k") { Ok(obj) => { - if obj != expected { + if !sloppyCompareHyper(&obj, &expected) { panic!("expected: {:?} actual: {:?}", expected, obj); } @@ -66,7 +203,7 @@ actual: {:?}", expected, obj); let expected = NewHyperObject!("v", 0 as i64,); match client.get("kv", "k") { Ok(obj) => { - if obj != expected { + if !sloppyCompareHyper(&obj, &expected) { panic!("expected: {:?} actual: {:?}", expected, obj); } @@ -81,7 +218,7 @@ actual: {:?}", expected, obj); let expected = NewHyperObject!("v", 9223372036854775807 as i64,); match client.get("kv", "k") { Ok(obj) => { - if obj != expected { + if !sloppyCompareHyper(&obj, &expected) { panic!("expected: {:?} actual: {:?}", expected, obj); } @@ -96,7 +233,7 @@ actual: {:?}", expected, obj); let expected = NewHyperObject!("v", -9223372036854775808 as i64,); match client.get("kv", "k") { Ok(obj) => { - if obj != expected { + if !sloppyCompareHyper(&obj, &expected) { panic!("expected: {:?} actual: {:?}", expected, obj); } diff --git a/test/rust/DataTypeListFloat.rs b/test/rust/DataTypeListFloat.rs index 866421a5a..6cf2d4ad2 100644 --- a/test/rust/DataTypeListFloat.rs +++ b/test/rust/DataTypeListFloat.rs @@ -6,10 +6,147 @@ use std::str::FromStr; use std::collections::BTreeSet; use std::collections::HashMap; use std::iter::FromIterator; +use std::mem::transmute; +use std::any::Any; use hyperdex::*; +use hyperdex::HyperValue::*; use hyperdex::HyperPredicateType::*; +macro_rules! sloppyCompare { + ($a: ident, $b: ident) => ( + if $a.len() == 0 && $b.len() == 0 { + true + } else { + if $a.get_type_id() != $b.get_type_id() { + false + } else { + unsafe { + transmute($a) == $b + } + } + } + ); +} + +fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { + for (ak, av) in a.map.iter() { + let bv = match b.map.get(ak) { + None => return false, + Some(x) => x, + }; + + let av = av.clone(); + let bv = bv.clone(); + + // this is dumb but I do not see a better way... fortunately the following lines are generated + // by a python script + match (av, bv) { + (HyperListString(x), HyperListString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperListString(x), HyperListInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperListString(x), HyperListFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperListInt(x), HyperListString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperListInt(x), HyperListInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperListInt(x), HyperListFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperListFloat(x), HyperListString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperListFloat(x), HyperListInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperListFloat(x), HyperListFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperSetString(x), HyperSetString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperSetString(x), HyperSetInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperSetString(x), HyperSetFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperSetInt(x), HyperSetString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperSetInt(x), HyperSetInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperSetInt(x), HyperSetFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperSetFloat(x), HyperSetString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperSetFloat(x), HyperSetInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperSetFloat(x), HyperSetFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringString(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringString(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringString(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringString(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringString(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringString(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringString(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringString(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringString(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringInt(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringInt(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringInt(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringInt(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringInt(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringInt(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringInt(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringInt(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringInt(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringFloat(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringFloat(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringFloat(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringFloat(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringFloat(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringFloat(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringFloat(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringFloat(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringFloat(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntString(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntString(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntString(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntString(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntString(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntString(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntString(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntString(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntString(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntInt(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntInt(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntInt(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntInt(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntInt(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntInt(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntInt(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntInt(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntInt(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntFloat(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntFloat(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntFloat(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntFloat(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntFloat(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntFloat(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntFloat(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntFloat(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntFloat(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatString(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatString(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatString(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatString(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatString(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatString(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatString(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatString(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatString(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatInt(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatInt(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatInt(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatInt(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatInt(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatInt(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatInt(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatInt(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatInt(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatFloat(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatFloat(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatFloat(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatFloat(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatFloat(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatFloat(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatFloat(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatFloat(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatFloat(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (x, y) => if x != y { return false; }, + } + } + return true; +} + fn main() { let args = os::args(); let mut client = Client::new(FromStr::from_str(format!("{}:{}", args[1], args[2]).as_slice()).unwrap()).unwrap(); @@ -18,10 +155,10 @@ fn main() { Ok(()) => (), Err(err) => panic!(err), } - let expected = NewHyperObject!("v", vec!(),); + let expected = NewHyperObject!("v", Vec::::new(),); match client.get("kv", "k") { Ok(obj) => { - if obj != expected { + if !sloppyCompareHyper(&obj, &expected) { panic!("expected: {:?} actual: {:?}", expected, obj); } @@ -36,7 +173,7 @@ actual: {:?}", expected, obj); let expected = NewHyperObject!("v", vec!(3.14 as f64, 0.25 as f64, 1.0 as f64),); match client.get("kv", "k") { Ok(obj) => { - if obj != expected { + if !sloppyCompareHyper(&obj, &expected) { panic!("expected: {:?} actual: {:?}", expected, obj); } @@ -44,14 +181,14 @@ actual: {:?}", expected, obj); Err(err) => panic!(err), } - match client.put("kv", "k", NewHyperObject!("v", vec!(),)) { + match client.put("kv", "k", NewHyperObject!("v", Vec::::new(),)) { Ok(()) => (), Err(err) => panic!(err), } - let expected = NewHyperObject!("v", vec!(),); + let expected = NewHyperObject!("v", Vec::::new(),); match client.get("kv", "k") { Ok(obj) => { - if obj != expected { + if !sloppyCompareHyper(&obj, &expected) { panic!("expected: {:?} actual: {:?}", expected, obj); } diff --git a/test/rust/DataTypeListInt.rs b/test/rust/DataTypeListInt.rs index 9b772e328..f7052eed2 100644 --- a/test/rust/DataTypeListInt.rs +++ b/test/rust/DataTypeListInt.rs @@ -6,10 +6,147 @@ use std::str::FromStr; use std::collections::BTreeSet; use std::collections::HashMap; use std::iter::FromIterator; +use std::mem::transmute; +use std::any::Any; use hyperdex::*; +use hyperdex::HyperValue::*; use hyperdex::HyperPredicateType::*; +macro_rules! sloppyCompare { + ($a: ident, $b: ident) => ( + if $a.len() == 0 && $b.len() == 0 { + true + } else { + if $a.get_type_id() != $b.get_type_id() { + false + } else { + unsafe { + transmute($a) == $b + } + } + } + ); +} + +fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { + for (ak, av) in a.map.iter() { + let bv = match b.map.get(ak) { + None => return false, + Some(x) => x, + }; + + let av = av.clone(); + let bv = bv.clone(); + + // this is dumb but I do not see a better way... fortunately the following lines are generated + // by a python script + match (av, bv) { + (HyperListString(x), HyperListString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperListString(x), HyperListInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperListString(x), HyperListFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperListInt(x), HyperListString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperListInt(x), HyperListInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperListInt(x), HyperListFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperListFloat(x), HyperListString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperListFloat(x), HyperListInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperListFloat(x), HyperListFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperSetString(x), HyperSetString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperSetString(x), HyperSetInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperSetString(x), HyperSetFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperSetInt(x), HyperSetString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperSetInt(x), HyperSetInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperSetInt(x), HyperSetFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperSetFloat(x), HyperSetString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperSetFloat(x), HyperSetInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperSetFloat(x), HyperSetFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringString(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringString(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringString(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringString(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringString(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringString(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringString(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringString(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringString(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringInt(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringInt(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringInt(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringInt(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringInt(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringInt(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringInt(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringInt(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringInt(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringFloat(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringFloat(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringFloat(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringFloat(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringFloat(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringFloat(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringFloat(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringFloat(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringFloat(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntString(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntString(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntString(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntString(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntString(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntString(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntString(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntString(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntString(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntInt(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntInt(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntInt(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntInt(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntInt(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntInt(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntInt(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntInt(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntInt(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntFloat(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntFloat(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntFloat(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntFloat(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntFloat(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntFloat(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntFloat(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntFloat(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntFloat(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatString(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatString(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatString(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatString(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatString(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatString(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatString(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatString(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatString(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatInt(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatInt(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatInt(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatInt(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatInt(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatInt(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatInt(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatInt(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatInt(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatFloat(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatFloat(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatFloat(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatFloat(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatFloat(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatFloat(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatFloat(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatFloat(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatFloat(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (x, y) => if x != y { return false; }, + } + } + return true; +} + fn main() { let args = os::args(); let mut client = Client::new(FromStr::from_str(format!("{}:{}", args[1], args[2]).as_slice()).unwrap()).unwrap(); @@ -18,10 +155,10 @@ fn main() { Ok(()) => (), Err(err) => panic!(err), } - let expected = NewHyperObject!("v", vec!(),); + let expected = NewHyperObject!("v", Vec::::new(),); match client.get("kv", "k") { Ok(obj) => { - if obj != expected { + if !sloppyCompareHyper(&obj, &expected) { panic!("expected: {:?} actual: {:?}", expected, obj); } @@ -36,7 +173,7 @@ actual: {:?}", expected, obj); let expected = NewHyperObject!("v", vec!(1 as i64, 2 as i64, 3 as i64),); match client.get("kv", "k") { Ok(obj) => { - if obj != expected { + if !sloppyCompareHyper(&obj, &expected) { panic!("expected: {:?} actual: {:?}", expected, obj); } @@ -44,14 +181,14 @@ actual: {:?}", expected, obj); Err(err) => panic!(err), } - match client.put("kv", "k", NewHyperObject!("v", vec!(),)) { + match client.put("kv", "k", NewHyperObject!("v", Vec::::new(),)) { Ok(()) => (), Err(err) => panic!(err), } - let expected = NewHyperObject!("v", vec!(),); + let expected = NewHyperObject!("v", Vec::::new(),); match client.get("kv", "k") { Ok(obj) => { - if obj != expected { + if !sloppyCompareHyper(&obj, &expected) { panic!("expected: {:?} actual: {:?}", expected, obj); } diff --git a/test/rust/DataTypeListString.rs b/test/rust/DataTypeListString.rs index 2bc9b6038..9c296db03 100644 --- a/test/rust/DataTypeListString.rs +++ b/test/rust/DataTypeListString.rs @@ -6,10 +6,147 @@ use std::str::FromStr; use std::collections::BTreeSet; use std::collections::HashMap; use std::iter::FromIterator; +use std::mem::transmute; +use std::any::Any; use hyperdex::*; +use hyperdex::HyperValue::*; use hyperdex::HyperPredicateType::*; +macro_rules! sloppyCompare { + ($a: ident, $b: ident) => ( + if $a.len() == 0 && $b.len() == 0 { + true + } else { + if $a.get_type_id() != $b.get_type_id() { + false + } else { + unsafe { + transmute($a) == $b + } + } + } + ); +} + +fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { + for (ak, av) in a.map.iter() { + let bv = match b.map.get(ak) { + None => return false, + Some(x) => x, + }; + + let av = av.clone(); + let bv = bv.clone(); + + // this is dumb but I do not see a better way... fortunately the following lines are generated + // by a python script + match (av, bv) { + (HyperListString(x), HyperListString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperListString(x), HyperListInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperListString(x), HyperListFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperListInt(x), HyperListString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperListInt(x), HyperListInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperListInt(x), HyperListFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperListFloat(x), HyperListString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperListFloat(x), HyperListInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperListFloat(x), HyperListFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperSetString(x), HyperSetString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperSetString(x), HyperSetInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperSetString(x), HyperSetFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperSetInt(x), HyperSetString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperSetInt(x), HyperSetInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperSetInt(x), HyperSetFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperSetFloat(x), HyperSetString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperSetFloat(x), HyperSetInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperSetFloat(x), HyperSetFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringString(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringString(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringString(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringString(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringString(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringString(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringString(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringString(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringString(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringInt(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringInt(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringInt(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringInt(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringInt(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringInt(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringInt(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringInt(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringInt(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringFloat(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringFloat(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringFloat(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringFloat(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringFloat(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringFloat(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringFloat(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringFloat(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringFloat(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntString(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntString(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntString(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntString(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntString(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntString(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntString(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntString(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntString(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntInt(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntInt(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntInt(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntInt(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntInt(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntInt(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntInt(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntInt(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntInt(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntFloat(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntFloat(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntFloat(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntFloat(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntFloat(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntFloat(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntFloat(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntFloat(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntFloat(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatString(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatString(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatString(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatString(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatString(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatString(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatString(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatString(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatString(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatInt(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatInt(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatInt(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatInt(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatInt(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatInt(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatInt(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatInt(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatInt(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatFloat(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatFloat(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatFloat(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatFloat(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatFloat(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatFloat(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatFloat(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatFloat(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatFloat(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (x, y) => if x != y { return false; }, + } + } + return true; +} + fn main() { let args = os::args(); let mut client = Client::new(FromStr::from_str(format!("{}:{}", args[1], args[2]).as_slice()).unwrap()).unwrap(); @@ -18,10 +155,10 @@ fn main() { Ok(()) => (), Err(err) => panic!(err), } - let expected = NewHyperObject!("v", vec!(),); + let expected = NewHyperObject!("v", Vec::::new(),); match client.get("kv", "k") { Ok(obj) => { - if obj != expected { + if !sloppyCompareHyper(&obj, &expected) { panic!("expected: {:?} actual: {:?}", expected, obj); } @@ -36,7 +173,7 @@ actual: {:?}", expected, obj); let expected = NewHyperObject!("v", vec!("A", "B", "C"),); match client.get("kv", "k") { Ok(obj) => { - if obj != expected { + if !sloppyCompareHyper(&obj, &expected) { panic!("expected: {:?} actual: {:?}", expected, obj); } @@ -44,14 +181,14 @@ actual: {:?}", expected, obj); Err(err) => panic!(err), } - match client.put("kv", "k", NewHyperObject!("v", vec!(),)) { + match client.put("kv", "k", NewHyperObject!("v", Vec::::new(),)) { Ok(()) => (), Err(err) => panic!(err), } - let expected = NewHyperObject!("v", vec!(),); + let expected = NewHyperObject!("v", Vec::::new(),); match client.get("kv", "k") { Ok(obj) => { - if obj != expected { + if !sloppyCompareHyper(&obj, &expected) { panic!("expected: {:?} actual: {:?}", expected, obj); } diff --git a/test/rust/DataTypeMapFloatFloat.rs b/test/rust/DataTypeMapFloatFloat.rs index e55bb786a..f7f4a270d 100644 --- a/test/rust/DataTypeMapFloatFloat.rs +++ b/test/rust/DataTypeMapFloatFloat.rs @@ -6,10 +6,147 @@ use std::str::FromStr; use std::collections::BTreeSet; use std::collections::HashMap; use std::iter::FromIterator; +use std::mem::transmute; +use std::any::Any; use hyperdex::*; +use hyperdex::HyperValue::*; use hyperdex::HyperPredicateType::*; +macro_rules! sloppyCompare { + ($a: ident, $b: ident) => ( + if $a.len() == 0 && $b.len() == 0 { + true + } else { + if $a.get_type_id() != $b.get_type_id() { + false + } else { + unsafe { + transmute($a) == $b + } + } + } + ); +} + +fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { + for (ak, av) in a.map.iter() { + let bv = match b.map.get(ak) { + None => return false, + Some(x) => x, + }; + + let av = av.clone(); + let bv = bv.clone(); + + // this is dumb but I do not see a better way... fortunately the following lines are generated + // by a python script + match (av, bv) { + (HyperListString(x), HyperListString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperListString(x), HyperListInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperListString(x), HyperListFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperListInt(x), HyperListString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperListInt(x), HyperListInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperListInt(x), HyperListFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperListFloat(x), HyperListString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperListFloat(x), HyperListInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperListFloat(x), HyperListFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperSetString(x), HyperSetString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperSetString(x), HyperSetInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperSetString(x), HyperSetFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperSetInt(x), HyperSetString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperSetInt(x), HyperSetInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperSetInt(x), HyperSetFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperSetFloat(x), HyperSetString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperSetFloat(x), HyperSetInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperSetFloat(x), HyperSetFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringString(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringString(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringString(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringString(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringString(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringString(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringString(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringString(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringString(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringInt(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringInt(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringInt(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringInt(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringInt(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringInt(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringInt(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringInt(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringInt(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringFloat(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringFloat(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringFloat(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringFloat(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringFloat(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringFloat(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringFloat(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringFloat(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringFloat(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntString(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntString(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntString(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntString(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntString(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntString(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntString(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntString(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntString(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntInt(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntInt(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntInt(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntInt(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntInt(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntInt(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntInt(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntInt(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntInt(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntFloat(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntFloat(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntFloat(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntFloat(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntFloat(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntFloat(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntFloat(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntFloat(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntFloat(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatString(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatString(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatString(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatString(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatString(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatString(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatString(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatString(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatString(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatInt(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatInt(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatInt(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatInt(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatInt(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatInt(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatInt(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatInt(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatInt(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatFloat(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatFloat(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatFloat(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatFloat(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatFloat(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatFloat(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatFloat(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatFloat(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatFloat(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (x, y) => if x != y { return false; }, + } + } + return true; +} + fn main() { let args = os::args(); let mut client = Client::new(FromStr::from_str(format!("{}:{}", args[1], args[2]).as_slice()).unwrap()).unwrap(); @@ -21,7 +158,7 @@ fn main() { let expected = NewHyperObject!("v", HashMap::, Vec>::new(),); match client.get("kv", "k") { Ok(obj) => { - if obj != expected { + if !sloppyCompareHyper(&obj, &expected) { panic!("expected: {:?} actual: {:?}", expected, obj); } @@ -50,7 +187,7 @@ m ,); match client.get("kv", "k") { Ok(obj) => { - if obj != expected { + if !sloppyCompareHyper(&obj, &expected) { panic!("expected: {:?} actual: {:?}", expected, obj); } @@ -65,7 +202,7 @@ actual: {:?}", expected, obj); let expected = NewHyperObject!("v", HashMap::, Vec>::new(),); match client.get("kv", "k") { Ok(obj) => { - if obj != expected { + if !sloppyCompareHyper(&obj, &expected) { panic!("expected: {:?} actual: {:?}", expected, obj); } diff --git a/test/rust/DataTypeMapFloatInt.rs b/test/rust/DataTypeMapFloatInt.rs index c83152cda..84ef7c720 100644 --- a/test/rust/DataTypeMapFloatInt.rs +++ b/test/rust/DataTypeMapFloatInt.rs @@ -6,10 +6,147 @@ use std::str::FromStr; use std::collections::BTreeSet; use std::collections::HashMap; use std::iter::FromIterator; +use std::mem::transmute; +use std::any::Any; use hyperdex::*; +use hyperdex::HyperValue::*; use hyperdex::HyperPredicateType::*; +macro_rules! sloppyCompare { + ($a: ident, $b: ident) => ( + if $a.len() == 0 && $b.len() == 0 { + true + } else { + if $a.get_type_id() != $b.get_type_id() { + false + } else { + unsafe { + transmute($a) == $b + } + } + } + ); +} + +fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { + for (ak, av) in a.map.iter() { + let bv = match b.map.get(ak) { + None => return false, + Some(x) => x, + }; + + let av = av.clone(); + let bv = bv.clone(); + + // this is dumb but I do not see a better way... fortunately the following lines are generated + // by a python script + match (av, bv) { + (HyperListString(x), HyperListString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperListString(x), HyperListInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperListString(x), HyperListFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperListInt(x), HyperListString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperListInt(x), HyperListInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperListInt(x), HyperListFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperListFloat(x), HyperListString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperListFloat(x), HyperListInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperListFloat(x), HyperListFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperSetString(x), HyperSetString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperSetString(x), HyperSetInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperSetString(x), HyperSetFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperSetInt(x), HyperSetString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperSetInt(x), HyperSetInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperSetInt(x), HyperSetFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperSetFloat(x), HyperSetString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperSetFloat(x), HyperSetInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperSetFloat(x), HyperSetFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringString(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringString(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringString(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringString(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringString(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringString(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringString(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringString(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringString(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringInt(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringInt(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringInt(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringInt(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringInt(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringInt(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringInt(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringInt(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringInt(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringFloat(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringFloat(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringFloat(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringFloat(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringFloat(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringFloat(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringFloat(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringFloat(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringFloat(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntString(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntString(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntString(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntString(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntString(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntString(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntString(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntString(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntString(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntInt(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntInt(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntInt(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntInt(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntInt(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntInt(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntInt(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntInt(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntInt(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntFloat(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntFloat(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntFloat(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntFloat(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntFloat(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntFloat(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntFloat(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntFloat(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntFloat(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatString(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatString(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatString(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatString(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatString(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatString(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatString(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatString(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatString(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatInt(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatInt(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatInt(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatInt(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatInt(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatInt(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatInt(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatInt(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatInt(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatFloat(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatFloat(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatFloat(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatFloat(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatFloat(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatFloat(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatFloat(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatFloat(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatFloat(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (x, y) => if x != y { return false; }, + } + } + return true; +} + fn main() { let args = os::args(); let mut client = Client::new(FromStr::from_str(format!("{}:{}", args[1], args[2]).as_slice()).unwrap()).unwrap(); @@ -21,7 +158,7 @@ fn main() { let expected = NewHyperObject!("v", HashMap::, Vec>::new(),); match client.get("kv", "k") { Ok(obj) => { - if obj != expected { + if !sloppyCompareHyper(&obj, &expected) { panic!("expected: {:?} actual: {:?}", expected, obj); } @@ -50,7 +187,7 @@ m ,); match client.get("kv", "k") { Ok(obj) => { - if obj != expected { + if !sloppyCompareHyper(&obj, &expected) { panic!("expected: {:?} actual: {:?}", expected, obj); } @@ -65,7 +202,7 @@ actual: {:?}", expected, obj); let expected = NewHyperObject!("v", HashMap::, Vec>::new(),); match client.get("kv", "k") { Ok(obj) => { - if obj != expected { + if !sloppyCompareHyper(&obj, &expected) { panic!("expected: {:?} actual: {:?}", expected, obj); } diff --git a/test/rust/DataTypeMapFloatString.rs b/test/rust/DataTypeMapFloatString.rs index 63682a9df..351d0a4f2 100644 --- a/test/rust/DataTypeMapFloatString.rs +++ b/test/rust/DataTypeMapFloatString.rs @@ -6,10 +6,147 @@ use std::str::FromStr; use std::collections::BTreeSet; use std::collections::HashMap; use std::iter::FromIterator; +use std::mem::transmute; +use std::any::Any; use hyperdex::*; +use hyperdex::HyperValue::*; use hyperdex::HyperPredicateType::*; +macro_rules! sloppyCompare { + ($a: ident, $b: ident) => ( + if $a.len() == 0 && $b.len() == 0 { + true + } else { + if $a.get_type_id() != $b.get_type_id() { + false + } else { + unsafe { + transmute($a) == $b + } + } + } + ); +} + +fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { + for (ak, av) in a.map.iter() { + let bv = match b.map.get(ak) { + None => return false, + Some(x) => x, + }; + + let av = av.clone(); + let bv = bv.clone(); + + // this is dumb but I do not see a better way... fortunately the following lines are generated + // by a python script + match (av, bv) { + (HyperListString(x), HyperListString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperListString(x), HyperListInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperListString(x), HyperListFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperListInt(x), HyperListString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperListInt(x), HyperListInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperListInt(x), HyperListFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperListFloat(x), HyperListString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperListFloat(x), HyperListInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperListFloat(x), HyperListFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperSetString(x), HyperSetString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperSetString(x), HyperSetInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperSetString(x), HyperSetFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperSetInt(x), HyperSetString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperSetInt(x), HyperSetInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperSetInt(x), HyperSetFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperSetFloat(x), HyperSetString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperSetFloat(x), HyperSetInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperSetFloat(x), HyperSetFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringString(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringString(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringString(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringString(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringString(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringString(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringString(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringString(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringString(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringInt(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringInt(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringInt(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringInt(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringInt(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringInt(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringInt(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringInt(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringInt(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringFloat(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringFloat(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringFloat(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringFloat(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringFloat(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringFloat(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringFloat(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringFloat(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringFloat(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntString(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntString(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntString(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntString(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntString(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntString(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntString(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntString(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntString(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntInt(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntInt(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntInt(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntInt(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntInt(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntInt(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntInt(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntInt(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntInt(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntFloat(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntFloat(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntFloat(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntFloat(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntFloat(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntFloat(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntFloat(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntFloat(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntFloat(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatString(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatString(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatString(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatString(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatString(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatString(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatString(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatString(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatString(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatInt(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatInt(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatInt(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatInt(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatInt(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatInt(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatInt(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatInt(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatInt(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatFloat(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatFloat(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatFloat(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatFloat(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatFloat(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatFloat(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatFloat(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatFloat(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatFloat(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (x, y) => if x != y { return false; }, + } + } + return true; +} + fn main() { let args = os::args(); let mut client = Client::new(FromStr::from_str(format!("{}:{}", args[1], args[2]).as_slice()).unwrap()).unwrap(); @@ -21,7 +158,7 @@ fn main() { let expected = NewHyperObject!("v", HashMap::, Vec>::new(),); match client.get("kv", "k") { Ok(obj) => { - if obj != expected { + if !sloppyCompareHyper(&obj, &expected) { panic!("expected: {:?} actual: {:?}", expected, obj); } @@ -50,7 +187,7 @@ m ,); match client.get("kv", "k") { Ok(obj) => { - if obj != expected { + if !sloppyCompareHyper(&obj, &expected) { panic!("expected: {:?} actual: {:?}", expected, obj); } @@ -65,7 +202,7 @@ actual: {:?}", expected, obj); let expected = NewHyperObject!("v", HashMap::, Vec>::new(),); match client.get("kv", "k") { Ok(obj) => { - if obj != expected { + if !sloppyCompareHyper(&obj, &expected) { panic!("expected: {:?} actual: {:?}", expected, obj); } diff --git a/test/rust/DataTypeMapIntFloat.rs b/test/rust/DataTypeMapIntFloat.rs index 5f21b5741..eafe29e8f 100644 --- a/test/rust/DataTypeMapIntFloat.rs +++ b/test/rust/DataTypeMapIntFloat.rs @@ -6,10 +6,147 @@ use std::str::FromStr; use std::collections::BTreeSet; use std::collections::HashMap; use std::iter::FromIterator; +use std::mem::transmute; +use std::any::Any; use hyperdex::*; +use hyperdex::HyperValue::*; use hyperdex::HyperPredicateType::*; +macro_rules! sloppyCompare { + ($a: ident, $b: ident) => ( + if $a.len() == 0 && $b.len() == 0 { + true + } else { + if $a.get_type_id() != $b.get_type_id() { + false + } else { + unsafe { + transmute($a) == $b + } + } + } + ); +} + +fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { + for (ak, av) in a.map.iter() { + let bv = match b.map.get(ak) { + None => return false, + Some(x) => x, + }; + + let av = av.clone(); + let bv = bv.clone(); + + // this is dumb but I do not see a better way... fortunately the following lines are generated + // by a python script + match (av, bv) { + (HyperListString(x), HyperListString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperListString(x), HyperListInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperListString(x), HyperListFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperListInt(x), HyperListString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperListInt(x), HyperListInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperListInt(x), HyperListFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperListFloat(x), HyperListString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperListFloat(x), HyperListInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperListFloat(x), HyperListFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperSetString(x), HyperSetString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperSetString(x), HyperSetInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperSetString(x), HyperSetFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperSetInt(x), HyperSetString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperSetInt(x), HyperSetInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperSetInt(x), HyperSetFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperSetFloat(x), HyperSetString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperSetFloat(x), HyperSetInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperSetFloat(x), HyperSetFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringString(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringString(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringString(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringString(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringString(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringString(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringString(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringString(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringString(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringInt(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringInt(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringInt(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringInt(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringInt(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringInt(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringInt(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringInt(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringInt(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringFloat(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringFloat(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringFloat(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringFloat(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringFloat(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringFloat(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringFloat(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringFloat(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringFloat(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntString(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntString(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntString(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntString(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntString(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntString(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntString(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntString(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntString(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntInt(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntInt(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntInt(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntInt(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntInt(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntInt(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntInt(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntInt(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntInt(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntFloat(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntFloat(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntFloat(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntFloat(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntFloat(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntFloat(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntFloat(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntFloat(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntFloat(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatString(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatString(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatString(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatString(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatString(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatString(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatString(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatString(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatString(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatInt(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatInt(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatInt(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatInt(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatInt(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatInt(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatInt(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatInt(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatInt(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatFloat(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatFloat(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatFloat(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatFloat(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatFloat(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatFloat(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatFloat(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatFloat(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatFloat(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (x, y) => if x != y { return false; }, + } + } + return true; +} + fn main() { let args = os::args(); let mut client = Client::new(FromStr::from_str(format!("{}:{}", args[1], args[2]).as_slice()).unwrap()).unwrap(); @@ -21,7 +158,7 @@ fn main() { let expected = NewHyperObject!("v", HashMap::, Vec>::new(),); match client.get("kv", "k") { Ok(obj) => { - if obj != expected { + if !sloppyCompareHyper(&obj, &expected) { panic!("expected: {:?} actual: {:?}", expected, obj); } @@ -50,7 +187,7 @@ m ,); match client.get("kv", "k") { Ok(obj) => { - if obj != expected { + if !sloppyCompareHyper(&obj, &expected) { panic!("expected: {:?} actual: {:?}", expected, obj); } @@ -65,7 +202,7 @@ actual: {:?}", expected, obj); let expected = NewHyperObject!("v", HashMap::, Vec>::new(),); match client.get("kv", "k") { Ok(obj) => { - if obj != expected { + if !sloppyCompareHyper(&obj, &expected) { panic!("expected: {:?} actual: {:?}", expected, obj); } diff --git a/test/rust/DataTypeMapIntInt.rs b/test/rust/DataTypeMapIntInt.rs index bf35f9a51..e736bbf55 100644 --- a/test/rust/DataTypeMapIntInt.rs +++ b/test/rust/DataTypeMapIntInt.rs @@ -6,10 +6,147 @@ use std::str::FromStr; use std::collections::BTreeSet; use std::collections::HashMap; use std::iter::FromIterator; +use std::mem::transmute; +use std::any::Any; use hyperdex::*; +use hyperdex::HyperValue::*; use hyperdex::HyperPredicateType::*; +macro_rules! sloppyCompare { + ($a: ident, $b: ident) => ( + if $a.len() == 0 && $b.len() == 0 { + true + } else { + if $a.get_type_id() != $b.get_type_id() { + false + } else { + unsafe { + transmute($a) == $b + } + } + } + ); +} + +fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { + for (ak, av) in a.map.iter() { + let bv = match b.map.get(ak) { + None => return false, + Some(x) => x, + }; + + let av = av.clone(); + let bv = bv.clone(); + + // this is dumb but I do not see a better way... fortunately the following lines are generated + // by a python script + match (av, bv) { + (HyperListString(x), HyperListString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperListString(x), HyperListInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperListString(x), HyperListFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperListInt(x), HyperListString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperListInt(x), HyperListInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperListInt(x), HyperListFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperListFloat(x), HyperListString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperListFloat(x), HyperListInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperListFloat(x), HyperListFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperSetString(x), HyperSetString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperSetString(x), HyperSetInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperSetString(x), HyperSetFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperSetInt(x), HyperSetString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperSetInt(x), HyperSetInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperSetInt(x), HyperSetFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperSetFloat(x), HyperSetString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperSetFloat(x), HyperSetInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperSetFloat(x), HyperSetFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringString(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringString(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringString(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringString(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringString(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringString(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringString(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringString(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringString(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringInt(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringInt(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringInt(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringInt(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringInt(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringInt(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringInt(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringInt(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringInt(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringFloat(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringFloat(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringFloat(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringFloat(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringFloat(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringFloat(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringFloat(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringFloat(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringFloat(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntString(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntString(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntString(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntString(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntString(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntString(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntString(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntString(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntString(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntInt(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntInt(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntInt(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntInt(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntInt(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntInt(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntInt(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntInt(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntInt(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntFloat(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntFloat(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntFloat(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntFloat(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntFloat(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntFloat(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntFloat(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntFloat(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntFloat(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatString(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatString(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatString(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatString(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatString(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatString(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatString(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatString(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatString(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatInt(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatInt(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatInt(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatInt(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatInt(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatInt(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatInt(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatInt(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatInt(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatFloat(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatFloat(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatFloat(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatFloat(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatFloat(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatFloat(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatFloat(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatFloat(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatFloat(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (x, y) => if x != y { return false; }, + } + } + return true; +} + fn main() { let args = os::args(); let mut client = Client::new(FromStr::from_str(format!("{}:{}", args[1], args[2]).as_slice()).unwrap()).unwrap(); @@ -21,7 +158,7 @@ fn main() { let expected = NewHyperObject!("v", HashMap::, Vec>::new(),); match client.get("kv", "k") { Ok(obj) => { - if obj != expected { + if !sloppyCompareHyper(&obj, &expected) { panic!("expected: {:?} actual: {:?}", expected, obj); } @@ -50,7 +187,7 @@ m ,); match client.get("kv", "k") { Ok(obj) => { - if obj != expected { + if !sloppyCompareHyper(&obj, &expected) { panic!("expected: {:?} actual: {:?}", expected, obj); } @@ -65,7 +202,7 @@ actual: {:?}", expected, obj); let expected = NewHyperObject!("v", HashMap::, Vec>::new(),); match client.get("kv", "k") { Ok(obj) => { - if obj != expected { + if !sloppyCompareHyper(&obj, &expected) { panic!("expected: {:?} actual: {:?}", expected, obj); } diff --git a/test/rust/DataTypeMapIntString.rs b/test/rust/DataTypeMapIntString.rs index bc8338dfa..f8def7e1a 100644 --- a/test/rust/DataTypeMapIntString.rs +++ b/test/rust/DataTypeMapIntString.rs @@ -6,10 +6,147 @@ use std::str::FromStr; use std::collections::BTreeSet; use std::collections::HashMap; use std::iter::FromIterator; +use std::mem::transmute; +use std::any::Any; use hyperdex::*; +use hyperdex::HyperValue::*; use hyperdex::HyperPredicateType::*; +macro_rules! sloppyCompare { + ($a: ident, $b: ident) => ( + if $a.len() == 0 && $b.len() == 0 { + true + } else { + if $a.get_type_id() != $b.get_type_id() { + false + } else { + unsafe { + transmute($a) == $b + } + } + } + ); +} + +fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { + for (ak, av) in a.map.iter() { + let bv = match b.map.get(ak) { + None => return false, + Some(x) => x, + }; + + let av = av.clone(); + let bv = bv.clone(); + + // this is dumb but I do not see a better way... fortunately the following lines are generated + // by a python script + match (av, bv) { + (HyperListString(x), HyperListString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperListString(x), HyperListInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperListString(x), HyperListFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperListInt(x), HyperListString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperListInt(x), HyperListInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperListInt(x), HyperListFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperListFloat(x), HyperListString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperListFloat(x), HyperListInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperListFloat(x), HyperListFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperSetString(x), HyperSetString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperSetString(x), HyperSetInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperSetString(x), HyperSetFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperSetInt(x), HyperSetString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperSetInt(x), HyperSetInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperSetInt(x), HyperSetFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperSetFloat(x), HyperSetString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperSetFloat(x), HyperSetInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperSetFloat(x), HyperSetFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringString(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringString(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringString(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringString(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringString(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringString(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringString(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringString(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringString(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringInt(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringInt(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringInt(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringInt(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringInt(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringInt(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringInt(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringInt(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringInt(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringFloat(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringFloat(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringFloat(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringFloat(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringFloat(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringFloat(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringFloat(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringFloat(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringFloat(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntString(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntString(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntString(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntString(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntString(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntString(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntString(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntString(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntString(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntInt(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntInt(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntInt(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntInt(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntInt(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntInt(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntInt(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntInt(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntInt(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntFloat(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntFloat(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntFloat(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntFloat(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntFloat(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntFloat(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntFloat(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntFloat(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntFloat(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatString(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatString(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatString(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatString(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatString(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatString(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatString(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatString(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatString(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatInt(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatInt(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatInt(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatInt(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatInt(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatInt(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatInt(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatInt(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatInt(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatFloat(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatFloat(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatFloat(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatFloat(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatFloat(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatFloat(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatFloat(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatFloat(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatFloat(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (x, y) => if x != y { return false; }, + } + } + return true; +} + fn main() { let args = os::args(); let mut client = Client::new(FromStr::from_str(format!("{}:{}", args[1], args[2]).as_slice()).unwrap()).unwrap(); @@ -21,7 +158,7 @@ fn main() { let expected = NewHyperObject!("v", HashMap::, Vec>::new(),); match client.get("kv", "k") { Ok(obj) => { - if obj != expected { + if !sloppyCompareHyper(&obj, &expected) { panic!("expected: {:?} actual: {:?}", expected, obj); } @@ -50,7 +187,7 @@ m ,); match client.get("kv", "k") { Ok(obj) => { - if obj != expected { + if !sloppyCompareHyper(&obj, &expected) { panic!("expected: {:?} actual: {:?}", expected, obj); } @@ -65,7 +202,7 @@ actual: {:?}", expected, obj); let expected = NewHyperObject!("v", HashMap::, Vec>::new(),); match client.get("kv", "k") { Ok(obj) => { - if obj != expected { + if !sloppyCompareHyper(&obj, &expected) { panic!("expected: {:?} actual: {:?}", expected, obj); } diff --git a/test/rust/DataTypeMapStringFloat.rs b/test/rust/DataTypeMapStringFloat.rs index 9a80b37b3..44c5bc2d3 100644 --- a/test/rust/DataTypeMapStringFloat.rs +++ b/test/rust/DataTypeMapStringFloat.rs @@ -6,10 +6,147 @@ use std::str::FromStr; use std::collections::BTreeSet; use std::collections::HashMap; use std::iter::FromIterator; +use std::mem::transmute; +use std::any::Any; use hyperdex::*; +use hyperdex::HyperValue::*; use hyperdex::HyperPredicateType::*; +macro_rules! sloppyCompare { + ($a: ident, $b: ident) => ( + if $a.len() == 0 && $b.len() == 0 { + true + } else { + if $a.get_type_id() != $b.get_type_id() { + false + } else { + unsafe { + transmute($a) == $b + } + } + } + ); +} + +fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { + for (ak, av) in a.map.iter() { + let bv = match b.map.get(ak) { + None => return false, + Some(x) => x, + }; + + let av = av.clone(); + let bv = bv.clone(); + + // this is dumb but I do not see a better way... fortunately the following lines are generated + // by a python script + match (av, bv) { + (HyperListString(x), HyperListString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperListString(x), HyperListInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperListString(x), HyperListFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperListInt(x), HyperListString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperListInt(x), HyperListInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperListInt(x), HyperListFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperListFloat(x), HyperListString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperListFloat(x), HyperListInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperListFloat(x), HyperListFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperSetString(x), HyperSetString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperSetString(x), HyperSetInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperSetString(x), HyperSetFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperSetInt(x), HyperSetString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperSetInt(x), HyperSetInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperSetInt(x), HyperSetFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperSetFloat(x), HyperSetString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperSetFloat(x), HyperSetInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperSetFloat(x), HyperSetFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringString(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringString(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringString(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringString(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringString(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringString(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringString(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringString(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringString(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringInt(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringInt(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringInt(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringInt(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringInt(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringInt(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringInt(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringInt(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringInt(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringFloat(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringFloat(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringFloat(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringFloat(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringFloat(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringFloat(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringFloat(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringFloat(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringFloat(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntString(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntString(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntString(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntString(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntString(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntString(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntString(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntString(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntString(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntInt(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntInt(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntInt(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntInt(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntInt(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntInt(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntInt(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntInt(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntInt(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntFloat(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntFloat(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntFloat(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntFloat(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntFloat(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntFloat(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntFloat(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntFloat(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntFloat(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatString(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatString(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatString(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatString(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatString(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatString(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatString(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatString(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatString(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatInt(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatInt(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatInt(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatInt(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatInt(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatInt(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatInt(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatInt(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatInt(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatFloat(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatFloat(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatFloat(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatFloat(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatFloat(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatFloat(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatFloat(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatFloat(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatFloat(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (x, y) => if x != y { return false; }, + } + } + return true; +} + fn main() { let args = os::args(); let mut client = Client::new(FromStr::from_str(format!("{}:{}", args[1], args[2]).as_slice()).unwrap()).unwrap(); @@ -21,7 +158,7 @@ fn main() { let expected = NewHyperObject!("v", HashMap::, Vec>::new(),); match client.get("kv", "k") { Ok(obj) => { - if obj != expected { + if !sloppyCompareHyper(&obj, &expected) { panic!("expected: {:?} actual: {:?}", expected, obj); } @@ -50,7 +187,7 @@ m ,); match client.get("kv", "k") { Ok(obj) => { - if obj != expected { + if !sloppyCompareHyper(&obj, &expected) { panic!("expected: {:?} actual: {:?}", expected, obj); } @@ -65,7 +202,7 @@ actual: {:?}", expected, obj); let expected = NewHyperObject!("v", HashMap::, Vec>::new(),); match client.get("kv", "k") { Ok(obj) => { - if obj != expected { + if !sloppyCompareHyper(&obj, &expected) { panic!("expected: {:?} actual: {:?}", expected, obj); } diff --git a/test/rust/DataTypeMapStringInt.rs b/test/rust/DataTypeMapStringInt.rs index 39b8f3540..3eaee1a8c 100644 --- a/test/rust/DataTypeMapStringInt.rs +++ b/test/rust/DataTypeMapStringInt.rs @@ -6,10 +6,147 @@ use std::str::FromStr; use std::collections::BTreeSet; use std::collections::HashMap; use std::iter::FromIterator; +use std::mem::transmute; +use std::any::Any; use hyperdex::*; +use hyperdex::HyperValue::*; use hyperdex::HyperPredicateType::*; +macro_rules! sloppyCompare { + ($a: ident, $b: ident) => ( + if $a.len() == 0 && $b.len() == 0 { + true + } else { + if $a.get_type_id() != $b.get_type_id() { + false + } else { + unsafe { + transmute($a) == $b + } + } + } + ); +} + +fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { + for (ak, av) in a.map.iter() { + let bv = match b.map.get(ak) { + None => return false, + Some(x) => x, + }; + + let av = av.clone(); + let bv = bv.clone(); + + // this is dumb but I do not see a better way... fortunately the following lines are generated + // by a python script + match (av, bv) { + (HyperListString(x), HyperListString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperListString(x), HyperListInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperListString(x), HyperListFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperListInt(x), HyperListString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperListInt(x), HyperListInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperListInt(x), HyperListFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperListFloat(x), HyperListString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperListFloat(x), HyperListInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperListFloat(x), HyperListFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperSetString(x), HyperSetString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperSetString(x), HyperSetInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperSetString(x), HyperSetFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperSetInt(x), HyperSetString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperSetInt(x), HyperSetInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperSetInt(x), HyperSetFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperSetFloat(x), HyperSetString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperSetFloat(x), HyperSetInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperSetFloat(x), HyperSetFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringString(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringString(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringString(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringString(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringString(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringString(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringString(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringString(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringString(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringInt(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringInt(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringInt(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringInt(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringInt(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringInt(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringInt(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringInt(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringInt(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringFloat(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringFloat(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringFloat(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringFloat(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringFloat(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringFloat(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringFloat(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringFloat(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringFloat(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntString(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntString(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntString(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntString(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntString(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntString(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntString(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntString(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntString(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntInt(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntInt(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntInt(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntInt(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntInt(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntInt(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntInt(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntInt(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntInt(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntFloat(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntFloat(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntFloat(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntFloat(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntFloat(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntFloat(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntFloat(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntFloat(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntFloat(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatString(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatString(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatString(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatString(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatString(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatString(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatString(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatString(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatString(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatInt(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatInt(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatInt(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatInt(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatInt(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatInt(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatInt(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatInt(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatInt(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatFloat(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatFloat(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatFloat(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatFloat(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatFloat(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatFloat(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatFloat(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatFloat(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatFloat(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (x, y) => if x != y { return false; }, + } + } + return true; +} + fn main() { let args = os::args(); let mut client = Client::new(FromStr::from_str(format!("{}:{}", args[1], args[2]).as_slice()).unwrap()).unwrap(); @@ -21,7 +158,7 @@ fn main() { let expected = NewHyperObject!("v", HashMap::, Vec>::new(),); match client.get("kv", "k") { Ok(obj) => { - if obj != expected { + if !sloppyCompareHyper(&obj, &expected) { panic!("expected: {:?} actual: {:?}", expected, obj); } @@ -50,7 +187,7 @@ m ,); match client.get("kv", "k") { Ok(obj) => { - if obj != expected { + if !sloppyCompareHyper(&obj, &expected) { panic!("expected: {:?} actual: {:?}", expected, obj); } @@ -65,7 +202,7 @@ actual: {:?}", expected, obj); let expected = NewHyperObject!("v", HashMap::, Vec>::new(),); match client.get("kv", "k") { Ok(obj) => { - if obj != expected { + if !sloppyCompareHyper(&obj, &expected) { panic!("expected: {:?} actual: {:?}", expected, obj); } diff --git a/test/rust/DataTypeMapStringString.rs b/test/rust/DataTypeMapStringString.rs index 1454e55a6..9ee034f73 100644 --- a/test/rust/DataTypeMapStringString.rs +++ b/test/rust/DataTypeMapStringString.rs @@ -6,10 +6,147 @@ use std::str::FromStr; use std::collections::BTreeSet; use std::collections::HashMap; use std::iter::FromIterator; +use std::mem::transmute; +use std::any::Any; use hyperdex::*; +use hyperdex::HyperValue::*; use hyperdex::HyperPredicateType::*; +macro_rules! sloppyCompare { + ($a: ident, $b: ident) => ( + if $a.len() == 0 && $b.len() == 0 { + true + } else { + if $a.get_type_id() != $b.get_type_id() { + false + } else { + unsafe { + transmute($a) == $b + } + } + } + ); +} + +fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { + for (ak, av) in a.map.iter() { + let bv = match b.map.get(ak) { + None => return false, + Some(x) => x, + }; + + let av = av.clone(); + let bv = bv.clone(); + + // this is dumb but I do not see a better way... fortunately the following lines are generated + // by a python script + match (av, bv) { + (HyperListString(x), HyperListString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperListString(x), HyperListInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperListString(x), HyperListFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperListInt(x), HyperListString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperListInt(x), HyperListInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperListInt(x), HyperListFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperListFloat(x), HyperListString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperListFloat(x), HyperListInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperListFloat(x), HyperListFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperSetString(x), HyperSetString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperSetString(x), HyperSetInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperSetString(x), HyperSetFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperSetInt(x), HyperSetString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperSetInt(x), HyperSetInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperSetInt(x), HyperSetFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperSetFloat(x), HyperSetString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperSetFloat(x), HyperSetInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperSetFloat(x), HyperSetFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringString(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringString(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringString(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringString(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringString(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringString(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringString(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringString(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringString(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringInt(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringInt(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringInt(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringInt(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringInt(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringInt(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringInt(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringInt(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringInt(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringFloat(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringFloat(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringFloat(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringFloat(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringFloat(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringFloat(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringFloat(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringFloat(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringFloat(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntString(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntString(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntString(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntString(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntString(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntString(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntString(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntString(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntString(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntInt(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntInt(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntInt(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntInt(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntInt(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntInt(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntInt(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntInt(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntInt(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntFloat(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntFloat(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntFloat(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntFloat(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntFloat(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntFloat(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntFloat(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntFloat(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntFloat(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatString(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatString(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatString(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatString(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatString(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatString(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatString(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatString(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatString(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatInt(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatInt(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatInt(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatInt(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatInt(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatInt(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatInt(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatInt(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatInt(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatFloat(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatFloat(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatFloat(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatFloat(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatFloat(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatFloat(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatFloat(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatFloat(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatFloat(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (x, y) => if x != y { return false; }, + } + } + return true; +} + fn main() { let args = os::args(); let mut client = Client::new(FromStr::from_str(format!("{}:{}", args[1], args[2]).as_slice()).unwrap()).unwrap(); @@ -21,7 +158,7 @@ fn main() { let expected = NewHyperObject!("v", HashMap::, Vec>::new(),); match client.get("kv", "k") { Ok(obj) => { - if obj != expected { + if !sloppyCompareHyper(&obj, &expected) { panic!("expected: {:?} actual: {:?}", expected, obj); } @@ -50,7 +187,7 @@ m ,); match client.get("kv", "k") { Ok(obj) => { - if obj != expected { + if !sloppyCompareHyper(&obj, &expected) { panic!("expected: {:?} actual: {:?}", expected, obj); } @@ -65,7 +202,7 @@ actual: {:?}", expected, obj); let expected = NewHyperObject!("v", HashMap::, Vec>::new(),); match client.get("kv", "k") { Ok(obj) => { - if obj != expected { + if !sloppyCompareHyper(&obj, &expected) { panic!("expected: {:?} actual: {:?}", expected, obj); } diff --git a/test/rust/DataTypeSetFloat.rs b/test/rust/DataTypeSetFloat.rs index ca9dccb21..1cc0e8d99 100644 --- a/test/rust/DataTypeSetFloat.rs +++ b/test/rust/DataTypeSetFloat.rs @@ -6,10 +6,147 @@ use std::str::FromStr; use std::collections::BTreeSet; use std::collections::HashMap; use std::iter::FromIterator; +use std::mem::transmute; +use std::any::Any; use hyperdex::*; +use hyperdex::HyperValue::*; use hyperdex::HyperPredicateType::*; +macro_rules! sloppyCompare { + ($a: ident, $b: ident) => ( + if $a.len() == 0 && $b.len() == 0 { + true + } else { + if $a.get_type_id() != $b.get_type_id() { + false + } else { + unsafe { + transmute($a) == $b + } + } + } + ); +} + +fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { + for (ak, av) in a.map.iter() { + let bv = match b.map.get(ak) { + None => return false, + Some(x) => x, + }; + + let av = av.clone(); + let bv = bv.clone(); + + // this is dumb but I do not see a better way... fortunately the following lines are generated + // by a python script + match (av, bv) { + (HyperListString(x), HyperListString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperListString(x), HyperListInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperListString(x), HyperListFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperListInt(x), HyperListString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperListInt(x), HyperListInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperListInt(x), HyperListFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperListFloat(x), HyperListString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperListFloat(x), HyperListInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperListFloat(x), HyperListFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperSetString(x), HyperSetString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperSetString(x), HyperSetInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperSetString(x), HyperSetFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperSetInt(x), HyperSetString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperSetInt(x), HyperSetInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperSetInt(x), HyperSetFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperSetFloat(x), HyperSetString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperSetFloat(x), HyperSetInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperSetFloat(x), HyperSetFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringString(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringString(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringString(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringString(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringString(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringString(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringString(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringString(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringString(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringInt(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringInt(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringInt(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringInt(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringInt(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringInt(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringInt(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringInt(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringInt(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringFloat(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringFloat(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringFloat(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringFloat(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringFloat(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringFloat(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringFloat(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringFloat(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringFloat(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntString(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntString(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntString(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntString(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntString(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntString(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntString(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntString(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntString(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntInt(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntInt(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntInt(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntInt(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntInt(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntInt(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntInt(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntInt(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntInt(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntFloat(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntFloat(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntFloat(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntFloat(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntFloat(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntFloat(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntFloat(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntFloat(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntFloat(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatString(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatString(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatString(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatString(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatString(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatString(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatString(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatString(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatString(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatInt(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatInt(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatInt(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatInt(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatInt(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatInt(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatInt(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatInt(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatInt(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatFloat(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatFloat(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatFloat(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatFloat(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatFloat(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatFloat(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatFloat(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatFloat(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatFloat(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (x, y) => if x != y { return false; }, + } + } + return true; +} + fn main() { let args = os::args(); let mut client = Client::new(FromStr::from_str(format!("{}:{}", args[1], args[2]).as_slice()).unwrap()).unwrap(); @@ -21,7 +158,7 @@ fn main() { let expected = NewHyperObject!("v", BTreeSet::>::new(),); match client.get("kv", "k") { Ok(obj) => { - if obj != expected { + if !sloppyCompareHyper(&obj, &expected) { panic!("expected: {:?} actual: {:?}", expected, obj); } @@ -50,7 +187,7 @@ s ,); match client.get("kv", "k") { Ok(obj) => { - if obj != expected { + if !sloppyCompareHyper(&obj, &expected) { panic!("expected: {:?} actual: {:?}", expected, obj); } @@ -65,7 +202,7 @@ actual: {:?}", expected, obj); let expected = NewHyperObject!("v", BTreeSet::>::new(),); match client.get("kv", "k") { Ok(obj) => { - if obj != expected { + if !sloppyCompareHyper(&obj, &expected) { panic!("expected: {:?} actual: {:?}", expected, obj); } diff --git a/test/rust/DataTypeSetInt.rs b/test/rust/DataTypeSetInt.rs index 642407b7d..89cc3e07e 100644 --- a/test/rust/DataTypeSetInt.rs +++ b/test/rust/DataTypeSetInt.rs @@ -6,10 +6,147 @@ use std::str::FromStr; use std::collections::BTreeSet; use std::collections::HashMap; use std::iter::FromIterator; +use std::mem::transmute; +use std::any::Any; use hyperdex::*; +use hyperdex::HyperValue::*; use hyperdex::HyperPredicateType::*; +macro_rules! sloppyCompare { + ($a: ident, $b: ident) => ( + if $a.len() == 0 && $b.len() == 0 { + true + } else { + if $a.get_type_id() != $b.get_type_id() { + false + } else { + unsafe { + transmute($a) == $b + } + } + } + ); +} + +fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { + for (ak, av) in a.map.iter() { + let bv = match b.map.get(ak) { + None => return false, + Some(x) => x, + }; + + let av = av.clone(); + let bv = bv.clone(); + + // this is dumb but I do not see a better way... fortunately the following lines are generated + // by a python script + match (av, bv) { + (HyperListString(x), HyperListString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperListString(x), HyperListInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperListString(x), HyperListFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperListInt(x), HyperListString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperListInt(x), HyperListInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperListInt(x), HyperListFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperListFloat(x), HyperListString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperListFloat(x), HyperListInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperListFloat(x), HyperListFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperSetString(x), HyperSetString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperSetString(x), HyperSetInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperSetString(x), HyperSetFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperSetInt(x), HyperSetString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperSetInt(x), HyperSetInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperSetInt(x), HyperSetFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperSetFloat(x), HyperSetString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperSetFloat(x), HyperSetInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperSetFloat(x), HyperSetFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringString(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringString(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringString(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringString(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringString(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringString(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringString(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringString(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringString(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringInt(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringInt(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringInt(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringInt(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringInt(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringInt(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringInt(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringInt(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringInt(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringFloat(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringFloat(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringFloat(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringFloat(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringFloat(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringFloat(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringFloat(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringFloat(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringFloat(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntString(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntString(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntString(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntString(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntString(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntString(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntString(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntString(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntString(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntInt(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntInt(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntInt(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntInt(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntInt(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntInt(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntInt(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntInt(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntInt(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntFloat(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntFloat(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntFloat(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntFloat(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntFloat(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntFloat(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntFloat(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntFloat(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntFloat(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatString(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatString(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatString(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatString(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatString(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatString(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatString(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatString(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatString(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatInt(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatInt(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatInt(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatInt(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatInt(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatInt(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatInt(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatInt(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatInt(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatFloat(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatFloat(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatFloat(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatFloat(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatFloat(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatFloat(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatFloat(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatFloat(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatFloat(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (x, y) => if x != y { return false; }, + } + } + return true; +} + fn main() { let args = os::args(); let mut client = Client::new(FromStr::from_str(format!("{}:{}", args[1], args[2]).as_slice()).unwrap()).unwrap(); @@ -21,7 +158,7 @@ fn main() { let expected = NewHyperObject!("v", BTreeSet::>::new(),); match client.get("kv", "k") { Ok(obj) => { - if obj != expected { + if !sloppyCompareHyper(&obj, &expected) { panic!("expected: {:?} actual: {:?}", expected, obj); } @@ -50,7 +187,7 @@ s ,); match client.get("kv", "k") { Ok(obj) => { - if obj != expected { + if !sloppyCompareHyper(&obj, &expected) { panic!("expected: {:?} actual: {:?}", expected, obj); } @@ -65,7 +202,7 @@ actual: {:?}", expected, obj); let expected = NewHyperObject!("v", BTreeSet::>::new(),); match client.get("kv", "k") { Ok(obj) => { - if obj != expected { + if !sloppyCompareHyper(&obj, &expected) { panic!("expected: {:?} actual: {:?}", expected, obj); } diff --git a/test/rust/DataTypeSetString.rs b/test/rust/DataTypeSetString.rs index c3ce5e9f3..26a6e6816 100644 --- a/test/rust/DataTypeSetString.rs +++ b/test/rust/DataTypeSetString.rs @@ -6,10 +6,147 @@ use std::str::FromStr; use std::collections::BTreeSet; use std::collections::HashMap; use std::iter::FromIterator; +use std::mem::transmute; +use std::any::Any; use hyperdex::*; +use hyperdex::HyperValue::*; use hyperdex::HyperPredicateType::*; +macro_rules! sloppyCompare { + ($a: ident, $b: ident) => ( + if $a.len() == 0 && $b.len() == 0 { + true + } else { + if $a.get_type_id() != $b.get_type_id() { + false + } else { + unsafe { + transmute($a) == $b + } + } + } + ); +} + +fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { + for (ak, av) in a.map.iter() { + let bv = match b.map.get(ak) { + None => return false, + Some(x) => x, + }; + + let av = av.clone(); + let bv = bv.clone(); + + // this is dumb but I do not see a better way... fortunately the following lines are generated + // by a python script + match (av, bv) { + (HyperListString(x), HyperListString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperListString(x), HyperListInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperListString(x), HyperListFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperListInt(x), HyperListString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperListInt(x), HyperListInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperListInt(x), HyperListFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperListFloat(x), HyperListString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperListFloat(x), HyperListInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperListFloat(x), HyperListFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperSetString(x), HyperSetString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperSetString(x), HyperSetInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperSetString(x), HyperSetFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperSetInt(x), HyperSetString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperSetInt(x), HyperSetInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperSetInt(x), HyperSetFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperSetFloat(x), HyperSetString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperSetFloat(x), HyperSetInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperSetFloat(x), HyperSetFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringString(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringString(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringString(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringString(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringString(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringString(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringString(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringString(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringString(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringInt(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringInt(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringInt(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringInt(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringInt(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringInt(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringInt(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringInt(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringInt(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringFloat(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringFloat(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringFloat(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringFloat(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringFloat(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringFloat(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringFloat(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringFloat(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringFloat(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntString(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntString(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntString(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntString(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntString(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntString(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntString(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntString(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntString(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntInt(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntInt(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntInt(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntInt(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntInt(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntInt(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntInt(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntInt(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntInt(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntFloat(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntFloat(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntFloat(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntFloat(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntFloat(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntFloat(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntFloat(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntFloat(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntFloat(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatString(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatString(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatString(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatString(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatString(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatString(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatString(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatString(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatString(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatInt(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatInt(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatInt(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatInt(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatInt(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatInt(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatInt(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatInt(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatInt(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatFloat(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatFloat(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatFloat(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatFloat(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatFloat(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatFloat(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatFloat(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatFloat(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatFloat(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (x, y) => if x != y { return false; }, + } + } + return true; +} + fn main() { let args = os::args(); let mut client = Client::new(FromStr::from_str(format!("{}:{}", args[1], args[2]).as_slice()).unwrap()).unwrap(); @@ -21,7 +158,7 @@ fn main() { let expected = NewHyperObject!("v", BTreeSet::>::new(),); match client.get("kv", "k") { Ok(obj) => { - if obj != expected { + if !sloppyCompareHyper(&obj, &expected) { panic!("expected: {:?} actual: {:?}", expected, obj); } @@ -50,7 +187,7 @@ s ,); match client.get("kv", "k") { Ok(obj) => { - if obj != expected { + if !sloppyCompareHyper(&obj, &expected) { panic!("expected: {:?} actual: {:?}", expected, obj); } @@ -65,7 +202,7 @@ actual: {:?}", expected, obj); let expected = NewHyperObject!("v", BTreeSet::>::new(),); match client.get("kv", "k") { Ok(obj) => { - if obj != expected { + if !sloppyCompareHyper(&obj, &expected) { panic!("expected: {:?} actual: {:?}", expected, obj); } diff --git a/test/rust/DataTypeString.rs b/test/rust/DataTypeString.rs index 5e9651ff2..55ac80bbc 100644 --- a/test/rust/DataTypeString.rs +++ b/test/rust/DataTypeString.rs @@ -6,10 +6,147 @@ use std::str::FromStr; use std::collections::BTreeSet; use std::collections::HashMap; use std::iter::FromIterator; +use std::mem::transmute; +use std::any::Any; use hyperdex::*; +use hyperdex::HyperValue::*; use hyperdex::HyperPredicateType::*; +macro_rules! sloppyCompare { + ($a: ident, $b: ident) => ( + if $a.len() == 0 && $b.len() == 0 { + true + } else { + if $a.get_type_id() != $b.get_type_id() { + false + } else { + unsafe { + transmute($a) == $b + } + } + } + ); +} + +fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { + for (ak, av) in a.map.iter() { + let bv = match b.map.get(ak) { + None => return false, + Some(x) => x, + }; + + let av = av.clone(); + let bv = bv.clone(); + + // this is dumb but I do not see a better way... fortunately the following lines are generated + // by a python script + match (av, bv) { + (HyperListString(x), HyperListString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperListString(x), HyperListInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperListString(x), HyperListFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperListInt(x), HyperListString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperListInt(x), HyperListInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperListInt(x), HyperListFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperListFloat(x), HyperListString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperListFloat(x), HyperListInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperListFloat(x), HyperListFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperSetString(x), HyperSetString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperSetString(x), HyperSetInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperSetString(x), HyperSetFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperSetInt(x), HyperSetString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperSetInt(x), HyperSetInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperSetInt(x), HyperSetFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperSetFloat(x), HyperSetString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperSetFloat(x), HyperSetInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperSetFloat(x), HyperSetFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringString(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringString(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringString(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringString(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringString(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringString(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringString(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringString(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringString(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringInt(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringInt(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringInt(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringInt(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringInt(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringInt(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringInt(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringInt(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringInt(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringFloat(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringFloat(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringFloat(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringFloat(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringFloat(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringFloat(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringFloat(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringFloat(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringFloat(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntString(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntString(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntString(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntString(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntString(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntString(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntString(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntString(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntString(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntInt(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntInt(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntInt(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntInt(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntInt(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntInt(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntInt(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntInt(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntInt(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntFloat(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntFloat(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntFloat(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntFloat(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntFloat(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntFloat(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntFloat(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntFloat(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntFloat(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatString(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatString(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatString(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatString(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatString(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatString(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatString(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatString(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatString(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatInt(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatInt(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatInt(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatInt(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatInt(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatInt(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatInt(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatInt(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatInt(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatFloat(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatFloat(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatFloat(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatFloat(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatFloat(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatFloat(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatFloat(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatFloat(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatFloat(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (x, y) => if x != y { return false; }, + } + } + return true; +} + fn main() { let args = os::args(); let mut client = Client::new(FromStr::from_str(format!("{}:{}", args[1], args[2]).as_slice()).unwrap()).unwrap(); @@ -21,7 +158,7 @@ fn main() { let expected = NewHyperObject!("v", "",); match client.get("kv", "k") { Ok(obj) => { - if obj != expected { + if !sloppyCompareHyper(&obj, &expected) { panic!("expected: {:?} actual: {:?}", expected, obj); } @@ -36,7 +173,7 @@ actual: {:?}", expected, obj); let expected = NewHyperObject!("v", "xxx",); match client.get("kv", "k") { Ok(obj) => { - if obj != expected { + if !sloppyCompareHyper(&obj, &expected) { panic!("expected: {:?} actual: {:?}", expected, obj); } @@ -51,7 +188,7 @@ actual: {:?}", expected, obj); let expected = NewHyperObject!("v", "\xde\xad\xbe\xef",); match client.get("kv", "k") { Ok(obj) => { - if obj != expected { + if !sloppyCompareHyper(&obj, &expected) { panic!("expected: {:?} actual: {:?}", expected, obj); } diff --git a/test/rust/LengthString.rs b/test/rust/LengthString.rs index 3e34ed3de..ccea51f10 100644 --- a/test/rust/LengthString.rs +++ b/test/rust/LengthString.rs @@ -6,10 +6,147 @@ use std::str::FromStr; use std::collections::BTreeSet; use std::collections::HashMap; use std::iter::FromIterator; +use std::mem::transmute; +use std::any::Any; use hyperdex::*; +use hyperdex::HyperValue::*; use hyperdex::HyperPredicateType::*; +macro_rules! sloppyCompare { + ($a: ident, $b: ident) => ( + if $a.len() == 0 && $b.len() == 0 { + true + } else { + if $a.get_type_id() != $b.get_type_id() { + false + } else { + unsafe { + transmute($a) == $b + } + } + } + ); +} + +fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { + for (ak, av) in a.map.iter() { + let bv = match b.map.get(ak) { + None => return false, + Some(x) => x, + }; + + let av = av.clone(); + let bv = bv.clone(); + + // this is dumb but I do not see a better way... fortunately the following lines are generated + // by a python script + match (av, bv) { + (HyperListString(x), HyperListString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperListString(x), HyperListInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperListString(x), HyperListFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperListInt(x), HyperListString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperListInt(x), HyperListInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperListInt(x), HyperListFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperListFloat(x), HyperListString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperListFloat(x), HyperListInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperListFloat(x), HyperListFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperSetString(x), HyperSetString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperSetString(x), HyperSetInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperSetString(x), HyperSetFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperSetInt(x), HyperSetString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperSetInt(x), HyperSetInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperSetInt(x), HyperSetFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperSetFloat(x), HyperSetString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperSetFloat(x), HyperSetInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperSetFloat(x), HyperSetFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringString(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringString(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringString(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringString(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringString(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringString(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringString(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringString(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringString(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringInt(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringInt(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringInt(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringInt(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringInt(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringInt(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringInt(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringInt(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringInt(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringFloat(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringFloat(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringFloat(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringFloat(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringFloat(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringFloat(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringFloat(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringFloat(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringFloat(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntString(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntString(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntString(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntString(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntString(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntString(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntString(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntString(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntString(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntInt(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntInt(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntInt(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntInt(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntInt(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntInt(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntInt(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntInt(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntInt(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntFloat(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntFloat(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntFloat(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntFloat(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntFloat(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntFloat(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntFloat(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntFloat(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntFloat(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatString(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatString(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatString(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatString(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatString(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatString(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatString(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatString(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatString(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatInt(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatInt(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatInt(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatInt(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatInt(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatInt(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatInt(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatInt(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatInt(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatFloat(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatFloat(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatFloat(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatFloat(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatFloat(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatFloat(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatFloat(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatFloat(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatFloat(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (x, y) => if x != y { return false; }, + } + } + return true; +} + fn main() { let args = os::args(); let mut client = Client::new(FromStr::from_str(format!("{}:{}", args[1], args[2]).as_slice()).unwrap()).unwrap(); diff --git a/test/rust/MultiAttribute.rs b/test/rust/MultiAttribute.rs index 89fe6640b..9ee81c506 100644 --- a/test/rust/MultiAttribute.rs +++ b/test/rust/MultiAttribute.rs @@ -6,10 +6,147 @@ use std::str::FromStr; use std::collections::BTreeSet; use std::collections::HashMap; use std::iter::FromIterator; +use std::mem::transmute; +use std::any::Any; use hyperdex::*; +use hyperdex::HyperValue::*; use hyperdex::HyperPredicateType::*; +macro_rules! sloppyCompare { + ($a: ident, $b: ident) => ( + if $a.len() == 0 && $b.len() == 0 { + true + } else { + if $a.get_type_id() != $b.get_type_id() { + false + } else { + unsafe { + transmute($a) == $b + } + } + } + ); +} + +fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { + for (ak, av) in a.map.iter() { + let bv = match b.map.get(ak) { + None => return false, + Some(x) => x, + }; + + let av = av.clone(); + let bv = bv.clone(); + + // this is dumb but I do not see a better way... fortunately the following lines are generated + // by a python script + match (av, bv) { + (HyperListString(x), HyperListString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperListString(x), HyperListInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperListString(x), HyperListFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperListInt(x), HyperListString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperListInt(x), HyperListInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperListInt(x), HyperListFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperListFloat(x), HyperListString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperListFloat(x), HyperListInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperListFloat(x), HyperListFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperSetString(x), HyperSetString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperSetString(x), HyperSetInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperSetString(x), HyperSetFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperSetInt(x), HyperSetString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperSetInt(x), HyperSetInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperSetInt(x), HyperSetFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperSetFloat(x), HyperSetString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperSetFloat(x), HyperSetInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperSetFloat(x), HyperSetFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringString(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringString(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringString(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringString(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringString(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringString(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringString(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringString(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringString(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringInt(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringInt(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringInt(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringInt(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringInt(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringInt(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringInt(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringInt(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringInt(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringFloat(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringFloat(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringFloat(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringFloat(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringFloat(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringFloat(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringFloat(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringFloat(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringFloat(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntString(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntString(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntString(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntString(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntString(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntString(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntString(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntString(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntString(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntInt(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntInt(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntInt(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntInt(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntInt(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntInt(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntInt(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntInt(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntInt(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntFloat(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntFloat(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntFloat(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntFloat(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntFloat(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntFloat(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntFloat(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntFloat(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntFloat(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatString(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatString(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatString(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatString(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatString(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatString(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatString(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatString(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatString(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatInt(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatInt(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatInt(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatInt(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatInt(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatInt(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatInt(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatInt(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatInt(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatFloat(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatFloat(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatFloat(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatFloat(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatFloat(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatFloat(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatFloat(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatFloat(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatFloat(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (x, y) => if x != y { return false; }, + } + } + return true; +} + fn main() { let args = os::args(); let mut client = Client::new(FromStr::from_str(format!("{}:{}", args[1], args[2]).as_slice()).unwrap()).unwrap(); @@ -28,7 +165,7 @@ fn main() { let expected = NewHyperObject!("v1", "ABC", "v2", "",); match client.get("kv", "k") { Ok(obj) => { - if obj != expected { + if !sloppyCompareHyper(&obj, &expected) { panic!("expected: {:?} actual: {:?}", expected, obj); } @@ -43,7 +180,7 @@ actual: {:?}", expected, obj); let expected = NewHyperObject!("v1", "ABC", "v2", "123",); match client.get("kv", "k") { Ok(obj) => { - if obj != expected { + if !sloppyCompareHyper(&obj, &expected) { panic!("expected: {:?} actual: {:?}", expected, obj); } @@ -53,7 +190,7 @@ actual: {:?}", expected, obj); let expected = NewHyperObject!("v1", "ABC",); match client.get_partial("kv", "k", vec!("v1")) { Ok(obj) => { - if obj != expected { + if !sloppyCompareHyper(&obj, &expected) { panic!("expected: {:?} actual: {:?}", expected, obj); } diff --git a/test/rust/RangeSearchInt.rs b/test/rust/RangeSearchInt.rs index ff12bfa2d..92bfa75e4 100644 --- a/test/rust/RangeSearchInt.rs +++ b/test/rust/RangeSearchInt.rs @@ -6,10 +6,147 @@ use std::str::FromStr; use std::collections::BTreeSet; use std::collections::HashMap; use std::iter::FromIterator; +use std::mem::transmute; +use std::any::Any; use hyperdex::*; +use hyperdex::HyperValue::*; use hyperdex::HyperPredicateType::*; +macro_rules! sloppyCompare { + ($a: ident, $b: ident) => ( + if $a.len() == 0 && $b.len() == 0 { + true + } else { + if $a.get_type_id() != $b.get_type_id() { + false + } else { + unsafe { + transmute($a) == $b + } + } + } + ); +} + +fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { + for (ak, av) in a.map.iter() { + let bv = match b.map.get(ak) { + None => return false, + Some(x) => x, + }; + + let av = av.clone(); + let bv = bv.clone(); + + // this is dumb but I do not see a better way... fortunately the following lines are generated + // by a python script + match (av, bv) { + (HyperListString(x), HyperListString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperListString(x), HyperListInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperListString(x), HyperListFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperListInt(x), HyperListString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperListInt(x), HyperListInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperListInt(x), HyperListFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperListFloat(x), HyperListString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperListFloat(x), HyperListInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperListFloat(x), HyperListFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperSetString(x), HyperSetString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperSetString(x), HyperSetInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperSetString(x), HyperSetFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperSetInt(x), HyperSetString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperSetInt(x), HyperSetInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperSetInt(x), HyperSetFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperSetFloat(x), HyperSetString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperSetFloat(x), HyperSetInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperSetFloat(x), HyperSetFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringString(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringString(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringString(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringString(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringString(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringString(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringString(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringString(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringString(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringInt(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringInt(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringInt(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringInt(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringInt(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringInt(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringInt(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringInt(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringInt(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringFloat(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringFloat(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringFloat(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringFloat(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringFloat(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringFloat(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringFloat(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringFloat(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringFloat(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntString(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntString(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntString(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntString(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntString(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntString(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntString(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntString(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntString(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntInt(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntInt(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntInt(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntInt(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntInt(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntInt(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntInt(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntInt(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntInt(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntFloat(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntFloat(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntFloat(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntFloat(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntFloat(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntFloat(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntFloat(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntFloat(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntFloat(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatString(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatString(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatString(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatString(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatString(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatString(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatString(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatString(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatString(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatInt(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatInt(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatInt(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatInt(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatInt(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatInt(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatInt(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatInt(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatInt(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatFloat(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatFloat(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatFloat(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatFloat(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatFloat(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatFloat(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatFloat(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatFloat(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatFloat(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (x, y) => if x != y { return false; }, + } + } + return true; +} + fn main() { let args = os::args(); let mut client = Client::new(FromStr::from_str(format!("{}:{}", args[1], args[2]).as_slice()).unwrap()).unwrap(); diff --git a/test/rust/RangeSearchString.rs b/test/rust/RangeSearchString.rs index c27c16086..0a02a415b 100644 --- a/test/rust/RangeSearchString.rs +++ b/test/rust/RangeSearchString.rs @@ -6,10 +6,147 @@ use std::str::FromStr; use std::collections::BTreeSet; use std::collections::HashMap; use std::iter::FromIterator; +use std::mem::transmute; +use std::any::Any; use hyperdex::*; +use hyperdex::HyperValue::*; use hyperdex::HyperPredicateType::*; +macro_rules! sloppyCompare { + ($a: ident, $b: ident) => ( + if $a.len() == 0 && $b.len() == 0 { + true + } else { + if $a.get_type_id() != $b.get_type_id() { + false + } else { + unsafe { + transmute($a) == $b + } + } + } + ); +} + +fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { + for (ak, av) in a.map.iter() { + let bv = match b.map.get(ak) { + None => return false, + Some(x) => x, + }; + + let av = av.clone(); + let bv = bv.clone(); + + // this is dumb but I do not see a better way... fortunately the following lines are generated + // by a python script + match (av, bv) { + (HyperListString(x), HyperListString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperListString(x), HyperListInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperListString(x), HyperListFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperListInt(x), HyperListString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperListInt(x), HyperListInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperListInt(x), HyperListFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperListFloat(x), HyperListString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperListFloat(x), HyperListInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperListFloat(x), HyperListFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperSetString(x), HyperSetString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperSetString(x), HyperSetInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperSetString(x), HyperSetFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperSetInt(x), HyperSetString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperSetInt(x), HyperSetInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperSetInt(x), HyperSetFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperSetFloat(x), HyperSetString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperSetFloat(x), HyperSetInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperSetFloat(x), HyperSetFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringString(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringString(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringString(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringString(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringString(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringString(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringString(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringString(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringString(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringInt(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringInt(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringInt(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringInt(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringInt(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringInt(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringInt(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringInt(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringInt(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringFloat(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringFloat(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringFloat(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringFloat(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringFloat(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringFloat(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringFloat(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringFloat(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringFloat(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntString(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntString(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntString(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntString(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntString(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntString(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntString(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntString(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntString(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntInt(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntInt(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntInt(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntInt(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntInt(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntInt(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntInt(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntInt(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntInt(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntFloat(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntFloat(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntFloat(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntFloat(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntFloat(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntFloat(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntFloat(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntFloat(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntFloat(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatString(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatString(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatString(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatString(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatString(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatString(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatString(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatString(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatString(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatInt(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatInt(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatInt(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatInt(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatInt(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatInt(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatInt(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatInt(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatInt(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatFloat(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatFloat(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatFloat(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatFloat(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatFloat(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatFloat(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatFloat(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatFloat(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatFloat(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (x, y) => if x != y { return false; }, + } + } + return true; +} + fn main() { let args = os::args(); let mut client = Client::new(FromStr::from_str(format!("{}:{}", args[1], args[2]).as_slice()).unwrap()).unwrap(); diff --git a/test/rust/RegexSearch.rs b/test/rust/RegexSearch.rs index b761c6c5b..5348b25cc 100644 --- a/test/rust/RegexSearch.rs +++ b/test/rust/RegexSearch.rs @@ -6,10 +6,147 @@ use std::str::FromStr; use std::collections::BTreeSet; use std::collections::HashMap; use std::iter::FromIterator; +use std::mem::transmute; +use std::any::Any; use hyperdex::*; +use hyperdex::HyperValue::*; use hyperdex::HyperPredicateType::*; +macro_rules! sloppyCompare { + ($a: ident, $b: ident) => ( + if $a.len() == 0 && $b.len() == 0 { + true + } else { + if $a.get_type_id() != $b.get_type_id() { + false + } else { + unsafe { + transmute($a) == $b + } + } + } + ); +} + +fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { + for (ak, av) in a.map.iter() { + let bv = match b.map.get(ak) { + None => return false, + Some(x) => x, + }; + + let av = av.clone(); + let bv = bv.clone(); + + // this is dumb but I do not see a better way... fortunately the following lines are generated + // by a python script + match (av, bv) { + (HyperListString(x), HyperListString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperListString(x), HyperListInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperListString(x), HyperListFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperListInt(x), HyperListString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperListInt(x), HyperListInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperListInt(x), HyperListFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperListFloat(x), HyperListString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperListFloat(x), HyperListInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperListFloat(x), HyperListFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperSetString(x), HyperSetString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperSetString(x), HyperSetInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperSetString(x), HyperSetFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperSetInt(x), HyperSetString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperSetInt(x), HyperSetInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperSetInt(x), HyperSetFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperSetFloat(x), HyperSetString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperSetFloat(x), HyperSetInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperSetFloat(x), HyperSetFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringString(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringString(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringString(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringString(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringString(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringString(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringString(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringString(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringString(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringInt(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringInt(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringInt(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringInt(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringInt(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringInt(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringInt(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringInt(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringInt(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringFloat(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringFloat(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringFloat(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringFloat(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringFloat(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringFloat(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringFloat(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringFloat(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapStringFloat(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntString(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntString(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntString(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntString(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntString(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntString(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntString(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntString(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntString(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntInt(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntInt(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntInt(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntInt(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntInt(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntInt(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntInt(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntInt(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntInt(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntFloat(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntFloat(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntFloat(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntFloat(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntFloat(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntFloat(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntFloat(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntFloat(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapIntFloat(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatString(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatString(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatString(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatString(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatString(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatString(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatString(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatString(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatString(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatInt(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatInt(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatInt(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatInt(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatInt(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatInt(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatInt(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatInt(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatInt(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatFloat(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatFloat(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatFloat(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatFloat(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatFloat(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatFloat(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatFloat(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatFloat(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, + (HyperMapFloatFloat(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, + (x, y) => if x != y { return false; }, + } + } + return true; +} + fn main() { let args = os::args(); let mut client = Client::new(FromStr::from_str(format!("{}:{}", args[1], args[2]).as_slice()).unwrap()).unwrap(); From 91cf827dbddafbc2d59131a21806b15e7b9cf332 Mon Sep 17 00:00:00 2001 From: Derek Chiang Date: Mon, 2 Mar 2015 04:31:18 -0500 Subject: [PATCH 5/7] Add rust tests --- Makefile.am | 45 ++++++------- maint/generate-bindings-tests.py | 8 +-- test/rust/Basic.rs | 24 +++---- test/rust/BasicSearch.rs | 16 ++--- test/rust/CondPut.rs | 20 +++--- test/rust/DataTypeFloat.rs | 12 ++-- test/rust/DataTypeInt.rs | 36 +++++----- test/rust/DataTypeListFloat.rs | 18 ++--- test/rust/DataTypeListInt.rs | 18 ++--- test/rust/DataTypeListString.rs | 18 ++--- test/rust/DataTypeMapFloatFloat.rs | 18 ++--- test/rust/DataTypeMapFloatInt.rs | 18 ++--- test/rust/DataTypeMapFloatString.rs | 30 ++++----- test/rust/DataTypeMapIntFloat.rs | 18 ++--- test/rust/DataTypeMapIntInt.rs | 18 ++--- test/rust/DataTypeMapIntString.rs | 30 ++++----- test/rust/DataTypeMapStringFloat.rs | 30 ++++----- test/rust/DataTypeMapStringInt.rs | 30 ++++----- test/rust/DataTypeMapStringString.rs | 30 ++++----- test/rust/DataTypeSetFloat.rs | 30 ++++----- test/rust/DataTypeSetInt.rs | 18 ++--- test/rust/DataTypeSetString.rs | 30 ++++----- test/rust/DataTypeString.rs | 18 ++--- test/rust/LengthString.rs | 38 +++++------ test/rust/MultiAttribute.rs | 18 ++--- test/rust/RangeSearchInt.rs | 50 +++++++------- test/rust/RangeSearchString.rs | 50 +++++++------- test/rust/RegexSearch.rs | 66 +++++++++---------- test/sh/bindings.rust.Basic.sh | 2 +- test/sh/bindings.rust.BasicSearch.sh | 2 +- test/sh/bindings.rust.CondPut.sh | 2 +- test/sh/bindings.rust.DataTypeFloat.sh | 2 +- test/sh/bindings.rust.DataTypeInt.sh | 2 +- test/sh/bindings.rust.DataTypeListFloat.sh | 2 +- test/sh/bindings.rust.DataTypeListInt.sh | 2 +- test/sh/bindings.rust.DataTypeListString.sh | 2 +- .../sh/bindings.rust.DataTypeMapFloatFloat.sh | 2 +- test/sh/bindings.rust.DataTypeMapFloatInt.sh | 2 +- .../bindings.rust.DataTypeMapFloatString.sh | 2 +- test/sh/bindings.rust.DataTypeMapIntFloat.sh | 2 +- test/sh/bindings.rust.DataTypeMapIntInt.sh | 2 +- test/sh/bindings.rust.DataTypeMapIntString.sh | 2 +- .../bindings.rust.DataTypeMapStringFloat.sh | 2 +- test/sh/bindings.rust.DataTypeMapStringInt.sh | 2 +- .../bindings.rust.DataTypeMapStringString.sh | 2 +- test/sh/bindings.rust.DataTypeSetFloat.sh | 2 +- test/sh/bindings.rust.DataTypeSetInt.sh | 2 +- test/sh/bindings.rust.DataTypeSetString.sh | 2 +- test/sh/bindings.rust.DataTypeString.sh | 2 +- test/sh/bindings.rust.LengthString.sh | 2 +- test/sh/bindings.rust.MultiAttribute.sh | 2 +- test/sh/bindings.rust.RangeSearchInt.sh | 2 +- test/sh/bindings.rust.RangeSearchString.sh | 2 +- test/sh/bindings.rust.RegexSearch.sh | 2 +- 54 files changed, 404 insertions(+), 403 deletions(-) diff --git a/Makefile.am b/Makefile.am index 544c9927e..4b8263f5a 100644 --- a/Makefile.am +++ b/Makefile.am @@ -298,12 +298,12 @@ hyperdex_daemon_SOURCES += daemon/state_transfer_manager_transfer_in_state.cc hyperdex_daemon_SOURCES += daemon/state_transfer_manager_transfer_out_state.cc hyperdex_daemon_CXXFLAGS = $(AM_CXXFLAGS) $(CXXFLAGS) hyperdex_daemon_LDADD = -hyperdex_daemon_LDADD += $(TREADSTONE_LIBS) hyperdex_daemon_LDADD += $(MACAROONS_LIBS) hyperdex_daemon_LDADD += $(REPLICANT_LIBS) hyperdex_daemon_LDADD += $(HYPERLEVELDB_LIBS) hyperdex_daemon_LDADD += $(BUSYBEE_LIBS) hyperdex_daemon_LDADD += $(E_LIBS) +hyperdex_daemon_LDADD += $(TREADSTONE_LIBS) hyperdex_daemon_LDADD += -lpopt -lglog $(LRT_LDFLAGS) -lpthread man/hyperdex-daemon.1: man/hyperdex-daemon.1.h2m daemon/main.cc | hyperdex-daemon$(EXEEXT) $(help2man_verbose)help2man $(HELP2MAN_FLAGS) --section 1 --output $@ --include $< ${abs_top_builddir}/hyperdex-daemon$(EXEEXT) @@ -453,11 +453,11 @@ libhyperdex_client_la_SOURCES += client/pending_search_describe.cc libhyperdex_client_la_SOURCES += client/pending_sorted_search.cc libhyperdex_client_la_SOURCES += client/util.cc libhyperdex_client_la_LIBADD = -libhyperdex_client_la_LIBADD += $(TREADSTONE_LIBS) libhyperdex_client_la_LIBADD += $(MACAROONS_LIBS) libhyperdex_client_la_LIBADD += $(REPLICANT_LIBS) libhyperdex_client_la_LIBADD += $(BUSYBEE_LIBS) libhyperdex_client_la_LIBADD += $(E_LIBS) +libhyperdex_client_la_LIBADD += $(TREADSTONE_LIBS) client/keyop_info.cc: client/keyop_info.gperf client/keyop_info.h $(gperf_verbose)gperf -m 100 $(abs_top_srcdir)/client/keyop_info.gperf --output-file=$(abs_top_builddir)/client/keyop_info.cc @@ -549,11 +549,11 @@ libhyperdex_admin_la_SOURCES += admin/pending_string.cc libhyperdex_admin_la_SOURCES += admin/raw_backup.cc libhyperdex_admin_la_SOURCES += admin/yieldable.cc libhyperdex_admin_la_LIBADD = -libhyperdex_admin_la_LIBADD += $(TREADSTONE_LIBS) libhyperdex_admin_la_LIBADD += $(MACAROONS_LIBS) libhyperdex_admin_la_LIBADD += $(REPLICANT_LIBS) libhyperdex_admin_la_LIBADD += $(BUSYBEE_LIBS) libhyperdex_admin_la_LIBADD += $(E_LIBS) +libhyperdex_admin_la_LIBADD += $(TREADSTONE_LIBS) ################################################################################ ################################### Bindings ################################### @@ -844,11 +844,11 @@ stress_wrappers += test/sh/search.combination.keytype=string,daemons=4.fault-tol shell_wrappers += $(stress_wrappers) python_wrappers = -python_wrappers += test/sh/bindings.python.Admin.sh +#python_wrappers += test/sh/bindings.python.Admin.sh python_wrappers += test/sh/bindings.python.BasicSearch.sh python_wrappers += test/sh/bindings.python.Basic.sh python_wrappers += test/sh/bindings.python.CondPut.sh -python_wrappers += test/sh/bindings.python.DataTypeDocument.sh +#python_wrappers += test/sh/bindings.python.DataTypeDocument.sh python_wrappers += test/sh/bindings.python.DataTypeFloat.sh python_wrappers += test/sh/bindings.python.DataTypeInt.sh python_wrappers += test/sh/bindings.python.DataTypeListFloat.sh @@ -1421,21 +1421,23 @@ EXTRA_DIST += $(wildcard doc/*/*/*/*.tex) EXTRA_DIST += $(wildcard doc/*/*/*/*/*.tex) EXTRA_DIST += doc/Makefile EXTRA_DIST += doc/latex.py -EXTRA_DIST += doc/c/client/hello-world.c -EXTRA_DIST += doc/c/client/iterate.c -EXTRA_DIST += doc/go/client/hello-world.go -EXTRA_DIST += doc/java/client/HelloWorldAsyncLoop.java -EXTRA_DIST += doc/java/client/HelloWorldAsyncWait.java -EXTRA_DIST += doc/java/client/HelloWorld.java -EXTRA_DIST += doc/node.js/client/hello-world.js -EXTRA_DIST += doc/node.js/client/window-pattern.js -EXTRA_DIST += doc/python/client/hello-world-async-loop.py -EXTRA_DIST += doc/python/client/hello-world-async-wait.py -EXTRA_DIST += doc/python/client/hello-world.py -EXTRA_DIST += doc/ruby/client/hello-world-async-loop.rb -EXTRA_DIST += doc/ruby/client/hello-world-async-wait.rb -EXTRA_DIST += doc/ruby/client/hello-world.rb -EXTRA_DIST += $(wildcard doc/install/*) +EXTRA_DIST += doc/api/c/hello-world.c +EXTRA_DIST += doc/api/c/iterate.c +EXTRA_DIST += doc/api/java/HelloWorldAsyncLoop.java +EXTRA_DIST += doc/api/java/HelloWorldAsyncWait.java +EXTRA_DIST += doc/api/java/HelloWorld.java +EXTRA_DIST += doc/api/node.js/hello-world.js +EXTRA_DIST += doc/api/node.js/window-pattern.js +EXTRA_DIST += doc/api/ruby/hello-world-async-loop.rb +EXTRA_DIST += doc/api/ruby/hello-world-async-wait.rb +EXTRA_DIST += doc/api/ruby/hello-world.rb +EXTRA_DIST += doc/install/centos-packages.sh +EXTRA_DIST += doc/install/debian7-packages.sh +EXTRA_DIST += doc/install/fedora-packages.sh +EXTRA_DIST += doc/install/linux-amd64.sh +EXTRA_DIST += doc/install/ubuntu12.04-packages.sh +EXTRA_DIST += doc/install/ubuntu14.04-packages.sh +EXTRA_DIST += doc/install/ubuntu14.10-packages.sh ################################################################################ ################################## Maintenance ################################# @@ -1451,13 +1453,13 @@ EXTRA_DIST += maint/generate-doc-shell-stubs.py EXTRA_DIST += maint/generate-replication-shell-stubs.py EXTRA_DIST += maint/generate-search-shell-stubs.py EXTRA_DIST += maint/generate-test-packages.py +EXTRA_DIST += doc/maint/generate-api-descriptions.py maint_lib_check_SOURCES = maint/lib-check.c maint_lib_check_LDADD = -ldl maintainer-generate: python2 bindings/c.py - python2 bindings/go.py python2 bindings/java.py python2 bindings/nodejs.py python2 bindings/python.py @@ -1472,4 +1474,3 @@ maintainer-generate: python2 test/doc-extract.py python doc/atomic-ops.tex test/doc.atomic-ops.py python2 test/doc-extract.py python doc/documents.tex test/doc.documents.py python2 test/doc-extract.py python doc/authorization.tex test/doc.authorization.py - python2 test/doc-extract.py python doc/mongo.tex test/doc.mongo.py diff --git a/maint/generate-bindings-tests.py b/maint/generate-bindings-tests.py index 00853f9aa..184339826 100644 --- a/maint/generate-bindings-tests.py +++ b/maint/generate-bindings-tests.py @@ -773,7 +773,7 @@ def test(self, name, space): assert self.f is None self.count = 0 self.path = 'test/rust/{0}.rs'.format(name) - precmd = 'rustc -L {1} -o "${{HYPERDEX_BUILDDIR}}"/test/rust/{0} "${{HYPERDEX_SRCDIR}}"/test/rust/{0}.rs'.format(name, self.lib_dir + '/target') + precmd = 'rustc -g -L {1} -o "${{HYPERDEX_BUILDDIR}}"/test/rust/{0} "${{HYPERDEX_SRCDIR}}"/test/rust/{0}.rs'.format(name, self.lib_dir + '/target') cmd = '"${{HYPERDEX_BUILDDIR}}"/test/rust/{0}'.format(name) gen_shell('rust', name, cmd, space, precmd=precmd) self.f = open(self.path, 'w') @@ -1027,7 +1027,7 @@ def search(self, space, pred, expected): self.f.write(''' let res = client.search({0}, {1}); let elems: Vec> = res.iter().collect(); - assert!(elems.len() == {2}.len()); + assert_eq!(elems.len(), {2}.len()); '''.format(self.to_rust(space), self.to_preds(pred), self.to_rust(expected))) def to_preds(self, preds): @@ -1073,7 +1073,7 @@ def to_rust(self, x, inner=False): elif x is None: return 'None' elif isinstance(x, str): - return double_quote(x) + return 'r'+double_quote(x) elif isinstance(x, long) or isinstance(x, int): return '%s as i64' % str(x) elif isinstance(x, float): @@ -1094,7 +1094,7 @@ def to_rust(self, x, inner=False): s = '{\n' s += 'let mut s = BTreeSet::new();\n' for v in x: - s += 's.insert({0});\n'.format(self.to_rust(v)) + s += 's.insert({0});\n'.format(self.to_rust(v, inner=True)) s += 's\n}\n' return s else: diff --git a/test/rust/Basic.rs b/test/rust/Basic.rs index 6c6021749..f0cf5d287 100644 --- a/test/rust/Basic.rs +++ b/test/rust/Basic.rs @@ -151,19 +151,19 @@ fn main() { let args = os::args(); let mut client = Client::new(FromStr::from_str(format!("{}:{}", args[1], args[2]).as_slice()).unwrap()).unwrap(); - match client.get("kv", "k") { + match client.get(r"kv", r"k") { Ok(obj) => { panic!("this object should not be found!"); }, Err(err) => (), } - match client.put("kv", "k", NewHyperObject!("v", "v1",)) { + match client.put(r"kv", r"k", NewHyperObject!(r"v", r"v1",)) { Ok(()) => (), Err(err) => panic!(err), } - let expected = NewHyperObject!("v", "v1",); - match client.get("kv", "k") { + let expected = NewHyperObject!(r"v", r"v1",); + match client.get(r"kv", r"k") { Ok(obj) => { if !sloppyCompareHyper(&obj, &expected) { panic!("expected: {:?} @@ -173,12 +173,12 @@ actual: {:?}", expected, obj); Err(err) => panic!(err), } - match client.put("kv", "k", NewHyperObject!("v", "v2",)) { + match client.put(r"kv", r"k", NewHyperObject!(r"v", r"v2",)) { Ok(()) => (), Err(err) => panic!(err), } - let expected = NewHyperObject!("v", "v2",); - match client.get("kv", "k") { + let expected = NewHyperObject!(r"v", r"v2",); + match client.get(r"kv", r"k") { Ok(obj) => { if !sloppyCompareHyper(&obj, &expected) { panic!("expected: {:?} @@ -188,12 +188,12 @@ actual: {:?}", expected, obj); Err(err) => panic!(err), } - match client.put("kv", "k", NewHyperObject!("v", "v3",)) { + match client.put(r"kv", r"k", NewHyperObject!(r"v", r"v3",)) { Ok(()) => (), Err(err) => panic!(err), } - let expected = NewHyperObject!("v", "v3",); - match client.get("kv", "k") { + let expected = NewHyperObject!(r"v", r"v3",); + match client.get(r"kv", r"k") { Ok(obj) => { if !sloppyCompareHyper(&obj, &expected) { panic!("expected: {:?} @@ -203,12 +203,12 @@ actual: {:?}", expected, obj); Err(err) => panic!(err), } - match client.del("kv", "k") { + match client.del(r"kv", r"k") { Ok(()) => (), Err(err) => panic!(err), } - match client.get("kv", "k") { + match client.get(r"kv", r"k") { Ok(obj) => { panic!("this object should not be found!"); }, diff --git a/test/rust/BasicSearch.rs b/test/rust/BasicSearch.rs index 3f890b49f..f15fa9c99 100644 --- a/test/rust/BasicSearch.rs +++ b/test/rust/BasicSearch.rs @@ -151,25 +151,25 @@ fn main() { let args = os::args(); let mut client = Client::new(FromStr::from_str(format!("{}:{}", args[1], args[2]).as_slice()).unwrap()).unwrap(); - let res = client.search("kv", vec!(HyperPredicate::new("v", EQUALS, "v1"))); + let res = client.search(r"kv", vec!(HyperPredicate::new(r"v", EQUALS, r"v1"))); let elems: Vec> = res.iter().collect(); - assert!(elems.len() == BTreeSet::>::new().len()); + assert_eq!(elems.len(), BTreeSet::>::new().len()); - match client.put("kv", "k1", NewHyperObject!("v", "v1",)) { + match client.put(r"kv", r"k1", NewHyperObject!(r"v", r"v1",)) { Ok(()) => (), Err(err) => panic!(err), } - let res = client.search("kv", vec!(HyperPredicate::new("v", EQUALS, "v1"))); + let res = client.search(r"kv", vec!(HyperPredicate::new(r"v", EQUALS, r"v1"))); let elems: Vec> = res.iter().collect(); - assert!(elems.len() == vec!(NewHyperObject!("k", "k1", "v", "v1",)).len()); + assert_eq!(elems.len(), vec!(NewHyperObject!(r"k", r"k1", r"v", r"v1",)).len()); - match client.put("kv", "k2", NewHyperObject!("v", "v1",)) { + match client.put(r"kv", r"k2", NewHyperObject!(r"v", r"v1",)) { Ok(()) => (), Err(err) => panic!(err), } - let res = client.search("kv", vec!(HyperPredicate::new("v", EQUALS, "v1"))); + let res = client.search(r"kv", vec!(HyperPredicate::new(r"v", EQUALS, r"v1"))); let elems: Vec> = res.iter().collect(); - assert!(elems.len() == vec!(NewHyperObject!("k", "k1", "v", "v1",), NewHyperObject!("k", "k2", "v", "v1",)).len()); + assert_eq!(elems.len(), vec!(NewHyperObject!(r"k", r"k1", r"v", r"v1",), NewHyperObject!(r"k", r"k2", r"v", r"v1",)).len()); } diff --git a/test/rust/CondPut.rs b/test/rust/CondPut.rs index 7bd481255..77d3d843c 100644 --- a/test/rust/CondPut.rs +++ b/test/rust/CondPut.rs @@ -151,19 +151,19 @@ fn main() { let args = os::args(); let mut client = Client::new(FromStr::from_str(format!("{}:{}", args[1], args[2]).as_slice()).unwrap()).unwrap(); - match client.get("kv", "k") { + match client.get(r"kv", r"k") { Ok(obj) => { panic!("this object should not be found!"); }, Err(err) => (), } - match client.put("kv", "k", NewHyperObject!("v", "v1",)) { + match client.put(r"kv", r"k", NewHyperObject!(r"v", r"v1",)) { Ok(()) => (), Err(err) => panic!(err), } - let expected = NewHyperObject!("v", "v1",); - match client.get("kv", "k") { + let expected = NewHyperObject!(r"v", r"v1",); + match client.get(r"kv", r"k") { Ok(obj) => { if !sloppyCompareHyper(&obj, &expected) { panic!("expected: {:?} @@ -173,12 +173,12 @@ actual: {:?}", expected, obj); Err(err) => panic!(err), } - match client.cond_put("kv", "k", vec!(HyperPredicate::new("v", EQUALS, "v2")), NewHyperObject!("v", "v3",)) { + match client.cond_put(r"kv", r"k", vec!(HyperPredicate::new(r"v", EQUALS, r"v2")), NewHyperObject!(r"v", r"v3",)) { Ok(()) => panic!("this CONDPUT operation should have failed"), Err(err) => (), } - let expected = NewHyperObject!("v", "v1",); - match client.get("kv", "k") { + let expected = NewHyperObject!(r"v", r"v1",); + match client.get(r"kv", r"k") { Ok(obj) => { if !sloppyCompareHyper(&obj, &expected) { panic!("expected: {:?} @@ -188,12 +188,12 @@ actual: {:?}", expected, obj); Err(err) => panic!(err), } - match client.cond_put("kv", "k", vec!(HyperPredicate::new("v", EQUALS, "v1")), NewHyperObject!("v", "v3",)) { + match client.cond_put(r"kv", r"k", vec!(HyperPredicate::new(r"v", EQUALS, r"v1")), NewHyperObject!(r"v", r"v3",)) { Ok(()) => (), Err(err) => panic!(err), } - let expected = NewHyperObject!("v", "v3",); - match client.get("kv", "k") { + let expected = NewHyperObject!(r"v", r"v3",); + match client.get(r"kv", r"k") { Ok(obj) => { if !sloppyCompareHyper(&obj, &expected) { panic!("expected: {:?} diff --git a/test/rust/DataTypeFloat.rs b/test/rust/DataTypeFloat.rs index 6c08e23bd..2ae793dfd 100644 --- a/test/rust/DataTypeFloat.rs +++ b/test/rust/DataTypeFloat.rs @@ -151,12 +151,12 @@ fn main() { let args = os::args(); let mut client = Client::new(FromStr::from_str(format!("{}:{}", args[1], args[2]).as_slice()).unwrap()).unwrap(); - match client.put("kv", "k", HyperObject::new()) { + match client.put(r"kv", r"k", HyperObject::new()) { Ok(()) => (), Err(err) => panic!(err), } - let expected = NewHyperObject!("v", 0.0 as f64,); - match client.get("kv", "k") { + let expected = NewHyperObject!(r"v", 0.0 as f64,); + match client.get(r"kv", r"k") { Ok(obj) => { if !sloppyCompareHyper(&obj, &expected) { panic!("expected: {:?} @@ -166,12 +166,12 @@ actual: {:?}", expected, obj); Err(err) => panic!(err), } - match client.put("kv", "k", NewHyperObject!("v", 3.14 as f64,)) { + match client.put(r"kv", r"k", NewHyperObject!(r"v", 3.14 as f64,)) { Ok(()) => (), Err(err) => panic!(err), } - let expected = NewHyperObject!("v", 3.14 as f64,); - match client.get("kv", "k") { + let expected = NewHyperObject!(r"v", 3.14 as f64,); + match client.get(r"kv", r"k") { Ok(obj) => { if !sloppyCompareHyper(&obj, &expected) { panic!("expected: {:?} diff --git a/test/rust/DataTypeInt.rs b/test/rust/DataTypeInt.rs index 8ff19d235..b32d6939d 100644 --- a/test/rust/DataTypeInt.rs +++ b/test/rust/DataTypeInt.rs @@ -151,12 +151,12 @@ fn main() { let args = os::args(); let mut client = Client::new(FromStr::from_str(format!("{}:{}", args[1], args[2]).as_slice()).unwrap()).unwrap(); - match client.put("kv", "k", HyperObject::new()) { + match client.put(r"kv", r"k", HyperObject::new()) { Ok(()) => (), Err(err) => panic!(err), } - let expected = NewHyperObject!("v", 0 as i64,); - match client.get("kv", "k") { + let expected = NewHyperObject!(r"v", 0 as i64,); + match client.get(r"kv", r"k") { Ok(obj) => { if !sloppyCompareHyper(&obj, &expected) { panic!("expected: {:?} @@ -166,12 +166,12 @@ actual: {:?}", expected, obj); Err(err) => panic!(err), } - match client.put("kv", "k", NewHyperObject!("v", 1 as i64,)) { + match client.put(r"kv", r"k", NewHyperObject!(r"v", 1 as i64,)) { Ok(()) => (), Err(err) => panic!(err), } - let expected = NewHyperObject!("v", 1 as i64,); - match client.get("kv", "k") { + let expected = NewHyperObject!(r"v", 1 as i64,); + match client.get(r"kv", r"k") { Ok(obj) => { if !sloppyCompareHyper(&obj, &expected) { panic!("expected: {:?} @@ -181,12 +181,12 @@ actual: {:?}", expected, obj); Err(err) => panic!(err), } - match client.put("kv", "k", NewHyperObject!("v", -1 as i64,)) { + match client.put(r"kv", r"k", NewHyperObject!(r"v", -1 as i64,)) { Ok(()) => (), Err(err) => panic!(err), } - let expected = NewHyperObject!("v", -1 as i64,); - match client.get("kv", "k") { + let expected = NewHyperObject!(r"v", -1 as i64,); + match client.get(r"kv", r"k") { Ok(obj) => { if !sloppyCompareHyper(&obj, &expected) { panic!("expected: {:?} @@ -196,12 +196,12 @@ actual: {:?}", expected, obj); Err(err) => panic!(err), } - match client.put("kv", "k", NewHyperObject!("v", 0 as i64,)) { + match client.put(r"kv", r"k", NewHyperObject!(r"v", 0 as i64,)) { Ok(()) => (), Err(err) => panic!(err), } - let expected = NewHyperObject!("v", 0 as i64,); - match client.get("kv", "k") { + let expected = NewHyperObject!(r"v", 0 as i64,); + match client.get(r"kv", r"k") { Ok(obj) => { if !sloppyCompareHyper(&obj, &expected) { panic!("expected: {:?} @@ -211,12 +211,12 @@ actual: {:?}", expected, obj); Err(err) => panic!(err), } - match client.put("kv", "k", NewHyperObject!("v", 9223372036854775807 as i64,)) { + match client.put(r"kv", r"k", NewHyperObject!(r"v", 9223372036854775807 as i64,)) { Ok(()) => (), Err(err) => panic!(err), } - let expected = NewHyperObject!("v", 9223372036854775807 as i64,); - match client.get("kv", "k") { + let expected = NewHyperObject!(r"v", 9223372036854775807 as i64,); + match client.get(r"kv", r"k") { Ok(obj) => { if !sloppyCompareHyper(&obj, &expected) { panic!("expected: {:?} @@ -226,12 +226,12 @@ actual: {:?}", expected, obj); Err(err) => panic!(err), } - match client.put("kv", "k", NewHyperObject!("v", -9223372036854775808 as i64,)) { + match client.put(r"kv", r"k", NewHyperObject!(r"v", -9223372036854775808 as i64,)) { Ok(()) => (), Err(err) => panic!(err), } - let expected = NewHyperObject!("v", -9223372036854775808 as i64,); - match client.get("kv", "k") { + let expected = NewHyperObject!(r"v", -9223372036854775808 as i64,); + match client.get(r"kv", r"k") { Ok(obj) => { if !sloppyCompareHyper(&obj, &expected) { panic!("expected: {:?} diff --git a/test/rust/DataTypeListFloat.rs b/test/rust/DataTypeListFloat.rs index 6cf2d4ad2..c2fd878a0 100644 --- a/test/rust/DataTypeListFloat.rs +++ b/test/rust/DataTypeListFloat.rs @@ -151,12 +151,12 @@ fn main() { let args = os::args(); let mut client = Client::new(FromStr::from_str(format!("{}:{}", args[1], args[2]).as_slice()).unwrap()).unwrap(); - match client.put("kv", "k", HyperObject::new()) { + match client.put(r"kv", r"k", HyperObject::new()) { Ok(()) => (), Err(err) => panic!(err), } - let expected = NewHyperObject!("v", Vec::::new(),); - match client.get("kv", "k") { + let expected = NewHyperObject!(r"v", Vec::::new(),); + match client.get(r"kv", r"k") { Ok(obj) => { if !sloppyCompareHyper(&obj, &expected) { panic!("expected: {:?} @@ -166,12 +166,12 @@ actual: {:?}", expected, obj); Err(err) => panic!(err), } - match client.put("kv", "k", NewHyperObject!("v", vec!(3.14 as f64, 0.25 as f64, 1.0 as f64),)) { + match client.put(r"kv", r"k", NewHyperObject!(r"v", vec!(3.14 as f64, 0.25 as f64, 1.0 as f64),)) { Ok(()) => (), Err(err) => panic!(err), } - let expected = NewHyperObject!("v", vec!(3.14 as f64, 0.25 as f64, 1.0 as f64),); - match client.get("kv", "k") { + let expected = NewHyperObject!(r"v", vec!(3.14 as f64, 0.25 as f64, 1.0 as f64),); + match client.get(r"kv", r"k") { Ok(obj) => { if !sloppyCompareHyper(&obj, &expected) { panic!("expected: {:?} @@ -181,12 +181,12 @@ actual: {:?}", expected, obj); Err(err) => panic!(err), } - match client.put("kv", "k", NewHyperObject!("v", Vec::::new(),)) { + match client.put(r"kv", r"k", NewHyperObject!(r"v", Vec::::new(),)) { Ok(()) => (), Err(err) => panic!(err), } - let expected = NewHyperObject!("v", Vec::::new(),); - match client.get("kv", "k") { + let expected = NewHyperObject!(r"v", Vec::::new(),); + match client.get(r"kv", r"k") { Ok(obj) => { if !sloppyCompareHyper(&obj, &expected) { panic!("expected: {:?} diff --git a/test/rust/DataTypeListInt.rs b/test/rust/DataTypeListInt.rs index f7052eed2..8c0d1ca8a 100644 --- a/test/rust/DataTypeListInt.rs +++ b/test/rust/DataTypeListInt.rs @@ -151,12 +151,12 @@ fn main() { let args = os::args(); let mut client = Client::new(FromStr::from_str(format!("{}:{}", args[1], args[2]).as_slice()).unwrap()).unwrap(); - match client.put("kv", "k", HyperObject::new()) { + match client.put(r"kv", r"k", HyperObject::new()) { Ok(()) => (), Err(err) => panic!(err), } - let expected = NewHyperObject!("v", Vec::::new(),); - match client.get("kv", "k") { + let expected = NewHyperObject!(r"v", Vec::::new(),); + match client.get(r"kv", r"k") { Ok(obj) => { if !sloppyCompareHyper(&obj, &expected) { panic!("expected: {:?} @@ -166,12 +166,12 @@ actual: {:?}", expected, obj); Err(err) => panic!(err), } - match client.put("kv", "k", NewHyperObject!("v", vec!(1 as i64, 2 as i64, 3 as i64),)) { + match client.put(r"kv", r"k", NewHyperObject!(r"v", vec!(1 as i64, 2 as i64, 3 as i64),)) { Ok(()) => (), Err(err) => panic!(err), } - let expected = NewHyperObject!("v", vec!(1 as i64, 2 as i64, 3 as i64),); - match client.get("kv", "k") { + let expected = NewHyperObject!(r"v", vec!(1 as i64, 2 as i64, 3 as i64),); + match client.get(r"kv", r"k") { Ok(obj) => { if !sloppyCompareHyper(&obj, &expected) { panic!("expected: {:?} @@ -181,12 +181,12 @@ actual: {:?}", expected, obj); Err(err) => panic!(err), } - match client.put("kv", "k", NewHyperObject!("v", Vec::::new(),)) { + match client.put(r"kv", r"k", NewHyperObject!(r"v", Vec::::new(),)) { Ok(()) => (), Err(err) => panic!(err), } - let expected = NewHyperObject!("v", Vec::::new(),); - match client.get("kv", "k") { + let expected = NewHyperObject!(r"v", Vec::::new(),); + match client.get(r"kv", r"k") { Ok(obj) => { if !sloppyCompareHyper(&obj, &expected) { panic!("expected: {:?} diff --git a/test/rust/DataTypeListString.rs b/test/rust/DataTypeListString.rs index 9c296db03..9e576a5ee 100644 --- a/test/rust/DataTypeListString.rs +++ b/test/rust/DataTypeListString.rs @@ -151,12 +151,12 @@ fn main() { let args = os::args(); let mut client = Client::new(FromStr::from_str(format!("{}:{}", args[1], args[2]).as_slice()).unwrap()).unwrap(); - match client.put("kv", "k", HyperObject::new()) { + match client.put(r"kv", r"k", HyperObject::new()) { Ok(()) => (), Err(err) => panic!(err), } - let expected = NewHyperObject!("v", Vec::::new(),); - match client.get("kv", "k") { + let expected = NewHyperObject!(r"v", Vec::::new(),); + match client.get(r"kv", r"k") { Ok(obj) => { if !sloppyCompareHyper(&obj, &expected) { panic!("expected: {:?} @@ -166,12 +166,12 @@ actual: {:?}", expected, obj); Err(err) => panic!(err), } - match client.put("kv", "k", NewHyperObject!("v", vec!("A", "B", "C"),)) { + match client.put(r"kv", r"k", NewHyperObject!(r"v", vec!(r"A", r"B", r"C"),)) { Ok(()) => (), Err(err) => panic!(err), } - let expected = NewHyperObject!("v", vec!("A", "B", "C"),); - match client.get("kv", "k") { + let expected = NewHyperObject!(r"v", vec!(r"A", r"B", r"C"),); + match client.get(r"kv", r"k") { Ok(obj) => { if !sloppyCompareHyper(&obj, &expected) { panic!("expected: {:?} @@ -181,12 +181,12 @@ actual: {:?}", expected, obj); Err(err) => panic!(err), } - match client.put("kv", "k", NewHyperObject!("v", Vec::::new(),)) { + match client.put(r"kv", r"k", NewHyperObject!(r"v", Vec::::new(),)) { Ok(()) => (), Err(err) => panic!(err), } - let expected = NewHyperObject!("v", Vec::::new(),); - match client.get("kv", "k") { + let expected = NewHyperObject!(r"v", Vec::::new(),); + match client.get(r"kv", r"k") { Ok(obj) => { if !sloppyCompareHyper(&obj, &expected) { panic!("expected: {:?} diff --git a/test/rust/DataTypeMapFloatFloat.rs b/test/rust/DataTypeMapFloatFloat.rs index f7f4a270d..cc48a1fa9 100644 --- a/test/rust/DataTypeMapFloatFloat.rs +++ b/test/rust/DataTypeMapFloatFloat.rs @@ -151,12 +151,12 @@ fn main() { let args = os::args(); let mut client = Client::new(FromStr::from_str(format!("{}:{}", args[1], args[2]).as_slice()).unwrap()).unwrap(); - match client.put("kv", "k", HyperObject::new()) { + match client.put(r"kv", r"k", HyperObject::new()) { Ok(()) => (), Err(err) => panic!(err), } - let expected = NewHyperObject!("v", HashMap::, Vec>::new(),); - match client.get("kv", "k") { + let expected = NewHyperObject!(r"v", HashMap::, Vec>::new(),); + match client.get(r"kv", r"k") { Ok(obj) => { if !sloppyCompareHyper(&obj, &expected) { panic!("expected: {:?} @@ -166,7 +166,7 @@ actual: {:?}", expected, obj); Err(err) => panic!(err), } - match client.put("kv", "k", NewHyperObject!("v", { + match client.put(r"kv", r"k", NewHyperObject!(r"v", { let mut m = HashMap::new(); m.insert(F64(0.25 as f64), 2.0 as f64); m.insert(F64(1.0 as f64), 3.0 as f64); @@ -177,7 +177,7 @@ m Ok(()) => (), Err(err) => panic!(err), } - let expected = NewHyperObject!("v", { + let expected = NewHyperObject!(r"v", { let mut m = HashMap::new(); m.insert(F64(0.25 as f64), 2.0 as f64); m.insert(F64(1.0 as f64), 3.0 as f64); @@ -185,7 +185,7 @@ m.insert(F64(3.14 as f64), 1.0 as f64); m } ,); - match client.get("kv", "k") { + match client.get(r"kv", r"k") { Ok(obj) => { if !sloppyCompareHyper(&obj, &expected) { panic!("expected: {:?} @@ -195,12 +195,12 @@ actual: {:?}", expected, obj); Err(err) => panic!(err), } - match client.put("kv", "k", NewHyperObject!("v", HashMap::, Vec>::new(),)) { + match client.put(r"kv", r"k", NewHyperObject!(r"v", HashMap::, Vec>::new(),)) { Ok(()) => (), Err(err) => panic!(err), } - let expected = NewHyperObject!("v", HashMap::, Vec>::new(),); - match client.get("kv", "k") { + let expected = NewHyperObject!(r"v", HashMap::, Vec>::new(),); + match client.get(r"kv", r"k") { Ok(obj) => { if !sloppyCompareHyper(&obj, &expected) { panic!("expected: {:?} diff --git a/test/rust/DataTypeMapFloatInt.rs b/test/rust/DataTypeMapFloatInt.rs index 84ef7c720..1e08b0df8 100644 --- a/test/rust/DataTypeMapFloatInt.rs +++ b/test/rust/DataTypeMapFloatInt.rs @@ -151,12 +151,12 @@ fn main() { let args = os::args(); let mut client = Client::new(FromStr::from_str(format!("{}:{}", args[1], args[2]).as_slice()).unwrap()).unwrap(); - match client.put("kv", "k", HyperObject::new()) { + match client.put(r"kv", r"k", HyperObject::new()) { Ok(()) => (), Err(err) => panic!(err), } - let expected = NewHyperObject!("v", HashMap::, Vec>::new(),); - match client.get("kv", "k") { + let expected = NewHyperObject!(r"v", HashMap::, Vec>::new(),); + match client.get(r"kv", r"k") { Ok(obj) => { if !sloppyCompareHyper(&obj, &expected) { panic!("expected: {:?} @@ -166,7 +166,7 @@ actual: {:?}", expected, obj); Err(err) => panic!(err), } - match client.put("kv", "k", NewHyperObject!("v", { + match client.put(r"kv", r"k", NewHyperObject!(r"v", { let mut m = HashMap::new(); m.insert(F64(0.25 as f64), 2 as i64); m.insert(F64(1.0 as f64), 3 as i64); @@ -177,7 +177,7 @@ m Ok(()) => (), Err(err) => panic!(err), } - let expected = NewHyperObject!("v", { + let expected = NewHyperObject!(r"v", { let mut m = HashMap::new(); m.insert(F64(0.25 as f64), 2 as i64); m.insert(F64(1.0 as f64), 3 as i64); @@ -185,7 +185,7 @@ m.insert(F64(3.14 as f64), 1 as i64); m } ,); - match client.get("kv", "k") { + match client.get(r"kv", r"k") { Ok(obj) => { if !sloppyCompareHyper(&obj, &expected) { panic!("expected: {:?} @@ -195,12 +195,12 @@ actual: {:?}", expected, obj); Err(err) => panic!(err), } - match client.put("kv", "k", NewHyperObject!("v", HashMap::, Vec>::new(),)) { + match client.put(r"kv", r"k", NewHyperObject!(r"v", HashMap::, Vec>::new(),)) { Ok(()) => (), Err(err) => panic!(err), } - let expected = NewHyperObject!("v", HashMap::, Vec>::new(),); - match client.get("kv", "k") { + let expected = NewHyperObject!(r"v", HashMap::, Vec>::new(),); + match client.get(r"kv", r"k") { Ok(obj) => { if !sloppyCompareHyper(&obj, &expected) { panic!("expected: {:?} diff --git a/test/rust/DataTypeMapFloatString.rs b/test/rust/DataTypeMapFloatString.rs index 351d0a4f2..ced16b98c 100644 --- a/test/rust/DataTypeMapFloatString.rs +++ b/test/rust/DataTypeMapFloatString.rs @@ -151,12 +151,12 @@ fn main() { let args = os::args(); let mut client = Client::new(FromStr::from_str(format!("{}:{}", args[1], args[2]).as_slice()).unwrap()).unwrap(); - match client.put("kv", "k", HyperObject::new()) { + match client.put(r"kv", r"k", HyperObject::new()) { Ok(()) => (), Err(err) => panic!(err), } - let expected = NewHyperObject!("v", HashMap::, Vec>::new(),); - match client.get("kv", "k") { + let expected = NewHyperObject!(r"v", HashMap::, Vec>::new(),); + match client.get(r"kv", r"k") { Ok(obj) => { if !sloppyCompareHyper(&obj, &expected) { panic!("expected: {:?} @@ -166,26 +166,26 @@ actual: {:?}", expected, obj); Err(err) => panic!(err), } - match client.put("kv", "k", NewHyperObject!("v", { + match client.put(r"kv", r"k", NewHyperObject!(r"v", { let mut m = HashMap::new(); -m.insert(F64(0.25 as f64), "Y"); -m.insert(F64(1.0 as f64), "Z"); -m.insert(F64(3.14 as f64), "X"); +m.insert(F64(0.25 as f64), r"Y"); +m.insert(F64(1.0 as f64), r"Z"); +m.insert(F64(3.14 as f64), r"X"); m } ,)) { Ok(()) => (), Err(err) => panic!(err), } - let expected = NewHyperObject!("v", { + let expected = NewHyperObject!(r"v", { let mut m = HashMap::new(); -m.insert(F64(0.25 as f64), "Y"); -m.insert(F64(1.0 as f64), "Z"); -m.insert(F64(3.14 as f64), "X"); +m.insert(F64(0.25 as f64), r"Y"); +m.insert(F64(1.0 as f64), r"Z"); +m.insert(F64(3.14 as f64), r"X"); m } ,); - match client.get("kv", "k") { + match client.get(r"kv", r"k") { Ok(obj) => { if !sloppyCompareHyper(&obj, &expected) { panic!("expected: {:?} @@ -195,12 +195,12 @@ actual: {:?}", expected, obj); Err(err) => panic!(err), } - match client.put("kv", "k", NewHyperObject!("v", HashMap::, Vec>::new(),)) { + match client.put(r"kv", r"k", NewHyperObject!(r"v", HashMap::, Vec>::new(),)) { Ok(()) => (), Err(err) => panic!(err), } - let expected = NewHyperObject!("v", HashMap::, Vec>::new(),); - match client.get("kv", "k") { + let expected = NewHyperObject!(r"v", HashMap::, Vec>::new(),); + match client.get(r"kv", r"k") { Ok(obj) => { if !sloppyCompareHyper(&obj, &expected) { panic!("expected: {:?} diff --git a/test/rust/DataTypeMapIntFloat.rs b/test/rust/DataTypeMapIntFloat.rs index eafe29e8f..21d543c65 100644 --- a/test/rust/DataTypeMapIntFloat.rs +++ b/test/rust/DataTypeMapIntFloat.rs @@ -151,12 +151,12 @@ fn main() { let args = os::args(); let mut client = Client::new(FromStr::from_str(format!("{}:{}", args[1], args[2]).as_slice()).unwrap()).unwrap(); - match client.put("kv", "k", HyperObject::new()) { + match client.put(r"kv", r"k", HyperObject::new()) { Ok(()) => (), Err(err) => panic!(err), } - let expected = NewHyperObject!("v", HashMap::, Vec>::new(),); - match client.get("kv", "k") { + let expected = NewHyperObject!(r"v", HashMap::, Vec>::new(),); + match client.get(r"kv", r"k") { Ok(obj) => { if !sloppyCompareHyper(&obj, &expected) { panic!("expected: {:?} @@ -166,7 +166,7 @@ actual: {:?}", expected, obj); Err(err) => panic!(err), } - match client.put("kv", "k", NewHyperObject!("v", { + match client.put(r"kv", r"k", NewHyperObject!(r"v", { let mut m = HashMap::new(); m.insert(1 as i64, 3.14 as f64); m.insert(2 as i64, 0.25 as f64); @@ -177,7 +177,7 @@ m Ok(()) => (), Err(err) => panic!(err), } - let expected = NewHyperObject!("v", { + let expected = NewHyperObject!(r"v", { let mut m = HashMap::new(); m.insert(1 as i64, 3.14 as f64); m.insert(2 as i64, 0.25 as f64); @@ -185,7 +185,7 @@ m.insert(3 as i64, 1.0 as f64); m } ,); - match client.get("kv", "k") { + match client.get(r"kv", r"k") { Ok(obj) => { if !sloppyCompareHyper(&obj, &expected) { panic!("expected: {:?} @@ -195,12 +195,12 @@ actual: {:?}", expected, obj); Err(err) => panic!(err), } - match client.put("kv", "k", NewHyperObject!("v", HashMap::, Vec>::new(),)) { + match client.put(r"kv", r"k", NewHyperObject!(r"v", HashMap::, Vec>::new(),)) { Ok(()) => (), Err(err) => panic!(err), } - let expected = NewHyperObject!("v", HashMap::, Vec>::new(),); - match client.get("kv", "k") { + let expected = NewHyperObject!(r"v", HashMap::, Vec>::new(),); + match client.get(r"kv", r"k") { Ok(obj) => { if !sloppyCompareHyper(&obj, &expected) { panic!("expected: {:?} diff --git a/test/rust/DataTypeMapIntInt.rs b/test/rust/DataTypeMapIntInt.rs index e736bbf55..854ea6c8f 100644 --- a/test/rust/DataTypeMapIntInt.rs +++ b/test/rust/DataTypeMapIntInt.rs @@ -151,12 +151,12 @@ fn main() { let args = os::args(); let mut client = Client::new(FromStr::from_str(format!("{}:{}", args[1], args[2]).as_slice()).unwrap()).unwrap(); - match client.put("kv", "k", HyperObject::new()) { + match client.put(r"kv", r"k", HyperObject::new()) { Ok(()) => (), Err(err) => panic!(err), } - let expected = NewHyperObject!("v", HashMap::, Vec>::new(),); - match client.get("kv", "k") { + let expected = NewHyperObject!(r"v", HashMap::, Vec>::new(),); + match client.get(r"kv", r"k") { Ok(obj) => { if !sloppyCompareHyper(&obj, &expected) { panic!("expected: {:?} @@ -166,7 +166,7 @@ actual: {:?}", expected, obj); Err(err) => panic!(err), } - match client.put("kv", "k", NewHyperObject!("v", { + match client.put(r"kv", r"k", NewHyperObject!(r"v", { let mut m = HashMap::new(); m.insert(1 as i64, 7 as i64); m.insert(2 as i64, 8 as i64); @@ -177,7 +177,7 @@ m Ok(()) => (), Err(err) => panic!(err), } - let expected = NewHyperObject!("v", { + let expected = NewHyperObject!(r"v", { let mut m = HashMap::new(); m.insert(1 as i64, 7 as i64); m.insert(2 as i64, 8 as i64); @@ -185,7 +185,7 @@ m.insert(3 as i64, 9 as i64); m } ,); - match client.get("kv", "k") { + match client.get(r"kv", r"k") { Ok(obj) => { if !sloppyCompareHyper(&obj, &expected) { panic!("expected: {:?} @@ -195,12 +195,12 @@ actual: {:?}", expected, obj); Err(err) => panic!(err), } - match client.put("kv", "k", NewHyperObject!("v", HashMap::, Vec>::new(),)) { + match client.put(r"kv", r"k", NewHyperObject!(r"v", HashMap::, Vec>::new(),)) { Ok(()) => (), Err(err) => panic!(err), } - let expected = NewHyperObject!("v", HashMap::, Vec>::new(),); - match client.get("kv", "k") { + let expected = NewHyperObject!(r"v", HashMap::, Vec>::new(),); + match client.get(r"kv", r"k") { Ok(obj) => { if !sloppyCompareHyper(&obj, &expected) { panic!("expected: {:?} diff --git a/test/rust/DataTypeMapIntString.rs b/test/rust/DataTypeMapIntString.rs index f8def7e1a..481d9004a 100644 --- a/test/rust/DataTypeMapIntString.rs +++ b/test/rust/DataTypeMapIntString.rs @@ -151,12 +151,12 @@ fn main() { let args = os::args(); let mut client = Client::new(FromStr::from_str(format!("{}:{}", args[1], args[2]).as_slice()).unwrap()).unwrap(); - match client.put("kv", "k", HyperObject::new()) { + match client.put(r"kv", r"k", HyperObject::new()) { Ok(()) => (), Err(err) => panic!(err), } - let expected = NewHyperObject!("v", HashMap::, Vec>::new(),); - match client.get("kv", "k") { + let expected = NewHyperObject!(r"v", HashMap::, Vec>::new(),); + match client.get(r"kv", r"k") { Ok(obj) => { if !sloppyCompareHyper(&obj, &expected) { panic!("expected: {:?} @@ -166,26 +166,26 @@ actual: {:?}", expected, obj); Err(err) => panic!(err), } - match client.put("kv", "k", NewHyperObject!("v", { + match client.put(r"kv", r"k", NewHyperObject!(r"v", { let mut m = HashMap::new(); -m.insert(1 as i64, "X"); -m.insert(2 as i64, "Y"); -m.insert(3 as i64, "Z"); +m.insert(1 as i64, r"X"); +m.insert(2 as i64, r"Y"); +m.insert(3 as i64, r"Z"); m } ,)) { Ok(()) => (), Err(err) => panic!(err), } - let expected = NewHyperObject!("v", { + let expected = NewHyperObject!(r"v", { let mut m = HashMap::new(); -m.insert(1 as i64, "X"); -m.insert(2 as i64, "Y"); -m.insert(3 as i64, "Z"); +m.insert(1 as i64, r"X"); +m.insert(2 as i64, r"Y"); +m.insert(3 as i64, r"Z"); m } ,); - match client.get("kv", "k") { + match client.get(r"kv", r"k") { Ok(obj) => { if !sloppyCompareHyper(&obj, &expected) { panic!("expected: {:?} @@ -195,12 +195,12 @@ actual: {:?}", expected, obj); Err(err) => panic!(err), } - match client.put("kv", "k", NewHyperObject!("v", HashMap::, Vec>::new(),)) { + match client.put(r"kv", r"k", NewHyperObject!(r"v", HashMap::, Vec>::new(),)) { Ok(()) => (), Err(err) => panic!(err), } - let expected = NewHyperObject!("v", HashMap::, Vec>::new(),); - match client.get("kv", "k") { + let expected = NewHyperObject!(r"v", HashMap::, Vec>::new(),); + match client.get(r"kv", r"k") { Ok(obj) => { if !sloppyCompareHyper(&obj, &expected) { panic!("expected: {:?} diff --git a/test/rust/DataTypeMapStringFloat.rs b/test/rust/DataTypeMapStringFloat.rs index 44c5bc2d3..70695c8e5 100644 --- a/test/rust/DataTypeMapStringFloat.rs +++ b/test/rust/DataTypeMapStringFloat.rs @@ -151,12 +151,12 @@ fn main() { let args = os::args(); let mut client = Client::new(FromStr::from_str(format!("{}:{}", args[1], args[2]).as_slice()).unwrap()).unwrap(); - match client.put("kv", "k", HyperObject::new()) { + match client.put(r"kv", r"k", HyperObject::new()) { Ok(()) => (), Err(err) => panic!(err), } - let expected = NewHyperObject!("v", HashMap::, Vec>::new(),); - match client.get("kv", "k") { + let expected = NewHyperObject!(r"v", HashMap::, Vec>::new(),); + match client.get(r"kv", r"k") { Ok(obj) => { if !sloppyCompareHyper(&obj, &expected) { panic!("expected: {:?} @@ -166,26 +166,26 @@ actual: {:?}", expected, obj); Err(err) => panic!(err), } - match client.put("kv", "k", NewHyperObject!("v", { + match client.put(r"kv", r"k", NewHyperObject!(r"v", { let mut m = HashMap::new(); -m.insert("A", 3.14 as f64); -m.insert("C", 1.0 as f64); -m.insert("B", 0.25 as f64); +m.insert(r"A", 3.14 as f64); +m.insert(r"C", 1.0 as f64); +m.insert(r"B", 0.25 as f64); m } ,)) { Ok(()) => (), Err(err) => panic!(err), } - let expected = NewHyperObject!("v", { + let expected = NewHyperObject!(r"v", { let mut m = HashMap::new(); -m.insert("A", 3.14 as f64); -m.insert("C", 1.0 as f64); -m.insert("B", 0.25 as f64); +m.insert(r"A", 3.14 as f64); +m.insert(r"C", 1.0 as f64); +m.insert(r"B", 0.25 as f64); m } ,); - match client.get("kv", "k") { + match client.get(r"kv", r"k") { Ok(obj) => { if !sloppyCompareHyper(&obj, &expected) { panic!("expected: {:?} @@ -195,12 +195,12 @@ actual: {:?}", expected, obj); Err(err) => panic!(err), } - match client.put("kv", "k", NewHyperObject!("v", HashMap::, Vec>::new(),)) { + match client.put(r"kv", r"k", NewHyperObject!(r"v", HashMap::, Vec>::new(),)) { Ok(()) => (), Err(err) => panic!(err), } - let expected = NewHyperObject!("v", HashMap::, Vec>::new(),); - match client.get("kv", "k") { + let expected = NewHyperObject!(r"v", HashMap::, Vec>::new(),); + match client.get(r"kv", r"k") { Ok(obj) => { if !sloppyCompareHyper(&obj, &expected) { panic!("expected: {:?} diff --git a/test/rust/DataTypeMapStringInt.rs b/test/rust/DataTypeMapStringInt.rs index 3eaee1a8c..0ba86a213 100644 --- a/test/rust/DataTypeMapStringInt.rs +++ b/test/rust/DataTypeMapStringInt.rs @@ -151,12 +151,12 @@ fn main() { let args = os::args(); let mut client = Client::new(FromStr::from_str(format!("{}:{}", args[1], args[2]).as_slice()).unwrap()).unwrap(); - match client.put("kv", "k", HyperObject::new()) { + match client.put(r"kv", r"k", HyperObject::new()) { Ok(()) => (), Err(err) => panic!(err), } - let expected = NewHyperObject!("v", HashMap::, Vec>::new(),); - match client.get("kv", "k") { + let expected = NewHyperObject!(r"v", HashMap::, Vec>::new(),); + match client.get(r"kv", r"k") { Ok(obj) => { if !sloppyCompareHyper(&obj, &expected) { panic!("expected: {:?} @@ -166,26 +166,26 @@ actual: {:?}", expected, obj); Err(err) => panic!(err), } - match client.put("kv", "k", NewHyperObject!("v", { + match client.put(r"kv", r"k", NewHyperObject!(r"v", { let mut m = HashMap::new(); -m.insert("A", 1 as i64); -m.insert("C", 3 as i64); -m.insert("B", 2 as i64); +m.insert(r"A", 1 as i64); +m.insert(r"C", 3 as i64); +m.insert(r"B", 2 as i64); m } ,)) { Ok(()) => (), Err(err) => panic!(err), } - let expected = NewHyperObject!("v", { + let expected = NewHyperObject!(r"v", { let mut m = HashMap::new(); -m.insert("A", 1 as i64); -m.insert("C", 3 as i64); -m.insert("B", 2 as i64); +m.insert(r"A", 1 as i64); +m.insert(r"C", 3 as i64); +m.insert(r"B", 2 as i64); m } ,); - match client.get("kv", "k") { + match client.get(r"kv", r"k") { Ok(obj) => { if !sloppyCompareHyper(&obj, &expected) { panic!("expected: {:?} @@ -195,12 +195,12 @@ actual: {:?}", expected, obj); Err(err) => panic!(err), } - match client.put("kv", "k", NewHyperObject!("v", HashMap::, Vec>::new(),)) { + match client.put(r"kv", r"k", NewHyperObject!(r"v", HashMap::, Vec>::new(),)) { Ok(()) => (), Err(err) => panic!(err), } - let expected = NewHyperObject!("v", HashMap::, Vec>::new(),); - match client.get("kv", "k") { + let expected = NewHyperObject!(r"v", HashMap::, Vec>::new(),); + match client.get(r"kv", r"k") { Ok(obj) => { if !sloppyCompareHyper(&obj, &expected) { panic!("expected: {:?} diff --git a/test/rust/DataTypeMapStringString.rs b/test/rust/DataTypeMapStringString.rs index 9ee034f73..bda3fc22a 100644 --- a/test/rust/DataTypeMapStringString.rs +++ b/test/rust/DataTypeMapStringString.rs @@ -151,12 +151,12 @@ fn main() { let args = os::args(); let mut client = Client::new(FromStr::from_str(format!("{}:{}", args[1], args[2]).as_slice()).unwrap()).unwrap(); - match client.put("kv", "k", HyperObject::new()) { + match client.put(r"kv", r"k", HyperObject::new()) { Ok(()) => (), Err(err) => panic!(err), } - let expected = NewHyperObject!("v", HashMap::, Vec>::new(),); - match client.get("kv", "k") { + let expected = NewHyperObject!(r"v", HashMap::, Vec>::new(),); + match client.get(r"kv", r"k") { Ok(obj) => { if !sloppyCompareHyper(&obj, &expected) { panic!("expected: {:?} @@ -166,26 +166,26 @@ actual: {:?}", expected, obj); Err(err) => panic!(err), } - match client.put("kv", "k", NewHyperObject!("v", { + match client.put(r"kv", r"k", NewHyperObject!(r"v", { let mut m = HashMap::new(); -m.insert("A", "X"); -m.insert("C", "Z"); -m.insert("B", "Y"); +m.insert(r"A", r"X"); +m.insert(r"C", r"Z"); +m.insert(r"B", r"Y"); m } ,)) { Ok(()) => (), Err(err) => panic!(err), } - let expected = NewHyperObject!("v", { + let expected = NewHyperObject!(r"v", { let mut m = HashMap::new(); -m.insert("A", "X"); -m.insert("C", "Z"); -m.insert("B", "Y"); +m.insert(r"A", r"X"); +m.insert(r"C", r"Z"); +m.insert(r"B", r"Y"); m } ,); - match client.get("kv", "k") { + match client.get(r"kv", r"k") { Ok(obj) => { if !sloppyCompareHyper(&obj, &expected) { panic!("expected: {:?} @@ -195,12 +195,12 @@ actual: {:?}", expected, obj); Err(err) => panic!(err), } - match client.put("kv", "k", NewHyperObject!("v", HashMap::, Vec>::new(),)) { + match client.put(r"kv", r"k", NewHyperObject!(r"v", HashMap::, Vec>::new(),)) { Ok(()) => (), Err(err) => panic!(err), } - let expected = NewHyperObject!("v", HashMap::, Vec>::new(),); - match client.get("kv", "k") { + let expected = NewHyperObject!(r"v", HashMap::, Vec>::new(),); + match client.get(r"kv", r"k") { Ok(obj) => { if !sloppyCompareHyper(&obj, &expected) { panic!("expected: {:?} diff --git a/test/rust/DataTypeSetFloat.rs b/test/rust/DataTypeSetFloat.rs index 1cc0e8d99..5e25dde50 100644 --- a/test/rust/DataTypeSetFloat.rs +++ b/test/rust/DataTypeSetFloat.rs @@ -151,12 +151,12 @@ fn main() { let args = os::args(); let mut client = Client::new(FromStr::from_str(format!("{}:{}", args[1], args[2]).as_slice()).unwrap()).unwrap(); - match client.put("kv", "k", HyperObject::new()) { + match client.put(r"kv", r"k", HyperObject::new()) { Ok(()) => (), Err(err) => panic!(err), } - let expected = NewHyperObject!("v", BTreeSet::>::new(),); - match client.get("kv", "k") { + let expected = NewHyperObject!(r"v", BTreeSet::>::new(),); + match client.get(r"kv", r"k") { Ok(obj) => { if !sloppyCompareHyper(&obj, &expected) { panic!("expected: {:?} @@ -166,26 +166,26 @@ actual: {:?}", expected, obj); Err(err) => panic!(err), } - match client.put("kv", "k", NewHyperObject!("v", { + match client.put(r"kv", r"k", NewHyperObject!(r"v", { let mut s = BTreeSet::new(); -s.insert(0.25 as f64); -s.insert(1.0 as f64); -s.insert(3.14 as f64); +s.insert(F64(0.25 as f64)); +s.insert(F64(1.0 as f64)); +s.insert(F64(3.14 as f64)); s } ,)) { Ok(()) => (), Err(err) => panic!(err), } - let expected = NewHyperObject!("v", { + let expected = NewHyperObject!(r"v", { let mut s = BTreeSet::new(); -s.insert(0.25 as f64); -s.insert(1.0 as f64); -s.insert(3.14 as f64); +s.insert(F64(0.25 as f64)); +s.insert(F64(1.0 as f64)); +s.insert(F64(3.14 as f64)); s } ,); - match client.get("kv", "k") { + match client.get(r"kv", r"k") { Ok(obj) => { if !sloppyCompareHyper(&obj, &expected) { panic!("expected: {:?} @@ -195,12 +195,12 @@ actual: {:?}", expected, obj); Err(err) => panic!(err), } - match client.put("kv", "k", NewHyperObject!("v", BTreeSet::>::new(),)) { + match client.put(r"kv", r"k", NewHyperObject!(r"v", BTreeSet::>::new(),)) { Ok(()) => (), Err(err) => panic!(err), } - let expected = NewHyperObject!("v", BTreeSet::>::new(),); - match client.get("kv", "k") { + let expected = NewHyperObject!(r"v", BTreeSet::>::new(),); + match client.get(r"kv", r"k") { Ok(obj) => { if !sloppyCompareHyper(&obj, &expected) { panic!("expected: {:?} diff --git a/test/rust/DataTypeSetInt.rs b/test/rust/DataTypeSetInt.rs index 89cc3e07e..f822dc397 100644 --- a/test/rust/DataTypeSetInt.rs +++ b/test/rust/DataTypeSetInt.rs @@ -151,12 +151,12 @@ fn main() { let args = os::args(); let mut client = Client::new(FromStr::from_str(format!("{}:{}", args[1], args[2]).as_slice()).unwrap()).unwrap(); - match client.put("kv", "k", HyperObject::new()) { + match client.put(r"kv", r"k", HyperObject::new()) { Ok(()) => (), Err(err) => panic!(err), } - let expected = NewHyperObject!("v", BTreeSet::>::new(),); - match client.get("kv", "k") { + let expected = NewHyperObject!(r"v", BTreeSet::>::new(),); + match client.get(r"kv", r"k") { Ok(obj) => { if !sloppyCompareHyper(&obj, &expected) { panic!("expected: {:?} @@ -166,7 +166,7 @@ actual: {:?}", expected, obj); Err(err) => panic!(err), } - match client.put("kv", "k", NewHyperObject!("v", { + match client.put(r"kv", r"k", NewHyperObject!(r"v", { let mut s = BTreeSet::new(); s.insert(1 as i64); s.insert(2 as i64); @@ -177,7 +177,7 @@ s Ok(()) => (), Err(err) => panic!(err), } - let expected = NewHyperObject!("v", { + let expected = NewHyperObject!(r"v", { let mut s = BTreeSet::new(); s.insert(1 as i64); s.insert(2 as i64); @@ -185,7 +185,7 @@ s.insert(3 as i64); s } ,); - match client.get("kv", "k") { + match client.get(r"kv", r"k") { Ok(obj) => { if !sloppyCompareHyper(&obj, &expected) { panic!("expected: {:?} @@ -195,12 +195,12 @@ actual: {:?}", expected, obj); Err(err) => panic!(err), } - match client.put("kv", "k", NewHyperObject!("v", BTreeSet::>::new(),)) { + match client.put(r"kv", r"k", NewHyperObject!(r"v", BTreeSet::>::new(),)) { Ok(()) => (), Err(err) => panic!(err), } - let expected = NewHyperObject!("v", BTreeSet::>::new(),); - match client.get("kv", "k") { + let expected = NewHyperObject!(r"v", BTreeSet::>::new(),); + match client.get(r"kv", r"k") { Ok(obj) => { if !sloppyCompareHyper(&obj, &expected) { panic!("expected: {:?} diff --git a/test/rust/DataTypeSetString.rs b/test/rust/DataTypeSetString.rs index 26a6e6816..d8519bd67 100644 --- a/test/rust/DataTypeSetString.rs +++ b/test/rust/DataTypeSetString.rs @@ -151,12 +151,12 @@ fn main() { let args = os::args(); let mut client = Client::new(FromStr::from_str(format!("{}:{}", args[1], args[2]).as_slice()).unwrap()).unwrap(); - match client.put("kv", "k", HyperObject::new()) { + match client.put(r"kv", r"k", HyperObject::new()) { Ok(()) => (), Err(err) => panic!(err), } - let expected = NewHyperObject!("v", BTreeSet::>::new(),); - match client.get("kv", "k") { + let expected = NewHyperObject!(r"v", BTreeSet::>::new(),); + match client.get(r"kv", r"k") { Ok(obj) => { if !sloppyCompareHyper(&obj, &expected) { panic!("expected: {:?} @@ -166,26 +166,26 @@ actual: {:?}", expected, obj); Err(err) => panic!(err), } - match client.put("kv", "k", NewHyperObject!("v", { + match client.put(r"kv", r"k", NewHyperObject!(r"v", { let mut s = BTreeSet::new(); -s.insert("A"); -s.insert("C"); -s.insert("B"); +s.insert(r"A"); +s.insert(r"C"); +s.insert(r"B"); s } ,)) { Ok(()) => (), Err(err) => panic!(err), } - let expected = NewHyperObject!("v", { + let expected = NewHyperObject!(r"v", { let mut s = BTreeSet::new(); -s.insert("A"); -s.insert("C"); -s.insert("B"); +s.insert(r"A"); +s.insert(r"C"); +s.insert(r"B"); s } ,); - match client.get("kv", "k") { + match client.get(r"kv", r"k") { Ok(obj) => { if !sloppyCompareHyper(&obj, &expected) { panic!("expected: {:?} @@ -195,12 +195,12 @@ actual: {:?}", expected, obj); Err(err) => panic!(err), } - match client.put("kv", "k", NewHyperObject!("v", BTreeSet::>::new(),)) { + match client.put(r"kv", r"k", NewHyperObject!(r"v", BTreeSet::>::new(),)) { Ok(()) => (), Err(err) => panic!(err), } - let expected = NewHyperObject!("v", BTreeSet::>::new(),); - match client.get("kv", "k") { + let expected = NewHyperObject!(r"v", BTreeSet::>::new(),); + match client.get(r"kv", r"k") { Ok(obj) => { if !sloppyCompareHyper(&obj, &expected) { panic!("expected: {:?} diff --git a/test/rust/DataTypeString.rs b/test/rust/DataTypeString.rs index 55ac80bbc..afb1ac4b1 100644 --- a/test/rust/DataTypeString.rs +++ b/test/rust/DataTypeString.rs @@ -151,12 +151,12 @@ fn main() { let args = os::args(); let mut client = Client::new(FromStr::from_str(format!("{}:{}", args[1], args[2]).as_slice()).unwrap()).unwrap(); - match client.put("kv", "k", HyperObject::new()) { + match client.put(r"kv", r"k", HyperObject::new()) { Ok(()) => (), Err(err) => panic!(err), } - let expected = NewHyperObject!("v", "",); - match client.get("kv", "k") { + let expected = NewHyperObject!(r"v", r"",); + match client.get(r"kv", r"k") { Ok(obj) => { if !sloppyCompareHyper(&obj, &expected) { panic!("expected: {:?} @@ -166,12 +166,12 @@ actual: {:?}", expected, obj); Err(err) => panic!(err), } - match client.put("kv", "k", NewHyperObject!("v", "xxx",)) { + match client.put(r"kv", r"k", NewHyperObject!(r"v", r"xxx",)) { Ok(()) => (), Err(err) => panic!(err), } - let expected = NewHyperObject!("v", "xxx",); - match client.get("kv", "k") { + let expected = NewHyperObject!(r"v", r"xxx",); + match client.get(r"kv", r"k") { Ok(obj) => { if !sloppyCompareHyper(&obj, &expected) { panic!("expected: {:?} @@ -181,12 +181,12 @@ actual: {:?}", expected, obj); Err(err) => panic!(err), } - match client.put("kv", "k", NewHyperObject!("v", "\xde\xad\xbe\xef",)) { + match client.put(r"kv", r"k", NewHyperObject!(r"v", r"\xde\xad\xbe\xef",)) { Ok(()) => (), Err(err) => panic!(err), } - let expected = NewHyperObject!("v", "\xde\xad\xbe\xef",); - match client.get("kv", "k") { + let expected = NewHyperObject!(r"v", r"\xde\xad\xbe\xef",); + match client.get(r"kv", r"k") { Ok(obj) => { if !sloppyCompareHyper(&obj, &expected) { panic!("expected: {:?} diff --git a/test/rust/LengthString.rs b/test/rust/LengthString.rs index ccea51f10..857212122 100644 --- a/test/rust/LengthString.rs +++ b/test/rust/LengthString.rs @@ -151,56 +151,56 @@ fn main() { let args = os::args(); let mut client = Client::new(FromStr::from_str(format!("{}:{}", args[1], args[2]).as_slice()).unwrap()).unwrap(); - match client.put("kv", "A", HyperObject::new()) { + match client.put(r"kv", r"A", HyperObject::new()) { Ok(()) => (), Err(err) => panic!(err), } - match client.put("kv", "AB", HyperObject::new()) { + match client.put(r"kv", r"AB", HyperObject::new()) { Ok(()) => (), Err(err) => panic!(err), } - match client.put("kv", "ABC", HyperObject::new()) { + match client.put(r"kv", r"ABC", HyperObject::new()) { Ok(()) => (), Err(err) => panic!(err), } - match client.put("kv", "ABCD", HyperObject::new()) { + match client.put(r"kv", r"ABCD", HyperObject::new()) { Ok(()) => (), Err(err) => panic!(err), } - match client.put("kv", "ABCDE", HyperObject::new()) { + match client.put(r"kv", r"ABCDE", HyperObject::new()) { Ok(()) => (), Err(err) => panic!(err), } - let res = client.search("kv", vec!(HyperPredicate::new("k", LENGTH_EQUALS, 1 as i64))); + let res = client.search(r"kv", vec!(HyperPredicate::new(r"k", LENGTH_EQUALS, 1 as i64))); let elems: Vec> = res.iter().collect(); - assert!(elems.len() == vec!(NewHyperObject!("k", "A",)).len()); + assert_eq!(elems.len(), vec!(NewHyperObject!(r"k", r"A",)).len()); - let res = client.search("kv", vec!(HyperPredicate::new("k", LENGTH_EQUALS, 2 as i64))); + let res = client.search(r"kv", vec!(HyperPredicate::new(r"k", LENGTH_EQUALS, 2 as i64))); let elems: Vec> = res.iter().collect(); - assert!(elems.len() == vec!(NewHyperObject!("k", "AB",)).len()); + assert_eq!(elems.len(), vec!(NewHyperObject!(r"k", r"AB",)).len()); - let res = client.search("kv", vec!(HyperPredicate::new("k", LENGTH_EQUALS, 3 as i64))); + let res = client.search(r"kv", vec!(HyperPredicate::new(r"k", LENGTH_EQUALS, 3 as i64))); let elems: Vec> = res.iter().collect(); - assert!(elems.len() == vec!(NewHyperObject!("k", "ABC",)).len()); + assert_eq!(elems.len(), vec!(NewHyperObject!(r"k", r"ABC",)).len()); - let res = client.search("kv", vec!(HyperPredicate::new("k", LENGTH_EQUALS, 4 as i64))); + let res = client.search(r"kv", vec!(HyperPredicate::new(r"k", LENGTH_EQUALS, 4 as i64))); let elems: Vec> = res.iter().collect(); - assert!(elems.len() == vec!(NewHyperObject!("k", "ABCD",)).len()); + assert_eq!(elems.len(), vec!(NewHyperObject!(r"k", r"ABCD",)).len()); - let res = client.search("kv", vec!(HyperPredicate::new("k", LENGTH_EQUALS, 5 as i64))); + let res = client.search(r"kv", vec!(HyperPredicate::new(r"k", LENGTH_EQUALS, 5 as i64))); let elems: Vec> = res.iter().collect(); - assert!(elems.len() == vec!(NewHyperObject!("k", "ABCDE",)).len()); + assert_eq!(elems.len(), vec!(NewHyperObject!(r"k", r"ABCDE",)).len()); - let res = client.search("kv", vec!(HyperPredicate::new("k", LENGTH_LESS_EQUAL, 3 as i64))); + let res = client.search(r"kv", vec!(HyperPredicate::new(r"k", LENGTH_LESS_EQUAL, 3 as i64))); let elems: Vec> = res.iter().collect(); - assert!(elems.len() == vec!(NewHyperObject!("k", "A",), NewHyperObject!("k", "AB",), NewHyperObject!("k", "ABC",)).len()); + assert_eq!(elems.len(), vec!(NewHyperObject!(r"k", r"A",), NewHyperObject!(r"k", r"AB",), NewHyperObject!(r"k", r"ABC",)).len()); - let res = client.search("kv", vec!(HyperPredicate::new("k", LENGTH_GREATER_EQUAL, 3 as i64))); + let res = client.search(r"kv", vec!(HyperPredicate::new(r"k", LENGTH_GREATER_EQUAL, 3 as i64))); let elems: Vec> = res.iter().collect(); - assert!(elems.len() == vec!(NewHyperObject!("k", "ABC",), NewHyperObject!("k", "ABCD",), NewHyperObject!("k", "ABCDE",)).len()); + assert_eq!(elems.len(), vec!(NewHyperObject!(r"k", r"ABC",), NewHyperObject!(r"k", r"ABCD",), NewHyperObject!(r"k", r"ABCDE",)).len()); } diff --git a/test/rust/MultiAttribute.rs b/test/rust/MultiAttribute.rs index 9ee81c506..9039b9c2e 100644 --- a/test/rust/MultiAttribute.rs +++ b/test/rust/MultiAttribute.rs @@ -151,19 +151,19 @@ fn main() { let args = os::args(); let mut client = Client::new(FromStr::from_str(format!("{}:{}", args[1], args[2]).as_slice()).unwrap()).unwrap(); - match client.get("kv", "k") { + match client.get(r"kv", r"k") { Ok(obj) => { panic!("this object should not be found!"); }, Err(err) => (), } - match client.put("kv", "k", NewHyperObject!("v1", "ABC",)) { + match client.put(r"kv", r"k", NewHyperObject!(r"v1", r"ABC",)) { Ok(()) => (), Err(err) => panic!(err), } - let expected = NewHyperObject!("v1", "ABC", "v2", "",); - match client.get("kv", "k") { + let expected = NewHyperObject!(r"v1", r"ABC", r"v2", r"",); + match client.get(r"kv", r"k") { Ok(obj) => { if !sloppyCompareHyper(&obj, &expected) { panic!("expected: {:?} @@ -173,12 +173,12 @@ actual: {:?}", expected, obj); Err(err) => panic!(err), } - match client.put("kv", "k", NewHyperObject!("v2", "123",)) { + match client.put(r"kv", r"k", NewHyperObject!(r"v2", r"123",)) { Ok(()) => (), Err(err) => panic!(err), } - let expected = NewHyperObject!("v1", "ABC", "v2", "123",); - match client.get("kv", "k") { + let expected = NewHyperObject!(r"v1", r"ABC", r"v2", r"123",); + match client.get(r"kv", r"k") { Ok(obj) => { if !sloppyCompareHyper(&obj, &expected) { panic!("expected: {:?} @@ -187,8 +187,8 @@ actual: {:?}", expected, obj); }, Err(err) => panic!(err), } - let expected = NewHyperObject!("v1", "ABC",); - match client.get_partial("kv", "k", vec!("v1")) { + let expected = NewHyperObject!(r"v1", r"ABC",); + match client.get_partial(r"kv", r"k", vec!(r"v1")) { Ok(obj) => { if !sloppyCompareHyper(&obj, &expected) { panic!("expected: {:?} diff --git a/test/rust/RangeSearchInt.rs b/test/rust/RangeSearchInt.rs index 92bfa75e4..45bf0f290 100644 --- a/test/rust/RangeSearchInt.rs +++ b/test/rust/RangeSearchInt.rs @@ -151,68 +151,68 @@ fn main() { let args = os::args(); let mut client = Client::new(FromStr::from_str(format!("{}:{}", args[1], args[2]).as_slice()).unwrap()).unwrap(); - match client.put("kv", -2 as i64, NewHyperObject!("v", -2 as i64,)) { + match client.put(r"kv", -2 as i64, NewHyperObject!(r"v", -2 as i64,)) { Ok(()) => (), Err(err) => panic!(err), } - match client.put("kv", -1 as i64, NewHyperObject!("v", -1 as i64,)) { + match client.put(r"kv", -1 as i64, NewHyperObject!(r"v", -1 as i64,)) { Ok(()) => (), Err(err) => panic!(err), } - match client.put("kv", 0 as i64, NewHyperObject!("v", 0 as i64,)) { + match client.put(r"kv", 0 as i64, NewHyperObject!(r"v", 0 as i64,)) { Ok(()) => (), Err(err) => panic!(err), } - match client.put("kv", 1 as i64, NewHyperObject!("v", 1 as i64,)) { + match client.put(r"kv", 1 as i64, NewHyperObject!(r"v", 1 as i64,)) { Ok(()) => (), Err(err) => panic!(err), } - match client.put("kv", 2 as i64, NewHyperObject!("v", 2 as i64,)) { + match client.put(r"kv", 2 as i64, NewHyperObject!(r"v", 2 as i64,)) { Ok(()) => (), Err(err) => panic!(err), } - let res = client.search("kv", vec!(HyperPredicate::new("k", LESS_EQUAL, 0 as i64))); + let res = client.search(r"kv", vec!(HyperPredicate::new(r"k", LESS_EQUAL, 0 as i64))); let elems: Vec> = res.iter().collect(); - assert!(elems.len() == vec!(NewHyperObject!("k", -2 as i64, "v", -2 as i64,), NewHyperObject!("k", -1 as i64, "v", -1 as i64,), NewHyperObject!("k", 0 as i64, "v", 0 as i64,)).len()); + assert_eq!(elems.len(), vec!(NewHyperObject!(r"k", -2 as i64, r"v", -2 as i64,), NewHyperObject!(r"k", -1 as i64, r"v", -1 as i64,), NewHyperObject!(r"k", 0 as i64, r"v", 0 as i64,)).len()); - let res = client.search("kv", vec!(HyperPredicate::new("v", LESS_EQUAL, 0 as i64))); + let res = client.search(r"kv", vec!(HyperPredicate::new(r"v", LESS_EQUAL, 0 as i64))); let elems: Vec> = res.iter().collect(); - assert!(elems.len() == vec!(NewHyperObject!("k", -2 as i64, "v", -2 as i64,), NewHyperObject!("k", -1 as i64, "v", -1 as i64,), NewHyperObject!("k", 0 as i64, "v", 0 as i64,)).len()); + assert_eq!(elems.len(), vec!(NewHyperObject!(r"k", -2 as i64, r"v", -2 as i64,), NewHyperObject!(r"k", -1 as i64, r"v", -1 as i64,), NewHyperObject!(r"k", 0 as i64, r"v", 0 as i64,)).len()); - let res = client.search("kv", vec!(HyperPredicate::new("k", GREATER_EQUAL, 0 as i64))); + let res = client.search(r"kv", vec!(HyperPredicate::new(r"k", GREATER_EQUAL, 0 as i64))); let elems: Vec> = res.iter().collect(); - assert!(elems.len() == vec!(NewHyperObject!("k", 0 as i64, "v", 0 as i64,), NewHyperObject!("k", 1 as i64, "v", 1 as i64,), NewHyperObject!("k", 2 as i64, "v", 2 as i64,)).len()); + assert_eq!(elems.len(), vec!(NewHyperObject!(r"k", 0 as i64, r"v", 0 as i64,), NewHyperObject!(r"k", 1 as i64, r"v", 1 as i64,), NewHyperObject!(r"k", 2 as i64, r"v", 2 as i64,)).len()); - let res = client.search("kv", vec!(HyperPredicate::new("v", GREATER_EQUAL, 0 as i64))); + let res = client.search(r"kv", vec!(HyperPredicate::new(r"v", GREATER_EQUAL, 0 as i64))); let elems: Vec> = res.iter().collect(); - assert!(elems.len() == vec!(NewHyperObject!("k", 0 as i64, "v", 0 as i64,), NewHyperObject!("k", 1 as i64, "v", 1 as i64,), NewHyperObject!("k", 2 as i64, "v", 2 as i64,)).len()); + assert_eq!(elems.len(), vec!(NewHyperObject!(r"k", 0 as i64, r"v", 0 as i64,), NewHyperObject!(r"k", 1 as i64, r"v", 1 as i64,), NewHyperObject!(r"k", 2 as i64, r"v", 2 as i64,)).len()); - let res = client.search("kv", vec!(HyperPredicate::new("k", LESS_THAN, 0 as i64))); + let res = client.search(r"kv", vec!(HyperPredicate::new(r"k", LESS_THAN, 0 as i64))); let elems: Vec> = res.iter().collect(); - assert!(elems.len() == vec!(NewHyperObject!("k", -2 as i64, "v", -2 as i64,), NewHyperObject!("k", -1 as i64, "v", -1 as i64,)).len()); + assert_eq!(elems.len(), vec!(NewHyperObject!(r"k", -2 as i64, r"v", -2 as i64,), NewHyperObject!(r"k", -1 as i64, r"v", -1 as i64,)).len()); - let res = client.search("kv", vec!(HyperPredicate::new("v", LESS_THAN, 0 as i64))); + let res = client.search(r"kv", vec!(HyperPredicate::new(r"v", LESS_THAN, 0 as i64))); let elems: Vec> = res.iter().collect(); - assert!(elems.len() == vec!(NewHyperObject!("k", -2 as i64, "v", -2 as i64,), NewHyperObject!("k", -1 as i64, "v", -1 as i64,)).len()); + assert_eq!(elems.len(), vec!(NewHyperObject!(r"k", -2 as i64, r"v", -2 as i64,), NewHyperObject!(r"k", -1 as i64, r"v", -1 as i64,)).len()); - let res = client.search("kv", vec!(HyperPredicate::new("k", GREATER_THAN, 0 as i64))); + let res = client.search(r"kv", vec!(HyperPredicate::new(r"k", GREATER_THAN, 0 as i64))); let elems: Vec> = res.iter().collect(); - assert!(elems.len() == vec!(NewHyperObject!("k", 1 as i64, "v", 1 as i64,), NewHyperObject!("k", 2 as i64, "v", 2 as i64,)).len()); + assert_eq!(elems.len(), vec!(NewHyperObject!(r"k", 1 as i64, r"v", 1 as i64,), NewHyperObject!(r"k", 2 as i64, r"v", 2 as i64,)).len()); - let res = client.search("kv", vec!(HyperPredicate::new("v", GREATER_THAN, 0 as i64))); + let res = client.search(r"kv", vec!(HyperPredicate::new(r"v", GREATER_THAN, 0 as i64))); let elems: Vec> = res.iter().collect(); - assert!(elems.len() == vec!(NewHyperObject!("k", 1 as i64, "v", 1 as i64,), NewHyperObject!("k", 2 as i64, "v", 2 as i64,)).len()); + assert_eq!(elems.len(), vec!(NewHyperObject!(r"k", 1 as i64, r"v", 1 as i64,), NewHyperObject!(r"k", 2 as i64, r"v", 2 as i64,)).len()); - let res = client.search("kv", vec!(HyperPredicate::new("k", GREATER_EQUAL, -1 as i64), HyperPredicate::new("k", LESS_EQUAL, 1 as i64))); + let res = client.search(r"kv", vec!(HyperPredicate::new(r"k", GREATER_EQUAL, -1 as i64), HyperPredicate::new(r"k", LESS_EQUAL, 1 as i64))); let elems: Vec> = res.iter().collect(); - assert!(elems.len() == vec!(NewHyperObject!("k", -1 as i64, "v", -1 as i64,), NewHyperObject!("k", 0 as i64, "v", 0 as i64,), NewHyperObject!("k", 1 as i64, "v", 1 as i64,)).len()); + assert_eq!(elems.len(), vec!(NewHyperObject!(r"k", -1 as i64, r"v", -1 as i64,), NewHyperObject!(r"k", 0 as i64, r"v", 0 as i64,), NewHyperObject!(r"k", 1 as i64, r"v", 1 as i64,)).len()); - let res = client.search("kv", vec!(HyperPredicate::new("v", GREATER_EQUAL, -1 as i64), HyperPredicate::new("v", LESS_EQUAL, 1 as i64))); + let res = client.search(r"kv", vec!(HyperPredicate::new(r"v", GREATER_EQUAL, -1 as i64), HyperPredicate::new(r"v", LESS_EQUAL, 1 as i64))); let elems: Vec> = res.iter().collect(); - assert!(elems.len() == vec!(NewHyperObject!("k", -1 as i64, "v", -1 as i64,), NewHyperObject!("k", 0 as i64, "v", 0 as i64,), NewHyperObject!("k", 1 as i64, "v", 1 as i64,)).len()); + assert_eq!(elems.len(), vec!(NewHyperObject!(r"k", -1 as i64, r"v", -1 as i64,), NewHyperObject!(r"k", 0 as i64, r"v", 0 as i64,), NewHyperObject!(r"k", 1 as i64, r"v", 1 as i64,)).len()); } diff --git a/test/rust/RangeSearchString.rs b/test/rust/RangeSearchString.rs index 0a02a415b..427811af9 100644 --- a/test/rust/RangeSearchString.rs +++ b/test/rust/RangeSearchString.rs @@ -151,68 +151,68 @@ fn main() { let args = os::args(); let mut client = Client::new(FromStr::from_str(format!("{}:{}", args[1], args[2]).as_slice()).unwrap()).unwrap(); - match client.put("kv", "A", NewHyperObject!("v", "A",)) { + match client.put(r"kv", r"A", NewHyperObject!(r"v", r"A",)) { Ok(()) => (), Err(err) => panic!(err), } - match client.put("kv", "B", NewHyperObject!("v", "B",)) { + match client.put(r"kv", r"B", NewHyperObject!(r"v", r"B",)) { Ok(()) => (), Err(err) => panic!(err), } - match client.put("kv", "C", NewHyperObject!("v", "C",)) { + match client.put(r"kv", r"C", NewHyperObject!(r"v", r"C",)) { Ok(()) => (), Err(err) => panic!(err), } - match client.put("kv", "D", NewHyperObject!("v", "D",)) { + match client.put(r"kv", r"D", NewHyperObject!(r"v", r"D",)) { Ok(()) => (), Err(err) => panic!(err), } - match client.put("kv", "E", NewHyperObject!("v", "E",)) { + match client.put(r"kv", r"E", NewHyperObject!(r"v", r"E",)) { Ok(()) => (), Err(err) => panic!(err), } - let res = client.search("kv", vec!(HyperPredicate::new("k", LESS_EQUAL, "C"))); + let res = client.search(r"kv", vec!(HyperPredicate::new(r"k", LESS_EQUAL, r"C"))); let elems: Vec> = res.iter().collect(); - assert!(elems.len() == vec!(NewHyperObject!("k", "A", "v", "A",), NewHyperObject!("k", "B", "v", "B",), NewHyperObject!("k", "C", "v", "C",)).len()); + assert_eq!(elems.len(), vec!(NewHyperObject!(r"k", r"A", r"v", r"A",), NewHyperObject!(r"k", r"B", r"v", r"B",), NewHyperObject!(r"k", r"C", r"v", r"C",)).len()); - let res = client.search("kv", vec!(HyperPredicate::new("v", LESS_EQUAL, "C"))); + let res = client.search(r"kv", vec!(HyperPredicate::new(r"v", LESS_EQUAL, r"C"))); let elems: Vec> = res.iter().collect(); - assert!(elems.len() == vec!(NewHyperObject!("k", "A", "v", "A",), NewHyperObject!("k", "B", "v", "B",), NewHyperObject!("k", "C", "v", "C",)).len()); + assert_eq!(elems.len(), vec!(NewHyperObject!(r"k", r"A", r"v", r"A",), NewHyperObject!(r"k", r"B", r"v", r"B",), NewHyperObject!(r"k", r"C", r"v", r"C",)).len()); - let res = client.search("kv", vec!(HyperPredicate::new("k", GREATER_EQUAL, "C"))); + let res = client.search(r"kv", vec!(HyperPredicate::new(r"k", GREATER_EQUAL, r"C"))); let elems: Vec> = res.iter().collect(); - assert!(elems.len() == vec!(NewHyperObject!("k", "C", "v", "C",), NewHyperObject!("k", "D", "v", "D",), NewHyperObject!("k", "E", "v", "E",)).len()); + assert_eq!(elems.len(), vec!(NewHyperObject!(r"k", r"C", r"v", r"C",), NewHyperObject!(r"k", r"D", r"v", r"D",), NewHyperObject!(r"k", r"E", r"v", r"E",)).len()); - let res = client.search("kv", vec!(HyperPredicate::new("v", GREATER_EQUAL, "C"))); + let res = client.search(r"kv", vec!(HyperPredicate::new(r"v", GREATER_EQUAL, r"C"))); let elems: Vec> = res.iter().collect(); - assert!(elems.len() == vec!(NewHyperObject!("k", "C", "v", "C",), NewHyperObject!("k", "D", "v", "D",), NewHyperObject!("k", "E", "v", "E",)).len()); + assert_eq!(elems.len(), vec!(NewHyperObject!(r"k", r"C", r"v", r"C",), NewHyperObject!(r"k", r"D", r"v", r"D",), NewHyperObject!(r"k", r"E", r"v", r"E",)).len()); - let res = client.search("kv", vec!(HyperPredicate::new("k", LESS_THAN, "C"))); + let res = client.search(r"kv", vec!(HyperPredicate::new(r"k", LESS_THAN, r"C"))); let elems: Vec> = res.iter().collect(); - assert!(elems.len() == vec!(NewHyperObject!("k", "A", "v", "A",), NewHyperObject!("k", "B", "v", "B",)).len()); + assert_eq!(elems.len(), vec!(NewHyperObject!(r"k", r"A", r"v", r"A",), NewHyperObject!(r"k", r"B", r"v", r"B",)).len()); - let res = client.search("kv", vec!(HyperPredicate::new("v", LESS_THAN, "C"))); + let res = client.search(r"kv", vec!(HyperPredicate::new(r"v", LESS_THAN, r"C"))); let elems: Vec> = res.iter().collect(); - assert!(elems.len() == vec!(NewHyperObject!("k", "A", "v", "A",), NewHyperObject!("k", "B", "v", "B",)).len()); + assert_eq!(elems.len(), vec!(NewHyperObject!(r"k", r"A", r"v", r"A",), NewHyperObject!(r"k", r"B", r"v", r"B",)).len()); - let res = client.search("kv", vec!(HyperPredicate::new("k", GREATER_THAN, "C"))); + let res = client.search(r"kv", vec!(HyperPredicate::new(r"k", GREATER_THAN, r"C"))); let elems: Vec> = res.iter().collect(); - assert!(elems.len() == vec!(NewHyperObject!("k", "D", "v", "D",), NewHyperObject!("k", "E", "v", "E",)).len()); + assert_eq!(elems.len(), vec!(NewHyperObject!(r"k", r"D", r"v", r"D",), NewHyperObject!(r"k", r"E", r"v", r"E",)).len()); - let res = client.search("kv", vec!(HyperPredicate::new("v", GREATER_THAN, "C"))); + let res = client.search(r"kv", vec!(HyperPredicate::new(r"v", GREATER_THAN, r"C"))); let elems: Vec> = res.iter().collect(); - assert!(elems.len() == vec!(NewHyperObject!("k", "D", "v", "D",), NewHyperObject!("k", "E", "v", "E",)).len()); + assert_eq!(elems.len(), vec!(NewHyperObject!(r"k", r"D", r"v", r"D",), NewHyperObject!(r"k", r"E", r"v", r"E",)).len()); - let res = client.search("kv", vec!(HyperPredicate::new("k", GREATER_EQUAL, "B"), HyperPredicate::new("k", LESS_EQUAL, "D"))); + let res = client.search(r"kv", vec!(HyperPredicate::new(r"k", GREATER_EQUAL, r"B"), HyperPredicate::new(r"k", LESS_EQUAL, r"D"))); let elems: Vec> = res.iter().collect(); - assert!(elems.len() == vec!(NewHyperObject!("k", "B", "v", "B",), NewHyperObject!("k", "C", "v", "C",), NewHyperObject!("k", "D", "v", "D",)).len()); + assert_eq!(elems.len(), vec!(NewHyperObject!(r"k", r"B", r"v", r"B",), NewHyperObject!(r"k", r"C", r"v", r"C",), NewHyperObject!(r"k", r"D", r"v", r"D",)).len()); - let res = client.search("kv", vec!(HyperPredicate::new("v", GREATER_EQUAL, "B"), HyperPredicate::new("v", LESS_EQUAL, "D"))); + let res = client.search(r"kv", vec!(HyperPredicate::new(r"v", GREATER_EQUAL, r"B"), HyperPredicate::new(r"v", LESS_EQUAL, r"D"))); let elems: Vec> = res.iter().collect(); - assert!(elems.len() == vec!(NewHyperObject!("k", "B", "v", "B",), NewHyperObject!("k", "C", "v", "C",), NewHyperObject!("k", "D", "v", "D",)).len()); + assert_eq!(elems.len(), vec!(NewHyperObject!(r"k", r"B", r"v", r"B",), NewHyperObject!(r"k", r"C", r"v", r"C",), NewHyperObject!(r"k", r"D", r"v", r"D",)).len()); } diff --git a/test/rust/RegexSearch.rs b/test/rust/RegexSearch.rs index 5348b25cc..bf936d119 100644 --- a/test/rust/RegexSearch.rs +++ b/test/rust/RegexSearch.rs @@ -151,150 +151,150 @@ fn main() { let args = os::args(); let mut client = Client::new(FromStr::from_str(format!("{}:{}", args[1], args[2]).as_slice()).unwrap()).unwrap(); - match client.put("kv", "foo/foo/foo", HyperObject::new()) { + match client.put(r"kv", r"foo/foo/foo", HyperObject::new()) { Ok(()) => (), Err(err) => panic!(err), } - match client.put("kv", "foo/foo/bar", HyperObject::new()) { + match client.put(r"kv", r"foo/foo/bar", HyperObject::new()) { Ok(()) => (), Err(err) => panic!(err), } - match client.put("kv", "foo/foo/baz", HyperObject::new()) { + match client.put(r"kv", r"foo/foo/baz", HyperObject::new()) { Ok(()) => (), Err(err) => panic!(err), } - match client.put("kv", "foo/bar/foo", HyperObject::new()) { + match client.put(r"kv", r"foo/bar/foo", HyperObject::new()) { Ok(()) => (), Err(err) => panic!(err), } - match client.put("kv", "foo/bar/bar", HyperObject::new()) { + match client.put(r"kv", r"foo/bar/bar", HyperObject::new()) { Ok(()) => (), Err(err) => panic!(err), } - match client.put("kv", "foo/bar/baz", HyperObject::new()) { + match client.put(r"kv", r"foo/bar/baz", HyperObject::new()) { Ok(()) => (), Err(err) => panic!(err), } - match client.put("kv", "foo/baz/foo", HyperObject::new()) { + match client.put(r"kv", r"foo/baz/foo", HyperObject::new()) { Ok(()) => (), Err(err) => panic!(err), } - match client.put("kv", "foo/baz/bar", HyperObject::new()) { + match client.put(r"kv", r"foo/baz/bar", HyperObject::new()) { Ok(()) => (), Err(err) => panic!(err), } - match client.put("kv", "foo/baz/baz", HyperObject::new()) { + match client.put(r"kv", r"foo/baz/baz", HyperObject::new()) { Ok(()) => (), Err(err) => panic!(err), } - match client.put("kv", "bar/foo/foo", HyperObject::new()) { + match client.put(r"kv", r"bar/foo/foo", HyperObject::new()) { Ok(()) => (), Err(err) => panic!(err), } - match client.put("kv", "bar/foo/bar", HyperObject::new()) { + match client.put(r"kv", r"bar/foo/bar", HyperObject::new()) { Ok(()) => (), Err(err) => panic!(err), } - match client.put("kv", "bar/foo/baz", HyperObject::new()) { + match client.put(r"kv", r"bar/foo/baz", HyperObject::new()) { Ok(()) => (), Err(err) => panic!(err), } - match client.put("kv", "bar/bar/foo", HyperObject::new()) { + match client.put(r"kv", r"bar/bar/foo", HyperObject::new()) { Ok(()) => (), Err(err) => panic!(err), } - match client.put("kv", "bar/bar/bar", HyperObject::new()) { + match client.put(r"kv", r"bar/bar/bar", HyperObject::new()) { Ok(()) => (), Err(err) => panic!(err), } - match client.put("kv", "bar/bar/baz", HyperObject::new()) { + match client.put(r"kv", r"bar/bar/baz", HyperObject::new()) { Ok(()) => (), Err(err) => panic!(err), } - match client.put("kv", "bar/baz/foo", HyperObject::new()) { + match client.put(r"kv", r"bar/baz/foo", HyperObject::new()) { Ok(()) => (), Err(err) => panic!(err), } - match client.put("kv", "bar/baz/bar", HyperObject::new()) { + match client.put(r"kv", r"bar/baz/bar", HyperObject::new()) { Ok(()) => (), Err(err) => panic!(err), } - match client.put("kv", "bar/baz/baz", HyperObject::new()) { + match client.put(r"kv", r"bar/baz/baz", HyperObject::new()) { Ok(()) => (), Err(err) => panic!(err), } - match client.put("kv", "baz/foo/foo", HyperObject::new()) { + match client.put(r"kv", r"baz/foo/foo", HyperObject::new()) { Ok(()) => (), Err(err) => panic!(err), } - match client.put("kv", "baz/foo/bar", HyperObject::new()) { + match client.put(r"kv", r"baz/foo/bar", HyperObject::new()) { Ok(()) => (), Err(err) => panic!(err), } - match client.put("kv", "baz/foo/baz", HyperObject::new()) { + match client.put(r"kv", r"baz/foo/baz", HyperObject::new()) { Ok(()) => (), Err(err) => panic!(err), } - match client.put("kv", "baz/bar/foo", HyperObject::new()) { + match client.put(r"kv", r"baz/bar/foo", HyperObject::new()) { Ok(()) => (), Err(err) => panic!(err), } - match client.put("kv", "baz/bar/bar", HyperObject::new()) { + match client.put(r"kv", r"baz/bar/bar", HyperObject::new()) { Ok(()) => (), Err(err) => panic!(err), } - match client.put("kv", "baz/bar/baz", HyperObject::new()) { + match client.put(r"kv", r"baz/bar/baz", HyperObject::new()) { Ok(()) => (), Err(err) => panic!(err), } - match client.put("kv", "baz/baz/foo", HyperObject::new()) { + match client.put(r"kv", r"baz/baz/foo", HyperObject::new()) { Ok(()) => (), Err(err) => panic!(err), } - match client.put("kv", "baz/baz/bar", HyperObject::new()) { + match client.put(r"kv", r"baz/baz/bar", HyperObject::new()) { Ok(()) => (), Err(err) => panic!(err), } - match client.put("kv", "baz/baz/baz", HyperObject::new()) { + match client.put(r"kv", r"baz/baz/baz", HyperObject::new()) { Ok(()) => (), Err(err) => panic!(err), } - let res = client.search("kv", vec!(HyperPredicate::new("k", REGEX, "^foo"))); + let res = client.search(r"kv", vec!(HyperPredicate::new(r"k", REGEX, r"^foo"))); let elems: Vec> = res.iter().collect(); - assert!(elems.len() == vec!(NewHyperObject!("k", "foo/foo/foo",), NewHyperObject!("k", "foo/foo/bar",), NewHyperObject!("k", "foo/foo/baz",), NewHyperObject!("k", "foo/bar/foo",), NewHyperObject!("k", "foo/bar/bar",), NewHyperObject!("k", "foo/bar/baz",), NewHyperObject!("k", "foo/baz/foo",), NewHyperObject!("k", "foo/baz/bar",), NewHyperObject!("k", "foo/baz/baz",)).len()); + assert_eq!(elems.len(), vec!(NewHyperObject!(r"k", r"foo/foo/foo",), NewHyperObject!(r"k", r"foo/foo/bar",), NewHyperObject!(r"k", r"foo/foo/baz",), NewHyperObject!(r"k", r"foo/bar/foo",), NewHyperObject!(r"k", r"foo/bar/bar",), NewHyperObject!(r"k", r"foo/bar/baz",), NewHyperObject!(r"k", r"foo/baz/foo",), NewHyperObject!(r"k", r"foo/baz/bar",), NewHyperObject!(r"k", r"foo/baz/baz",)).len()); - let res = client.search("kv", vec!(HyperPredicate::new("k", REGEX, "foo$"))); + let res = client.search(r"kv", vec!(HyperPredicate::new(r"k", REGEX, r"foo$"))); let elems: Vec> = res.iter().collect(); - assert!(elems.len() == vec!(NewHyperObject!("k", "foo/foo/foo",), NewHyperObject!("k", "foo/bar/foo",), NewHyperObject!("k", "foo/baz/foo",), NewHyperObject!("k", "bar/foo/foo",), NewHyperObject!("k", "bar/bar/foo",), NewHyperObject!("k", "bar/baz/foo",), NewHyperObject!("k", "baz/foo/foo",), NewHyperObject!("k", "baz/bar/foo",), NewHyperObject!("k", "baz/baz/foo",)).len()); + assert_eq!(elems.len(), vec!(NewHyperObject!(r"k", r"foo/foo/foo",), NewHyperObject!(r"k", r"foo/bar/foo",), NewHyperObject!(r"k", r"foo/baz/foo",), NewHyperObject!(r"k", r"bar/foo/foo",), NewHyperObject!(r"k", r"bar/bar/foo",), NewHyperObject!(r"k", r"bar/baz/foo",), NewHyperObject!(r"k", r"baz/foo/foo",), NewHyperObject!(r"k", r"baz/bar/foo",), NewHyperObject!(r"k", r"baz/baz/foo",)).len()); - let res = client.search("kv", vec!(HyperPredicate::new("k", REGEX, "^b.*/foo/.*$"))); + let res = client.search(r"kv", vec!(HyperPredicate::new(r"k", REGEX, r"^b.*/foo/.*$"))); let elems: Vec> = res.iter().collect(); - assert!(elems.len() == vec!(NewHyperObject!("k", "bar/foo/foo",), NewHyperObject!("k", "bar/foo/bar",), NewHyperObject!("k", "bar/foo/baz",), NewHyperObject!("k", "baz/foo/foo",), NewHyperObject!("k", "baz/foo/bar",), NewHyperObject!("k", "baz/foo/baz",)).len()); + assert_eq!(elems.len(), vec!(NewHyperObject!(r"k", r"bar/foo/foo",), NewHyperObject!(r"k", r"bar/foo/bar",), NewHyperObject!(r"k", r"bar/foo/baz",), NewHyperObject!(r"k", r"baz/foo/foo",), NewHyperObject!(r"k", r"baz/foo/bar",), NewHyperObject!(r"k", r"baz/foo/baz",)).len()); } diff --git a/test/sh/bindings.rust.Basic.sh b/test/sh/bindings.rust.Basic.sh index e695f4064..3bef4218e 100755 --- a/test/sh/bindings.rust.Basic.sh +++ b/test/sh/bindings.rust.Basic.sh @@ -1,5 +1,5 @@ #!/bin/sh -rustc -L rust_hyperdex/target -o "${HYPERDEX_BUILDDIR}"/test/rust/Basic "${HYPERDEX_SRCDIR}"/test/rust/Basic.rs +rustc -g -L rust_hyperdex/target -o "${HYPERDEX_BUILDDIR}"/test/rust/Basic "${HYPERDEX_SRCDIR}"/test/rust/Basic.rs python2 "${HYPERDEX_SRCDIR}"/test/runner.py --space="space kv key k attribute v" --daemons=1 -- \ "${HYPERDEX_BUILDDIR}"/test/rust/Basic {HOST} {PORT} diff --git a/test/sh/bindings.rust.BasicSearch.sh b/test/sh/bindings.rust.BasicSearch.sh index 5f9cfe199..9d8467de5 100755 --- a/test/sh/bindings.rust.BasicSearch.sh +++ b/test/sh/bindings.rust.BasicSearch.sh @@ -1,5 +1,5 @@ #!/bin/sh -rustc -L rust_hyperdex/target -o "${HYPERDEX_BUILDDIR}"/test/rust/BasicSearch "${HYPERDEX_SRCDIR}"/test/rust/BasicSearch.rs +rustc -g -L rust_hyperdex/target -o "${HYPERDEX_BUILDDIR}"/test/rust/BasicSearch "${HYPERDEX_SRCDIR}"/test/rust/BasicSearch.rs python2 "${HYPERDEX_SRCDIR}"/test/runner.py --space="space kv key k attribute v" --daemons=1 -- \ "${HYPERDEX_BUILDDIR}"/test/rust/BasicSearch {HOST} {PORT} diff --git a/test/sh/bindings.rust.CondPut.sh b/test/sh/bindings.rust.CondPut.sh index 57c9c3c4d..6bb61d6c3 100755 --- a/test/sh/bindings.rust.CondPut.sh +++ b/test/sh/bindings.rust.CondPut.sh @@ -1,5 +1,5 @@ #!/bin/sh -rustc -L rust_hyperdex/target -o "${HYPERDEX_BUILDDIR}"/test/rust/CondPut "${HYPERDEX_SRCDIR}"/test/rust/CondPut.rs +rustc -g -L rust_hyperdex/target -o "${HYPERDEX_BUILDDIR}"/test/rust/CondPut "${HYPERDEX_SRCDIR}"/test/rust/CondPut.rs python2 "${HYPERDEX_SRCDIR}"/test/runner.py --space="space kv key k attribute v" --daemons=1 -- \ "${HYPERDEX_BUILDDIR}"/test/rust/CondPut {HOST} {PORT} diff --git a/test/sh/bindings.rust.DataTypeFloat.sh b/test/sh/bindings.rust.DataTypeFloat.sh index a84b38022..81a691171 100755 --- a/test/sh/bindings.rust.DataTypeFloat.sh +++ b/test/sh/bindings.rust.DataTypeFloat.sh @@ -1,5 +1,5 @@ #!/bin/sh -rustc -L rust_hyperdex/target -o "${HYPERDEX_BUILDDIR}"/test/rust/DataTypeFloat "${HYPERDEX_SRCDIR}"/test/rust/DataTypeFloat.rs +rustc -g -L rust_hyperdex/target -o "${HYPERDEX_BUILDDIR}"/test/rust/DataTypeFloat "${HYPERDEX_SRCDIR}"/test/rust/DataTypeFloat.rs python2 "${HYPERDEX_SRCDIR}"/test/runner.py --space="space kv key k attributes float v" --daemons=1 -- \ "${HYPERDEX_BUILDDIR}"/test/rust/DataTypeFloat {HOST} {PORT} diff --git a/test/sh/bindings.rust.DataTypeInt.sh b/test/sh/bindings.rust.DataTypeInt.sh index d20a298aa..26a91ed3e 100755 --- a/test/sh/bindings.rust.DataTypeInt.sh +++ b/test/sh/bindings.rust.DataTypeInt.sh @@ -1,5 +1,5 @@ #!/bin/sh -rustc -L rust_hyperdex/target -o "${HYPERDEX_BUILDDIR}"/test/rust/DataTypeInt "${HYPERDEX_SRCDIR}"/test/rust/DataTypeInt.rs +rustc -g -L rust_hyperdex/target -o "${HYPERDEX_BUILDDIR}"/test/rust/DataTypeInt "${HYPERDEX_SRCDIR}"/test/rust/DataTypeInt.rs python2 "${HYPERDEX_SRCDIR}"/test/runner.py --space="space kv key k attributes int v" --daemons=1 -- \ "${HYPERDEX_BUILDDIR}"/test/rust/DataTypeInt {HOST} {PORT} diff --git a/test/sh/bindings.rust.DataTypeListFloat.sh b/test/sh/bindings.rust.DataTypeListFloat.sh index 3d55c41ff..1f980fb36 100755 --- a/test/sh/bindings.rust.DataTypeListFloat.sh +++ b/test/sh/bindings.rust.DataTypeListFloat.sh @@ -1,5 +1,5 @@ #!/bin/sh -rustc -L rust_hyperdex/target -o "${HYPERDEX_BUILDDIR}"/test/rust/DataTypeListFloat "${HYPERDEX_SRCDIR}"/test/rust/DataTypeListFloat.rs +rustc -g -L rust_hyperdex/target -o "${HYPERDEX_BUILDDIR}"/test/rust/DataTypeListFloat "${HYPERDEX_SRCDIR}"/test/rust/DataTypeListFloat.rs python2 "${HYPERDEX_SRCDIR}"/test/runner.py --space="space kv key k attributes list(float) v" --daemons=1 -- \ "${HYPERDEX_BUILDDIR}"/test/rust/DataTypeListFloat {HOST} {PORT} diff --git a/test/sh/bindings.rust.DataTypeListInt.sh b/test/sh/bindings.rust.DataTypeListInt.sh index ca89bbdb9..f0bbc6703 100755 --- a/test/sh/bindings.rust.DataTypeListInt.sh +++ b/test/sh/bindings.rust.DataTypeListInt.sh @@ -1,5 +1,5 @@ #!/bin/sh -rustc -L rust_hyperdex/target -o "${HYPERDEX_BUILDDIR}"/test/rust/DataTypeListInt "${HYPERDEX_SRCDIR}"/test/rust/DataTypeListInt.rs +rustc -g -L rust_hyperdex/target -o "${HYPERDEX_BUILDDIR}"/test/rust/DataTypeListInt "${HYPERDEX_SRCDIR}"/test/rust/DataTypeListInt.rs python2 "${HYPERDEX_SRCDIR}"/test/runner.py --space="space kv key k attributes list(int) v" --daemons=1 -- \ "${HYPERDEX_BUILDDIR}"/test/rust/DataTypeListInt {HOST} {PORT} diff --git a/test/sh/bindings.rust.DataTypeListString.sh b/test/sh/bindings.rust.DataTypeListString.sh index 408b78294..de73ca456 100755 --- a/test/sh/bindings.rust.DataTypeListString.sh +++ b/test/sh/bindings.rust.DataTypeListString.sh @@ -1,5 +1,5 @@ #!/bin/sh -rustc -L rust_hyperdex/target -o "${HYPERDEX_BUILDDIR}"/test/rust/DataTypeListString "${HYPERDEX_SRCDIR}"/test/rust/DataTypeListString.rs +rustc -g -L rust_hyperdex/target -o "${HYPERDEX_BUILDDIR}"/test/rust/DataTypeListString "${HYPERDEX_SRCDIR}"/test/rust/DataTypeListString.rs python2 "${HYPERDEX_SRCDIR}"/test/runner.py --space="space kv key k attributes list(string) v" --daemons=1 -- \ "${HYPERDEX_BUILDDIR}"/test/rust/DataTypeListString {HOST} {PORT} diff --git a/test/sh/bindings.rust.DataTypeMapFloatFloat.sh b/test/sh/bindings.rust.DataTypeMapFloatFloat.sh index e1ec288e8..8c762d322 100755 --- a/test/sh/bindings.rust.DataTypeMapFloatFloat.sh +++ b/test/sh/bindings.rust.DataTypeMapFloatFloat.sh @@ -1,5 +1,5 @@ #!/bin/sh -rustc -L rust_hyperdex/target -o "${HYPERDEX_BUILDDIR}"/test/rust/DataTypeMapFloatFloat "${HYPERDEX_SRCDIR}"/test/rust/DataTypeMapFloatFloat.rs +rustc -g -L rust_hyperdex/target -o "${HYPERDEX_BUILDDIR}"/test/rust/DataTypeMapFloatFloat "${HYPERDEX_SRCDIR}"/test/rust/DataTypeMapFloatFloat.rs python2 "${HYPERDEX_SRCDIR}"/test/runner.py --space="space kv key k attributes map(float, float) v" --daemons=1 -- \ "${HYPERDEX_BUILDDIR}"/test/rust/DataTypeMapFloatFloat {HOST} {PORT} diff --git a/test/sh/bindings.rust.DataTypeMapFloatInt.sh b/test/sh/bindings.rust.DataTypeMapFloatInt.sh index a982027f0..21af695c1 100755 --- a/test/sh/bindings.rust.DataTypeMapFloatInt.sh +++ b/test/sh/bindings.rust.DataTypeMapFloatInt.sh @@ -1,5 +1,5 @@ #!/bin/sh -rustc -L rust_hyperdex/target -o "${HYPERDEX_BUILDDIR}"/test/rust/DataTypeMapFloatInt "${HYPERDEX_SRCDIR}"/test/rust/DataTypeMapFloatInt.rs +rustc -g -L rust_hyperdex/target -o "${HYPERDEX_BUILDDIR}"/test/rust/DataTypeMapFloatInt "${HYPERDEX_SRCDIR}"/test/rust/DataTypeMapFloatInt.rs python2 "${HYPERDEX_SRCDIR}"/test/runner.py --space="space kv key k attributes map(float, int) v" --daemons=1 -- \ "${HYPERDEX_BUILDDIR}"/test/rust/DataTypeMapFloatInt {HOST} {PORT} diff --git a/test/sh/bindings.rust.DataTypeMapFloatString.sh b/test/sh/bindings.rust.DataTypeMapFloatString.sh index 158d88cf8..ecb0758cf 100755 --- a/test/sh/bindings.rust.DataTypeMapFloatString.sh +++ b/test/sh/bindings.rust.DataTypeMapFloatString.sh @@ -1,5 +1,5 @@ #!/bin/sh -rustc -L rust_hyperdex/target -o "${HYPERDEX_BUILDDIR}"/test/rust/DataTypeMapFloatString "${HYPERDEX_SRCDIR}"/test/rust/DataTypeMapFloatString.rs +rustc -g -L rust_hyperdex/target -o "${HYPERDEX_BUILDDIR}"/test/rust/DataTypeMapFloatString "${HYPERDEX_SRCDIR}"/test/rust/DataTypeMapFloatString.rs python2 "${HYPERDEX_SRCDIR}"/test/runner.py --space="space kv key k attributes map(float, string) v" --daemons=1 -- \ "${HYPERDEX_BUILDDIR}"/test/rust/DataTypeMapFloatString {HOST} {PORT} diff --git a/test/sh/bindings.rust.DataTypeMapIntFloat.sh b/test/sh/bindings.rust.DataTypeMapIntFloat.sh index b32724ba1..08c359dd8 100755 --- a/test/sh/bindings.rust.DataTypeMapIntFloat.sh +++ b/test/sh/bindings.rust.DataTypeMapIntFloat.sh @@ -1,5 +1,5 @@ #!/bin/sh -rustc -L rust_hyperdex/target -o "${HYPERDEX_BUILDDIR}"/test/rust/DataTypeMapIntFloat "${HYPERDEX_SRCDIR}"/test/rust/DataTypeMapIntFloat.rs +rustc -g -L rust_hyperdex/target -o "${HYPERDEX_BUILDDIR}"/test/rust/DataTypeMapIntFloat "${HYPERDEX_SRCDIR}"/test/rust/DataTypeMapIntFloat.rs python2 "${HYPERDEX_SRCDIR}"/test/runner.py --space="space kv key k attributes map(int, float) v" --daemons=1 -- \ "${HYPERDEX_BUILDDIR}"/test/rust/DataTypeMapIntFloat {HOST} {PORT} diff --git a/test/sh/bindings.rust.DataTypeMapIntInt.sh b/test/sh/bindings.rust.DataTypeMapIntInt.sh index d90b0bd58..19645371e 100755 --- a/test/sh/bindings.rust.DataTypeMapIntInt.sh +++ b/test/sh/bindings.rust.DataTypeMapIntInt.sh @@ -1,5 +1,5 @@ #!/bin/sh -rustc -L rust_hyperdex/target -o "${HYPERDEX_BUILDDIR}"/test/rust/DataTypeMapIntInt "${HYPERDEX_SRCDIR}"/test/rust/DataTypeMapIntInt.rs +rustc -g -L rust_hyperdex/target -o "${HYPERDEX_BUILDDIR}"/test/rust/DataTypeMapIntInt "${HYPERDEX_SRCDIR}"/test/rust/DataTypeMapIntInt.rs python2 "${HYPERDEX_SRCDIR}"/test/runner.py --space="space kv key k attributes map(int, int) v" --daemons=1 -- \ "${HYPERDEX_BUILDDIR}"/test/rust/DataTypeMapIntInt {HOST} {PORT} diff --git a/test/sh/bindings.rust.DataTypeMapIntString.sh b/test/sh/bindings.rust.DataTypeMapIntString.sh index 54d4ffa54..76cdeaf89 100755 --- a/test/sh/bindings.rust.DataTypeMapIntString.sh +++ b/test/sh/bindings.rust.DataTypeMapIntString.sh @@ -1,5 +1,5 @@ #!/bin/sh -rustc -L rust_hyperdex/target -o "${HYPERDEX_BUILDDIR}"/test/rust/DataTypeMapIntString "${HYPERDEX_SRCDIR}"/test/rust/DataTypeMapIntString.rs +rustc -g -L rust_hyperdex/target -o "${HYPERDEX_BUILDDIR}"/test/rust/DataTypeMapIntString "${HYPERDEX_SRCDIR}"/test/rust/DataTypeMapIntString.rs python2 "${HYPERDEX_SRCDIR}"/test/runner.py --space="space kv key k attributes map(int, string) v" --daemons=1 -- \ "${HYPERDEX_BUILDDIR}"/test/rust/DataTypeMapIntString {HOST} {PORT} diff --git a/test/sh/bindings.rust.DataTypeMapStringFloat.sh b/test/sh/bindings.rust.DataTypeMapStringFloat.sh index d1fde7b1b..3d51f8ad1 100755 --- a/test/sh/bindings.rust.DataTypeMapStringFloat.sh +++ b/test/sh/bindings.rust.DataTypeMapStringFloat.sh @@ -1,5 +1,5 @@ #!/bin/sh -rustc -L rust_hyperdex/target -o "${HYPERDEX_BUILDDIR}"/test/rust/DataTypeMapStringFloat "${HYPERDEX_SRCDIR}"/test/rust/DataTypeMapStringFloat.rs +rustc -g -L rust_hyperdex/target -o "${HYPERDEX_BUILDDIR}"/test/rust/DataTypeMapStringFloat "${HYPERDEX_SRCDIR}"/test/rust/DataTypeMapStringFloat.rs python2 "${HYPERDEX_SRCDIR}"/test/runner.py --space="space kv key k attributes map(string, float) v" --daemons=1 -- \ "${HYPERDEX_BUILDDIR}"/test/rust/DataTypeMapStringFloat {HOST} {PORT} diff --git a/test/sh/bindings.rust.DataTypeMapStringInt.sh b/test/sh/bindings.rust.DataTypeMapStringInt.sh index e81354d8a..f1adc54f8 100755 --- a/test/sh/bindings.rust.DataTypeMapStringInt.sh +++ b/test/sh/bindings.rust.DataTypeMapStringInt.sh @@ -1,5 +1,5 @@ #!/bin/sh -rustc -L rust_hyperdex/target -o "${HYPERDEX_BUILDDIR}"/test/rust/DataTypeMapStringInt "${HYPERDEX_SRCDIR}"/test/rust/DataTypeMapStringInt.rs +rustc -g -L rust_hyperdex/target -o "${HYPERDEX_BUILDDIR}"/test/rust/DataTypeMapStringInt "${HYPERDEX_SRCDIR}"/test/rust/DataTypeMapStringInt.rs python2 "${HYPERDEX_SRCDIR}"/test/runner.py --space="space kv key k attributes map(string, int) v" --daemons=1 -- \ "${HYPERDEX_BUILDDIR}"/test/rust/DataTypeMapStringInt {HOST} {PORT} diff --git a/test/sh/bindings.rust.DataTypeMapStringString.sh b/test/sh/bindings.rust.DataTypeMapStringString.sh index cd77f7009..474342aad 100755 --- a/test/sh/bindings.rust.DataTypeMapStringString.sh +++ b/test/sh/bindings.rust.DataTypeMapStringString.sh @@ -1,5 +1,5 @@ #!/bin/sh -rustc -L rust_hyperdex/target -o "${HYPERDEX_BUILDDIR}"/test/rust/DataTypeMapStringString "${HYPERDEX_SRCDIR}"/test/rust/DataTypeMapStringString.rs +rustc -g -L rust_hyperdex/target -o "${HYPERDEX_BUILDDIR}"/test/rust/DataTypeMapStringString "${HYPERDEX_SRCDIR}"/test/rust/DataTypeMapStringString.rs python2 "${HYPERDEX_SRCDIR}"/test/runner.py --space="space kv key k attributes map(string, string) v" --daemons=1 -- \ "${HYPERDEX_BUILDDIR}"/test/rust/DataTypeMapStringString {HOST} {PORT} diff --git a/test/sh/bindings.rust.DataTypeSetFloat.sh b/test/sh/bindings.rust.DataTypeSetFloat.sh index 4151fbb38..153c3f995 100755 --- a/test/sh/bindings.rust.DataTypeSetFloat.sh +++ b/test/sh/bindings.rust.DataTypeSetFloat.sh @@ -1,5 +1,5 @@ #!/bin/sh -rustc -L rust_hyperdex/target -o "${HYPERDEX_BUILDDIR}"/test/rust/DataTypeSetFloat "${HYPERDEX_SRCDIR}"/test/rust/DataTypeSetFloat.rs +rustc -g -L rust_hyperdex/target -o "${HYPERDEX_BUILDDIR}"/test/rust/DataTypeSetFloat "${HYPERDEX_SRCDIR}"/test/rust/DataTypeSetFloat.rs python2 "${HYPERDEX_SRCDIR}"/test/runner.py --space="space kv key k attributes set(float) v" --daemons=1 -- \ "${HYPERDEX_BUILDDIR}"/test/rust/DataTypeSetFloat {HOST} {PORT} diff --git a/test/sh/bindings.rust.DataTypeSetInt.sh b/test/sh/bindings.rust.DataTypeSetInt.sh index c8bc1770b..3b2003aa5 100755 --- a/test/sh/bindings.rust.DataTypeSetInt.sh +++ b/test/sh/bindings.rust.DataTypeSetInt.sh @@ -1,5 +1,5 @@ #!/bin/sh -rustc -L rust_hyperdex/target -o "${HYPERDEX_BUILDDIR}"/test/rust/DataTypeSetInt "${HYPERDEX_SRCDIR}"/test/rust/DataTypeSetInt.rs +rustc -g -L rust_hyperdex/target -o "${HYPERDEX_BUILDDIR}"/test/rust/DataTypeSetInt "${HYPERDEX_SRCDIR}"/test/rust/DataTypeSetInt.rs python2 "${HYPERDEX_SRCDIR}"/test/runner.py --space="space kv key k attributes set(int) v" --daemons=1 -- \ "${HYPERDEX_BUILDDIR}"/test/rust/DataTypeSetInt {HOST} {PORT} diff --git a/test/sh/bindings.rust.DataTypeSetString.sh b/test/sh/bindings.rust.DataTypeSetString.sh index 250a50451..6a10d7615 100755 --- a/test/sh/bindings.rust.DataTypeSetString.sh +++ b/test/sh/bindings.rust.DataTypeSetString.sh @@ -1,5 +1,5 @@ #!/bin/sh -rustc -L rust_hyperdex/target -o "${HYPERDEX_BUILDDIR}"/test/rust/DataTypeSetString "${HYPERDEX_SRCDIR}"/test/rust/DataTypeSetString.rs +rustc -g -L rust_hyperdex/target -o "${HYPERDEX_BUILDDIR}"/test/rust/DataTypeSetString "${HYPERDEX_SRCDIR}"/test/rust/DataTypeSetString.rs python2 "${HYPERDEX_SRCDIR}"/test/runner.py --space="space kv key k attributes set(string) v" --daemons=1 -- \ "${HYPERDEX_BUILDDIR}"/test/rust/DataTypeSetString {HOST} {PORT} diff --git a/test/sh/bindings.rust.DataTypeString.sh b/test/sh/bindings.rust.DataTypeString.sh index 3c42fb537..ca630410c 100755 --- a/test/sh/bindings.rust.DataTypeString.sh +++ b/test/sh/bindings.rust.DataTypeString.sh @@ -1,5 +1,5 @@ #!/bin/sh -rustc -L rust_hyperdex/target -o "${HYPERDEX_BUILDDIR}"/test/rust/DataTypeString "${HYPERDEX_SRCDIR}"/test/rust/DataTypeString.rs +rustc -g -L rust_hyperdex/target -o "${HYPERDEX_BUILDDIR}"/test/rust/DataTypeString "${HYPERDEX_SRCDIR}"/test/rust/DataTypeString.rs python2 "${HYPERDEX_SRCDIR}"/test/runner.py --space="space kv key k attributes v" --daemons=1 -- \ "${HYPERDEX_BUILDDIR}"/test/rust/DataTypeString {HOST} {PORT} diff --git a/test/sh/bindings.rust.LengthString.sh b/test/sh/bindings.rust.LengthString.sh index 6b043c6b1..6121cbb9b 100755 --- a/test/sh/bindings.rust.LengthString.sh +++ b/test/sh/bindings.rust.LengthString.sh @@ -1,5 +1,5 @@ #!/bin/sh -rustc -L rust_hyperdex/target -o "${HYPERDEX_BUILDDIR}"/test/rust/LengthString "${HYPERDEX_SRCDIR}"/test/rust/LengthString.rs +rustc -g -L rust_hyperdex/target -o "${HYPERDEX_BUILDDIR}"/test/rust/LengthString "${HYPERDEX_SRCDIR}"/test/rust/LengthString.rs python2 "${HYPERDEX_SRCDIR}"/test/runner.py --space="space kv key k" --daemons=1 -- \ "${HYPERDEX_BUILDDIR}"/test/rust/LengthString {HOST} {PORT} diff --git a/test/sh/bindings.rust.MultiAttribute.sh b/test/sh/bindings.rust.MultiAttribute.sh index aa2f900b7..ad90657e0 100755 --- a/test/sh/bindings.rust.MultiAttribute.sh +++ b/test/sh/bindings.rust.MultiAttribute.sh @@ -1,5 +1,5 @@ #!/bin/sh -rustc -L rust_hyperdex/target -o "${HYPERDEX_BUILDDIR}"/test/rust/MultiAttribute "${HYPERDEX_SRCDIR}"/test/rust/MultiAttribute.rs +rustc -g -L rust_hyperdex/target -o "${HYPERDEX_BUILDDIR}"/test/rust/MultiAttribute "${HYPERDEX_SRCDIR}"/test/rust/MultiAttribute.rs python2 "${HYPERDEX_SRCDIR}"/test/runner.py --space="space kv key k attributes v1, v2" --daemons=1 -- \ "${HYPERDEX_BUILDDIR}"/test/rust/MultiAttribute {HOST} {PORT} diff --git a/test/sh/bindings.rust.RangeSearchInt.sh b/test/sh/bindings.rust.RangeSearchInt.sh index 9d4f26f3f..fb2277284 100755 --- a/test/sh/bindings.rust.RangeSearchInt.sh +++ b/test/sh/bindings.rust.RangeSearchInt.sh @@ -1,5 +1,5 @@ #!/bin/sh -rustc -L rust_hyperdex/target -o "${HYPERDEX_BUILDDIR}"/test/rust/RangeSearchInt "${HYPERDEX_SRCDIR}"/test/rust/RangeSearchInt.rs +rustc -g -L rust_hyperdex/target -o "${HYPERDEX_BUILDDIR}"/test/rust/RangeSearchInt "${HYPERDEX_SRCDIR}"/test/rust/RangeSearchInt.rs python2 "${HYPERDEX_SRCDIR}"/test/runner.py --space="space kv key int k attribute int v" --daemons=1 -- \ "${HYPERDEX_BUILDDIR}"/test/rust/RangeSearchInt {HOST} {PORT} diff --git a/test/sh/bindings.rust.RangeSearchString.sh b/test/sh/bindings.rust.RangeSearchString.sh index e154c34ed..64793cac5 100755 --- a/test/sh/bindings.rust.RangeSearchString.sh +++ b/test/sh/bindings.rust.RangeSearchString.sh @@ -1,5 +1,5 @@ #!/bin/sh -rustc -L rust_hyperdex/target -o "${HYPERDEX_BUILDDIR}"/test/rust/RangeSearchString "${HYPERDEX_SRCDIR}"/test/rust/RangeSearchString.rs +rustc -g -L rust_hyperdex/target -o "${HYPERDEX_BUILDDIR}"/test/rust/RangeSearchString "${HYPERDEX_SRCDIR}"/test/rust/RangeSearchString.rs python2 "${HYPERDEX_SRCDIR}"/test/runner.py --space="space kv key k attribute v" --daemons=1 -- \ "${HYPERDEX_BUILDDIR}"/test/rust/RangeSearchString {HOST} {PORT} diff --git a/test/sh/bindings.rust.RegexSearch.sh b/test/sh/bindings.rust.RegexSearch.sh index ee893c4de..f6bec407a 100755 --- a/test/sh/bindings.rust.RegexSearch.sh +++ b/test/sh/bindings.rust.RegexSearch.sh @@ -1,5 +1,5 @@ #!/bin/sh -rustc -L rust_hyperdex/target -o "${HYPERDEX_BUILDDIR}"/test/rust/RegexSearch "${HYPERDEX_SRCDIR}"/test/rust/RegexSearch.rs +rustc -g -L rust_hyperdex/target -o "${HYPERDEX_BUILDDIR}"/test/rust/RegexSearch "${HYPERDEX_SRCDIR}"/test/rust/RegexSearch.rs python2 "${HYPERDEX_SRCDIR}"/test/runner.py --space="space kv key k" --daemons=1 -- \ "${HYPERDEX_BUILDDIR}"/test/rust/RegexSearch {HOST} {PORT} From cfd679a2e35f97de8df57e1ff1eb4c4c7bf24297 Mon Sep 17 00:00:00 2001 From: Derek Chiang Date: Tue, 3 Mar 2015 23:49:15 -0500 Subject: [PATCH 6/7] Undo accidental changes to Makefile.am --- Makefile.am | 45 ++++++++++++++++++++++----------------------- 1 file changed, 22 insertions(+), 23 deletions(-) diff --git a/Makefile.am b/Makefile.am index 4b8263f5a..544c9927e 100644 --- a/Makefile.am +++ b/Makefile.am @@ -298,12 +298,12 @@ hyperdex_daemon_SOURCES += daemon/state_transfer_manager_transfer_in_state.cc hyperdex_daemon_SOURCES += daemon/state_transfer_manager_transfer_out_state.cc hyperdex_daemon_CXXFLAGS = $(AM_CXXFLAGS) $(CXXFLAGS) hyperdex_daemon_LDADD = +hyperdex_daemon_LDADD += $(TREADSTONE_LIBS) hyperdex_daemon_LDADD += $(MACAROONS_LIBS) hyperdex_daemon_LDADD += $(REPLICANT_LIBS) hyperdex_daemon_LDADD += $(HYPERLEVELDB_LIBS) hyperdex_daemon_LDADD += $(BUSYBEE_LIBS) hyperdex_daemon_LDADD += $(E_LIBS) -hyperdex_daemon_LDADD += $(TREADSTONE_LIBS) hyperdex_daemon_LDADD += -lpopt -lglog $(LRT_LDFLAGS) -lpthread man/hyperdex-daemon.1: man/hyperdex-daemon.1.h2m daemon/main.cc | hyperdex-daemon$(EXEEXT) $(help2man_verbose)help2man $(HELP2MAN_FLAGS) --section 1 --output $@ --include $< ${abs_top_builddir}/hyperdex-daemon$(EXEEXT) @@ -453,11 +453,11 @@ libhyperdex_client_la_SOURCES += client/pending_search_describe.cc libhyperdex_client_la_SOURCES += client/pending_sorted_search.cc libhyperdex_client_la_SOURCES += client/util.cc libhyperdex_client_la_LIBADD = +libhyperdex_client_la_LIBADD += $(TREADSTONE_LIBS) libhyperdex_client_la_LIBADD += $(MACAROONS_LIBS) libhyperdex_client_la_LIBADD += $(REPLICANT_LIBS) libhyperdex_client_la_LIBADD += $(BUSYBEE_LIBS) libhyperdex_client_la_LIBADD += $(E_LIBS) -libhyperdex_client_la_LIBADD += $(TREADSTONE_LIBS) client/keyop_info.cc: client/keyop_info.gperf client/keyop_info.h $(gperf_verbose)gperf -m 100 $(abs_top_srcdir)/client/keyop_info.gperf --output-file=$(abs_top_builddir)/client/keyop_info.cc @@ -549,11 +549,11 @@ libhyperdex_admin_la_SOURCES += admin/pending_string.cc libhyperdex_admin_la_SOURCES += admin/raw_backup.cc libhyperdex_admin_la_SOURCES += admin/yieldable.cc libhyperdex_admin_la_LIBADD = +libhyperdex_admin_la_LIBADD += $(TREADSTONE_LIBS) libhyperdex_admin_la_LIBADD += $(MACAROONS_LIBS) libhyperdex_admin_la_LIBADD += $(REPLICANT_LIBS) libhyperdex_admin_la_LIBADD += $(BUSYBEE_LIBS) libhyperdex_admin_la_LIBADD += $(E_LIBS) -libhyperdex_admin_la_LIBADD += $(TREADSTONE_LIBS) ################################################################################ ################################### Bindings ################################### @@ -844,11 +844,11 @@ stress_wrappers += test/sh/search.combination.keytype=string,daemons=4.fault-tol shell_wrappers += $(stress_wrappers) python_wrappers = -#python_wrappers += test/sh/bindings.python.Admin.sh +python_wrappers += test/sh/bindings.python.Admin.sh python_wrappers += test/sh/bindings.python.BasicSearch.sh python_wrappers += test/sh/bindings.python.Basic.sh python_wrappers += test/sh/bindings.python.CondPut.sh -#python_wrappers += test/sh/bindings.python.DataTypeDocument.sh +python_wrappers += test/sh/bindings.python.DataTypeDocument.sh python_wrappers += test/sh/bindings.python.DataTypeFloat.sh python_wrappers += test/sh/bindings.python.DataTypeInt.sh python_wrappers += test/sh/bindings.python.DataTypeListFloat.sh @@ -1421,23 +1421,21 @@ EXTRA_DIST += $(wildcard doc/*/*/*/*.tex) EXTRA_DIST += $(wildcard doc/*/*/*/*/*.tex) EXTRA_DIST += doc/Makefile EXTRA_DIST += doc/latex.py -EXTRA_DIST += doc/api/c/hello-world.c -EXTRA_DIST += doc/api/c/iterate.c -EXTRA_DIST += doc/api/java/HelloWorldAsyncLoop.java -EXTRA_DIST += doc/api/java/HelloWorldAsyncWait.java -EXTRA_DIST += doc/api/java/HelloWorld.java -EXTRA_DIST += doc/api/node.js/hello-world.js -EXTRA_DIST += doc/api/node.js/window-pattern.js -EXTRA_DIST += doc/api/ruby/hello-world-async-loop.rb -EXTRA_DIST += doc/api/ruby/hello-world-async-wait.rb -EXTRA_DIST += doc/api/ruby/hello-world.rb -EXTRA_DIST += doc/install/centos-packages.sh -EXTRA_DIST += doc/install/debian7-packages.sh -EXTRA_DIST += doc/install/fedora-packages.sh -EXTRA_DIST += doc/install/linux-amd64.sh -EXTRA_DIST += doc/install/ubuntu12.04-packages.sh -EXTRA_DIST += doc/install/ubuntu14.04-packages.sh -EXTRA_DIST += doc/install/ubuntu14.10-packages.sh +EXTRA_DIST += doc/c/client/hello-world.c +EXTRA_DIST += doc/c/client/iterate.c +EXTRA_DIST += doc/go/client/hello-world.go +EXTRA_DIST += doc/java/client/HelloWorldAsyncLoop.java +EXTRA_DIST += doc/java/client/HelloWorldAsyncWait.java +EXTRA_DIST += doc/java/client/HelloWorld.java +EXTRA_DIST += doc/node.js/client/hello-world.js +EXTRA_DIST += doc/node.js/client/window-pattern.js +EXTRA_DIST += doc/python/client/hello-world-async-loop.py +EXTRA_DIST += doc/python/client/hello-world-async-wait.py +EXTRA_DIST += doc/python/client/hello-world.py +EXTRA_DIST += doc/ruby/client/hello-world-async-loop.rb +EXTRA_DIST += doc/ruby/client/hello-world-async-wait.rb +EXTRA_DIST += doc/ruby/client/hello-world.rb +EXTRA_DIST += $(wildcard doc/install/*) ################################################################################ ################################## Maintenance ################################# @@ -1453,13 +1451,13 @@ EXTRA_DIST += maint/generate-doc-shell-stubs.py EXTRA_DIST += maint/generate-replication-shell-stubs.py EXTRA_DIST += maint/generate-search-shell-stubs.py EXTRA_DIST += maint/generate-test-packages.py -EXTRA_DIST += doc/maint/generate-api-descriptions.py maint_lib_check_SOURCES = maint/lib-check.c maint_lib_check_LDADD = -ldl maintainer-generate: python2 bindings/c.py + python2 bindings/go.py python2 bindings/java.py python2 bindings/nodejs.py python2 bindings/python.py @@ -1474,3 +1472,4 @@ maintainer-generate: python2 test/doc-extract.py python doc/atomic-ops.tex test/doc.atomic-ops.py python2 test/doc-extract.py python doc/documents.tex test/doc.documents.py python2 test/doc-extract.py python doc/authorization.tex test/doc.authorization.py + python2 test/doc-extract.py python doc/mongo.tex test/doc.mongo.py From dda8bb494a8da6e2ed788b2d709a948e8be3fd7d Mon Sep 17 00:00:00 2001 From: Derek Chiang Date: Sat, 18 Apr 2015 21:53:11 -0400 Subject: [PATCH 7/7] Update for latest Rust --- bindings/go/client/client.go | 230 +++++++++--------- client/c.cc | 7 - maint/generate-bindings-tests.py | 30 +-- test/go/Basic.go | 84 +++---- test/go/BasicSearch.go | 84 +++---- test/go/CondPut.go | 84 +++---- test/go/DataTypeFloat.go | 84 +++---- test/go/DataTypeInt.go | 84 +++---- test/go/DataTypeListFloat.go | 84 +++---- test/go/DataTypeListInt.go | 84 +++---- test/go/DataTypeListString.go | 84 +++---- test/go/DataTypeMapFloatFloat.go | 84 +++---- test/go/DataTypeMapFloatInt.go | 84 +++---- test/go/DataTypeMapFloatString.go | 84 +++---- test/go/DataTypeMapIntFloat.go | 84 +++---- test/go/DataTypeMapIntInt.go | 84 +++---- test/go/DataTypeMapIntString.go | 84 +++---- test/go/DataTypeMapStringFloat.go | 84 +++---- test/go/DataTypeMapStringInt.go | 84 +++---- test/go/DataTypeMapStringString.go | 84 +++---- test/go/DataTypeSetFloat.go | 84 +++---- test/go/DataTypeSetInt.go | 84 +++---- test/go/DataTypeSetString.go | 84 +++---- test/go/DataTypeString.go | 84 +++---- test/go/LengthString.go | 84 +++---- test/go/MultiAttribute.go | 84 +++---- test/go/RangeSearchInt.go | 84 +++---- test/go/RangeSearchString.go | 84 +++---- test/go/RegexSearch.go | 84 +++---- test/rust/Basic.rs | 28 +-- test/rust/BasicSearch.rs | 28 +-- test/rust/CondPut.rs | 28 +-- test/rust/DataTypeFloat.rs | 28 +-- test/rust/DataTypeInt.rs | 28 +-- test/rust/DataTypeListFloat.rs | 28 +-- test/rust/DataTypeListInt.rs | 28 +-- test/rust/DataTypeListString.rs | 28 +-- test/rust/DataTypeMapFloatFloat.rs | 28 +-- test/rust/DataTypeMapFloatInt.rs | 28 +-- test/rust/DataTypeMapFloatString.rs | 28 +-- test/rust/DataTypeMapIntFloat.rs | 28 +-- test/rust/DataTypeMapIntInt.rs | 28 +-- test/rust/DataTypeMapIntString.rs | 28 +-- test/rust/DataTypeMapStringFloat.rs | 28 +-- test/rust/DataTypeMapStringInt.rs | 28 +-- test/rust/DataTypeMapStringString.rs | 28 +-- test/rust/DataTypeSetFloat.rs | 28 +-- test/rust/DataTypeSetInt.rs | 28 +-- test/rust/DataTypeSetString.rs | 28 +-- test/rust/DataTypeString.rs | 28 +-- test/rust/LengthString.rs | 28 +-- test/rust/MultiAttribute.rs | 28 +-- test/rust/RangeSearchInt.rs | 28 +-- test/rust/RangeSearchString.rs | 28 +-- test/rust/RegexSearch.rs | 28 +-- test/sh/bindings.rust.Basic.sh | 2 +- test/sh/bindings.rust.BasicSearch.sh | 2 +- test/sh/bindings.rust.CondPut.sh | 2 +- test/sh/bindings.rust.DataTypeFloat.sh | 2 +- test/sh/bindings.rust.DataTypeInt.sh | 2 +- test/sh/bindings.rust.DataTypeListFloat.sh | 2 +- test/sh/bindings.rust.DataTypeListInt.sh | 2 +- test/sh/bindings.rust.DataTypeListString.sh | 2 +- .../sh/bindings.rust.DataTypeMapFloatFloat.sh | 2 +- test/sh/bindings.rust.DataTypeMapFloatInt.sh | 2 +- .../bindings.rust.DataTypeMapFloatString.sh | 2 +- test/sh/bindings.rust.DataTypeMapIntFloat.sh | 2 +- test/sh/bindings.rust.DataTypeMapIntInt.sh | 2 +- test/sh/bindings.rust.DataTypeMapIntString.sh | 2 +- .../bindings.rust.DataTypeMapStringFloat.sh | 2 +- test/sh/bindings.rust.DataTypeMapStringInt.sh | 2 +- .../bindings.rust.DataTypeMapStringString.sh | 2 +- test/sh/bindings.rust.DataTypeSetFloat.sh | 2 +- test/sh/bindings.rust.DataTypeSetInt.sh | 2 +- test/sh/bindings.rust.DataTypeSetString.sh | 2 +- test/sh/bindings.rust.DataTypeString.sh | 2 +- test/sh/bindings.rust.LengthString.sh | 2 +- test/sh/bindings.rust.MultiAttribute.sh | 2 +- test/sh/bindings.rust.RangeSearchInt.sh | 2 +- test/sh/bindings.rust.RangeSearchString.sh | 2 +- test/sh/bindings.rust.RegexSearch.sh | 2 +- 81 files changed, 1336 insertions(+), 1895 deletions(-) diff --git a/bindings/go/client/client.go b/bindings/go/client/client.go index 392df3a93..a13a6eb5b 100644 --- a/bindings/go/client/client.go +++ b/bindings/go/client/client.go @@ -1131,18 +1131,17 @@ func (client *Client) AsynccallSpacenameKeyStatusAttributes(stub func(client *C. inner.ops[reqid] = done } else { if c_status != SUCCESS { - err = &Error{Status(c_status), - C.GoString(C.hyperdex_client_error_message(inner.ptr)), - C.GoString(C.hyperdex_client_error_location(inner.ptr))} - } + err = &Error{Status(c_status), + C.GoString(C.hyperdex_client_error_message(inner.ptr)), + C.GoString(C.hyperdex_client_error_location(inner.ptr))}} } inner.mutex.Unlock() if reqid >= 0 { - rz := <-done - if c_status != SUCCESS { - err = &rz - err.Status = Status(c_status) - } + rz := <-done + if c_status != SUCCESS { + err = &rz + err.Status = Status(c_status) + } } if c_status == SUCCESS { var er error @@ -1193,18 +1192,17 @@ func (client *Client) AsynccallSpacenameKeyAttributenamesStatusAttributes(stub f inner.ops[reqid] = done } else { if c_status != SUCCESS { - err = &Error{Status(c_status), - C.GoString(C.hyperdex_client_error_message(inner.ptr)), - C.GoString(C.hyperdex_client_error_location(inner.ptr))} - } + err = &Error{Status(c_status), + C.GoString(C.hyperdex_client_error_message(inner.ptr)), + C.GoString(C.hyperdex_client_error_location(inner.ptr))}} } inner.mutex.Unlock() if reqid >= 0 { - rz := <-done - if c_status != SUCCESS { - err = &rz - err.Status = Status(c_status) - } + rz := <-done + if c_status != SUCCESS { + err = &rz + err.Status = Status(c_status) + } } if c_status == SUCCESS { var er error @@ -1253,18 +1251,17 @@ func (client *Client) AsynccallSpacenameKeyAttributesStatus(stub func(client *C. inner.ops[reqid] = done } else { if c_status != SUCCESS { - err = &Error{Status(c_status), - C.GoString(C.hyperdex_client_error_message(inner.ptr)), - C.GoString(C.hyperdex_client_error_location(inner.ptr))} - } + err = &Error{Status(c_status), + C.GoString(C.hyperdex_client_error_message(inner.ptr)), + C.GoString(C.hyperdex_client_error_location(inner.ptr))}} } inner.mutex.Unlock() if reqid >= 0 { - rz := <-done - if c_status != SUCCESS { - err = &rz - err.Status = Status(c_status) - } + rz := <-done + if c_status != SUCCESS { + err = &rz + err.Status = Status(c_status) + } } return } @@ -1312,18 +1309,17 @@ func (client *Client) AsynccallSpacenameKeyPredicatesAttributesStatus(stub func( inner.ops[reqid] = done } else { if c_status != SUCCESS { - err = &Error{Status(c_status), - C.GoString(C.hyperdex_client_error_message(inner.ptr)), - C.GoString(C.hyperdex_client_error_location(inner.ptr))} - } + err = &Error{Status(c_status), + C.GoString(C.hyperdex_client_error_message(inner.ptr)), + C.GoString(C.hyperdex_client_error_location(inner.ptr))}} } inner.mutex.Unlock() if reqid >= 0 { - rz := <-done - if c_status != SUCCESS { - err = &rz - err.Status = Status(c_status) - } + rz := <-done + if c_status != SUCCESS { + err = &rz + err.Status = Status(c_status) + } } return } @@ -1365,18 +1361,17 @@ func (client *Client) AsynccallSpacenamePredicatesAttributesStatusCount(stub fun inner.ops[reqid] = done } else { if c_status != SUCCESS { - err = &Error{Status(c_status), - C.GoString(C.hyperdex_client_error_message(inner.ptr)), - C.GoString(C.hyperdex_client_error_location(inner.ptr))} - } + err = &Error{Status(c_status), + C.GoString(C.hyperdex_client_error_message(inner.ptr)), + C.GoString(C.hyperdex_client_error_location(inner.ptr))}} } inner.mutex.Unlock() if reqid >= 0 { - rz := <-done - if c_status != SUCCESS { - err = &rz - err.Status = Status(c_status) - } + rz := <-done + if c_status != SUCCESS { + err = &rz + err.Status = Status(c_status) + } } if c_status == SUCCESS { count = uint64(c_count) @@ -1413,18 +1408,17 @@ func (client *Client) AsynccallSpacenameKeyStatus(stub func(client *C.struct_hyp inner.ops[reqid] = done } else { if c_status != SUCCESS { - err = &Error{Status(c_status), - C.GoString(C.hyperdex_client_error_message(inner.ptr)), - C.GoString(C.hyperdex_client_error_location(inner.ptr))} - } + err = &Error{Status(c_status), + C.GoString(C.hyperdex_client_error_message(inner.ptr)), + C.GoString(C.hyperdex_client_error_location(inner.ptr))}} } inner.mutex.Unlock() if reqid >= 0 { - rz := <-done - if c_status != SUCCESS { - err = &rz - err.Status = Status(c_status) - } + rz := <-done + if c_status != SUCCESS { + err = &rz + err.Status = Status(c_status) + } } return } @@ -1465,18 +1459,17 @@ func (client *Client) AsynccallSpacenameKeyPredicatesStatus(stub func(client *C. inner.ops[reqid] = done } else { if c_status != SUCCESS { - err = &Error{Status(c_status), - C.GoString(C.hyperdex_client_error_message(inner.ptr)), - C.GoString(C.hyperdex_client_error_location(inner.ptr))} - } + err = &Error{Status(c_status), + C.GoString(C.hyperdex_client_error_message(inner.ptr)), + C.GoString(C.hyperdex_client_error_location(inner.ptr))}} } inner.mutex.Unlock() if reqid >= 0 { - rz := <-done - if c_status != SUCCESS { - err = &rz - err.Status = Status(c_status) - } + rz := <-done + if c_status != SUCCESS { + err = &rz + err.Status = Status(c_status) + } } return } @@ -1511,18 +1504,17 @@ func (client *Client) AsynccallSpacenamePredicatesStatusCount(stub func(client * inner.ops[reqid] = done } else { if c_status != SUCCESS { - err = &Error{Status(c_status), - C.GoString(C.hyperdex_client_error_message(inner.ptr)), - C.GoString(C.hyperdex_client_error_location(inner.ptr))} - } + err = &Error{Status(c_status), + C.GoString(C.hyperdex_client_error_message(inner.ptr)), + C.GoString(C.hyperdex_client_error_location(inner.ptr))}} } inner.mutex.Unlock() if reqid >= 0 { - rz := <-done - if c_status != SUCCESS { - err = &rz - err.Status = Status(c_status) - } + rz := <-done + if c_status != SUCCESS { + err = &rz + err.Status = Status(c_status) + } } if c_status == SUCCESS { count = uint64(c_count) @@ -1566,18 +1558,17 @@ func (client *Client) AsynccallSpacenameKeyMapattributesStatus(stub func(client inner.ops[reqid] = done } else { if c_status != SUCCESS { - err = &Error{Status(c_status), - C.GoString(C.hyperdex_client_error_message(inner.ptr)), - C.GoString(C.hyperdex_client_error_location(inner.ptr))} - } + err = &Error{Status(c_status), + C.GoString(C.hyperdex_client_error_message(inner.ptr)), + C.GoString(C.hyperdex_client_error_location(inner.ptr))}} } inner.mutex.Unlock() if reqid >= 0 { - rz := <-done - if c_status != SUCCESS { - err = &rz - err.Status = Status(c_status) - } + rz := <-done + if c_status != SUCCESS { + err = &rz + err.Status = Status(c_status) + } } return } @@ -1625,18 +1616,17 @@ func (client *Client) AsynccallSpacenameKeyPredicatesMapattributesStatus(stub fu inner.ops[reqid] = done } else { if c_status != SUCCESS { - err = &Error{Status(c_status), - C.GoString(C.hyperdex_client_error_message(inner.ptr)), - C.GoString(C.hyperdex_client_error_location(inner.ptr))} - } + err = &Error{Status(c_status), + C.GoString(C.hyperdex_client_error_message(inner.ptr)), + C.GoString(C.hyperdex_client_error_location(inner.ptr))}} } inner.mutex.Unlock() if reqid >= 0 { - rz := <-done - if c_status != SUCCESS { - err = &rz - err.Status = Status(c_status) - } + rz := <-done + if c_status != SUCCESS { + err = &rz + err.Status = Status(c_status) + } } return } @@ -1678,18 +1668,17 @@ func (client *Client) AsynccallSpacenamePredicatesMapattributesStatusCount(stub inner.ops[reqid] = done } else { if c_status != SUCCESS { - err = &Error{Status(c_status), - C.GoString(C.hyperdex_client_error_message(inner.ptr)), - C.GoString(C.hyperdex_client_error_location(inner.ptr))} - } + err = &Error{Status(c_status), + C.GoString(C.hyperdex_client_error_message(inner.ptr)), + C.GoString(C.hyperdex_client_error_location(inner.ptr))}} } inner.mutex.Unlock() if reqid >= 0 { - rz := <-done - if c_status != SUCCESS { - err = &rz - err.Status = Status(c_status) - } + rz := <-done + if c_status != SUCCESS { + err = &rz + err.Status = Status(c_status) + } } if c_status == SUCCESS { count = uint64(c_count) @@ -1711,7 +1700,7 @@ func (client *Client) IteratorSpacenamePredicatesStatusAttributes(stub func(clie er = client.convertSpacename(arena, spacename, &c_space) if er != nil { err := Error{Status(WRONGTYPE), er.Error(), ""} - errs <- err + errs<-err close(attrs) close(errs) return @@ -1719,7 +1708,7 @@ func (client *Client) IteratorSpacenamePredicatesStatusAttributes(stub func(clie er = client.convertPredicates(arena, predicates, &c_checks, &c_checks_sz) if er != nil { err := Error{Status(WRONGTYPE), er.Error(), ""} - errs <- err + errs<-err close(attrs) close(errs) return @@ -1735,12 +1724,12 @@ func (client *Client) IteratorSpacenamePredicatesStatusAttributes(stub func(clie inner.searches[reqid] = &c_iter } else { err = Error{Status(c_iter.status), - C.GoString(C.hyperdex_client_error_message(inner.ptr)), - C.GoString(C.hyperdex_client_error_location(inner.ptr))} + C.GoString(C.hyperdex_client_error_message(inner.ptr)), + C.GoString(C.hyperdex_client_error_location(inner.ptr))} } inner.mutex.Unlock() if reqid < 0 { - errs <- err + errs<-err close(attrs) close(errs) } @@ -1777,18 +1766,17 @@ func (client *Client) AsynccallSpacenamePredicatesStatusDescription(stub func(cl inner.ops[reqid] = done } else { if c_status != SUCCESS { - err = &Error{Status(c_status), - C.GoString(C.hyperdex_client_error_message(inner.ptr)), - C.GoString(C.hyperdex_client_error_location(inner.ptr))} - } + err = &Error{Status(c_status), + C.GoString(C.hyperdex_client_error_message(inner.ptr)), + C.GoString(C.hyperdex_client_error_location(inner.ptr))}} } inner.mutex.Unlock() if reqid >= 0 { - rz := <-done - if c_status != SUCCESS { - err = &rz - err.Status = Status(c_status) - } + rz := <-done + if c_status != SUCCESS { + err = &rz + err.Status = Status(c_status) + } } if c_status == SUCCESS { desc = C.GoString(c_description) @@ -1813,7 +1801,7 @@ func (client *Client) IteratorSpacenamePredicatesSortbyLimitMaxminStatusAttribut er = client.convertSpacename(arena, spacename, &c_space) if er != nil { err := Error{Status(WRONGTYPE), er.Error(), ""} - errs <- err + errs<-err close(attrs) close(errs) return @@ -1821,7 +1809,7 @@ func (client *Client) IteratorSpacenamePredicatesSortbyLimitMaxminStatusAttribut er = client.convertPredicates(arena, predicates, &c_checks, &c_checks_sz) if er != nil { err := Error{Status(WRONGTYPE), er.Error(), ""} - errs <- err + errs<-err close(attrs) close(errs) return @@ -1829,7 +1817,7 @@ func (client *Client) IteratorSpacenamePredicatesSortbyLimitMaxminStatusAttribut er = client.convertSortby(arena, sortby, &c_sort_by) if er != nil { err := Error{Status(WRONGTYPE), er.Error(), ""} - errs <- err + errs<-err close(attrs) close(errs) return @@ -1837,7 +1825,7 @@ func (client *Client) IteratorSpacenamePredicatesSortbyLimitMaxminStatusAttribut er = client.convertLimit(arena, limit, &c_limit) if er != nil { err := Error{Status(WRONGTYPE), er.Error(), ""} - errs <- err + errs<-err close(attrs) close(errs) return @@ -1845,7 +1833,7 @@ func (client *Client) IteratorSpacenamePredicatesSortbyLimitMaxminStatusAttribut er = client.convertMaxmin(arena, maxmin, &c_maxmin) if er != nil { err := Error{Status(WRONGTYPE), er.Error(), ""} - errs <- err + errs<-err close(attrs) close(errs) return @@ -1861,12 +1849,12 @@ func (client *Client) IteratorSpacenamePredicatesSortbyLimitMaxminStatusAttribut inner.searches[reqid] = &c_iter } else { err = Error{Status(c_iter.status), - C.GoString(C.hyperdex_client_error_message(inner.ptr)), - C.GoString(C.hyperdex_client_error_location(inner.ptr))} + C.GoString(C.hyperdex_client_error_message(inner.ptr)), + C.GoString(C.hyperdex_client_error_location(inner.ptr))} } inner.mutex.Unlock() if reqid < 0 { - errs <- err + errs<-err close(attrs) close(errs) } diff --git a/client/c.cc b/client/c.cc index 94ea46f5a..dc1edbc29 100644 --- a/client/c.cc +++ b/client/c.cc @@ -160,13 +160,6 @@ hyperdex_client_error_message(hyperdex_client* _cl) return cl->error_message(); } -HYPERDEX_API void -hyperdex_client_set_type_conversion(hyperdex_client* _cl, bool enabled) -{ - hyperdex::client* cl = reinterpret_cast(_cl); - cl->set_type_conversion(enabled); -} - HYPERDEX_API const char* hyperdex_client_error_location(hyperdex_client* _cl) { diff --git a/maint/generate-bindings-tests.py b/maint/generate-bindings-tests.py index 184339826..80d05e4ed 100644 --- a/maint/generate-bindings-tests.py +++ b/maint/generate-bindings-tests.py @@ -773,11 +773,12 @@ def test(self, name, space): assert self.f is None self.count = 0 self.path = 'test/rust/{0}.rs'.format(name) - precmd = 'rustc -g -L {1} -o "${{HYPERDEX_BUILDDIR}}"/test/rust/{0} "${{HYPERDEX_SRCDIR}}"/test/rust/{0}.rs'.format(name, self.lib_dir + '/target') + precmd = 'rustc -g -L {1} -L {2} -o "${{HYPERDEX_BUILDDIR}}"/test/rust/{0} "${{HYPERDEX_SRCDIR}}"/test/rust/{0}.rs'.format(name, self.lib_dir + '/target/debug', self.lib_dir + '/target/debug/deps') cmd = '"${{HYPERDEX_BUILDDIR}}"/test/rust/{0}'.format(name) gen_shell('rust', name, cmd, space, precmd=precmd) self.f = open(self.path, 'w') self.f.write(''' +#![feature(convert)] #[macro_use] extern crate hyperdex; use std::os; @@ -797,13 +798,7 @@ def test(self, name, space): if $a.len() == 0 && $b.len() == 0 { true } else { - if $a.get_type_id() != $b.get_type_id() { - false - } else { - unsafe { - transmute($a) == $b - } - } + false } ); } @@ -821,25 +816,18 @@ def test(self, name, space): // this is dumb but I do not see a better way... fortunately the following lines are generated // by a python script match (av, bv) { - (HyperListString(x), HyperListString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperListString(x), HyperListInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperListString(x), HyperListFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperListInt(x), HyperListString(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperListInt(x), HyperListInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperListInt(x), HyperListFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperListFloat(x), HyperListString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperListFloat(x), HyperListInt(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperListFloat(x), HyperListFloat(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperSetString(x), HyperSetString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperSetString(x), HyperSetInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperSetString(x), HyperSetFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperSetInt(x), HyperSetString(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperSetInt(x), HyperSetInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperSetInt(x), HyperSetFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperSetFloat(x), HyperSetString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperSetFloat(x), HyperSetInt(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperSetFloat(x), HyperSetFloat(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperMapStringString(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringString(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringString(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringString(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, @@ -849,7 +837,6 @@ def test(self, name, space): (HyperMapStringString(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringString(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringInt(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperMapStringInt(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringInt(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringInt(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringInt(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, @@ -859,7 +846,6 @@ def test(self, name, space): (HyperMapStringInt(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringFloat(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringFloat(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperMapStringFloat(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringFloat(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringFloat(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringFloat(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, @@ -869,7 +855,6 @@ def test(self, name, space): (HyperMapIntString(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntString(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntString(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperMapIntString(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntString(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntString(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntString(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, @@ -879,7 +864,6 @@ def test(self, name, space): (HyperMapIntInt(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntInt(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntInt(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperMapIntInt(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntInt(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntInt(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntInt(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, @@ -889,7 +873,6 @@ def test(self, name, space): (HyperMapIntFloat(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntFloat(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntFloat(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperMapIntFloat(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntFloat(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntFloat(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntFloat(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, @@ -899,7 +882,6 @@ def test(self, name, space): (HyperMapFloatString(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatString(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatString(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperMapFloatString(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatString(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatString(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatInt(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, @@ -909,7 +891,6 @@ def test(self, name, space): (HyperMapFloatInt(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatInt(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatInt(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperMapFloatInt(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatInt(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatFloat(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatFloat(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, @@ -919,7 +900,6 @@ def test(self, name, space): (HyperMapFloatFloat(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatFloat(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatFloat(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperMapFloatFloat(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (x, y) => if x != y { return false; }, } } @@ -927,8 +907,8 @@ def test(self, name, space): } fn main() { - let args = os::args(); - let mut client = Client::new(FromStr::from_str(format!("{}:{}", args[1], args[2]).as_slice()).unwrap()).unwrap(); + let args: Vec = std::env::args().collect(); + let mut client = Client::new(FromStr::from_str(format!("{}:{}", args[1], args[2]).as_str()).unwrap()).unwrap(); ''') def finish(self): diff --git a/test/go/Basic.go b/test/go/Basic.go index 3142dd715..20463b519 100644 --- a/test/go/Basic.go +++ b/test/go/Basic.go @@ -12,40 +12,40 @@ func sloppyEqual(lhs map[interface{}]interface{}, rhs map[interface{}]interface{ } for key, lval := range lhs { if rval, ok := rhs[key]; ok { - lstr := fmt.Sprintln(lval) - rstr := fmt.Sprintln(rval) - for i := 0; i < 1000; i++ { - if lstr != rstr { - rstr = fmt.Sprintln(rval) - } - } - lmap, lok := lval.(client.Map) - rmap, rok := rval.(client.Map) + lstr := fmt.Sprintln(lval) + rstr := fmt.Sprintln(rval) + for i := 0; i < 1000; i++ { + if lstr != rstr { + rstr = fmt.Sprintln(rval) + } + } + lmap, lok := lval.(client.Map) + rmap, rok := rval.(client.Map) if !(lval == rval || reflect.DeepEqual(lval, rval) || - (lok && rok && sloppyEqualMap(lmap, rmap)) || - lstr == rstr) { + (lok && rok && sloppyEqualMap(lmap, rmap)) || + lstr == rstr) { return false - } + } } else { return false } } for key, rval := range rhs { if lval, ok := lhs[key]; ok { - lstr := fmt.Sprintln(lval) - rstr := fmt.Sprintln(rval) - for i := 0; i < 1000; i++ { - if lstr != rstr { - rstr = fmt.Sprintln(rval) - } - } - lmap, lok := lval.(client.Map) - rmap, rok := rval.(client.Map) + lstr := fmt.Sprintln(lval) + rstr := fmt.Sprintln(rval) + for i := 0; i < 1000; i++ { + if lstr != rstr { + rstr = fmt.Sprintln(rval) + } + } + lmap, lok := lval.(client.Map) + rmap, rok := rval.(client.Map) if !(lval == rval || reflect.DeepEqual(lval, rval) || - (lok && rok && sloppyEqualMap(lmap, rmap)) || - lstr == rstr) { + (lok && rok && sloppyEqualMap(lmap, rmap)) || + lstr == rstr) { return false - } + } } else { return false } @@ -54,27 +54,27 @@ func sloppyEqual(lhs map[interface{}]interface{}, rhs map[interface{}]interface{ } func sloppyEqualMap(lhs client.Map, rhs client.Map) bool { - lmap := map[interface{}]interface{}{} - rmap := map[interface{}]interface{}{} - for k, v := range lhs { - lmap[k] = v - } - for k, v := range rhs { - rmap[k] = v - } - return sloppyEqual(lmap, rmap) + lmap := map[interface{}]interface{}{} + rmap := map[interface{}]interface{}{} + for k, v := range lhs { + lmap[k] = v + } + for k, v := range rhs { + rmap[k] = v + } + return sloppyEqual(lmap, rmap) } func sloppyEqualAttributes(lhs client.Attributes, rhs client.Attributes) bool { - lmap := map[interface{}]interface{}{} - rmap := map[interface{}]interface{}{} - for k, v := range lhs { - lmap[k] = v - } - for k, v := range rhs { - rmap[k] = v - } - return sloppyEqual(lmap, rmap) + lmap := map[interface{}]interface{}{} + rmap := map[interface{}]interface{}{} + for k, v := range lhs { + lmap[k] = v + } + for k, v := range rhs { + rmap[k] = v + } + return sloppyEqual(lmap, rmap) } func main() { diff --git a/test/go/BasicSearch.go b/test/go/BasicSearch.go index dae89fd15..38eaf35bf 100644 --- a/test/go/BasicSearch.go +++ b/test/go/BasicSearch.go @@ -12,40 +12,40 @@ func sloppyEqual(lhs map[interface{}]interface{}, rhs map[interface{}]interface{ } for key, lval := range lhs { if rval, ok := rhs[key]; ok { - lstr := fmt.Sprintln(lval) - rstr := fmt.Sprintln(rval) - for i := 0; i < 1000; i++ { - if lstr != rstr { - rstr = fmt.Sprintln(rval) - } - } - lmap, lok := lval.(client.Map) - rmap, rok := rval.(client.Map) + lstr := fmt.Sprintln(lval) + rstr := fmt.Sprintln(rval) + for i := 0; i < 1000; i++ { + if lstr != rstr { + rstr = fmt.Sprintln(rval) + } + } + lmap, lok := lval.(client.Map) + rmap, rok := rval.(client.Map) if !(lval == rval || reflect.DeepEqual(lval, rval) || - (lok && rok && sloppyEqualMap(lmap, rmap)) || - lstr == rstr) { + (lok && rok && sloppyEqualMap(lmap, rmap)) || + lstr == rstr) { return false - } + } } else { return false } } for key, rval := range rhs { if lval, ok := lhs[key]; ok { - lstr := fmt.Sprintln(lval) - rstr := fmt.Sprintln(rval) - for i := 0; i < 1000; i++ { - if lstr != rstr { - rstr = fmt.Sprintln(rval) - } - } - lmap, lok := lval.(client.Map) - rmap, rok := rval.(client.Map) + lstr := fmt.Sprintln(lval) + rstr := fmt.Sprintln(rval) + for i := 0; i < 1000; i++ { + if lstr != rstr { + rstr = fmt.Sprintln(rval) + } + } + lmap, lok := lval.(client.Map) + rmap, rok := rval.(client.Map) if !(lval == rval || reflect.DeepEqual(lval, rval) || - (lok && rok && sloppyEqualMap(lmap, rmap)) || - lstr == rstr) { + (lok && rok && sloppyEqualMap(lmap, rmap)) || + lstr == rstr) { return false - } + } } else { return false } @@ -54,27 +54,27 @@ func sloppyEqual(lhs map[interface{}]interface{}, rhs map[interface{}]interface{ } func sloppyEqualMap(lhs client.Map, rhs client.Map) bool { - lmap := map[interface{}]interface{}{} - rmap := map[interface{}]interface{}{} - for k, v := range lhs { - lmap[k] = v - } - for k, v := range rhs { - rmap[k] = v - } - return sloppyEqual(lmap, rmap) + lmap := map[interface{}]interface{}{} + rmap := map[interface{}]interface{}{} + for k, v := range lhs { + lmap[k] = v + } + for k, v := range rhs { + rmap[k] = v + } + return sloppyEqual(lmap, rmap) } func sloppyEqualAttributes(lhs client.Attributes, rhs client.Attributes) bool { - lmap := map[interface{}]interface{}{} - rmap := map[interface{}]interface{}{} - for k, v := range lhs { - lmap[k] = v - } - for k, v := range rhs { - rmap[k] = v - } - return sloppyEqual(lmap, rmap) + lmap := map[interface{}]interface{}{} + rmap := map[interface{}]interface{}{} + for k, v := range lhs { + lmap[k] = v + } + for k, v := range rhs { + rmap[k] = v + } + return sloppyEqual(lmap, rmap) } func main() { diff --git a/test/go/CondPut.go b/test/go/CondPut.go index 2eb924a45..a90bf384e 100644 --- a/test/go/CondPut.go +++ b/test/go/CondPut.go @@ -12,40 +12,40 @@ func sloppyEqual(lhs map[interface{}]interface{}, rhs map[interface{}]interface{ } for key, lval := range lhs { if rval, ok := rhs[key]; ok { - lstr := fmt.Sprintln(lval) - rstr := fmt.Sprintln(rval) - for i := 0; i < 1000; i++ { - if lstr != rstr { - rstr = fmt.Sprintln(rval) - } - } - lmap, lok := lval.(client.Map) - rmap, rok := rval.(client.Map) + lstr := fmt.Sprintln(lval) + rstr := fmt.Sprintln(rval) + for i := 0; i < 1000; i++ { + if lstr != rstr { + rstr = fmt.Sprintln(rval) + } + } + lmap, lok := lval.(client.Map) + rmap, rok := rval.(client.Map) if !(lval == rval || reflect.DeepEqual(lval, rval) || - (lok && rok && sloppyEqualMap(lmap, rmap)) || - lstr == rstr) { + (lok && rok && sloppyEqualMap(lmap, rmap)) || + lstr == rstr) { return false - } + } } else { return false } } for key, rval := range rhs { if lval, ok := lhs[key]; ok { - lstr := fmt.Sprintln(lval) - rstr := fmt.Sprintln(rval) - for i := 0; i < 1000; i++ { - if lstr != rstr { - rstr = fmt.Sprintln(rval) - } - } - lmap, lok := lval.(client.Map) - rmap, rok := rval.(client.Map) + lstr := fmt.Sprintln(lval) + rstr := fmt.Sprintln(rval) + for i := 0; i < 1000; i++ { + if lstr != rstr { + rstr = fmt.Sprintln(rval) + } + } + lmap, lok := lval.(client.Map) + rmap, rok := rval.(client.Map) if !(lval == rval || reflect.DeepEqual(lval, rval) || - (lok && rok && sloppyEqualMap(lmap, rmap)) || - lstr == rstr) { + (lok && rok && sloppyEqualMap(lmap, rmap)) || + lstr == rstr) { return false - } + } } else { return false } @@ -54,27 +54,27 @@ func sloppyEqual(lhs map[interface{}]interface{}, rhs map[interface{}]interface{ } func sloppyEqualMap(lhs client.Map, rhs client.Map) bool { - lmap := map[interface{}]interface{}{} - rmap := map[interface{}]interface{}{} - for k, v := range lhs { - lmap[k] = v - } - for k, v := range rhs { - rmap[k] = v - } - return sloppyEqual(lmap, rmap) + lmap := map[interface{}]interface{}{} + rmap := map[interface{}]interface{}{} + for k, v := range lhs { + lmap[k] = v + } + for k, v := range rhs { + rmap[k] = v + } + return sloppyEqual(lmap, rmap) } func sloppyEqualAttributes(lhs client.Attributes, rhs client.Attributes) bool { - lmap := map[interface{}]interface{}{} - rmap := map[interface{}]interface{}{} - for k, v := range lhs { - lmap[k] = v - } - for k, v := range rhs { - rmap[k] = v - } - return sloppyEqual(lmap, rmap) + lmap := map[interface{}]interface{}{} + rmap := map[interface{}]interface{}{} + for k, v := range lhs { + lmap[k] = v + } + for k, v := range rhs { + rmap[k] = v + } + return sloppyEqual(lmap, rmap) } func main() { diff --git a/test/go/DataTypeFloat.go b/test/go/DataTypeFloat.go index bb96c452c..415b4e636 100644 --- a/test/go/DataTypeFloat.go +++ b/test/go/DataTypeFloat.go @@ -12,40 +12,40 @@ func sloppyEqual(lhs map[interface{}]interface{}, rhs map[interface{}]interface{ } for key, lval := range lhs { if rval, ok := rhs[key]; ok { - lstr := fmt.Sprintln(lval) - rstr := fmt.Sprintln(rval) - for i := 0; i < 1000; i++ { - if lstr != rstr { - rstr = fmt.Sprintln(rval) - } - } - lmap, lok := lval.(client.Map) - rmap, rok := rval.(client.Map) + lstr := fmt.Sprintln(lval) + rstr := fmt.Sprintln(rval) + for i := 0; i < 1000; i++ { + if lstr != rstr { + rstr = fmt.Sprintln(rval) + } + } + lmap, lok := lval.(client.Map) + rmap, rok := rval.(client.Map) if !(lval == rval || reflect.DeepEqual(lval, rval) || - (lok && rok && sloppyEqualMap(lmap, rmap)) || - lstr == rstr) { + (lok && rok && sloppyEqualMap(lmap, rmap)) || + lstr == rstr) { return false - } + } } else { return false } } for key, rval := range rhs { if lval, ok := lhs[key]; ok { - lstr := fmt.Sprintln(lval) - rstr := fmt.Sprintln(rval) - for i := 0; i < 1000; i++ { - if lstr != rstr { - rstr = fmt.Sprintln(rval) - } - } - lmap, lok := lval.(client.Map) - rmap, rok := rval.(client.Map) + lstr := fmt.Sprintln(lval) + rstr := fmt.Sprintln(rval) + for i := 0; i < 1000; i++ { + if lstr != rstr { + rstr = fmt.Sprintln(rval) + } + } + lmap, lok := lval.(client.Map) + rmap, rok := rval.(client.Map) if !(lval == rval || reflect.DeepEqual(lval, rval) || - (lok && rok && sloppyEqualMap(lmap, rmap)) || - lstr == rstr) { + (lok && rok && sloppyEqualMap(lmap, rmap)) || + lstr == rstr) { return false - } + } } else { return false } @@ -54,27 +54,27 @@ func sloppyEqual(lhs map[interface{}]interface{}, rhs map[interface{}]interface{ } func sloppyEqualMap(lhs client.Map, rhs client.Map) bool { - lmap := map[interface{}]interface{}{} - rmap := map[interface{}]interface{}{} - for k, v := range lhs { - lmap[k] = v - } - for k, v := range rhs { - rmap[k] = v - } - return sloppyEqual(lmap, rmap) + lmap := map[interface{}]interface{}{} + rmap := map[interface{}]interface{}{} + for k, v := range lhs { + lmap[k] = v + } + for k, v := range rhs { + rmap[k] = v + } + return sloppyEqual(lmap, rmap) } func sloppyEqualAttributes(lhs client.Attributes, rhs client.Attributes) bool { - lmap := map[interface{}]interface{}{} - rmap := map[interface{}]interface{}{} - for k, v := range lhs { - lmap[k] = v - } - for k, v := range rhs { - rmap[k] = v - } - return sloppyEqual(lmap, rmap) + lmap := map[interface{}]interface{}{} + rmap := map[interface{}]interface{}{} + for k, v := range lhs { + lmap[k] = v + } + for k, v := range rhs { + rmap[k] = v + } + return sloppyEqual(lmap, rmap) } func main() { diff --git a/test/go/DataTypeInt.go b/test/go/DataTypeInt.go index b5a0101d2..7c4f0e053 100644 --- a/test/go/DataTypeInt.go +++ b/test/go/DataTypeInt.go @@ -12,40 +12,40 @@ func sloppyEqual(lhs map[interface{}]interface{}, rhs map[interface{}]interface{ } for key, lval := range lhs { if rval, ok := rhs[key]; ok { - lstr := fmt.Sprintln(lval) - rstr := fmt.Sprintln(rval) - for i := 0; i < 1000; i++ { - if lstr != rstr { - rstr = fmt.Sprintln(rval) - } - } - lmap, lok := lval.(client.Map) - rmap, rok := rval.(client.Map) + lstr := fmt.Sprintln(lval) + rstr := fmt.Sprintln(rval) + for i := 0; i < 1000; i++ { + if lstr != rstr { + rstr = fmt.Sprintln(rval) + } + } + lmap, lok := lval.(client.Map) + rmap, rok := rval.(client.Map) if !(lval == rval || reflect.DeepEqual(lval, rval) || - (lok && rok && sloppyEqualMap(lmap, rmap)) || - lstr == rstr) { + (lok && rok && sloppyEqualMap(lmap, rmap)) || + lstr == rstr) { return false - } + } } else { return false } } for key, rval := range rhs { if lval, ok := lhs[key]; ok { - lstr := fmt.Sprintln(lval) - rstr := fmt.Sprintln(rval) - for i := 0; i < 1000; i++ { - if lstr != rstr { - rstr = fmt.Sprintln(rval) - } - } - lmap, lok := lval.(client.Map) - rmap, rok := rval.(client.Map) + lstr := fmt.Sprintln(lval) + rstr := fmt.Sprintln(rval) + for i := 0; i < 1000; i++ { + if lstr != rstr { + rstr = fmt.Sprintln(rval) + } + } + lmap, lok := lval.(client.Map) + rmap, rok := rval.(client.Map) if !(lval == rval || reflect.DeepEqual(lval, rval) || - (lok && rok && sloppyEqualMap(lmap, rmap)) || - lstr == rstr) { + (lok && rok && sloppyEqualMap(lmap, rmap)) || + lstr == rstr) { return false - } + } } else { return false } @@ -54,27 +54,27 @@ func sloppyEqual(lhs map[interface{}]interface{}, rhs map[interface{}]interface{ } func sloppyEqualMap(lhs client.Map, rhs client.Map) bool { - lmap := map[interface{}]interface{}{} - rmap := map[interface{}]interface{}{} - for k, v := range lhs { - lmap[k] = v - } - for k, v := range rhs { - rmap[k] = v - } - return sloppyEqual(lmap, rmap) + lmap := map[interface{}]interface{}{} + rmap := map[interface{}]interface{}{} + for k, v := range lhs { + lmap[k] = v + } + for k, v := range rhs { + rmap[k] = v + } + return sloppyEqual(lmap, rmap) } func sloppyEqualAttributes(lhs client.Attributes, rhs client.Attributes) bool { - lmap := map[interface{}]interface{}{} - rmap := map[interface{}]interface{}{} - for k, v := range lhs { - lmap[k] = v - } - for k, v := range rhs { - rmap[k] = v - } - return sloppyEqual(lmap, rmap) + lmap := map[interface{}]interface{}{} + rmap := map[interface{}]interface{}{} + for k, v := range lhs { + lmap[k] = v + } + for k, v := range rhs { + rmap[k] = v + } + return sloppyEqual(lmap, rmap) } func main() { diff --git a/test/go/DataTypeListFloat.go b/test/go/DataTypeListFloat.go index 1c285ad78..49ab89e2b 100644 --- a/test/go/DataTypeListFloat.go +++ b/test/go/DataTypeListFloat.go @@ -12,40 +12,40 @@ func sloppyEqual(lhs map[interface{}]interface{}, rhs map[interface{}]interface{ } for key, lval := range lhs { if rval, ok := rhs[key]; ok { - lstr := fmt.Sprintln(lval) - rstr := fmt.Sprintln(rval) - for i := 0; i < 1000; i++ { - if lstr != rstr { - rstr = fmt.Sprintln(rval) - } - } - lmap, lok := lval.(client.Map) - rmap, rok := rval.(client.Map) + lstr := fmt.Sprintln(lval) + rstr := fmt.Sprintln(rval) + for i := 0; i < 1000; i++ { + if lstr != rstr { + rstr = fmt.Sprintln(rval) + } + } + lmap, lok := lval.(client.Map) + rmap, rok := rval.(client.Map) if !(lval == rval || reflect.DeepEqual(lval, rval) || - (lok && rok && sloppyEqualMap(lmap, rmap)) || - lstr == rstr) { + (lok && rok && sloppyEqualMap(lmap, rmap)) || + lstr == rstr) { return false - } + } } else { return false } } for key, rval := range rhs { if lval, ok := lhs[key]; ok { - lstr := fmt.Sprintln(lval) - rstr := fmt.Sprintln(rval) - for i := 0; i < 1000; i++ { - if lstr != rstr { - rstr = fmt.Sprintln(rval) - } - } - lmap, lok := lval.(client.Map) - rmap, rok := rval.(client.Map) + lstr := fmt.Sprintln(lval) + rstr := fmt.Sprintln(rval) + for i := 0; i < 1000; i++ { + if lstr != rstr { + rstr = fmt.Sprintln(rval) + } + } + lmap, lok := lval.(client.Map) + rmap, rok := rval.(client.Map) if !(lval == rval || reflect.DeepEqual(lval, rval) || - (lok && rok && sloppyEqualMap(lmap, rmap)) || - lstr == rstr) { + (lok && rok && sloppyEqualMap(lmap, rmap)) || + lstr == rstr) { return false - } + } } else { return false } @@ -54,27 +54,27 @@ func sloppyEqual(lhs map[interface{}]interface{}, rhs map[interface{}]interface{ } func sloppyEqualMap(lhs client.Map, rhs client.Map) bool { - lmap := map[interface{}]interface{}{} - rmap := map[interface{}]interface{}{} - for k, v := range lhs { - lmap[k] = v - } - for k, v := range rhs { - rmap[k] = v - } - return sloppyEqual(lmap, rmap) + lmap := map[interface{}]interface{}{} + rmap := map[interface{}]interface{}{} + for k, v := range lhs { + lmap[k] = v + } + for k, v := range rhs { + rmap[k] = v + } + return sloppyEqual(lmap, rmap) } func sloppyEqualAttributes(lhs client.Attributes, rhs client.Attributes) bool { - lmap := map[interface{}]interface{}{} - rmap := map[interface{}]interface{}{} - for k, v := range lhs { - lmap[k] = v - } - for k, v := range rhs { - rmap[k] = v - } - return sloppyEqual(lmap, rmap) + lmap := map[interface{}]interface{}{} + rmap := map[interface{}]interface{}{} + for k, v := range lhs { + lmap[k] = v + } + for k, v := range rhs { + rmap[k] = v + } + return sloppyEqual(lmap, rmap) } func main() { diff --git a/test/go/DataTypeListInt.go b/test/go/DataTypeListInt.go index 92ed5e976..d661cb542 100644 --- a/test/go/DataTypeListInt.go +++ b/test/go/DataTypeListInt.go @@ -12,40 +12,40 @@ func sloppyEqual(lhs map[interface{}]interface{}, rhs map[interface{}]interface{ } for key, lval := range lhs { if rval, ok := rhs[key]; ok { - lstr := fmt.Sprintln(lval) - rstr := fmt.Sprintln(rval) - for i := 0; i < 1000; i++ { - if lstr != rstr { - rstr = fmt.Sprintln(rval) - } - } - lmap, lok := lval.(client.Map) - rmap, rok := rval.(client.Map) + lstr := fmt.Sprintln(lval) + rstr := fmt.Sprintln(rval) + for i := 0; i < 1000; i++ { + if lstr != rstr { + rstr = fmt.Sprintln(rval) + } + } + lmap, lok := lval.(client.Map) + rmap, rok := rval.(client.Map) if !(lval == rval || reflect.DeepEqual(lval, rval) || - (lok && rok && sloppyEqualMap(lmap, rmap)) || - lstr == rstr) { + (lok && rok && sloppyEqualMap(lmap, rmap)) || + lstr == rstr) { return false - } + } } else { return false } } for key, rval := range rhs { if lval, ok := lhs[key]; ok { - lstr := fmt.Sprintln(lval) - rstr := fmt.Sprintln(rval) - for i := 0; i < 1000; i++ { - if lstr != rstr { - rstr = fmt.Sprintln(rval) - } - } - lmap, lok := lval.(client.Map) - rmap, rok := rval.(client.Map) + lstr := fmt.Sprintln(lval) + rstr := fmt.Sprintln(rval) + for i := 0; i < 1000; i++ { + if lstr != rstr { + rstr = fmt.Sprintln(rval) + } + } + lmap, lok := lval.(client.Map) + rmap, rok := rval.(client.Map) if !(lval == rval || reflect.DeepEqual(lval, rval) || - (lok && rok && sloppyEqualMap(lmap, rmap)) || - lstr == rstr) { + (lok && rok && sloppyEqualMap(lmap, rmap)) || + lstr == rstr) { return false - } + } } else { return false } @@ -54,27 +54,27 @@ func sloppyEqual(lhs map[interface{}]interface{}, rhs map[interface{}]interface{ } func sloppyEqualMap(lhs client.Map, rhs client.Map) bool { - lmap := map[interface{}]interface{}{} - rmap := map[interface{}]interface{}{} - for k, v := range lhs { - lmap[k] = v - } - for k, v := range rhs { - rmap[k] = v - } - return sloppyEqual(lmap, rmap) + lmap := map[interface{}]interface{}{} + rmap := map[interface{}]interface{}{} + for k, v := range lhs { + lmap[k] = v + } + for k, v := range rhs { + rmap[k] = v + } + return sloppyEqual(lmap, rmap) } func sloppyEqualAttributes(lhs client.Attributes, rhs client.Attributes) bool { - lmap := map[interface{}]interface{}{} - rmap := map[interface{}]interface{}{} - for k, v := range lhs { - lmap[k] = v - } - for k, v := range rhs { - rmap[k] = v - } - return sloppyEqual(lmap, rmap) + lmap := map[interface{}]interface{}{} + rmap := map[interface{}]interface{}{} + for k, v := range lhs { + lmap[k] = v + } + for k, v := range rhs { + rmap[k] = v + } + return sloppyEqual(lmap, rmap) } func main() { diff --git a/test/go/DataTypeListString.go b/test/go/DataTypeListString.go index 86deeec51..ee4bb356a 100644 --- a/test/go/DataTypeListString.go +++ b/test/go/DataTypeListString.go @@ -12,40 +12,40 @@ func sloppyEqual(lhs map[interface{}]interface{}, rhs map[interface{}]interface{ } for key, lval := range lhs { if rval, ok := rhs[key]; ok { - lstr := fmt.Sprintln(lval) - rstr := fmt.Sprintln(rval) - for i := 0; i < 1000; i++ { - if lstr != rstr { - rstr = fmt.Sprintln(rval) - } - } - lmap, lok := lval.(client.Map) - rmap, rok := rval.(client.Map) + lstr := fmt.Sprintln(lval) + rstr := fmt.Sprintln(rval) + for i := 0; i < 1000; i++ { + if lstr != rstr { + rstr = fmt.Sprintln(rval) + } + } + lmap, lok := lval.(client.Map) + rmap, rok := rval.(client.Map) if !(lval == rval || reflect.DeepEqual(lval, rval) || - (lok && rok && sloppyEqualMap(lmap, rmap)) || - lstr == rstr) { + (lok && rok && sloppyEqualMap(lmap, rmap)) || + lstr == rstr) { return false - } + } } else { return false } } for key, rval := range rhs { if lval, ok := lhs[key]; ok { - lstr := fmt.Sprintln(lval) - rstr := fmt.Sprintln(rval) - for i := 0; i < 1000; i++ { - if lstr != rstr { - rstr = fmt.Sprintln(rval) - } - } - lmap, lok := lval.(client.Map) - rmap, rok := rval.(client.Map) + lstr := fmt.Sprintln(lval) + rstr := fmt.Sprintln(rval) + for i := 0; i < 1000; i++ { + if lstr != rstr { + rstr = fmt.Sprintln(rval) + } + } + lmap, lok := lval.(client.Map) + rmap, rok := rval.(client.Map) if !(lval == rval || reflect.DeepEqual(lval, rval) || - (lok && rok && sloppyEqualMap(lmap, rmap)) || - lstr == rstr) { + (lok && rok && sloppyEqualMap(lmap, rmap)) || + lstr == rstr) { return false - } + } } else { return false } @@ -54,27 +54,27 @@ func sloppyEqual(lhs map[interface{}]interface{}, rhs map[interface{}]interface{ } func sloppyEqualMap(lhs client.Map, rhs client.Map) bool { - lmap := map[interface{}]interface{}{} - rmap := map[interface{}]interface{}{} - for k, v := range lhs { - lmap[k] = v - } - for k, v := range rhs { - rmap[k] = v - } - return sloppyEqual(lmap, rmap) + lmap := map[interface{}]interface{}{} + rmap := map[interface{}]interface{}{} + for k, v := range lhs { + lmap[k] = v + } + for k, v := range rhs { + rmap[k] = v + } + return sloppyEqual(lmap, rmap) } func sloppyEqualAttributes(lhs client.Attributes, rhs client.Attributes) bool { - lmap := map[interface{}]interface{}{} - rmap := map[interface{}]interface{}{} - for k, v := range lhs { - lmap[k] = v - } - for k, v := range rhs { - rmap[k] = v - } - return sloppyEqual(lmap, rmap) + lmap := map[interface{}]interface{}{} + rmap := map[interface{}]interface{}{} + for k, v := range lhs { + lmap[k] = v + } + for k, v := range rhs { + rmap[k] = v + } + return sloppyEqual(lmap, rmap) } func main() { diff --git a/test/go/DataTypeMapFloatFloat.go b/test/go/DataTypeMapFloatFloat.go index b5a9d2fd3..b6e3752a8 100644 --- a/test/go/DataTypeMapFloatFloat.go +++ b/test/go/DataTypeMapFloatFloat.go @@ -12,40 +12,40 @@ func sloppyEqual(lhs map[interface{}]interface{}, rhs map[interface{}]interface{ } for key, lval := range lhs { if rval, ok := rhs[key]; ok { - lstr := fmt.Sprintln(lval) - rstr := fmt.Sprintln(rval) - for i := 0; i < 1000; i++ { - if lstr != rstr { - rstr = fmt.Sprintln(rval) - } - } - lmap, lok := lval.(client.Map) - rmap, rok := rval.(client.Map) + lstr := fmt.Sprintln(lval) + rstr := fmt.Sprintln(rval) + for i := 0; i < 1000; i++ { + if lstr != rstr { + rstr = fmt.Sprintln(rval) + } + } + lmap, lok := lval.(client.Map) + rmap, rok := rval.(client.Map) if !(lval == rval || reflect.DeepEqual(lval, rval) || - (lok && rok && sloppyEqualMap(lmap, rmap)) || - lstr == rstr) { + (lok && rok && sloppyEqualMap(lmap, rmap)) || + lstr == rstr) { return false - } + } } else { return false } } for key, rval := range rhs { if lval, ok := lhs[key]; ok { - lstr := fmt.Sprintln(lval) - rstr := fmt.Sprintln(rval) - for i := 0; i < 1000; i++ { - if lstr != rstr { - rstr = fmt.Sprintln(rval) - } - } - lmap, lok := lval.(client.Map) - rmap, rok := rval.(client.Map) + lstr := fmt.Sprintln(lval) + rstr := fmt.Sprintln(rval) + for i := 0; i < 1000; i++ { + if lstr != rstr { + rstr = fmt.Sprintln(rval) + } + } + lmap, lok := lval.(client.Map) + rmap, rok := rval.(client.Map) if !(lval == rval || reflect.DeepEqual(lval, rval) || - (lok && rok && sloppyEqualMap(lmap, rmap)) || - lstr == rstr) { + (lok && rok && sloppyEqualMap(lmap, rmap)) || + lstr == rstr) { return false - } + } } else { return false } @@ -54,27 +54,27 @@ func sloppyEqual(lhs map[interface{}]interface{}, rhs map[interface{}]interface{ } func sloppyEqualMap(lhs client.Map, rhs client.Map) bool { - lmap := map[interface{}]interface{}{} - rmap := map[interface{}]interface{}{} - for k, v := range lhs { - lmap[k] = v - } - for k, v := range rhs { - rmap[k] = v - } - return sloppyEqual(lmap, rmap) + lmap := map[interface{}]interface{}{} + rmap := map[interface{}]interface{}{} + for k, v := range lhs { + lmap[k] = v + } + for k, v := range rhs { + rmap[k] = v + } + return sloppyEqual(lmap, rmap) } func sloppyEqualAttributes(lhs client.Attributes, rhs client.Attributes) bool { - lmap := map[interface{}]interface{}{} - rmap := map[interface{}]interface{}{} - for k, v := range lhs { - lmap[k] = v - } - for k, v := range rhs { - rmap[k] = v - } - return sloppyEqual(lmap, rmap) + lmap := map[interface{}]interface{}{} + rmap := map[interface{}]interface{}{} + for k, v := range lhs { + lmap[k] = v + } + for k, v := range rhs { + rmap[k] = v + } + return sloppyEqual(lmap, rmap) } func main() { diff --git a/test/go/DataTypeMapFloatInt.go b/test/go/DataTypeMapFloatInt.go index bf7e82167..4b2428396 100644 --- a/test/go/DataTypeMapFloatInt.go +++ b/test/go/DataTypeMapFloatInt.go @@ -12,40 +12,40 @@ func sloppyEqual(lhs map[interface{}]interface{}, rhs map[interface{}]interface{ } for key, lval := range lhs { if rval, ok := rhs[key]; ok { - lstr := fmt.Sprintln(lval) - rstr := fmt.Sprintln(rval) - for i := 0; i < 1000; i++ { - if lstr != rstr { - rstr = fmt.Sprintln(rval) - } - } - lmap, lok := lval.(client.Map) - rmap, rok := rval.(client.Map) + lstr := fmt.Sprintln(lval) + rstr := fmt.Sprintln(rval) + for i := 0; i < 1000; i++ { + if lstr != rstr { + rstr = fmt.Sprintln(rval) + } + } + lmap, lok := lval.(client.Map) + rmap, rok := rval.(client.Map) if !(lval == rval || reflect.DeepEqual(lval, rval) || - (lok && rok && sloppyEqualMap(lmap, rmap)) || - lstr == rstr) { + (lok && rok && sloppyEqualMap(lmap, rmap)) || + lstr == rstr) { return false - } + } } else { return false } } for key, rval := range rhs { if lval, ok := lhs[key]; ok { - lstr := fmt.Sprintln(lval) - rstr := fmt.Sprintln(rval) - for i := 0; i < 1000; i++ { - if lstr != rstr { - rstr = fmt.Sprintln(rval) - } - } - lmap, lok := lval.(client.Map) - rmap, rok := rval.(client.Map) + lstr := fmt.Sprintln(lval) + rstr := fmt.Sprintln(rval) + for i := 0; i < 1000; i++ { + if lstr != rstr { + rstr = fmt.Sprintln(rval) + } + } + lmap, lok := lval.(client.Map) + rmap, rok := rval.(client.Map) if !(lval == rval || reflect.DeepEqual(lval, rval) || - (lok && rok && sloppyEqualMap(lmap, rmap)) || - lstr == rstr) { + (lok && rok && sloppyEqualMap(lmap, rmap)) || + lstr == rstr) { return false - } + } } else { return false } @@ -54,27 +54,27 @@ func sloppyEqual(lhs map[interface{}]interface{}, rhs map[interface{}]interface{ } func sloppyEqualMap(lhs client.Map, rhs client.Map) bool { - lmap := map[interface{}]interface{}{} - rmap := map[interface{}]interface{}{} - for k, v := range lhs { - lmap[k] = v - } - for k, v := range rhs { - rmap[k] = v - } - return sloppyEqual(lmap, rmap) + lmap := map[interface{}]interface{}{} + rmap := map[interface{}]interface{}{} + for k, v := range lhs { + lmap[k] = v + } + for k, v := range rhs { + rmap[k] = v + } + return sloppyEqual(lmap, rmap) } func sloppyEqualAttributes(lhs client.Attributes, rhs client.Attributes) bool { - lmap := map[interface{}]interface{}{} - rmap := map[interface{}]interface{}{} - for k, v := range lhs { - lmap[k] = v - } - for k, v := range rhs { - rmap[k] = v - } - return sloppyEqual(lmap, rmap) + lmap := map[interface{}]interface{}{} + rmap := map[interface{}]interface{}{} + for k, v := range lhs { + lmap[k] = v + } + for k, v := range rhs { + rmap[k] = v + } + return sloppyEqual(lmap, rmap) } func main() { diff --git a/test/go/DataTypeMapFloatString.go b/test/go/DataTypeMapFloatString.go index af8041d1a..33de16794 100644 --- a/test/go/DataTypeMapFloatString.go +++ b/test/go/DataTypeMapFloatString.go @@ -12,40 +12,40 @@ func sloppyEqual(lhs map[interface{}]interface{}, rhs map[interface{}]interface{ } for key, lval := range lhs { if rval, ok := rhs[key]; ok { - lstr := fmt.Sprintln(lval) - rstr := fmt.Sprintln(rval) - for i := 0; i < 1000; i++ { - if lstr != rstr { - rstr = fmt.Sprintln(rval) - } - } - lmap, lok := lval.(client.Map) - rmap, rok := rval.(client.Map) + lstr := fmt.Sprintln(lval) + rstr := fmt.Sprintln(rval) + for i := 0; i < 1000; i++ { + if lstr != rstr { + rstr = fmt.Sprintln(rval) + } + } + lmap, lok := lval.(client.Map) + rmap, rok := rval.(client.Map) if !(lval == rval || reflect.DeepEqual(lval, rval) || - (lok && rok && sloppyEqualMap(lmap, rmap)) || - lstr == rstr) { + (lok && rok && sloppyEqualMap(lmap, rmap)) || + lstr == rstr) { return false - } + } } else { return false } } for key, rval := range rhs { if lval, ok := lhs[key]; ok { - lstr := fmt.Sprintln(lval) - rstr := fmt.Sprintln(rval) - for i := 0; i < 1000; i++ { - if lstr != rstr { - rstr = fmt.Sprintln(rval) - } - } - lmap, lok := lval.(client.Map) - rmap, rok := rval.(client.Map) + lstr := fmt.Sprintln(lval) + rstr := fmt.Sprintln(rval) + for i := 0; i < 1000; i++ { + if lstr != rstr { + rstr = fmt.Sprintln(rval) + } + } + lmap, lok := lval.(client.Map) + rmap, rok := rval.(client.Map) if !(lval == rval || reflect.DeepEqual(lval, rval) || - (lok && rok && sloppyEqualMap(lmap, rmap)) || - lstr == rstr) { + (lok && rok && sloppyEqualMap(lmap, rmap)) || + lstr == rstr) { return false - } + } } else { return false } @@ -54,27 +54,27 @@ func sloppyEqual(lhs map[interface{}]interface{}, rhs map[interface{}]interface{ } func sloppyEqualMap(lhs client.Map, rhs client.Map) bool { - lmap := map[interface{}]interface{}{} - rmap := map[interface{}]interface{}{} - for k, v := range lhs { - lmap[k] = v - } - for k, v := range rhs { - rmap[k] = v - } - return sloppyEqual(lmap, rmap) + lmap := map[interface{}]interface{}{} + rmap := map[interface{}]interface{}{} + for k, v := range lhs { + lmap[k] = v + } + for k, v := range rhs { + rmap[k] = v + } + return sloppyEqual(lmap, rmap) } func sloppyEqualAttributes(lhs client.Attributes, rhs client.Attributes) bool { - lmap := map[interface{}]interface{}{} - rmap := map[interface{}]interface{}{} - for k, v := range lhs { - lmap[k] = v - } - for k, v := range rhs { - rmap[k] = v - } - return sloppyEqual(lmap, rmap) + lmap := map[interface{}]interface{}{} + rmap := map[interface{}]interface{}{} + for k, v := range lhs { + lmap[k] = v + } + for k, v := range rhs { + rmap[k] = v + } + return sloppyEqual(lmap, rmap) } func main() { diff --git a/test/go/DataTypeMapIntFloat.go b/test/go/DataTypeMapIntFloat.go index 40920c822..e9ce86ad2 100644 --- a/test/go/DataTypeMapIntFloat.go +++ b/test/go/DataTypeMapIntFloat.go @@ -12,40 +12,40 @@ func sloppyEqual(lhs map[interface{}]interface{}, rhs map[interface{}]interface{ } for key, lval := range lhs { if rval, ok := rhs[key]; ok { - lstr := fmt.Sprintln(lval) - rstr := fmt.Sprintln(rval) - for i := 0; i < 1000; i++ { - if lstr != rstr { - rstr = fmt.Sprintln(rval) - } - } - lmap, lok := lval.(client.Map) - rmap, rok := rval.(client.Map) + lstr := fmt.Sprintln(lval) + rstr := fmt.Sprintln(rval) + for i := 0; i < 1000; i++ { + if lstr != rstr { + rstr = fmt.Sprintln(rval) + } + } + lmap, lok := lval.(client.Map) + rmap, rok := rval.(client.Map) if !(lval == rval || reflect.DeepEqual(lval, rval) || - (lok && rok && sloppyEqualMap(lmap, rmap)) || - lstr == rstr) { + (lok && rok && sloppyEqualMap(lmap, rmap)) || + lstr == rstr) { return false - } + } } else { return false } } for key, rval := range rhs { if lval, ok := lhs[key]; ok { - lstr := fmt.Sprintln(lval) - rstr := fmt.Sprintln(rval) - for i := 0; i < 1000; i++ { - if lstr != rstr { - rstr = fmt.Sprintln(rval) - } - } - lmap, lok := lval.(client.Map) - rmap, rok := rval.(client.Map) + lstr := fmt.Sprintln(lval) + rstr := fmt.Sprintln(rval) + for i := 0; i < 1000; i++ { + if lstr != rstr { + rstr = fmt.Sprintln(rval) + } + } + lmap, lok := lval.(client.Map) + rmap, rok := rval.(client.Map) if !(lval == rval || reflect.DeepEqual(lval, rval) || - (lok && rok && sloppyEqualMap(lmap, rmap)) || - lstr == rstr) { + (lok && rok && sloppyEqualMap(lmap, rmap)) || + lstr == rstr) { return false - } + } } else { return false } @@ -54,27 +54,27 @@ func sloppyEqual(lhs map[interface{}]interface{}, rhs map[interface{}]interface{ } func sloppyEqualMap(lhs client.Map, rhs client.Map) bool { - lmap := map[interface{}]interface{}{} - rmap := map[interface{}]interface{}{} - for k, v := range lhs { - lmap[k] = v - } - for k, v := range rhs { - rmap[k] = v - } - return sloppyEqual(lmap, rmap) + lmap := map[interface{}]interface{}{} + rmap := map[interface{}]interface{}{} + for k, v := range lhs { + lmap[k] = v + } + for k, v := range rhs { + rmap[k] = v + } + return sloppyEqual(lmap, rmap) } func sloppyEqualAttributes(lhs client.Attributes, rhs client.Attributes) bool { - lmap := map[interface{}]interface{}{} - rmap := map[interface{}]interface{}{} - for k, v := range lhs { - lmap[k] = v - } - for k, v := range rhs { - rmap[k] = v - } - return sloppyEqual(lmap, rmap) + lmap := map[interface{}]interface{}{} + rmap := map[interface{}]interface{}{} + for k, v := range lhs { + lmap[k] = v + } + for k, v := range rhs { + rmap[k] = v + } + return sloppyEqual(lmap, rmap) } func main() { diff --git a/test/go/DataTypeMapIntInt.go b/test/go/DataTypeMapIntInt.go index 5775de2ac..93162199c 100644 --- a/test/go/DataTypeMapIntInt.go +++ b/test/go/DataTypeMapIntInt.go @@ -12,40 +12,40 @@ func sloppyEqual(lhs map[interface{}]interface{}, rhs map[interface{}]interface{ } for key, lval := range lhs { if rval, ok := rhs[key]; ok { - lstr := fmt.Sprintln(lval) - rstr := fmt.Sprintln(rval) - for i := 0; i < 1000; i++ { - if lstr != rstr { - rstr = fmt.Sprintln(rval) - } - } - lmap, lok := lval.(client.Map) - rmap, rok := rval.(client.Map) + lstr := fmt.Sprintln(lval) + rstr := fmt.Sprintln(rval) + for i := 0; i < 1000; i++ { + if lstr != rstr { + rstr = fmt.Sprintln(rval) + } + } + lmap, lok := lval.(client.Map) + rmap, rok := rval.(client.Map) if !(lval == rval || reflect.DeepEqual(lval, rval) || - (lok && rok && sloppyEqualMap(lmap, rmap)) || - lstr == rstr) { + (lok && rok && sloppyEqualMap(lmap, rmap)) || + lstr == rstr) { return false - } + } } else { return false } } for key, rval := range rhs { if lval, ok := lhs[key]; ok { - lstr := fmt.Sprintln(lval) - rstr := fmt.Sprintln(rval) - for i := 0; i < 1000; i++ { - if lstr != rstr { - rstr = fmt.Sprintln(rval) - } - } - lmap, lok := lval.(client.Map) - rmap, rok := rval.(client.Map) + lstr := fmt.Sprintln(lval) + rstr := fmt.Sprintln(rval) + for i := 0; i < 1000; i++ { + if lstr != rstr { + rstr = fmt.Sprintln(rval) + } + } + lmap, lok := lval.(client.Map) + rmap, rok := rval.(client.Map) if !(lval == rval || reflect.DeepEqual(lval, rval) || - (lok && rok && sloppyEqualMap(lmap, rmap)) || - lstr == rstr) { + (lok && rok && sloppyEqualMap(lmap, rmap)) || + lstr == rstr) { return false - } + } } else { return false } @@ -54,27 +54,27 @@ func sloppyEqual(lhs map[interface{}]interface{}, rhs map[interface{}]interface{ } func sloppyEqualMap(lhs client.Map, rhs client.Map) bool { - lmap := map[interface{}]interface{}{} - rmap := map[interface{}]interface{}{} - for k, v := range lhs { - lmap[k] = v - } - for k, v := range rhs { - rmap[k] = v - } - return sloppyEqual(lmap, rmap) + lmap := map[interface{}]interface{}{} + rmap := map[interface{}]interface{}{} + for k, v := range lhs { + lmap[k] = v + } + for k, v := range rhs { + rmap[k] = v + } + return sloppyEqual(lmap, rmap) } func sloppyEqualAttributes(lhs client.Attributes, rhs client.Attributes) bool { - lmap := map[interface{}]interface{}{} - rmap := map[interface{}]interface{}{} - for k, v := range lhs { - lmap[k] = v - } - for k, v := range rhs { - rmap[k] = v - } - return sloppyEqual(lmap, rmap) + lmap := map[interface{}]interface{}{} + rmap := map[interface{}]interface{}{} + for k, v := range lhs { + lmap[k] = v + } + for k, v := range rhs { + rmap[k] = v + } + return sloppyEqual(lmap, rmap) } func main() { diff --git a/test/go/DataTypeMapIntString.go b/test/go/DataTypeMapIntString.go index d2bfbd140..57ce30cba 100644 --- a/test/go/DataTypeMapIntString.go +++ b/test/go/DataTypeMapIntString.go @@ -12,40 +12,40 @@ func sloppyEqual(lhs map[interface{}]interface{}, rhs map[interface{}]interface{ } for key, lval := range lhs { if rval, ok := rhs[key]; ok { - lstr := fmt.Sprintln(lval) - rstr := fmt.Sprintln(rval) - for i := 0; i < 1000; i++ { - if lstr != rstr { - rstr = fmt.Sprintln(rval) - } - } - lmap, lok := lval.(client.Map) - rmap, rok := rval.(client.Map) + lstr := fmt.Sprintln(lval) + rstr := fmt.Sprintln(rval) + for i := 0; i < 1000; i++ { + if lstr != rstr { + rstr = fmt.Sprintln(rval) + } + } + lmap, lok := lval.(client.Map) + rmap, rok := rval.(client.Map) if !(lval == rval || reflect.DeepEqual(lval, rval) || - (lok && rok && sloppyEqualMap(lmap, rmap)) || - lstr == rstr) { + (lok && rok && sloppyEqualMap(lmap, rmap)) || + lstr == rstr) { return false - } + } } else { return false } } for key, rval := range rhs { if lval, ok := lhs[key]; ok { - lstr := fmt.Sprintln(lval) - rstr := fmt.Sprintln(rval) - for i := 0; i < 1000; i++ { - if lstr != rstr { - rstr = fmt.Sprintln(rval) - } - } - lmap, lok := lval.(client.Map) - rmap, rok := rval.(client.Map) + lstr := fmt.Sprintln(lval) + rstr := fmt.Sprintln(rval) + for i := 0; i < 1000; i++ { + if lstr != rstr { + rstr = fmt.Sprintln(rval) + } + } + lmap, lok := lval.(client.Map) + rmap, rok := rval.(client.Map) if !(lval == rval || reflect.DeepEqual(lval, rval) || - (lok && rok && sloppyEqualMap(lmap, rmap)) || - lstr == rstr) { + (lok && rok && sloppyEqualMap(lmap, rmap)) || + lstr == rstr) { return false - } + } } else { return false } @@ -54,27 +54,27 @@ func sloppyEqual(lhs map[interface{}]interface{}, rhs map[interface{}]interface{ } func sloppyEqualMap(lhs client.Map, rhs client.Map) bool { - lmap := map[interface{}]interface{}{} - rmap := map[interface{}]interface{}{} - for k, v := range lhs { - lmap[k] = v - } - for k, v := range rhs { - rmap[k] = v - } - return sloppyEqual(lmap, rmap) + lmap := map[interface{}]interface{}{} + rmap := map[interface{}]interface{}{} + for k, v := range lhs { + lmap[k] = v + } + for k, v := range rhs { + rmap[k] = v + } + return sloppyEqual(lmap, rmap) } func sloppyEqualAttributes(lhs client.Attributes, rhs client.Attributes) bool { - lmap := map[interface{}]interface{}{} - rmap := map[interface{}]interface{}{} - for k, v := range lhs { - lmap[k] = v - } - for k, v := range rhs { - rmap[k] = v - } - return sloppyEqual(lmap, rmap) + lmap := map[interface{}]interface{}{} + rmap := map[interface{}]interface{}{} + for k, v := range lhs { + lmap[k] = v + } + for k, v := range rhs { + rmap[k] = v + } + return sloppyEqual(lmap, rmap) } func main() { diff --git a/test/go/DataTypeMapStringFloat.go b/test/go/DataTypeMapStringFloat.go index c3e93e290..6401d4a82 100644 --- a/test/go/DataTypeMapStringFloat.go +++ b/test/go/DataTypeMapStringFloat.go @@ -12,40 +12,40 @@ func sloppyEqual(lhs map[interface{}]interface{}, rhs map[interface{}]interface{ } for key, lval := range lhs { if rval, ok := rhs[key]; ok { - lstr := fmt.Sprintln(lval) - rstr := fmt.Sprintln(rval) - for i := 0; i < 1000; i++ { - if lstr != rstr { - rstr = fmt.Sprintln(rval) - } - } - lmap, lok := lval.(client.Map) - rmap, rok := rval.(client.Map) + lstr := fmt.Sprintln(lval) + rstr := fmt.Sprintln(rval) + for i := 0; i < 1000; i++ { + if lstr != rstr { + rstr = fmt.Sprintln(rval) + } + } + lmap, lok := lval.(client.Map) + rmap, rok := rval.(client.Map) if !(lval == rval || reflect.DeepEqual(lval, rval) || - (lok && rok && sloppyEqualMap(lmap, rmap)) || - lstr == rstr) { + (lok && rok && sloppyEqualMap(lmap, rmap)) || + lstr == rstr) { return false - } + } } else { return false } } for key, rval := range rhs { if lval, ok := lhs[key]; ok { - lstr := fmt.Sprintln(lval) - rstr := fmt.Sprintln(rval) - for i := 0; i < 1000; i++ { - if lstr != rstr { - rstr = fmt.Sprintln(rval) - } - } - lmap, lok := lval.(client.Map) - rmap, rok := rval.(client.Map) + lstr := fmt.Sprintln(lval) + rstr := fmt.Sprintln(rval) + for i := 0; i < 1000; i++ { + if lstr != rstr { + rstr = fmt.Sprintln(rval) + } + } + lmap, lok := lval.(client.Map) + rmap, rok := rval.(client.Map) if !(lval == rval || reflect.DeepEqual(lval, rval) || - (lok && rok && sloppyEqualMap(lmap, rmap)) || - lstr == rstr) { + (lok && rok && sloppyEqualMap(lmap, rmap)) || + lstr == rstr) { return false - } + } } else { return false } @@ -54,27 +54,27 @@ func sloppyEqual(lhs map[interface{}]interface{}, rhs map[interface{}]interface{ } func sloppyEqualMap(lhs client.Map, rhs client.Map) bool { - lmap := map[interface{}]interface{}{} - rmap := map[interface{}]interface{}{} - for k, v := range lhs { - lmap[k] = v - } - for k, v := range rhs { - rmap[k] = v - } - return sloppyEqual(lmap, rmap) + lmap := map[interface{}]interface{}{} + rmap := map[interface{}]interface{}{} + for k, v := range lhs { + lmap[k] = v + } + for k, v := range rhs { + rmap[k] = v + } + return sloppyEqual(lmap, rmap) } func sloppyEqualAttributes(lhs client.Attributes, rhs client.Attributes) bool { - lmap := map[interface{}]interface{}{} - rmap := map[interface{}]interface{}{} - for k, v := range lhs { - lmap[k] = v - } - for k, v := range rhs { - rmap[k] = v - } - return sloppyEqual(lmap, rmap) + lmap := map[interface{}]interface{}{} + rmap := map[interface{}]interface{}{} + for k, v := range lhs { + lmap[k] = v + } + for k, v := range rhs { + rmap[k] = v + } + return sloppyEqual(lmap, rmap) } func main() { diff --git a/test/go/DataTypeMapStringInt.go b/test/go/DataTypeMapStringInt.go index 8df2aa8fd..ae797a307 100644 --- a/test/go/DataTypeMapStringInt.go +++ b/test/go/DataTypeMapStringInt.go @@ -12,40 +12,40 @@ func sloppyEqual(lhs map[interface{}]interface{}, rhs map[interface{}]interface{ } for key, lval := range lhs { if rval, ok := rhs[key]; ok { - lstr := fmt.Sprintln(lval) - rstr := fmt.Sprintln(rval) - for i := 0; i < 1000; i++ { - if lstr != rstr { - rstr = fmt.Sprintln(rval) - } - } - lmap, lok := lval.(client.Map) - rmap, rok := rval.(client.Map) + lstr := fmt.Sprintln(lval) + rstr := fmt.Sprintln(rval) + for i := 0; i < 1000; i++ { + if lstr != rstr { + rstr = fmt.Sprintln(rval) + } + } + lmap, lok := lval.(client.Map) + rmap, rok := rval.(client.Map) if !(lval == rval || reflect.DeepEqual(lval, rval) || - (lok && rok && sloppyEqualMap(lmap, rmap)) || - lstr == rstr) { + (lok && rok && sloppyEqualMap(lmap, rmap)) || + lstr == rstr) { return false - } + } } else { return false } } for key, rval := range rhs { if lval, ok := lhs[key]; ok { - lstr := fmt.Sprintln(lval) - rstr := fmt.Sprintln(rval) - for i := 0; i < 1000; i++ { - if lstr != rstr { - rstr = fmt.Sprintln(rval) - } - } - lmap, lok := lval.(client.Map) - rmap, rok := rval.(client.Map) + lstr := fmt.Sprintln(lval) + rstr := fmt.Sprintln(rval) + for i := 0; i < 1000; i++ { + if lstr != rstr { + rstr = fmt.Sprintln(rval) + } + } + lmap, lok := lval.(client.Map) + rmap, rok := rval.(client.Map) if !(lval == rval || reflect.DeepEqual(lval, rval) || - (lok && rok && sloppyEqualMap(lmap, rmap)) || - lstr == rstr) { + (lok && rok && sloppyEqualMap(lmap, rmap)) || + lstr == rstr) { return false - } + } } else { return false } @@ -54,27 +54,27 @@ func sloppyEqual(lhs map[interface{}]interface{}, rhs map[interface{}]interface{ } func sloppyEqualMap(lhs client.Map, rhs client.Map) bool { - lmap := map[interface{}]interface{}{} - rmap := map[interface{}]interface{}{} - for k, v := range lhs { - lmap[k] = v - } - for k, v := range rhs { - rmap[k] = v - } - return sloppyEqual(lmap, rmap) + lmap := map[interface{}]interface{}{} + rmap := map[interface{}]interface{}{} + for k, v := range lhs { + lmap[k] = v + } + for k, v := range rhs { + rmap[k] = v + } + return sloppyEqual(lmap, rmap) } func sloppyEqualAttributes(lhs client.Attributes, rhs client.Attributes) bool { - lmap := map[interface{}]interface{}{} - rmap := map[interface{}]interface{}{} - for k, v := range lhs { - lmap[k] = v - } - for k, v := range rhs { - rmap[k] = v - } - return sloppyEqual(lmap, rmap) + lmap := map[interface{}]interface{}{} + rmap := map[interface{}]interface{}{} + for k, v := range lhs { + lmap[k] = v + } + for k, v := range rhs { + rmap[k] = v + } + return sloppyEqual(lmap, rmap) } func main() { diff --git a/test/go/DataTypeMapStringString.go b/test/go/DataTypeMapStringString.go index 40c77d409..9838fd660 100644 --- a/test/go/DataTypeMapStringString.go +++ b/test/go/DataTypeMapStringString.go @@ -12,40 +12,40 @@ func sloppyEqual(lhs map[interface{}]interface{}, rhs map[interface{}]interface{ } for key, lval := range lhs { if rval, ok := rhs[key]; ok { - lstr := fmt.Sprintln(lval) - rstr := fmt.Sprintln(rval) - for i := 0; i < 1000; i++ { - if lstr != rstr { - rstr = fmt.Sprintln(rval) - } - } - lmap, lok := lval.(client.Map) - rmap, rok := rval.(client.Map) + lstr := fmt.Sprintln(lval) + rstr := fmt.Sprintln(rval) + for i := 0; i < 1000; i++ { + if lstr != rstr { + rstr = fmt.Sprintln(rval) + } + } + lmap, lok := lval.(client.Map) + rmap, rok := rval.(client.Map) if !(lval == rval || reflect.DeepEqual(lval, rval) || - (lok && rok && sloppyEqualMap(lmap, rmap)) || - lstr == rstr) { + (lok && rok && sloppyEqualMap(lmap, rmap)) || + lstr == rstr) { return false - } + } } else { return false } } for key, rval := range rhs { if lval, ok := lhs[key]; ok { - lstr := fmt.Sprintln(lval) - rstr := fmt.Sprintln(rval) - for i := 0; i < 1000; i++ { - if lstr != rstr { - rstr = fmt.Sprintln(rval) - } - } - lmap, lok := lval.(client.Map) - rmap, rok := rval.(client.Map) + lstr := fmt.Sprintln(lval) + rstr := fmt.Sprintln(rval) + for i := 0; i < 1000; i++ { + if lstr != rstr { + rstr = fmt.Sprintln(rval) + } + } + lmap, lok := lval.(client.Map) + rmap, rok := rval.(client.Map) if !(lval == rval || reflect.DeepEqual(lval, rval) || - (lok && rok && sloppyEqualMap(lmap, rmap)) || - lstr == rstr) { + (lok && rok && sloppyEqualMap(lmap, rmap)) || + lstr == rstr) { return false - } + } } else { return false } @@ -54,27 +54,27 @@ func sloppyEqual(lhs map[interface{}]interface{}, rhs map[interface{}]interface{ } func sloppyEqualMap(lhs client.Map, rhs client.Map) bool { - lmap := map[interface{}]interface{}{} - rmap := map[interface{}]interface{}{} - for k, v := range lhs { - lmap[k] = v - } - for k, v := range rhs { - rmap[k] = v - } - return sloppyEqual(lmap, rmap) + lmap := map[interface{}]interface{}{} + rmap := map[interface{}]interface{}{} + for k, v := range lhs { + lmap[k] = v + } + for k, v := range rhs { + rmap[k] = v + } + return sloppyEqual(lmap, rmap) } func sloppyEqualAttributes(lhs client.Attributes, rhs client.Attributes) bool { - lmap := map[interface{}]interface{}{} - rmap := map[interface{}]interface{}{} - for k, v := range lhs { - lmap[k] = v - } - for k, v := range rhs { - rmap[k] = v - } - return sloppyEqual(lmap, rmap) + lmap := map[interface{}]interface{}{} + rmap := map[interface{}]interface{}{} + for k, v := range lhs { + lmap[k] = v + } + for k, v := range rhs { + rmap[k] = v + } + return sloppyEqual(lmap, rmap) } func main() { diff --git a/test/go/DataTypeSetFloat.go b/test/go/DataTypeSetFloat.go index cba920981..9d8ee7282 100644 --- a/test/go/DataTypeSetFloat.go +++ b/test/go/DataTypeSetFloat.go @@ -12,40 +12,40 @@ func sloppyEqual(lhs map[interface{}]interface{}, rhs map[interface{}]interface{ } for key, lval := range lhs { if rval, ok := rhs[key]; ok { - lstr := fmt.Sprintln(lval) - rstr := fmt.Sprintln(rval) - for i := 0; i < 1000; i++ { - if lstr != rstr { - rstr = fmt.Sprintln(rval) - } - } - lmap, lok := lval.(client.Map) - rmap, rok := rval.(client.Map) + lstr := fmt.Sprintln(lval) + rstr := fmt.Sprintln(rval) + for i := 0; i < 1000; i++ { + if lstr != rstr { + rstr = fmt.Sprintln(rval) + } + } + lmap, lok := lval.(client.Map) + rmap, rok := rval.(client.Map) if !(lval == rval || reflect.DeepEqual(lval, rval) || - (lok && rok && sloppyEqualMap(lmap, rmap)) || - lstr == rstr) { + (lok && rok && sloppyEqualMap(lmap, rmap)) || + lstr == rstr) { return false - } + } } else { return false } } for key, rval := range rhs { if lval, ok := lhs[key]; ok { - lstr := fmt.Sprintln(lval) - rstr := fmt.Sprintln(rval) - for i := 0; i < 1000; i++ { - if lstr != rstr { - rstr = fmt.Sprintln(rval) - } - } - lmap, lok := lval.(client.Map) - rmap, rok := rval.(client.Map) + lstr := fmt.Sprintln(lval) + rstr := fmt.Sprintln(rval) + for i := 0; i < 1000; i++ { + if lstr != rstr { + rstr = fmt.Sprintln(rval) + } + } + lmap, lok := lval.(client.Map) + rmap, rok := rval.(client.Map) if !(lval == rval || reflect.DeepEqual(lval, rval) || - (lok && rok && sloppyEqualMap(lmap, rmap)) || - lstr == rstr) { + (lok && rok && sloppyEqualMap(lmap, rmap)) || + lstr == rstr) { return false - } + } } else { return false } @@ -54,27 +54,27 @@ func sloppyEqual(lhs map[interface{}]interface{}, rhs map[interface{}]interface{ } func sloppyEqualMap(lhs client.Map, rhs client.Map) bool { - lmap := map[interface{}]interface{}{} - rmap := map[interface{}]interface{}{} - for k, v := range lhs { - lmap[k] = v - } - for k, v := range rhs { - rmap[k] = v - } - return sloppyEqual(lmap, rmap) + lmap := map[interface{}]interface{}{} + rmap := map[interface{}]interface{}{} + for k, v := range lhs { + lmap[k] = v + } + for k, v := range rhs { + rmap[k] = v + } + return sloppyEqual(lmap, rmap) } func sloppyEqualAttributes(lhs client.Attributes, rhs client.Attributes) bool { - lmap := map[interface{}]interface{}{} - rmap := map[interface{}]interface{}{} - for k, v := range lhs { - lmap[k] = v - } - for k, v := range rhs { - rmap[k] = v - } - return sloppyEqual(lmap, rmap) + lmap := map[interface{}]interface{}{} + rmap := map[interface{}]interface{}{} + for k, v := range lhs { + lmap[k] = v + } + for k, v := range rhs { + rmap[k] = v + } + return sloppyEqual(lmap, rmap) } func main() { diff --git a/test/go/DataTypeSetInt.go b/test/go/DataTypeSetInt.go index 0ee45e23c..f8467d50c 100644 --- a/test/go/DataTypeSetInt.go +++ b/test/go/DataTypeSetInt.go @@ -12,40 +12,40 @@ func sloppyEqual(lhs map[interface{}]interface{}, rhs map[interface{}]interface{ } for key, lval := range lhs { if rval, ok := rhs[key]; ok { - lstr := fmt.Sprintln(lval) - rstr := fmt.Sprintln(rval) - for i := 0; i < 1000; i++ { - if lstr != rstr { - rstr = fmt.Sprintln(rval) - } - } - lmap, lok := lval.(client.Map) - rmap, rok := rval.(client.Map) + lstr := fmt.Sprintln(lval) + rstr := fmt.Sprintln(rval) + for i := 0; i < 1000; i++ { + if lstr != rstr { + rstr = fmt.Sprintln(rval) + } + } + lmap, lok := lval.(client.Map) + rmap, rok := rval.(client.Map) if !(lval == rval || reflect.DeepEqual(lval, rval) || - (lok && rok && sloppyEqualMap(lmap, rmap)) || - lstr == rstr) { + (lok && rok && sloppyEqualMap(lmap, rmap)) || + lstr == rstr) { return false - } + } } else { return false } } for key, rval := range rhs { if lval, ok := lhs[key]; ok { - lstr := fmt.Sprintln(lval) - rstr := fmt.Sprintln(rval) - for i := 0; i < 1000; i++ { - if lstr != rstr { - rstr = fmt.Sprintln(rval) - } - } - lmap, lok := lval.(client.Map) - rmap, rok := rval.(client.Map) + lstr := fmt.Sprintln(lval) + rstr := fmt.Sprintln(rval) + for i := 0; i < 1000; i++ { + if lstr != rstr { + rstr = fmt.Sprintln(rval) + } + } + lmap, lok := lval.(client.Map) + rmap, rok := rval.(client.Map) if !(lval == rval || reflect.DeepEqual(lval, rval) || - (lok && rok && sloppyEqualMap(lmap, rmap)) || - lstr == rstr) { + (lok && rok && sloppyEqualMap(lmap, rmap)) || + lstr == rstr) { return false - } + } } else { return false } @@ -54,27 +54,27 @@ func sloppyEqual(lhs map[interface{}]interface{}, rhs map[interface{}]interface{ } func sloppyEqualMap(lhs client.Map, rhs client.Map) bool { - lmap := map[interface{}]interface{}{} - rmap := map[interface{}]interface{}{} - for k, v := range lhs { - lmap[k] = v - } - for k, v := range rhs { - rmap[k] = v - } - return sloppyEqual(lmap, rmap) + lmap := map[interface{}]interface{}{} + rmap := map[interface{}]interface{}{} + for k, v := range lhs { + lmap[k] = v + } + for k, v := range rhs { + rmap[k] = v + } + return sloppyEqual(lmap, rmap) } func sloppyEqualAttributes(lhs client.Attributes, rhs client.Attributes) bool { - lmap := map[interface{}]interface{}{} - rmap := map[interface{}]interface{}{} - for k, v := range lhs { - lmap[k] = v - } - for k, v := range rhs { - rmap[k] = v - } - return sloppyEqual(lmap, rmap) + lmap := map[interface{}]interface{}{} + rmap := map[interface{}]interface{}{} + for k, v := range lhs { + lmap[k] = v + } + for k, v := range rhs { + rmap[k] = v + } + return sloppyEqual(lmap, rmap) } func main() { diff --git a/test/go/DataTypeSetString.go b/test/go/DataTypeSetString.go index 13c797aaf..c34d74b5e 100644 --- a/test/go/DataTypeSetString.go +++ b/test/go/DataTypeSetString.go @@ -12,40 +12,40 @@ func sloppyEqual(lhs map[interface{}]interface{}, rhs map[interface{}]interface{ } for key, lval := range lhs { if rval, ok := rhs[key]; ok { - lstr := fmt.Sprintln(lval) - rstr := fmt.Sprintln(rval) - for i := 0; i < 1000; i++ { - if lstr != rstr { - rstr = fmt.Sprintln(rval) - } - } - lmap, lok := lval.(client.Map) - rmap, rok := rval.(client.Map) + lstr := fmt.Sprintln(lval) + rstr := fmt.Sprintln(rval) + for i := 0; i < 1000; i++ { + if lstr != rstr { + rstr = fmt.Sprintln(rval) + } + } + lmap, lok := lval.(client.Map) + rmap, rok := rval.(client.Map) if !(lval == rval || reflect.DeepEqual(lval, rval) || - (lok && rok && sloppyEqualMap(lmap, rmap)) || - lstr == rstr) { + (lok && rok && sloppyEqualMap(lmap, rmap)) || + lstr == rstr) { return false - } + } } else { return false } } for key, rval := range rhs { if lval, ok := lhs[key]; ok { - lstr := fmt.Sprintln(lval) - rstr := fmt.Sprintln(rval) - for i := 0; i < 1000; i++ { - if lstr != rstr { - rstr = fmt.Sprintln(rval) - } - } - lmap, lok := lval.(client.Map) - rmap, rok := rval.(client.Map) + lstr := fmt.Sprintln(lval) + rstr := fmt.Sprintln(rval) + for i := 0; i < 1000; i++ { + if lstr != rstr { + rstr = fmt.Sprintln(rval) + } + } + lmap, lok := lval.(client.Map) + rmap, rok := rval.(client.Map) if !(lval == rval || reflect.DeepEqual(lval, rval) || - (lok && rok && sloppyEqualMap(lmap, rmap)) || - lstr == rstr) { + (lok && rok && sloppyEqualMap(lmap, rmap)) || + lstr == rstr) { return false - } + } } else { return false } @@ -54,27 +54,27 @@ func sloppyEqual(lhs map[interface{}]interface{}, rhs map[interface{}]interface{ } func sloppyEqualMap(lhs client.Map, rhs client.Map) bool { - lmap := map[interface{}]interface{}{} - rmap := map[interface{}]interface{}{} - for k, v := range lhs { - lmap[k] = v - } - for k, v := range rhs { - rmap[k] = v - } - return sloppyEqual(lmap, rmap) + lmap := map[interface{}]interface{}{} + rmap := map[interface{}]interface{}{} + for k, v := range lhs { + lmap[k] = v + } + for k, v := range rhs { + rmap[k] = v + } + return sloppyEqual(lmap, rmap) } func sloppyEqualAttributes(lhs client.Attributes, rhs client.Attributes) bool { - lmap := map[interface{}]interface{}{} - rmap := map[interface{}]interface{}{} - for k, v := range lhs { - lmap[k] = v - } - for k, v := range rhs { - rmap[k] = v - } - return sloppyEqual(lmap, rmap) + lmap := map[interface{}]interface{}{} + rmap := map[interface{}]interface{}{} + for k, v := range lhs { + lmap[k] = v + } + for k, v := range rhs { + rmap[k] = v + } + return sloppyEqual(lmap, rmap) } func main() { diff --git a/test/go/DataTypeString.go b/test/go/DataTypeString.go index f493d27b0..4aa407e86 100644 --- a/test/go/DataTypeString.go +++ b/test/go/DataTypeString.go @@ -12,40 +12,40 @@ func sloppyEqual(lhs map[interface{}]interface{}, rhs map[interface{}]interface{ } for key, lval := range lhs { if rval, ok := rhs[key]; ok { - lstr := fmt.Sprintln(lval) - rstr := fmt.Sprintln(rval) - for i := 0; i < 1000; i++ { - if lstr != rstr { - rstr = fmt.Sprintln(rval) - } - } - lmap, lok := lval.(client.Map) - rmap, rok := rval.(client.Map) + lstr := fmt.Sprintln(lval) + rstr := fmt.Sprintln(rval) + for i := 0; i < 1000; i++ { + if lstr != rstr { + rstr = fmt.Sprintln(rval) + } + } + lmap, lok := lval.(client.Map) + rmap, rok := rval.(client.Map) if !(lval == rval || reflect.DeepEqual(lval, rval) || - (lok && rok && sloppyEqualMap(lmap, rmap)) || - lstr == rstr) { + (lok && rok && sloppyEqualMap(lmap, rmap)) || + lstr == rstr) { return false - } + } } else { return false } } for key, rval := range rhs { if lval, ok := lhs[key]; ok { - lstr := fmt.Sprintln(lval) - rstr := fmt.Sprintln(rval) - for i := 0; i < 1000; i++ { - if lstr != rstr { - rstr = fmt.Sprintln(rval) - } - } - lmap, lok := lval.(client.Map) - rmap, rok := rval.(client.Map) + lstr := fmt.Sprintln(lval) + rstr := fmt.Sprintln(rval) + for i := 0; i < 1000; i++ { + if lstr != rstr { + rstr = fmt.Sprintln(rval) + } + } + lmap, lok := lval.(client.Map) + rmap, rok := rval.(client.Map) if !(lval == rval || reflect.DeepEqual(lval, rval) || - (lok && rok && sloppyEqualMap(lmap, rmap)) || - lstr == rstr) { + (lok && rok && sloppyEqualMap(lmap, rmap)) || + lstr == rstr) { return false - } + } } else { return false } @@ -54,27 +54,27 @@ func sloppyEqual(lhs map[interface{}]interface{}, rhs map[interface{}]interface{ } func sloppyEqualMap(lhs client.Map, rhs client.Map) bool { - lmap := map[interface{}]interface{}{} - rmap := map[interface{}]interface{}{} - for k, v := range lhs { - lmap[k] = v - } - for k, v := range rhs { - rmap[k] = v - } - return sloppyEqual(lmap, rmap) + lmap := map[interface{}]interface{}{} + rmap := map[interface{}]interface{}{} + for k, v := range lhs { + lmap[k] = v + } + for k, v := range rhs { + rmap[k] = v + } + return sloppyEqual(lmap, rmap) } func sloppyEqualAttributes(lhs client.Attributes, rhs client.Attributes) bool { - lmap := map[interface{}]interface{}{} - rmap := map[interface{}]interface{}{} - for k, v := range lhs { - lmap[k] = v - } - for k, v := range rhs { - rmap[k] = v - } - return sloppyEqual(lmap, rmap) + lmap := map[interface{}]interface{}{} + rmap := map[interface{}]interface{}{} + for k, v := range lhs { + lmap[k] = v + } + for k, v := range rhs { + rmap[k] = v + } + return sloppyEqual(lmap, rmap) } func main() { diff --git a/test/go/LengthString.go b/test/go/LengthString.go index 1a6d77d9b..12ad0ebf4 100644 --- a/test/go/LengthString.go +++ b/test/go/LengthString.go @@ -12,40 +12,40 @@ func sloppyEqual(lhs map[interface{}]interface{}, rhs map[interface{}]interface{ } for key, lval := range lhs { if rval, ok := rhs[key]; ok { - lstr := fmt.Sprintln(lval) - rstr := fmt.Sprintln(rval) - for i := 0; i < 1000; i++ { - if lstr != rstr { - rstr = fmt.Sprintln(rval) - } - } - lmap, lok := lval.(client.Map) - rmap, rok := rval.(client.Map) + lstr := fmt.Sprintln(lval) + rstr := fmt.Sprintln(rval) + for i := 0; i < 1000; i++ { + if lstr != rstr { + rstr = fmt.Sprintln(rval) + } + } + lmap, lok := lval.(client.Map) + rmap, rok := rval.(client.Map) if !(lval == rval || reflect.DeepEqual(lval, rval) || - (lok && rok && sloppyEqualMap(lmap, rmap)) || - lstr == rstr) { + (lok && rok && sloppyEqualMap(lmap, rmap)) || + lstr == rstr) { return false - } + } } else { return false } } for key, rval := range rhs { if lval, ok := lhs[key]; ok { - lstr := fmt.Sprintln(lval) - rstr := fmt.Sprintln(rval) - for i := 0; i < 1000; i++ { - if lstr != rstr { - rstr = fmt.Sprintln(rval) - } - } - lmap, lok := lval.(client.Map) - rmap, rok := rval.(client.Map) + lstr := fmt.Sprintln(lval) + rstr := fmt.Sprintln(rval) + for i := 0; i < 1000; i++ { + if lstr != rstr { + rstr = fmt.Sprintln(rval) + } + } + lmap, lok := lval.(client.Map) + rmap, rok := rval.(client.Map) if !(lval == rval || reflect.DeepEqual(lval, rval) || - (lok && rok && sloppyEqualMap(lmap, rmap)) || - lstr == rstr) { + (lok && rok && sloppyEqualMap(lmap, rmap)) || + lstr == rstr) { return false - } + } } else { return false } @@ -54,27 +54,27 @@ func sloppyEqual(lhs map[interface{}]interface{}, rhs map[interface{}]interface{ } func sloppyEqualMap(lhs client.Map, rhs client.Map) bool { - lmap := map[interface{}]interface{}{} - rmap := map[interface{}]interface{}{} - for k, v := range lhs { - lmap[k] = v - } - for k, v := range rhs { - rmap[k] = v - } - return sloppyEqual(lmap, rmap) + lmap := map[interface{}]interface{}{} + rmap := map[interface{}]interface{}{} + for k, v := range lhs { + lmap[k] = v + } + for k, v := range rhs { + rmap[k] = v + } + return sloppyEqual(lmap, rmap) } func sloppyEqualAttributes(lhs client.Attributes, rhs client.Attributes) bool { - lmap := map[interface{}]interface{}{} - rmap := map[interface{}]interface{}{} - for k, v := range lhs { - lmap[k] = v - } - for k, v := range rhs { - rmap[k] = v - } - return sloppyEqual(lmap, rmap) + lmap := map[interface{}]interface{}{} + rmap := map[interface{}]interface{}{} + for k, v := range lhs { + lmap[k] = v + } + for k, v := range rhs { + rmap[k] = v + } + return sloppyEqual(lmap, rmap) } func main() { diff --git a/test/go/MultiAttribute.go b/test/go/MultiAttribute.go index a48265cfc..418a8b554 100644 --- a/test/go/MultiAttribute.go +++ b/test/go/MultiAttribute.go @@ -12,40 +12,40 @@ func sloppyEqual(lhs map[interface{}]interface{}, rhs map[interface{}]interface{ } for key, lval := range lhs { if rval, ok := rhs[key]; ok { - lstr := fmt.Sprintln(lval) - rstr := fmt.Sprintln(rval) - for i := 0; i < 1000; i++ { - if lstr != rstr { - rstr = fmt.Sprintln(rval) - } - } - lmap, lok := lval.(client.Map) - rmap, rok := rval.(client.Map) + lstr := fmt.Sprintln(lval) + rstr := fmt.Sprintln(rval) + for i := 0; i < 1000; i++ { + if lstr != rstr { + rstr = fmt.Sprintln(rval) + } + } + lmap, lok := lval.(client.Map) + rmap, rok := rval.(client.Map) if !(lval == rval || reflect.DeepEqual(lval, rval) || - (lok && rok && sloppyEqualMap(lmap, rmap)) || - lstr == rstr) { + (lok && rok && sloppyEqualMap(lmap, rmap)) || + lstr == rstr) { return false - } + } } else { return false } } for key, rval := range rhs { if lval, ok := lhs[key]; ok { - lstr := fmt.Sprintln(lval) - rstr := fmt.Sprintln(rval) - for i := 0; i < 1000; i++ { - if lstr != rstr { - rstr = fmt.Sprintln(rval) - } - } - lmap, lok := lval.(client.Map) - rmap, rok := rval.(client.Map) + lstr := fmt.Sprintln(lval) + rstr := fmt.Sprintln(rval) + for i := 0; i < 1000; i++ { + if lstr != rstr { + rstr = fmt.Sprintln(rval) + } + } + lmap, lok := lval.(client.Map) + rmap, rok := rval.(client.Map) if !(lval == rval || reflect.DeepEqual(lval, rval) || - (lok && rok && sloppyEqualMap(lmap, rmap)) || - lstr == rstr) { + (lok && rok && sloppyEqualMap(lmap, rmap)) || + lstr == rstr) { return false - } + } } else { return false } @@ -54,27 +54,27 @@ func sloppyEqual(lhs map[interface{}]interface{}, rhs map[interface{}]interface{ } func sloppyEqualMap(lhs client.Map, rhs client.Map) bool { - lmap := map[interface{}]interface{}{} - rmap := map[interface{}]interface{}{} - for k, v := range lhs { - lmap[k] = v - } - for k, v := range rhs { - rmap[k] = v - } - return sloppyEqual(lmap, rmap) + lmap := map[interface{}]interface{}{} + rmap := map[interface{}]interface{}{} + for k, v := range lhs { + lmap[k] = v + } + for k, v := range rhs { + rmap[k] = v + } + return sloppyEqual(lmap, rmap) } func sloppyEqualAttributes(lhs client.Attributes, rhs client.Attributes) bool { - lmap := map[interface{}]interface{}{} - rmap := map[interface{}]interface{}{} - for k, v := range lhs { - lmap[k] = v - } - for k, v := range rhs { - rmap[k] = v - } - return sloppyEqual(lmap, rmap) + lmap := map[interface{}]interface{}{} + rmap := map[interface{}]interface{}{} + for k, v := range lhs { + lmap[k] = v + } + for k, v := range rhs { + rmap[k] = v + } + return sloppyEqual(lmap, rmap) } func main() { diff --git a/test/go/RangeSearchInt.go b/test/go/RangeSearchInt.go index c6b5726e5..4bb2001b2 100644 --- a/test/go/RangeSearchInt.go +++ b/test/go/RangeSearchInt.go @@ -12,40 +12,40 @@ func sloppyEqual(lhs map[interface{}]interface{}, rhs map[interface{}]interface{ } for key, lval := range lhs { if rval, ok := rhs[key]; ok { - lstr := fmt.Sprintln(lval) - rstr := fmt.Sprintln(rval) - for i := 0; i < 1000; i++ { - if lstr != rstr { - rstr = fmt.Sprintln(rval) - } - } - lmap, lok := lval.(client.Map) - rmap, rok := rval.(client.Map) + lstr := fmt.Sprintln(lval) + rstr := fmt.Sprintln(rval) + for i := 0; i < 1000; i++ { + if lstr != rstr { + rstr = fmt.Sprintln(rval) + } + } + lmap, lok := lval.(client.Map) + rmap, rok := rval.(client.Map) if !(lval == rval || reflect.DeepEqual(lval, rval) || - (lok && rok && sloppyEqualMap(lmap, rmap)) || - lstr == rstr) { + (lok && rok && sloppyEqualMap(lmap, rmap)) || + lstr == rstr) { return false - } + } } else { return false } } for key, rval := range rhs { if lval, ok := lhs[key]; ok { - lstr := fmt.Sprintln(lval) - rstr := fmt.Sprintln(rval) - for i := 0; i < 1000; i++ { - if lstr != rstr { - rstr = fmt.Sprintln(rval) - } - } - lmap, lok := lval.(client.Map) - rmap, rok := rval.(client.Map) + lstr := fmt.Sprintln(lval) + rstr := fmt.Sprintln(rval) + for i := 0; i < 1000; i++ { + if lstr != rstr { + rstr = fmt.Sprintln(rval) + } + } + lmap, lok := lval.(client.Map) + rmap, rok := rval.(client.Map) if !(lval == rval || reflect.DeepEqual(lval, rval) || - (lok && rok && sloppyEqualMap(lmap, rmap)) || - lstr == rstr) { + (lok && rok && sloppyEqualMap(lmap, rmap)) || + lstr == rstr) { return false - } + } } else { return false } @@ -54,27 +54,27 @@ func sloppyEqual(lhs map[interface{}]interface{}, rhs map[interface{}]interface{ } func sloppyEqualMap(lhs client.Map, rhs client.Map) bool { - lmap := map[interface{}]interface{}{} - rmap := map[interface{}]interface{}{} - for k, v := range lhs { - lmap[k] = v - } - for k, v := range rhs { - rmap[k] = v - } - return sloppyEqual(lmap, rmap) + lmap := map[interface{}]interface{}{} + rmap := map[interface{}]interface{}{} + for k, v := range lhs { + lmap[k] = v + } + for k, v := range rhs { + rmap[k] = v + } + return sloppyEqual(lmap, rmap) } func sloppyEqualAttributes(lhs client.Attributes, rhs client.Attributes) bool { - lmap := map[interface{}]interface{}{} - rmap := map[interface{}]interface{}{} - for k, v := range lhs { - lmap[k] = v - } - for k, v := range rhs { - rmap[k] = v - } - return sloppyEqual(lmap, rmap) + lmap := map[interface{}]interface{}{} + rmap := map[interface{}]interface{}{} + for k, v := range lhs { + lmap[k] = v + } + for k, v := range rhs { + rmap[k] = v + } + return sloppyEqual(lmap, rmap) } func main() { diff --git a/test/go/RangeSearchString.go b/test/go/RangeSearchString.go index 20e31cbc3..755313731 100644 --- a/test/go/RangeSearchString.go +++ b/test/go/RangeSearchString.go @@ -12,40 +12,40 @@ func sloppyEqual(lhs map[interface{}]interface{}, rhs map[interface{}]interface{ } for key, lval := range lhs { if rval, ok := rhs[key]; ok { - lstr := fmt.Sprintln(lval) - rstr := fmt.Sprintln(rval) - for i := 0; i < 1000; i++ { - if lstr != rstr { - rstr = fmt.Sprintln(rval) - } - } - lmap, lok := lval.(client.Map) - rmap, rok := rval.(client.Map) + lstr := fmt.Sprintln(lval) + rstr := fmt.Sprintln(rval) + for i := 0; i < 1000; i++ { + if lstr != rstr { + rstr = fmt.Sprintln(rval) + } + } + lmap, lok := lval.(client.Map) + rmap, rok := rval.(client.Map) if !(lval == rval || reflect.DeepEqual(lval, rval) || - (lok && rok && sloppyEqualMap(lmap, rmap)) || - lstr == rstr) { + (lok && rok && sloppyEqualMap(lmap, rmap)) || + lstr == rstr) { return false - } + } } else { return false } } for key, rval := range rhs { if lval, ok := lhs[key]; ok { - lstr := fmt.Sprintln(lval) - rstr := fmt.Sprintln(rval) - for i := 0; i < 1000; i++ { - if lstr != rstr { - rstr = fmt.Sprintln(rval) - } - } - lmap, lok := lval.(client.Map) - rmap, rok := rval.(client.Map) + lstr := fmt.Sprintln(lval) + rstr := fmt.Sprintln(rval) + for i := 0; i < 1000; i++ { + if lstr != rstr { + rstr = fmt.Sprintln(rval) + } + } + lmap, lok := lval.(client.Map) + rmap, rok := rval.(client.Map) if !(lval == rval || reflect.DeepEqual(lval, rval) || - (lok && rok && sloppyEqualMap(lmap, rmap)) || - lstr == rstr) { + (lok && rok && sloppyEqualMap(lmap, rmap)) || + lstr == rstr) { return false - } + } } else { return false } @@ -54,27 +54,27 @@ func sloppyEqual(lhs map[interface{}]interface{}, rhs map[interface{}]interface{ } func sloppyEqualMap(lhs client.Map, rhs client.Map) bool { - lmap := map[interface{}]interface{}{} - rmap := map[interface{}]interface{}{} - for k, v := range lhs { - lmap[k] = v - } - for k, v := range rhs { - rmap[k] = v - } - return sloppyEqual(lmap, rmap) + lmap := map[interface{}]interface{}{} + rmap := map[interface{}]interface{}{} + for k, v := range lhs { + lmap[k] = v + } + for k, v := range rhs { + rmap[k] = v + } + return sloppyEqual(lmap, rmap) } func sloppyEqualAttributes(lhs client.Attributes, rhs client.Attributes) bool { - lmap := map[interface{}]interface{}{} - rmap := map[interface{}]interface{}{} - for k, v := range lhs { - lmap[k] = v - } - for k, v := range rhs { - rmap[k] = v - } - return sloppyEqual(lmap, rmap) + lmap := map[interface{}]interface{}{} + rmap := map[interface{}]interface{}{} + for k, v := range lhs { + lmap[k] = v + } + for k, v := range rhs { + rmap[k] = v + } + return sloppyEqual(lmap, rmap) } func main() { diff --git a/test/go/RegexSearch.go b/test/go/RegexSearch.go index 0cabf4c67..b9e53001c 100644 --- a/test/go/RegexSearch.go +++ b/test/go/RegexSearch.go @@ -12,40 +12,40 @@ func sloppyEqual(lhs map[interface{}]interface{}, rhs map[interface{}]interface{ } for key, lval := range lhs { if rval, ok := rhs[key]; ok { - lstr := fmt.Sprintln(lval) - rstr := fmt.Sprintln(rval) - for i := 0; i < 1000; i++ { - if lstr != rstr { - rstr = fmt.Sprintln(rval) - } - } - lmap, lok := lval.(client.Map) - rmap, rok := rval.(client.Map) + lstr := fmt.Sprintln(lval) + rstr := fmt.Sprintln(rval) + for i := 0; i < 1000; i++ { + if lstr != rstr { + rstr = fmt.Sprintln(rval) + } + } + lmap, lok := lval.(client.Map) + rmap, rok := rval.(client.Map) if !(lval == rval || reflect.DeepEqual(lval, rval) || - (lok && rok && sloppyEqualMap(lmap, rmap)) || - lstr == rstr) { + (lok && rok && sloppyEqualMap(lmap, rmap)) || + lstr == rstr) { return false - } + } } else { return false } } for key, rval := range rhs { if lval, ok := lhs[key]; ok { - lstr := fmt.Sprintln(lval) - rstr := fmt.Sprintln(rval) - for i := 0; i < 1000; i++ { - if lstr != rstr { - rstr = fmt.Sprintln(rval) - } - } - lmap, lok := lval.(client.Map) - rmap, rok := rval.(client.Map) + lstr := fmt.Sprintln(lval) + rstr := fmt.Sprintln(rval) + for i := 0; i < 1000; i++ { + if lstr != rstr { + rstr = fmt.Sprintln(rval) + } + } + lmap, lok := lval.(client.Map) + rmap, rok := rval.(client.Map) if !(lval == rval || reflect.DeepEqual(lval, rval) || - (lok && rok && sloppyEqualMap(lmap, rmap)) || - lstr == rstr) { + (lok && rok && sloppyEqualMap(lmap, rmap)) || + lstr == rstr) { return false - } + } } else { return false } @@ -54,27 +54,27 @@ func sloppyEqual(lhs map[interface{}]interface{}, rhs map[interface{}]interface{ } func sloppyEqualMap(lhs client.Map, rhs client.Map) bool { - lmap := map[interface{}]interface{}{} - rmap := map[interface{}]interface{}{} - for k, v := range lhs { - lmap[k] = v - } - for k, v := range rhs { - rmap[k] = v - } - return sloppyEqual(lmap, rmap) + lmap := map[interface{}]interface{}{} + rmap := map[interface{}]interface{}{} + for k, v := range lhs { + lmap[k] = v + } + for k, v := range rhs { + rmap[k] = v + } + return sloppyEqual(lmap, rmap) } func sloppyEqualAttributes(lhs client.Attributes, rhs client.Attributes) bool { - lmap := map[interface{}]interface{}{} - rmap := map[interface{}]interface{}{} - for k, v := range lhs { - lmap[k] = v - } - for k, v := range rhs { - rmap[k] = v - } - return sloppyEqual(lmap, rmap) + lmap := map[interface{}]interface{}{} + rmap := map[interface{}]interface{}{} + for k, v := range lhs { + lmap[k] = v + } + for k, v := range rhs { + rmap[k] = v + } + return sloppyEqual(lmap, rmap) } func main() { diff --git a/test/rust/Basic.rs b/test/rust/Basic.rs index f0cf5d287..215893ff9 100644 --- a/test/rust/Basic.rs +++ b/test/rust/Basic.rs @@ -1,4 +1,5 @@ +#![feature(convert)] #[macro_use] extern crate hyperdex; use std::os; @@ -18,13 +19,7 @@ macro_rules! sloppyCompare { if $a.len() == 0 && $b.len() == 0 { true } else { - if $a.get_type_id() != $b.get_type_id() { - false - } else { - unsafe { - transmute($a) == $b - } - } + false } ); } @@ -42,25 +37,18 @@ fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { // this is dumb but I do not see a better way... fortunately the following lines are generated // by a python script match (av, bv) { - (HyperListString(x), HyperListString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperListString(x), HyperListInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperListString(x), HyperListFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperListInt(x), HyperListString(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperListInt(x), HyperListInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperListInt(x), HyperListFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperListFloat(x), HyperListString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperListFloat(x), HyperListInt(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperListFloat(x), HyperListFloat(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperSetString(x), HyperSetString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperSetString(x), HyperSetInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperSetString(x), HyperSetFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperSetInt(x), HyperSetString(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperSetInt(x), HyperSetInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperSetInt(x), HyperSetFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperSetFloat(x), HyperSetString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperSetFloat(x), HyperSetInt(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperSetFloat(x), HyperSetFloat(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperMapStringString(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringString(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringString(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringString(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, @@ -70,7 +58,6 @@ fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { (HyperMapStringString(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringString(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringInt(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperMapStringInt(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringInt(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringInt(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringInt(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, @@ -80,7 +67,6 @@ fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { (HyperMapStringInt(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringFloat(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringFloat(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperMapStringFloat(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringFloat(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringFloat(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringFloat(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, @@ -90,7 +76,6 @@ fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { (HyperMapIntString(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntString(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntString(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperMapIntString(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntString(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntString(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntString(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, @@ -100,7 +85,6 @@ fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { (HyperMapIntInt(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntInt(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntInt(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperMapIntInt(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntInt(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntInt(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntInt(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, @@ -110,7 +94,6 @@ fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { (HyperMapIntFloat(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntFloat(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntFloat(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperMapIntFloat(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntFloat(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntFloat(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntFloat(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, @@ -120,7 +103,6 @@ fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { (HyperMapFloatString(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatString(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatString(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperMapFloatString(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatString(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatString(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatInt(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, @@ -130,7 +112,6 @@ fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { (HyperMapFloatInt(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatInt(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatInt(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperMapFloatInt(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatInt(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatFloat(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatFloat(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, @@ -140,7 +121,6 @@ fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { (HyperMapFloatFloat(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatFloat(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatFloat(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperMapFloatFloat(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (x, y) => if x != y { return false; }, } } @@ -148,8 +128,8 @@ fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { } fn main() { - let args = os::args(); - let mut client = Client::new(FromStr::from_str(format!("{}:{}", args[1], args[2]).as_slice()).unwrap()).unwrap(); + let args: Vec = std::env::args().collect(); + let mut client = Client::new(FromStr::from_str(format!("{}:{}", args[1], args[2]).as_str()).unwrap()).unwrap(); match client.get(r"kv", r"k") { Ok(obj) => { diff --git a/test/rust/BasicSearch.rs b/test/rust/BasicSearch.rs index f15fa9c99..616fa4051 100644 --- a/test/rust/BasicSearch.rs +++ b/test/rust/BasicSearch.rs @@ -1,4 +1,5 @@ +#![feature(convert)] #[macro_use] extern crate hyperdex; use std::os; @@ -18,13 +19,7 @@ macro_rules! sloppyCompare { if $a.len() == 0 && $b.len() == 0 { true } else { - if $a.get_type_id() != $b.get_type_id() { - false - } else { - unsafe { - transmute($a) == $b - } - } + false } ); } @@ -42,25 +37,18 @@ fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { // this is dumb but I do not see a better way... fortunately the following lines are generated // by a python script match (av, bv) { - (HyperListString(x), HyperListString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperListString(x), HyperListInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperListString(x), HyperListFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperListInt(x), HyperListString(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperListInt(x), HyperListInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperListInt(x), HyperListFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperListFloat(x), HyperListString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperListFloat(x), HyperListInt(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperListFloat(x), HyperListFloat(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperSetString(x), HyperSetString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperSetString(x), HyperSetInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperSetString(x), HyperSetFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperSetInt(x), HyperSetString(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperSetInt(x), HyperSetInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperSetInt(x), HyperSetFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperSetFloat(x), HyperSetString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperSetFloat(x), HyperSetInt(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperSetFloat(x), HyperSetFloat(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperMapStringString(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringString(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringString(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringString(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, @@ -70,7 +58,6 @@ fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { (HyperMapStringString(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringString(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringInt(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperMapStringInt(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringInt(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringInt(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringInt(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, @@ -80,7 +67,6 @@ fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { (HyperMapStringInt(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringFloat(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringFloat(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperMapStringFloat(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringFloat(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringFloat(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringFloat(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, @@ -90,7 +76,6 @@ fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { (HyperMapIntString(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntString(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntString(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperMapIntString(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntString(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntString(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntString(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, @@ -100,7 +85,6 @@ fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { (HyperMapIntInt(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntInt(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntInt(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperMapIntInt(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntInt(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntInt(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntInt(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, @@ -110,7 +94,6 @@ fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { (HyperMapIntFloat(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntFloat(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntFloat(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperMapIntFloat(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntFloat(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntFloat(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntFloat(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, @@ -120,7 +103,6 @@ fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { (HyperMapFloatString(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatString(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatString(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperMapFloatString(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatString(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatString(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatInt(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, @@ -130,7 +112,6 @@ fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { (HyperMapFloatInt(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatInt(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatInt(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperMapFloatInt(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatInt(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatFloat(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatFloat(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, @@ -140,7 +121,6 @@ fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { (HyperMapFloatFloat(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatFloat(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatFloat(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperMapFloatFloat(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (x, y) => if x != y { return false; }, } } @@ -148,8 +128,8 @@ fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { } fn main() { - let args = os::args(); - let mut client = Client::new(FromStr::from_str(format!("{}:{}", args[1], args[2]).as_slice()).unwrap()).unwrap(); + let args: Vec = std::env::args().collect(); + let mut client = Client::new(FromStr::from_str(format!("{}:{}", args[1], args[2]).as_str()).unwrap()).unwrap(); let res = client.search(r"kv", vec!(HyperPredicate::new(r"v", EQUALS, r"v1"))); let elems: Vec> = res.iter().collect(); diff --git a/test/rust/CondPut.rs b/test/rust/CondPut.rs index 77d3d843c..14d35468d 100644 --- a/test/rust/CondPut.rs +++ b/test/rust/CondPut.rs @@ -1,4 +1,5 @@ +#![feature(convert)] #[macro_use] extern crate hyperdex; use std::os; @@ -18,13 +19,7 @@ macro_rules! sloppyCompare { if $a.len() == 0 && $b.len() == 0 { true } else { - if $a.get_type_id() != $b.get_type_id() { - false - } else { - unsafe { - transmute($a) == $b - } - } + false } ); } @@ -42,25 +37,18 @@ fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { // this is dumb but I do not see a better way... fortunately the following lines are generated // by a python script match (av, bv) { - (HyperListString(x), HyperListString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperListString(x), HyperListInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperListString(x), HyperListFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperListInt(x), HyperListString(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperListInt(x), HyperListInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperListInt(x), HyperListFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperListFloat(x), HyperListString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperListFloat(x), HyperListInt(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperListFloat(x), HyperListFloat(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperSetString(x), HyperSetString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperSetString(x), HyperSetInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperSetString(x), HyperSetFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperSetInt(x), HyperSetString(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperSetInt(x), HyperSetInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperSetInt(x), HyperSetFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperSetFloat(x), HyperSetString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperSetFloat(x), HyperSetInt(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperSetFloat(x), HyperSetFloat(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperMapStringString(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringString(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringString(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringString(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, @@ -70,7 +58,6 @@ fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { (HyperMapStringString(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringString(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringInt(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperMapStringInt(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringInt(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringInt(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringInt(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, @@ -80,7 +67,6 @@ fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { (HyperMapStringInt(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringFloat(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringFloat(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperMapStringFloat(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringFloat(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringFloat(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringFloat(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, @@ -90,7 +76,6 @@ fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { (HyperMapIntString(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntString(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntString(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperMapIntString(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntString(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntString(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntString(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, @@ -100,7 +85,6 @@ fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { (HyperMapIntInt(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntInt(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntInt(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperMapIntInt(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntInt(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntInt(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntInt(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, @@ -110,7 +94,6 @@ fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { (HyperMapIntFloat(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntFloat(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntFloat(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperMapIntFloat(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntFloat(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntFloat(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntFloat(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, @@ -120,7 +103,6 @@ fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { (HyperMapFloatString(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatString(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatString(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperMapFloatString(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatString(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatString(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatInt(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, @@ -130,7 +112,6 @@ fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { (HyperMapFloatInt(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatInt(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatInt(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperMapFloatInt(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatInt(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatFloat(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatFloat(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, @@ -140,7 +121,6 @@ fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { (HyperMapFloatFloat(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatFloat(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatFloat(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperMapFloatFloat(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (x, y) => if x != y { return false; }, } } @@ -148,8 +128,8 @@ fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { } fn main() { - let args = os::args(); - let mut client = Client::new(FromStr::from_str(format!("{}:{}", args[1], args[2]).as_slice()).unwrap()).unwrap(); + let args: Vec = std::env::args().collect(); + let mut client = Client::new(FromStr::from_str(format!("{}:{}", args[1], args[2]).as_str()).unwrap()).unwrap(); match client.get(r"kv", r"k") { Ok(obj) => { diff --git a/test/rust/DataTypeFloat.rs b/test/rust/DataTypeFloat.rs index 2ae793dfd..46bbbd008 100644 --- a/test/rust/DataTypeFloat.rs +++ b/test/rust/DataTypeFloat.rs @@ -1,4 +1,5 @@ +#![feature(convert)] #[macro_use] extern crate hyperdex; use std::os; @@ -18,13 +19,7 @@ macro_rules! sloppyCompare { if $a.len() == 0 && $b.len() == 0 { true } else { - if $a.get_type_id() != $b.get_type_id() { - false - } else { - unsafe { - transmute($a) == $b - } - } + false } ); } @@ -42,25 +37,18 @@ fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { // this is dumb but I do not see a better way... fortunately the following lines are generated // by a python script match (av, bv) { - (HyperListString(x), HyperListString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperListString(x), HyperListInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperListString(x), HyperListFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperListInt(x), HyperListString(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperListInt(x), HyperListInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperListInt(x), HyperListFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperListFloat(x), HyperListString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperListFloat(x), HyperListInt(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperListFloat(x), HyperListFloat(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperSetString(x), HyperSetString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperSetString(x), HyperSetInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperSetString(x), HyperSetFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperSetInt(x), HyperSetString(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperSetInt(x), HyperSetInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperSetInt(x), HyperSetFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperSetFloat(x), HyperSetString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperSetFloat(x), HyperSetInt(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperSetFloat(x), HyperSetFloat(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperMapStringString(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringString(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringString(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringString(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, @@ -70,7 +58,6 @@ fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { (HyperMapStringString(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringString(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringInt(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperMapStringInt(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringInt(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringInt(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringInt(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, @@ -80,7 +67,6 @@ fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { (HyperMapStringInt(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringFloat(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringFloat(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperMapStringFloat(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringFloat(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringFloat(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringFloat(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, @@ -90,7 +76,6 @@ fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { (HyperMapIntString(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntString(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntString(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperMapIntString(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntString(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntString(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntString(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, @@ -100,7 +85,6 @@ fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { (HyperMapIntInt(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntInt(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntInt(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperMapIntInt(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntInt(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntInt(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntInt(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, @@ -110,7 +94,6 @@ fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { (HyperMapIntFloat(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntFloat(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntFloat(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperMapIntFloat(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntFloat(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntFloat(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntFloat(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, @@ -120,7 +103,6 @@ fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { (HyperMapFloatString(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatString(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatString(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperMapFloatString(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatString(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatString(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatInt(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, @@ -130,7 +112,6 @@ fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { (HyperMapFloatInt(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatInt(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatInt(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperMapFloatInt(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatInt(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatFloat(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatFloat(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, @@ -140,7 +121,6 @@ fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { (HyperMapFloatFloat(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatFloat(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatFloat(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperMapFloatFloat(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (x, y) => if x != y { return false; }, } } @@ -148,8 +128,8 @@ fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { } fn main() { - let args = os::args(); - let mut client = Client::new(FromStr::from_str(format!("{}:{}", args[1], args[2]).as_slice()).unwrap()).unwrap(); + let args: Vec = std::env::args().collect(); + let mut client = Client::new(FromStr::from_str(format!("{}:{}", args[1], args[2]).as_str()).unwrap()).unwrap(); match client.put(r"kv", r"k", HyperObject::new()) { Ok(()) => (), diff --git a/test/rust/DataTypeInt.rs b/test/rust/DataTypeInt.rs index b32d6939d..6361c67d9 100644 --- a/test/rust/DataTypeInt.rs +++ b/test/rust/DataTypeInt.rs @@ -1,4 +1,5 @@ +#![feature(convert)] #[macro_use] extern crate hyperdex; use std::os; @@ -18,13 +19,7 @@ macro_rules! sloppyCompare { if $a.len() == 0 && $b.len() == 0 { true } else { - if $a.get_type_id() != $b.get_type_id() { - false - } else { - unsafe { - transmute($a) == $b - } - } + false } ); } @@ -42,25 +37,18 @@ fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { // this is dumb but I do not see a better way... fortunately the following lines are generated // by a python script match (av, bv) { - (HyperListString(x), HyperListString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperListString(x), HyperListInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperListString(x), HyperListFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperListInt(x), HyperListString(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperListInt(x), HyperListInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperListInt(x), HyperListFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperListFloat(x), HyperListString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperListFloat(x), HyperListInt(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperListFloat(x), HyperListFloat(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperSetString(x), HyperSetString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperSetString(x), HyperSetInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperSetString(x), HyperSetFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperSetInt(x), HyperSetString(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperSetInt(x), HyperSetInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperSetInt(x), HyperSetFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperSetFloat(x), HyperSetString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperSetFloat(x), HyperSetInt(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperSetFloat(x), HyperSetFloat(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperMapStringString(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringString(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringString(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringString(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, @@ -70,7 +58,6 @@ fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { (HyperMapStringString(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringString(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringInt(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperMapStringInt(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringInt(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringInt(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringInt(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, @@ -80,7 +67,6 @@ fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { (HyperMapStringInt(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringFloat(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringFloat(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperMapStringFloat(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringFloat(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringFloat(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringFloat(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, @@ -90,7 +76,6 @@ fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { (HyperMapIntString(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntString(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntString(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperMapIntString(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntString(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntString(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntString(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, @@ -100,7 +85,6 @@ fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { (HyperMapIntInt(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntInt(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntInt(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperMapIntInt(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntInt(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntInt(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntInt(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, @@ -110,7 +94,6 @@ fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { (HyperMapIntFloat(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntFloat(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntFloat(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperMapIntFloat(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntFloat(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntFloat(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntFloat(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, @@ -120,7 +103,6 @@ fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { (HyperMapFloatString(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatString(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatString(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperMapFloatString(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatString(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatString(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatInt(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, @@ -130,7 +112,6 @@ fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { (HyperMapFloatInt(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatInt(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatInt(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperMapFloatInt(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatInt(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatFloat(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatFloat(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, @@ -140,7 +121,6 @@ fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { (HyperMapFloatFloat(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatFloat(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatFloat(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperMapFloatFloat(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (x, y) => if x != y { return false; }, } } @@ -148,8 +128,8 @@ fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { } fn main() { - let args = os::args(); - let mut client = Client::new(FromStr::from_str(format!("{}:{}", args[1], args[2]).as_slice()).unwrap()).unwrap(); + let args: Vec = std::env::args().collect(); + let mut client = Client::new(FromStr::from_str(format!("{}:{}", args[1], args[2]).as_str()).unwrap()).unwrap(); match client.put(r"kv", r"k", HyperObject::new()) { Ok(()) => (), diff --git a/test/rust/DataTypeListFloat.rs b/test/rust/DataTypeListFloat.rs index c2fd878a0..8846e8ef1 100644 --- a/test/rust/DataTypeListFloat.rs +++ b/test/rust/DataTypeListFloat.rs @@ -1,4 +1,5 @@ +#![feature(convert)] #[macro_use] extern crate hyperdex; use std::os; @@ -18,13 +19,7 @@ macro_rules! sloppyCompare { if $a.len() == 0 && $b.len() == 0 { true } else { - if $a.get_type_id() != $b.get_type_id() { - false - } else { - unsafe { - transmute($a) == $b - } - } + false } ); } @@ -42,25 +37,18 @@ fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { // this is dumb but I do not see a better way... fortunately the following lines are generated // by a python script match (av, bv) { - (HyperListString(x), HyperListString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperListString(x), HyperListInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperListString(x), HyperListFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperListInt(x), HyperListString(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperListInt(x), HyperListInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperListInt(x), HyperListFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperListFloat(x), HyperListString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperListFloat(x), HyperListInt(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperListFloat(x), HyperListFloat(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperSetString(x), HyperSetString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperSetString(x), HyperSetInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperSetString(x), HyperSetFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperSetInt(x), HyperSetString(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperSetInt(x), HyperSetInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperSetInt(x), HyperSetFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperSetFloat(x), HyperSetString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperSetFloat(x), HyperSetInt(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperSetFloat(x), HyperSetFloat(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperMapStringString(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringString(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringString(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringString(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, @@ -70,7 +58,6 @@ fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { (HyperMapStringString(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringString(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringInt(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperMapStringInt(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringInt(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringInt(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringInt(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, @@ -80,7 +67,6 @@ fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { (HyperMapStringInt(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringFloat(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringFloat(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperMapStringFloat(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringFloat(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringFloat(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringFloat(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, @@ -90,7 +76,6 @@ fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { (HyperMapIntString(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntString(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntString(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperMapIntString(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntString(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntString(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntString(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, @@ -100,7 +85,6 @@ fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { (HyperMapIntInt(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntInt(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntInt(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperMapIntInt(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntInt(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntInt(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntInt(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, @@ -110,7 +94,6 @@ fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { (HyperMapIntFloat(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntFloat(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntFloat(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperMapIntFloat(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntFloat(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntFloat(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntFloat(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, @@ -120,7 +103,6 @@ fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { (HyperMapFloatString(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatString(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatString(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperMapFloatString(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatString(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatString(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatInt(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, @@ -130,7 +112,6 @@ fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { (HyperMapFloatInt(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatInt(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatInt(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperMapFloatInt(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatInt(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatFloat(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatFloat(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, @@ -140,7 +121,6 @@ fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { (HyperMapFloatFloat(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatFloat(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatFloat(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperMapFloatFloat(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (x, y) => if x != y { return false; }, } } @@ -148,8 +128,8 @@ fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { } fn main() { - let args = os::args(); - let mut client = Client::new(FromStr::from_str(format!("{}:{}", args[1], args[2]).as_slice()).unwrap()).unwrap(); + let args: Vec = std::env::args().collect(); + let mut client = Client::new(FromStr::from_str(format!("{}:{}", args[1], args[2]).as_str()).unwrap()).unwrap(); match client.put(r"kv", r"k", HyperObject::new()) { Ok(()) => (), diff --git a/test/rust/DataTypeListInt.rs b/test/rust/DataTypeListInt.rs index 8c0d1ca8a..698fa03e8 100644 --- a/test/rust/DataTypeListInt.rs +++ b/test/rust/DataTypeListInt.rs @@ -1,4 +1,5 @@ +#![feature(convert)] #[macro_use] extern crate hyperdex; use std::os; @@ -18,13 +19,7 @@ macro_rules! sloppyCompare { if $a.len() == 0 && $b.len() == 0 { true } else { - if $a.get_type_id() != $b.get_type_id() { - false - } else { - unsafe { - transmute($a) == $b - } - } + false } ); } @@ -42,25 +37,18 @@ fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { // this is dumb but I do not see a better way... fortunately the following lines are generated // by a python script match (av, bv) { - (HyperListString(x), HyperListString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperListString(x), HyperListInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperListString(x), HyperListFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperListInt(x), HyperListString(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperListInt(x), HyperListInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperListInt(x), HyperListFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperListFloat(x), HyperListString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperListFloat(x), HyperListInt(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperListFloat(x), HyperListFloat(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperSetString(x), HyperSetString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperSetString(x), HyperSetInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperSetString(x), HyperSetFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperSetInt(x), HyperSetString(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperSetInt(x), HyperSetInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperSetInt(x), HyperSetFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperSetFloat(x), HyperSetString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperSetFloat(x), HyperSetInt(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperSetFloat(x), HyperSetFloat(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperMapStringString(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringString(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringString(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringString(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, @@ -70,7 +58,6 @@ fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { (HyperMapStringString(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringString(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringInt(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperMapStringInt(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringInt(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringInt(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringInt(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, @@ -80,7 +67,6 @@ fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { (HyperMapStringInt(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringFloat(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringFloat(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperMapStringFloat(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringFloat(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringFloat(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringFloat(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, @@ -90,7 +76,6 @@ fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { (HyperMapIntString(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntString(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntString(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperMapIntString(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntString(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntString(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntString(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, @@ -100,7 +85,6 @@ fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { (HyperMapIntInt(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntInt(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntInt(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperMapIntInt(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntInt(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntInt(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntInt(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, @@ -110,7 +94,6 @@ fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { (HyperMapIntFloat(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntFloat(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntFloat(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperMapIntFloat(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntFloat(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntFloat(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntFloat(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, @@ -120,7 +103,6 @@ fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { (HyperMapFloatString(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatString(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatString(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperMapFloatString(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatString(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatString(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatInt(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, @@ -130,7 +112,6 @@ fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { (HyperMapFloatInt(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatInt(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatInt(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperMapFloatInt(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatInt(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatFloat(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatFloat(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, @@ -140,7 +121,6 @@ fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { (HyperMapFloatFloat(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatFloat(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatFloat(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperMapFloatFloat(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (x, y) => if x != y { return false; }, } } @@ -148,8 +128,8 @@ fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { } fn main() { - let args = os::args(); - let mut client = Client::new(FromStr::from_str(format!("{}:{}", args[1], args[2]).as_slice()).unwrap()).unwrap(); + let args: Vec = std::env::args().collect(); + let mut client = Client::new(FromStr::from_str(format!("{}:{}", args[1], args[2]).as_str()).unwrap()).unwrap(); match client.put(r"kv", r"k", HyperObject::new()) { Ok(()) => (), diff --git a/test/rust/DataTypeListString.rs b/test/rust/DataTypeListString.rs index 9e576a5ee..b9e3d9da0 100644 --- a/test/rust/DataTypeListString.rs +++ b/test/rust/DataTypeListString.rs @@ -1,4 +1,5 @@ +#![feature(convert)] #[macro_use] extern crate hyperdex; use std::os; @@ -18,13 +19,7 @@ macro_rules! sloppyCompare { if $a.len() == 0 && $b.len() == 0 { true } else { - if $a.get_type_id() != $b.get_type_id() { - false - } else { - unsafe { - transmute($a) == $b - } - } + false } ); } @@ -42,25 +37,18 @@ fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { // this is dumb but I do not see a better way... fortunately the following lines are generated // by a python script match (av, bv) { - (HyperListString(x), HyperListString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperListString(x), HyperListInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperListString(x), HyperListFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperListInt(x), HyperListString(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperListInt(x), HyperListInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperListInt(x), HyperListFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperListFloat(x), HyperListString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperListFloat(x), HyperListInt(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperListFloat(x), HyperListFloat(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperSetString(x), HyperSetString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperSetString(x), HyperSetInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperSetString(x), HyperSetFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperSetInt(x), HyperSetString(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperSetInt(x), HyperSetInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperSetInt(x), HyperSetFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperSetFloat(x), HyperSetString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperSetFloat(x), HyperSetInt(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperSetFloat(x), HyperSetFloat(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperMapStringString(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringString(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringString(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringString(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, @@ -70,7 +58,6 @@ fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { (HyperMapStringString(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringString(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringInt(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperMapStringInt(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringInt(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringInt(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringInt(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, @@ -80,7 +67,6 @@ fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { (HyperMapStringInt(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringFloat(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringFloat(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperMapStringFloat(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringFloat(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringFloat(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringFloat(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, @@ -90,7 +76,6 @@ fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { (HyperMapIntString(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntString(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntString(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperMapIntString(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntString(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntString(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntString(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, @@ -100,7 +85,6 @@ fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { (HyperMapIntInt(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntInt(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntInt(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperMapIntInt(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntInt(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntInt(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntInt(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, @@ -110,7 +94,6 @@ fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { (HyperMapIntFloat(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntFloat(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntFloat(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperMapIntFloat(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntFloat(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntFloat(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntFloat(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, @@ -120,7 +103,6 @@ fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { (HyperMapFloatString(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatString(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatString(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperMapFloatString(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatString(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatString(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatInt(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, @@ -130,7 +112,6 @@ fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { (HyperMapFloatInt(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatInt(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatInt(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperMapFloatInt(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatInt(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatFloat(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatFloat(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, @@ -140,7 +121,6 @@ fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { (HyperMapFloatFloat(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatFloat(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatFloat(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperMapFloatFloat(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (x, y) => if x != y { return false; }, } } @@ -148,8 +128,8 @@ fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { } fn main() { - let args = os::args(); - let mut client = Client::new(FromStr::from_str(format!("{}:{}", args[1], args[2]).as_slice()).unwrap()).unwrap(); + let args: Vec = std::env::args().collect(); + let mut client = Client::new(FromStr::from_str(format!("{}:{}", args[1], args[2]).as_str()).unwrap()).unwrap(); match client.put(r"kv", r"k", HyperObject::new()) { Ok(()) => (), diff --git a/test/rust/DataTypeMapFloatFloat.rs b/test/rust/DataTypeMapFloatFloat.rs index cc48a1fa9..0e0ff8221 100644 --- a/test/rust/DataTypeMapFloatFloat.rs +++ b/test/rust/DataTypeMapFloatFloat.rs @@ -1,4 +1,5 @@ +#![feature(convert)] #[macro_use] extern crate hyperdex; use std::os; @@ -18,13 +19,7 @@ macro_rules! sloppyCompare { if $a.len() == 0 && $b.len() == 0 { true } else { - if $a.get_type_id() != $b.get_type_id() { - false - } else { - unsafe { - transmute($a) == $b - } - } + false } ); } @@ -42,25 +37,18 @@ fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { // this is dumb but I do not see a better way... fortunately the following lines are generated // by a python script match (av, bv) { - (HyperListString(x), HyperListString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperListString(x), HyperListInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperListString(x), HyperListFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperListInt(x), HyperListString(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperListInt(x), HyperListInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperListInt(x), HyperListFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperListFloat(x), HyperListString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperListFloat(x), HyperListInt(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperListFloat(x), HyperListFloat(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperSetString(x), HyperSetString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperSetString(x), HyperSetInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperSetString(x), HyperSetFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperSetInt(x), HyperSetString(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperSetInt(x), HyperSetInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperSetInt(x), HyperSetFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperSetFloat(x), HyperSetString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperSetFloat(x), HyperSetInt(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperSetFloat(x), HyperSetFloat(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperMapStringString(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringString(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringString(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringString(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, @@ -70,7 +58,6 @@ fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { (HyperMapStringString(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringString(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringInt(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperMapStringInt(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringInt(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringInt(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringInt(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, @@ -80,7 +67,6 @@ fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { (HyperMapStringInt(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringFloat(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringFloat(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperMapStringFloat(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringFloat(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringFloat(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringFloat(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, @@ -90,7 +76,6 @@ fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { (HyperMapIntString(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntString(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntString(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperMapIntString(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntString(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntString(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntString(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, @@ -100,7 +85,6 @@ fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { (HyperMapIntInt(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntInt(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntInt(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperMapIntInt(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntInt(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntInt(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntInt(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, @@ -110,7 +94,6 @@ fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { (HyperMapIntFloat(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntFloat(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntFloat(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperMapIntFloat(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntFloat(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntFloat(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntFloat(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, @@ -120,7 +103,6 @@ fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { (HyperMapFloatString(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatString(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatString(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperMapFloatString(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatString(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatString(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatInt(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, @@ -130,7 +112,6 @@ fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { (HyperMapFloatInt(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatInt(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatInt(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperMapFloatInt(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatInt(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatFloat(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatFloat(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, @@ -140,7 +121,6 @@ fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { (HyperMapFloatFloat(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatFloat(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatFloat(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperMapFloatFloat(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (x, y) => if x != y { return false; }, } } @@ -148,8 +128,8 @@ fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { } fn main() { - let args = os::args(); - let mut client = Client::new(FromStr::from_str(format!("{}:{}", args[1], args[2]).as_slice()).unwrap()).unwrap(); + let args: Vec = std::env::args().collect(); + let mut client = Client::new(FromStr::from_str(format!("{}:{}", args[1], args[2]).as_str()).unwrap()).unwrap(); match client.put(r"kv", r"k", HyperObject::new()) { Ok(()) => (), diff --git a/test/rust/DataTypeMapFloatInt.rs b/test/rust/DataTypeMapFloatInt.rs index 1e08b0df8..6275d6c8e 100644 --- a/test/rust/DataTypeMapFloatInt.rs +++ b/test/rust/DataTypeMapFloatInt.rs @@ -1,4 +1,5 @@ +#![feature(convert)] #[macro_use] extern crate hyperdex; use std::os; @@ -18,13 +19,7 @@ macro_rules! sloppyCompare { if $a.len() == 0 && $b.len() == 0 { true } else { - if $a.get_type_id() != $b.get_type_id() { - false - } else { - unsafe { - transmute($a) == $b - } - } + false } ); } @@ -42,25 +37,18 @@ fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { // this is dumb but I do not see a better way... fortunately the following lines are generated // by a python script match (av, bv) { - (HyperListString(x), HyperListString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperListString(x), HyperListInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperListString(x), HyperListFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperListInt(x), HyperListString(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperListInt(x), HyperListInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperListInt(x), HyperListFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperListFloat(x), HyperListString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperListFloat(x), HyperListInt(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperListFloat(x), HyperListFloat(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperSetString(x), HyperSetString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperSetString(x), HyperSetInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperSetString(x), HyperSetFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperSetInt(x), HyperSetString(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperSetInt(x), HyperSetInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperSetInt(x), HyperSetFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperSetFloat(x), HyperSetString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperSetFloat(x), HyperSetInt(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperSetFloat(x), HyperSetFloat(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperMapStringString(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringString(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringString(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringString(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, @@ -70,7 +58,6 @@ fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { (HyperMapStringString(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringString(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringInt(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperMapStringInt(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringInt(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringInt(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringInt(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, @@ -80,7 +67,6 @@ fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { (HyperMapStringInt(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringFloat(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringFloat(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperMapStringFloat(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringFloat(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringFloat(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringFloat(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, @@ -90,7 +76,6 @@ fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { (HyperMapIntString(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntString(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntString(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperMapIntString(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntString(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntString(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntString(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, @@ -100,7 +85,6 @@ fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { (HyperMapIntInt(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntInt(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntInt(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperMapIntInt(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntInt(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntInt(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntInt(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, @@ -110,7 +94,6 @@ fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { (HyperMapIntFloat(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntFloat(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntFloat(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperMapIntFloat(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntFloat(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntFloat(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntFloat(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, @@ -120,7 +103,6 @@ fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { (HyperMapFloatString(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatString(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatString(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperMapFloatString(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatString(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatString(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatInt(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, @@ -130,7 +112,6 @@ fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { (HyperMapFloatInt(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatInt(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatInt(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperMapFloatInt(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatInt(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatFloat(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatFloat(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, @@ -140,7 +121,6 @@ fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { (HyperMapFloatFloat(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatFloat(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatFloat(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperMapFloatFloat(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (x, y) => if x != y { return false; }, } } @@ -148,8 +128,8 @@ fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { } fn main() { - let args = os::args(); - let mut client = Client::new(FromStr::from_str(format!("{}:{}", args[1], args[2]).as_slice()).unwrap()).unwrap(); + let args: Vec = std::env::args().collect(); + let mut client = Client::new(FromStr::from_str(format!("{}:{}", args[1], args[2]).as_str()).unwrap()).unwrap(); match client.put(r"kv", r"k", HyperObject::new()) { Ok(()) => (), diff --git a/test/rust/DataTypeMapFloatString.rs b/test/rust/DataTypeMapFloatString.rs index ced16b98c..1cadaf483 100644 --- a/test/rust/DataTypeMapFloatString.rs +++ b/test/rust/DataTypeMapFloatString.rs @@ -1,4 +1,5 @@ +#![feature(convert)] #[macro_use] extern crate hyperdex; use std::os; @@ -18,13 +19,7 @@ macro_rules! sloppyCompare { if $a.len() == 0 && $b.len() == 0 { true } else { - if $a.get_type_id() != $b.get_type_id() { - false - } else { - unsafe { - transmute($a) == $b - } - } + false } ); } @@ -42,25 +37,18 @@ fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { // this is dumb but I do not see a better way... fortunately the following lines are generated // by a python script match (av, bv) { - (HyperListString(x), HyperListString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperListString(x), HyperListInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperListString(x), HyperListFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperListInt(x), HyperListString(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperListInt(x), HyperListInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperListInt(x), HyperListFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperListFloat(x), HyperListString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperListFloat(x), HyperListInt(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperListFloat(x), HyperListFloat(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperSetString(x), HyperSetString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperSetString(x), HyperSetInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperSetString(x), HyperSetFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperSetInt(x), HyperSetString(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperSetInt(x), HyperSetInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperSetInt(x), HyperSetFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperSetFloat(x), HyperSetString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperSetFloat(x), HyperSetInt(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperSetFloat(x), HyperSetFloat(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperMapStringString(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringString(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringString(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringString(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, @@ -70,7 +58,6 @@ fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { (HyperMapStringString(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringString(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringInt(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperMapStringInt(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringInt(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringInt(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringInt(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, @@ -80,7 +67,6 @@ fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { (HyperMapStringInt(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringFloat(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringFloat(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperMapStringFloat(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringFloat(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringFloat(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringFloat(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, @@ -90,7 +76,6 @@ fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { (HyperMapIntString(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntString(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntString(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperMapIntString(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntString(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntString(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntString(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, @@ -100,7 +85,6 @@ fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { (HyperMapIntInt(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntInt(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntInt(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperMapIntInt(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntInt(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntInt(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntInt(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, @@ -110,7 +94,6 @@ fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { (HyperMapIntFloat(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntFloat(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntFloat(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperMapIntFloat(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntFloat(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntFloat(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntFloat(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, @@ -120,7 +103,6 @@ fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { (HyperMapFloatString(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatString(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatString(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperMapFloatString(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatString(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatString(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatInt(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, @@ -130,7 +112,6 @@ fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { (HyperMapFloatInt(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatInt(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatInt(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperMapFloatInt(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatInt(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatFloat(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatFloat(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, @@ -140,7 +121,6 @@ fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { (HyperMapFloatFloat(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatFloat(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatFloat(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperMapFloatFloat(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (x, y) => if x != y { return false; }, } } @@ -148,8 +128,8 @@ fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { } fn main() { - let args = os::args(); - let mut client = Client::new(FromStr::from_str(format!("{}:{}", args[1], args[2]).as_slice()).unwrap()).unwrap(); + let args: Vec = std::env::args().collect(); + let mut client = Client::new(FromStr::from_str(format!("{}:{}", args[1], args[2]).as_str()).unwrap()).unwrap(); match client.put(r"kv", r"k", HyperObject::new()) { Ok(()) => (), diff --git a/test/rust/DataTypeMapIntFloat.rs b/test/rust/DataTypeMapIntFloat.rs index 21d543c65..5f1db0cb6 100644 --- a/test/rust/DataTypeMapIntFloat.rs +++ b/test/rust/DataTypeMapIntFloat.rs @@ -1,4 +1,5 @@ +#![feature(convert)] #[macro_use] extern crate hyperdex; use std::os; @@ -18,13 +19,7 @@ macro_rules! sloppyCompare { if $a.len() == 0 && $b.len() == 0 { true } else { - if $a.get_type_id() != $b.get_type_id() { - false - } else { - unsafe { - transmute($a) == $b - } - } + false } ); } @@ -42,25 +37,18 @@ fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { // this is dumb but I do not see a better way... fortunately the following lines are generated // by a python script match (av, bv) { - (HyperListString(x), HyperListString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperListString(x), HyperListInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperListString(x), HyperListFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperListInt(x), HyperListString(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperListInt(x), HyperListInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperListInt(x), HyperListFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperListFloat(x), HyperListString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperListFloat(x), HyperListInt(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperListFloat(x), HyperListFloat(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperSetString(x), HyperSetString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperSetString(x), HyperSetInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperSetString(x), HyperSetFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperSetInt(x), HyperSetString(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperSetInt(x), HyperSetInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperSetInt(x), HyperSetFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperSetFloat(x), HyperSetString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperSetFloat(x), HyperSetInt(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperSetFloat(x), HyperSetFloat(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperMapStringString(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringString(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringString(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringString(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, @@ -70,7 +58,6 @@ fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { (HyperMapStringString(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringString(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringInt(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperMapStringInt(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringInt(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringInt(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringInt(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, @@ -80,7 +67,6 @@ fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { (HyperMapStringInt(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringFloat(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringFloat(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperMapStringFloat(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringFloat(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringFloat(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringFloat(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, @@ -90,7 +76,6 @@ fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { (HyperMapIntString(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntString(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntString(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperMapIntString(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntString(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntString(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntString(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, @@ -100,7 +85,6 @@ fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { (HyperMapIntInt(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntInt(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntInt(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperMapIntInt(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntInt(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntInt(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntInt(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, @@ -110,7 +94,6 @@ fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { (HyperMapIntFloat(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntFloat(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntFloat(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperMapIntFloat(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntFloat(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntFloat(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntFloat(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, @@ -120,7 +103,6 @@ fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { (HyperMapFloatString(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatString(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatString(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperMapFloatString(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatString(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatString(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatInt(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, @@ -130,7 +112,6 @@ fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { (HyperMapFloatInt(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatInt(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatInt(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperMapFloatInt(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatInt(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatFloat(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatFloat(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, @@ -140,7 +121,6 @@ fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { (HyperMapFloatFloat(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatFloat(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatFloat(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperMapFloatFloat(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (x, y) => if x != y { return false; }, } } @@ -148,8 +128,8 @@ fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { } fn main() { - let args = os::args(); - let mut client = Client::new(FromStr::from_str(format!("{}:{}", args[1], args[2]).as_slice()).unwrap()).unwrap(); + let args: Vec = std::env::args().collect(); + let mut client = Client::new(FromStr::from_str(format!("{}:{}", args[1], args[2]).as_str()).unwrap()).unwrap(); match client.put(r"kv", r"k", HyperObject::new()) { Ok(()) => (), diff --git a/test/rust/DataTypeMapIntInt.rs b/test/rust/DataTypeMapIntInt.rs index 854ea6c8f..b0a46700e 100644 --- a/test/rust/DataTypeMapIntInt.rs +++ b/test/rust/DataTypeMapIntInt.rs @@ -1,4 +1,5 @@ +#![feature(convert)] #[macro_use] extern crate hyperdex; use std::os; @@ -18,13 +19,7 @@ macro_rules! sloppyCompare { if $a.len() == 0 && $b.len() == 0 { true } else { - if $a.get_type_id() != $b.get_type_id() { - false - } else { - unsafe { - transmute($a) == $b - } - } + false } ); } @@ -42,25 +37,18 @@ fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { // this is dumb but I do not see a better way... fortunately the following lines are generated // by a python script match (av, bv) { - (HyperListString(x), HyperListString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperListString(x), HyperListInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperListString(x), HyperListFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperListInt(x), HyperListString(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperListInt(x), HyperListInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperListInt(x), HyperListFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperListFloat(x), HyperListString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperListFloat(x), HyperListInt(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperListFloat(x), HyperListFloat(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperSetString(x), HyperSetString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperSetString(x), HyperSetInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperSetString(x), HyperSetFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperSetInt(x), HyperSetString(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperSetInt(x), HyperSetInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperSetInt(x), HyperSetFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperSetFloat(x), HyperSetString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperSetFloat(x), HyperSetInt(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperSetFloat(x), HyperSetFloat(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperMapStringString(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringString(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringString(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringString(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, @@ -70,7 +58,6 @@ fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { (HyperMapStringString(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringString(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringInt(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperMapStringInt(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringInt(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringInt(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringInt(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, @@ -80,7 +67,6 @@ fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { (HyperMapStringInt(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringFloat(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringFloat(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperMapStringFloat(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringFloat(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringFloat(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringFloat(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, @@ -90,7 +76,6 @@ fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { (HyperMapIntString(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntString(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntString(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperMapIntString(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntString(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntString(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntString(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, @@ -100,7 +85,6 @@ fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { (HyperMapIntInt(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntInt(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntInt(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperMapIntInt(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntInt(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntInt(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntInt(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, @@ -110,7 +94,6 @@ fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { (HyperMapIntFloat(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntFloat(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntFloat(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperMapIntFloat(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntFloat(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntFloat(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntFloat(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, @@ -120,7 +103,6 @@ fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { (HyperMapFloatString(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatString(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatString(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperMapFloatString(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatString(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatString(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatInt(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, @@ -130,7 +112,6 @@ fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { (HyperMapFloatInt(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatInt(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatInt(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperMapFloatInt(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatInt(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatFloat(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatFloat(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, @@ -140,7 +121,6 @@ fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { (HyperMapFloatFloat(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatFloat(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatFloat(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperMapFloatFloat(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (x, y) => if x != y { return false; }, } } @@ -148,8 +128,8 @@ fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { } fn main() { - let args = os::args(); - let mut client = Client::new(FromStr::from_str(format!("{}:{}", args[1], args[2]).as_slice()).unwrap()).unwrap(); + let args: Vec = std::env::args().collect(); + let mut client = Client::new(FromStr::from_str(format!("{}:{}", args[1], args[2]).as_str()).unwrap()).unwrap(); match client.put(r"kv", r"k", HyperObject::new()) { Ok(()) => (), diff --git a/test/rust/DataTypeMapIntString.rs b/test/rust/DataTypeMapIntString.rs index 481d9004a..dcc8381bb 100644 --- a/test/rust/DataTypeMapIntString.rs +++ b/test/rust/DataTypeMapIntString.rs @@ -1,4 +1,5 @@ +#![feature(convert)] #[macro_use] extern crate hyperdex; use std::os; @@ -18,13 +19,7 @@ macro_rules! sloppyCompare { if $a.len() == 0 && $b.len() == 0 { true } else { - if $a.get_type_id() != $b.get_type_id() { - false - } else { - unsafe { - transmute($a) == $b - } - } + false } ); } @@ -42,25 +37,18 @@ fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { // this is dumb but I do not see a better way... fortunately the following lines are generated // by a python script match (av, bv) { - (HyperListString(x), HyperListString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperListString(x), HyperListInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperListString(x), HyperListFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperListInt(x), HyperListString(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperListInt(x), HyperListInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperListInt(x), HyperListFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperListFloat(x), HyperListString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperListFloat(x), HyperListInt(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperListFloat(x), HyperListFloat(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperSetString(x), HyperSetString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperSetString(x), HyperSetInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperSetString(x), HyperSetFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperSetInt(x), HyperSetString(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperSetInt(x), HyperSetInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperSetInt(x), HyperSetFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperSetFloat(x), HyperSetString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperSetFloat(x), HyperSetInt(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperSetFloat(x), HyperSetFloat(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperMapStringString(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringString(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringString(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringString(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, @@ -70,7 +58,6 @@ fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { (HyperMapStringString(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringString(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringInt(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperMapStringInt(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringInt(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringInt(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringInt(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, @@ -80,7 +67,6 @@ fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { (HyperMapStringInt(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringFloat(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringFloat(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperMapStringFloat(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringFloat(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringFloat(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringFloat(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, @@ -90,7 +76,6 @@ fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { (HyperMapIntString(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntString(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntString(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperMapIntString(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntString(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntString(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntString(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, @@ -100,7 +85,6 @@ fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { (HyperMapIntInt(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntInt(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntInt(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperMapIntInt(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntInt(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntInt(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntInt(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, @@ -110,7 +94,6 @@ fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { (HyperMapIntFloat(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntFloat(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntFloat(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperMapIntFloat(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntFloat(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntFloat(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntFloat(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, @@ -120,7 +103,6 @@ fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { (HyperMapFloatString(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatString(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatString(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperMapFloatString(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatString(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatString(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatInt(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, @@ -130,7 +112,6 @@ fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { (HyperMapFloatInt(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatInt(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatInt(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperMapFloatInt(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatInt(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatFloat(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatFloat(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, @@ -140,7 +121,6 @@ fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { (HyperMapFloatFloat(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatFloat(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatFloat(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperMapFloatFloat(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (x, y) => if x != y { return false; }, } } @@ -148,8 +128,8 @@ fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { } fn main() { - let args = os::args(); - let mut client = Client::new(FromStr::from_str(format!("{}:{}", args[1], args[2]).as_slice()).unwrap()).unwrap(); + let args: Vec = std::env::args().collect(); + let mut client = Client::new(FromStr::from_str(format!("{}:{}", args[1], args[2]).as_str()).unwrap()).unwrap(); match client.put(r"kv", r"k", HyperObject::new()) { Ok(()) => (), diff --git a/test/rust/DataTypeMapStringFloat.rs b/test/rust/DataTypeMapStringFloat.rs index 70695c8e5..d9c16eea2 100644 --- a/test/rust/DataTypeMapStringFloat.rs +++ b/test/rust/DataTypeMapStringFloat.rs @@ -1,4 +1,5 @@ +#![feature(convert)] #[macro_use] extern crate hyperdex; use std::os; @@ -18,13 +19,7 @@ macro_rules! sloppyCompare { if $a.len() == 0 && $b.len() == 0 { true } else { - if $a.get_type_id() != $b.get_type_id() { - false - } else { - unsafe { - transmute($a) == $b - } - } + false } ); } @@ -42,25 +37,18 @@ fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { // this is dumb but I do not see a better way... fortunately the following lines are generated // by a python script match (av, bv) { - (HyperListString(x), HyperListString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperListString(x), HyperListInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperListString(x), HyperListFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperListInt(x), HyperListString(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperListInt(x), HyperListInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperListInt(x), HyperListFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperListFloat(x), HyperListString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperListFloat(x), HyperListInt(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperListFloat(x), HyperListFloat(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperSetString(x), HyperSetString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperSetString(x), HyperSetInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperSetString(x), HyperSetFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperSetInt(x), HyperSetString(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperSetInt(x), HyperSetInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperSetInt(x), HyperSetFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperSetFloat(x), HyperSetString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperSetFloat(x), HyperSetInt(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperSetFloat(x), HyperSetFloat(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperMapStringString(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringString(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringString(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringString(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, @@ -70,7 +58,6 @@ fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { (HyperMapStringString(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringString(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringInt(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperMapStringInt(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringInt(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringInt(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringInt(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, @@ -80,7 +67,6 @@ fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { (HyperMapStringInt(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringFloat(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringFloat(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperMapStringFloat(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringFloat(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringFloat(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringFloat(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, @@ -90,7 +76,6 @@ fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { (HyperMapIntString(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntString(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntString(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperMapIntString(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntString(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntString(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntString(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, @@ -100,7 +85,6 @@ fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { (HyperMapIntInt(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntInt(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntInt(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperMapIntInt(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntInt(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntInt(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntInt(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, @@ -110,7 +94,6 @@ fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { (HyperMapIntFloat(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntFloat(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntFloat(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperMapIntFloat(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntFloat(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntFloat(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntFloat(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, @@ -120,7 +103,6 @@ fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { (HyperMapFloatString(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatString(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatString(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperMapFloatString(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatString(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatString(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatInt(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, @@ -130,7 +112,6 @@ fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { (HyperMapFloatInt(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatInt(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatInt(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperMapFloatInt(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatInt(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatFloat(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatFloat(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, @@ -140,7 +121,6 @@ fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { (HyperMapFloatFloat(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatFloat(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatFloat(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperMapFloatFloat(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (x, y) => if x != y { return false; }, } } @@ -148,8 +128,8 @@ fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { } fn main() { - let args = os::args(); - let mut client = Client::new(FromStr::from_str(format!("{}:{}", args[1], args[2]).as_slice()).unwrap()).unwrap(); + let args: Vec = std::env::args().collect(); + let mut client = Client::new(FromStr::from_str(format!("{}:{}", args[1], args[2]).as_str()).unwrap()).unwrap(); match client.put(r"kv", r"k", HyperObject::new()) { Ok(()) => (), diff --git a/test/rust/DataTypeMapStringInt.rs b/test/rust/DataTypeMapStringInt.rs index 0ba86a213..c2e2322a4 100644 --- a/test/rust/DataTypeMapStringInt.rs +++ b/test/rust/DataTypeMapStringInt.rs @@ -1,4 +1,5 @@ +#![feature(convert)] #[macro_use] extern crate hyperdex; use std::os; @@ -18,13 +19,7 @@ macro_rules! sloppyCompare { if $a.len() == 0 && $b.len() == 0 { true } else { - if $a.get_type_id() != $b.get_type_id() { - false - } else { - unsafe { - transmute($a) == $b - } - } + false } ); } @@ -42,25 +37,18 @@ fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { // this is dumb but I do not see a better way... fortunately the following lines are generated // by a python script match (av, bv) { - (HyperListString(x), HyperListString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperListString(x), HyperListInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperListString(x), HyperListFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperListInt(x), HyperListString(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperListInt(x), HyperListInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperListInt(x), HyperListFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperListFloat(x), HyperListString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperListFloat(x), HyperListInt(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperListFloat(x), HyperListFloat(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperSetString(x), HyperSetString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperSetString(x), HyperSetInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperSetString(x), HyperSetFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperSetInt(x), HyperSetString(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperSetInt(x), HyperSetInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperSetInt(x), HyperSetFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperSetFloat(x), HyperSetString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperSetFloat(x), HyperSetInt(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperSetFloat(x), HyperSetFloat(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperMapStringString(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringString(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringString(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringString(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, @@ -70,7 +58,6 @@ fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { (HyperMapStringString(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringString(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringInt(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperMapStringInt(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringInt(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringInt(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringInt(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, @@ -80,7 +67,6 @@ fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { (HyperMapStringInt(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringFloat(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringFloat(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperMapStringFloat(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringFloat(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringFloat(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringFloat(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, @@ -90,7 +76,6 @@ fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { (HyperMapIntString(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntString(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntString(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperMapIntString(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntString(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntString(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntString(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, @@ -100,7 +85,6 @@ fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { (HyperMapIntInt(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntInt(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntInt(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperMapIntInt(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntInt(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntInt(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntInt(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, @@ -110,7 +94,6 @@ fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { (HyperMapIntFloat(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntFloat(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntFloat(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperMapIntFloat(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntFloat(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntFloat(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntFloat(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, @@ -120,7 +103,6 @@ fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { (HyperMapFloatString(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatString(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatString(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperMapFloatString(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatString(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatString(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatInt(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, @@ -130,7 +112,6 @@ fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { (HyperMapFloatInt(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatInt(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatInt(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperMapFloatInt(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatInt(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatFloat(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatFloat(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, @@ -140,7 +121,6 @@ fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { (HyperMapFloatFloat(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatFloat(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatFloat(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperMapFloatFloat(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (x, y) => if x != y { return false; }, } } @@ -148,8 +128,8 @@ fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { } fn main() { - let args = os::args(); - let mut client = Client::new(FromStr::from_str(format!("{}:{}", args[1], args[2]).as_slice()).unwrap()).unwrap(); + let args: Vec = std::env::args().collect(); + let mut client = Client::new(FromStr::from_str(format!("{}:{}", args[1], args[2]).as_str()).unwrap()).unwrap(); match client.put(r"kv", r"k", HyperObject::new()) { Ok(()) => (), diff --git a/test/rust/DataTypeMapStringString.rs b/test/rust/DataTypeMapStringString.rs index bda3fc22a..d0db1d0c3 100644 --- a/test/rust/DataTypeMapStringString.rs +++ b/test/rust/DataTypeMapStringString.rs @@ -1,4 +1,5 @@ +#![feature(convert)] #[macro_use] extern crate hyperdex; use std::os; @@ -18,13 +19,7 @@ macro_rules! sloppyCompare { if $a.len() == 0 && $b.len() == 0 { true } else { - if $a.get_type_id() != $b.get_type_id() { - false - } else { - unsafe { - transmute($a) == $b - } - } + false } ); } @@ -42,25 +37,18 @@ fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { // this is dumb but I do not see a better way... fortunately the following lines are generated // by a python script match (av, bv) { - (HyperListString(x), HyperListString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperListString(x), HyperListInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperListString(x), HyperListFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperListInt(x), HyperListString(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperListInt(x), HyperListInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperListInt(x), HyperListFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperListFloat(x), HyperListString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperListFloat(x), HyperListInt(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperListFloat(x), HyperListFloat(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperSetString(x), HyperSetString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperSetString(x), HyperSetInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperSetString(x), HyperSetFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperSetInt(x), HyperSetString(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperSetInt(x), HyperSetInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperSetInt(x), HyperSetFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperSetFloat(x), HyperSetString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperSetFloat(x), HyperSetInt(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperSetFloat(x), HyperSetFloat(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperMapStringString(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringString(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringString(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringString(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, @@ -70,7 +58,6 @@ fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { (HyperMapStringString(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringString(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringInt(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperMapStringInt(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringInt(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringInt(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringInt(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, @@ -80,7 +67,6 @@ fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { (HyperMapStringInt(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringFloat(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringFloat(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperMapStringFloat(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringFloat(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringFloat(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringFloat(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, @@ -90,7 +76,6 @@ fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { (HyperMapIntString(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntString(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntString(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperMapIntString(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntString(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntString(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntString(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, @@ -100,7 +85,6 @@ fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { (HyperMapIntInt(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntInt(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntInt(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperMapIntInt(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntInt(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntInt(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntInt(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, @@ -110,7 +94,6 @@ fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { (HyperMapIntFloat(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntFloat(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntFloat(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperMapIntFloat(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntFloat(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntFloat(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntFloat(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, @@ -120,7 +103,6 @@ fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { (HyperMapFloatString(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatString(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatString(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperMapFloatString(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatString(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatString(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatInt(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, @@ -130,7 +112,6 @@ fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { (HyperMapFloatInt(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatInt(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatInt(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperMapFloatInt(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatInt(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatFloat(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatFloat(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, @@ -140,7 +121,6 @@ fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { (HyperMapFloatFloat(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatFloat(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatFloat(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperMapFloatFloat(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (x, y) => if x != y { return false; }, } } @@ -148,8 +128,8 @@ fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { } fn main() { - let args = os::args(); - let mut client = Client::new(FromStr::from_str(format!("{}:{}", args[1], args[2]).as_slice()).unwrap()).unwrap(); + let args: Vec = std::env::args().collect(); + let mut client = Client::new(FromStr::from_str(format!("{}:{}", args[1], args[2]).as_str()).unwrap()).unwrap(); match client.put(r"kv", r"k", HyperObject::new()) { Ok(()) => (), diff --git a/test/rust/DataTypeSetFloat.rs b/test/rust/DataTypeSetFloat.rs index 5e25dde50..b929a6dea 100644 --- a/test/rust/DataTypeSetFloat.rs +++ b/test/rust/DataTypeSetFloat.rs @@ -1,4 +1,5 @@ +#![feature(convert)] #[macro_use] extern crate hyperdex; use std::os; @@ -18,13 +19,7 @@ macro_rules! sloppyCompare { if $a.len() == 0 && $b.len() == 0 { true } else { - if $a.get_type_id() != $b.get_type_id() { - false - } else { - unsafe { - transmute($a) == $b - } - } + false } ); } @@ -42,25 +37,18 @@ fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { // this is dumb but I do not see a better way... fortunately the following lines are generated // by a python script match (av, bv) { - (HyperListString(x), HyperListString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperListString(x), HyperListInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperListString(x), HyperListFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperListInt(x), HyperListString(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperListInt(x), HyperListInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperListInt(x), HyperListFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperListFloat(x), HyperListString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperListFloat(x), HyperListInt(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperListFloat(x), HyperListFloat(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperSetString(x), HyperSetString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperSetString(x), HyperSetInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperSetString(x), HyperSetFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperSetInt(x), HyperSetString(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperSetInt(x), HyperSetInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperSetInt(x), HyperSetFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperSetFloat(x), HyperSetString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperSetFloat(x), HyperSetInt(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperSetFloat(x), HyperSetFloat(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperMapStringString(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringString(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringString(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringString(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, @@ -70,7 +58,6 @@ fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { (HyperMapStringString(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringString(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringInt(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperMapStringInt(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringInt(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringInt(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringInt(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, @@ -80,7 +67,6 @@ fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { (HyperMapStringInt(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringFloat(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringFloat(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperMapStringFloat(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringFloat(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringFloat(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringFloat(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, @@ -90,7 +76,6 @@ fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { (HyperMapIntString(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntString(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntString(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperMapIntString(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntString(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntString(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntString(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, @@ -100,7 +85,6 @@ fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { (HyperMapIntInt(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntInt(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntInt(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperMapIntInt(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntInt(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntInt(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntInt(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, @@ -110,7 +94,6 @@ fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { (HyperMapIntFloat(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntFloat(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntFloat(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperMapIntFloat(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntFloat(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntFloat(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntFloat(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, @@ -120,7 +103,6 @@ fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { (HyperMapFloatString(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatString(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatString(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperMapFloatString(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatString(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatString(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatInt(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, @@ -130,7 +112,6 @@ fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { (HyperMapFloatInt(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatInt(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatInt(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperMapFloatInt(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatInt(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatFloat(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatFloat(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, @@ -140,7 +121,6 @@ fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { (HyperMapFloatFloat(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatFloat(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatFloat(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperMapFloatFloat(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (x, y) => if x != y { return false; }, } } @@ -148,8 +128,8 @@ fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { } fn main() { - let args = os::args(); - let mut client = Client::new(FromStr::from_str(format!("{}:{}", args[1], args[2]).as_slice()).unwrap()).unwrap(); + let args: Vec = std::env::args().collect(); + let mut client = Client::new(FromStr::from_str(format!("{}:{}", args[1], args[2]).as_str()).unwrap()).unwrap(); match client.put(r"kv", r"k", HyperObject::new()) { Ok(()) => (), diff --git a/test/rust/DataTypeSetInt.rs b/test/rust/DataTypeSetInt.rs index f822dc397..d22dccca1 100644 --- a/test/rust/DataTypeSetInt.rs +++ b/test/rust/DataTypeSetInt.rs @@ -1,4 +1,5 @@ +#![feature(convert)] #[macro_use] extern crate hyperdex; use std::os; @@ -18,13 +19,7 @@ macro_rules! sloppyCompare { if $a.len() == 0 && $b.len() == 0 { true } else { - if $a.get_type_id() != $b.get_type_id() { - false - } else { - unsafe { - transmute($a) == $b - } - } + false } ); } @@ -42,25 +37,18 @@ fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { // this is dumb but I do not see a better way... fortunately the following lines are generated // by a python script match (av, bv) { - (HyperListString(x), HyperListString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperListString(x), HyperListInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperListString(x), HyperListFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperListInt(x), HyperListString(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperListInt(x), HyperListInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperListInt(x), HyperListFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperListFloat(x), HyperListString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperListFloat(x), HyperListInt(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperListFloat(x), HyperListFloat(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperSetString(x), HyperSetString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperSetString(x), HyperSetInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperSetString(x), HyperSetFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperSetInt(x), HyperSetString(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperSetInt(x), HyperSetInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperSetInt(x), HyperSetFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperSetFloat(x), HyperSetString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperSetFloat(x), HyperSetInt(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperSetFloat(x), HyperSetFloat(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperMapStringString(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringString(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringString(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringString(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, @@ -70,7 +58,6 @@ fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { (HyperMapStringString(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringString(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringInt(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperMapStringInt(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringInt(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringInt(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringInt(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, @@ -80,7 +67,6 @@ fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { (HyperMapStringInt(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringFloat(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringFloat(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperMapStringFloat(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringFloat(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringFloat(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringFloat(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, @@ -90,7 +76,6 @@ fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { (HyperMapIntString(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntString(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntString(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperMapIntString(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntString(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntString(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntString(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, @@ -100,7 +85,6 @@ fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { (HyperMapIntInt(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntInt(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntInt(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperMapIntInt(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntInt(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntInt(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntInt(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, @@ -110,7 +94,6 @@ fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { (HyperMapIntFloat(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntFloat(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntFloat(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperMapIntFloat(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntFloat(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntFloat(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntFloat(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, @@ -120,7 +103,6 @@ fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { (HyperMapFloatString(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatString(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatString(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperMapFloatString(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatString(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatString(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatInt(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, @@ -130,7 +112,6 @@ fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { (HyperMapFloatInt(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatInt(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatInt(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperMapFloatInt(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatInt(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatFloat(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatFloat(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, @@ -140,7 +121,6 @@ fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { (HyperMapFloatFloat(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatFloat(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatFloat(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperMapFloatFloat(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (x, y) => if x != y { return false; }, } } @@ -148,8 +128,8 @@ fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { } fn main() { - let args = os::args(); - let mut client = Client::new(FromStr::from_str(format!("{}:{}", args[1], args[2]).as_slice()).unwrap()).unwrap(); + let args: Vec = std::env::args().collect(); + let mut client = Client::new(FromStr::from_str(format!("{}:{}", args[1], args[2]).as_str()).unwrap()).unwrap(); match client.put(r"kv", r"k", HyperObject::new()) { Ok(()) => (), diff --git a/test/rust/DataTypeSetString.rs b/test/rust/DataTypeSetString.rs index d8519bd67..9683a7cb0 100644 --- a/test/rust/DataTypeSetString.rs +++ b/test/rust/DataTypeSetString.rs @@ -1,4 +1,5 @@ +#![feature(convert)] #[macro_use] extern crate hyperdex; use std::os; @@ -18,13 +19,7 @@ macro_rules! sloppyCompare { if $a.len() == 0 && $b.len() == 0 { true } else { - if $a.get_type_id() != $b.get_type_id() { - false - } else { - unsafe { - transmute($a) == $b - } - } + false } ); } @@ -42,25 +37,18 @@ fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { // this is dumb but I do not see a better way... fortunately the following lines are generated // by a python script match (av, bv) { - (HyperListString(x), HyperListString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperListString(x), HyperListInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperListString(x), HyperListFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperListInt(x), HyperListString(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperListInt(x), HyperListInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperListInt(x), HyperListFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperListFloat(x), HyperListString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperListFloat(x), HyperListInt(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperListFloat(x), HyperListFloat(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperSetString(x), HyperSetString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperSetString(x), HyperSetInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperSetString(x), HyperSetFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperSetInt(x), HyperSetString(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperSetInt(x), HyperSetInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperSetInt(x), HyperSetFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperSetFloat(x), HyperSetString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperSetFloat(x), HyperSetInt(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperSetFloat(x), HyperSetFloat(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperMapStringString(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringString(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringString(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringString(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, @@ -70,7 +58,6 @@ fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { (HyperMapStringString(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringString(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringInt(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperMapStringInt(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringInt(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringInt(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringInt(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, @@ -80,7 +67,6 @@ fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { (HyperMapStringInt(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringFloat(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringFloat(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperMapStringFloat(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringFloat(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringFloat(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringFloat(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, @@ -90,7 +76,6 @@ fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { (HyperMapIntString(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntString(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntString(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperMapIntString(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntString(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntString(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntString(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, @@ -100,7 +85,6 @@ fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { (HyperMapIntInt(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntInt(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntInt(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperMapIntInt(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntInt(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntInt(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntInt(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, @@ -110,7 +94,6 @@ fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { (HyperMapIntFloat(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntFloat(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntFloat(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperMapIntFloat(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntFloat(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntFloat(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntFloat(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, @@ -120,7 +103,6 @@ fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { (HyperMapFloatString(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatString(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatString(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperMapFloatString(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatString(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatString(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatInt(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, @@ -130,7 +112,6 @@ fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { (HyperMapFloatInt(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatInt(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatInt(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperMapFloatInt(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatInt(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatFloat(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatFloat(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, @@ -140,7 +121,6 @@ fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { (HyperMapFloatFloat(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatFloat(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatFloat(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperMapFloatFloat(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (x, y) => if x != y { return false; }, } } @@ -148,8 +128,8 @@ fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { } fn main() { - let args = os::args(); - let mut client = Client::new(FromStr::from_str(format!("{}:{}", args[1], args[2]).as_slice()).unwrap()).unwrap(); + let args: Vec = std::env::args().collect(); + let mut client = Client::new(FromStr::from_str(format!("{}:{}", args[1], args[2]).as_str()).unwrap()).unwrap(); match client.put(r"kv", r"k", HyperObject::new()) { Ok(()) => (), diff --git a/test/rust/DataTypeString.rs b/test/rust/DataTypeString.rs index afb1ac4b1..ae1a89451 100644 --- a/test/rust/DataTypeString.rs +++ b/test/rust/DataTypeString.rs @@ -1,4 +1,5 @@ +#![feature(convert)] #[macro_use] extern crate hyperdex; use std::os; @@ -18,13 +19,7 @@ macro_rules! sloppyCompare { if $a.len() == 0 && $b.len() == 0 { true } else { - if $a.get_type_id() != $b.get_type_id() { - false - } else { - unsafe { - transmute($a) == $b - } - } + false } ); } @@ -42,25 +37,18 @@ fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { // this is dumb but I do not see a better way... fortunately the following lines are generated // by a python script match (av, bv) { - (HyperListString(x), HyperListString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperListString(x), HyperListInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperListString(x), HyperListFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperListInt(x), HyperListString(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperListInt(x), HyperListInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperListInt(x), HyperListFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperListFloat(x), HyperListString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperListFloat(x), HyperListInt(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperListFloat(x), HyperListFloat(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperSetString(x), HyperSetString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperSetString(x), HyperSetInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperSetString(x), HyperSetFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperSetInt(x), HyperSetString(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperSetInt(x), HyperSetInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperSetInt(x), HyperSetFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperSetFloat(x), HyperSetString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperSetFloat(x), HyperSetInt(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperSetFloat(x), HyperSetFloat(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperMapStringString(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringString(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringString(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringString(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, @@ -70,7 +58,6 @@ fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { (HyperMapStringString(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringString(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringInt(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperMapStringInt(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringInt(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringInt(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringInt(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, @@ -80,7 +67,6 @@ fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { (HyperMapStringInt(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringFloat(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringFloat(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperMapStringFloat(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringFloat(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringFloat(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringFloat(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, @@ -90,7 +76,6 @@ fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { (HyperMapIntString(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntString(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntString(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperMapIntString(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntString(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntString(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntString(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, @@ -100,7 +85,6 @@ fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { (HyperMapIntInt(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntInt(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntInt(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperMapIntInt(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntInt(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntInt(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntInt(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, @@ -110,7 +94,6 @@ fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { (HyperMapIntFloat(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntFloat(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntFloat(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperMapIntFloat(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntFloat(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntFloat(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntFloat(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, @@ -120,7 +103,6 @@ fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { (HyperMapFloatString(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatString(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatString(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperMapFloatString(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatString(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatString(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatInt(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, @@ -130,7 +112,6 @@ fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { (HyperMapFloatInt(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatInt(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatInt(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperMapFloatInt(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatInt(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatFloat(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatFloat(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, @@ -140,7 +121,6 @@ fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { (HyperMapFloatFloat(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatFloat(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatFloat(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperMapFloatFloat(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (x, y) => if x != y { return false; }, } } @@ -148,8 +128,8 @@ fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { } fn main() { - let args = os::args(); - let mut client = Client::new(FromStr::from_str(format!("{}:{}", args[1], args[2]).as_slice()).unwrap()).unwrap(); + let args: Vec = std::env::args().collect(); + let mut client = Client::new(FromStr::from_str(format!("{}:{}", args[1], args[2]).as_str()).unwrap()).unwrap(); match client.put(r"kv", r"k", HyperObject::new()) { Ok(()) => (), diff --git a/test/rust/LengthString.rs b/test/rust/LengthString.rs index 857212122..4133ea224 100644 --- a/test/rust/LengthString.rs +++ b/test/rust/LengthString.rs @@ -1,4 +1,5 @@ +#![feature(convert)] #[macro_use] extern crate hyperdex; use std::os; @@ -18,13 +19,7 @@ macro_rules! sloppyCompare { if $a.len() == 0 && $b.len() == 0 { true } else { - if $a.get_type_id() != $b.get_type_id() { - false - } else { - unsafe { - transmute($a) == $b - } - } + false } ); } @@ -42,25 +37,18 @@ fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { // this is dumb but I do not see a better way... fortunately the following lines are generated // by a python script match (av, bv) { - (HyperListString(x), HyperListString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperListString(x), HyperListInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperListString(x), HyperListFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperListInt(x), HyperListString(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperListInt(x), HyperListInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperListInt(x), HyperListFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperListFloat(x), HyperListString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperListFloat(x), HyperListInt(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperListFloat(x), HyperListFloat(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperSetString(x), HyperSetString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperSetString(x), HyperSetInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperSetString(x), HyperSetFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperSetInt(x), HyperSetString(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperSetInt(x), HyperSetInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperSetInt(x), HyperSetFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperSetFloat(x), HyperSetString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperSetFloat(x), HyperSetInt(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperSetFloat(x), HyperSetFloat(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperMapStringString(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringString(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringString(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringString(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, @@ -70,7 +58,6 @@ fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { (HyperMapStringString(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringString(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringInt(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperMapStringInt(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringInt(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringInt(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringInt(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, @@ -80,7 +67,6 @@ fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { (HyperMapStringInt(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringFloat(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringFloat(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperMapStringFloat(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringFloat(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringFloat(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringFloat(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, @@ -90,7 +76,6 @@ fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { (HyperMapIntString(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntString(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntString(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperMapIntString(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntString(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntString(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntString(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, @@ -100,7 +85,6 @@ fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { (HyperMapIntInt(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntInt(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntInt(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperMapIntInt(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntInt(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntInt(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntInt(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, @@ -110,7 +94,6 @@ fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { (HyperMapIntFloat(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntFloat(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntFloat(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperMapIntFloat(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntFloat(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntFloat(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntFloat(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, @@ -120,7 +103,6 @@ fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { (HyperMapFloatString(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatString(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatString(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperMapFloatString(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatString(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatString(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatInt(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, @@ -130,7 +112,6 @@ fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { (HyperMapFloatInt(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatInt(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatInt(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperMapFloatInt(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatInt(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatFloat(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatFloat(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, @@ -140,7 +121,6 @@ fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { (HyperMapFloatFloat(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatFloat(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatFloat(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperMapFloatFloat(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (x, y) => if x != y { return false; }, } } @@ -148,8 +128,8 @@ fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { } fn main() { - let args = os::args(); - let mut client = Client::new(FromStr::from_str(format!("{}:{}", args[1], args[2]).as_slice()).unwrap()).unwrap(); + let args: Vec = std::env::args().collect(); + let mut client = Client::new(FromStr::from_str(format!("{}:{}", args[1], args[2]).as_str()).unwrap()).unwrap(); match client.put(r"kv", r"A", HyperObject::new()) { Ok(()) => (), diff --git a/test/rust/MultiAttribute.rs b/test/rust/MultiAttribute.rs index 9039b9c2e..2395ac351 100644 --- a/test/rust/MultiAttribute.rs +++ b/test/rust/MultiAttribute.rs @@ -1,4 +1,5 @@ +#![feature(convert)] #[macro_use] extern crate hyperdex; use std::os; @@ -18,13 +19,7 @@ macro_rules! sloppyCompare { if $a.len() == 0 && $b.len() == 0 { true } else { - if $a.get_type_id() != $b.get_type_id() { - false - } else { - unsafe { - transmute($a) == $b - } - } + false } ); } @@ -42,25 +37,18 @@ fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { // this is dumb but I do not see a better way... fortunately the following lines are generated // by a python script match (av, bv) { - (HyperListString(x), HyperListString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperListString(x), HyperListInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperListString(x), HyperListFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperListInt(x), HyperListString(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperListInt(x), HyperListInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperListInt(x), HyperListFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperListFloat(x), HyperListString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperListFloat(x), HyperListInt(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperListFloat(x), HyperListFloat(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperSetString(x), HyperSetString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperSetString(x), HyperSetInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperSetString(x), HyperSetFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperSetInt(x), HyperSetString(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperSetInt(x), HyperSetInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperSetInt(x), HyperSetFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperSetFloat(x), HyperSetString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperSetFloat(x), HyperSetInt(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperSetFloat(x), HyperSetFloat(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperMapStringString(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringString(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringString(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringString(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, @@ -70,7 +58,6 @@ fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { (HyperMapStringString(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringString(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringInt(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperMapStringInt(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringInt(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringInt(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringInt(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, @@ -80,7 +67,6 @@ fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { (HyperMapStringInt(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringFloat(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringFloat(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperMapStringFloat(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringFloat(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringFloat(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringFloat(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, @@ -90,7 +76,6 @@ fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { (HyperMapIntString(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntString(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntString(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperMapIntString(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntString(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntString(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntString(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, @@ -100,7 +85,6 @@ fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { (HyperMapIntInt(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntInt(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntInt(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperMapIntInt(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntInt(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntInt(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntInt(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, @@ -110,7 +94,6 @@ fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { (HyperMapIntFloat(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntFloat(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntFloat(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperMapIntFloat(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntFloat(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntFloat(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntFloat(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, @@ -120,7 +103,6 @@ fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { (HyperMapFloatString(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatString(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatString(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperMapFloatString(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatString(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatString(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatInt(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, @@ -130,7 +112,6 @@ fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { (HyperMapFloatInt(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatInt(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatInt(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperMapFloatInt(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatInt(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatFloat(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatFloat(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, @@ -140,7 +121,6 @@ fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { (HyperMapFloatFloat(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatFloat(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatFloat(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperMapFloatFloat(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (x, y) => if x != y { return false; }, } } @@ -148,8 +128,8 @@ fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { } fn main() { - let args = os::args(); - let mut client = Client::new(FromStr::from_str(format!("{}:{}", args[1], args[2]).as_slice()).unwrap()).unwrap(); + let args: Vec = std::env::args().collect(); + let mut client = Client::new(FromStr::from_str(format!("{}:{}", args[1], args[2]).as_str()).unwrap()).unwrap(); match client.get(r"kv", r"k") { Ok(obj) => { diff --git a/test/rust/RangeSearchInt.rs b/test/rust/RangeSearchInt.rs index 45bf0f290..bb701cf55 100644 --- a/test/rust/RangeSearchInt.rs +++ b/test/rust/RangeSearchInt.rs @@ -1,4 +1,5 @@ +#![feature(convert)] #[macro_use] extern crate hyperdex; use std::os; @@ -18,13 +19,7 @@ macro_rules! sloppyCompare { if $a.len() == 0 && $b.len() == 0 { true } else { - if $a.get_type_id() != $b.get_type_id() { - false - } else { - unsafe { - transmute($a) == $b - } - } + false } ); } @@ -42,25 +37,18 @@ fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { // this is dumb but I do not see a better way... fortunately the following lines are generated // by a python script match (av, bv) { - (HyperListString(x), HyperListString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperListString(x), HyperListInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperListString(x), HyperListFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperListInt(x), HyperListString(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperListInt(x), HyperListInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperListInt(x), HyperListFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperListFloat(x), HyperListString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperListFloat(x), HyperListInt(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperListFloat(x), HyperListFloat(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperSetString(x), HyperSetString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperSetString(x), HyperSetInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperSetString(x), HyperSetFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperSetInt(x), HyperSetString(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperSetInt(x), HyperSetInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperSetInt(x), HyperSetFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperSetFloat(x), HyperSetString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperSetFloat(x), HyperSetInt(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperSetFloat(x), HyperSetFloat(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperMapStringString(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringString(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringString(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringString(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, @@ -70,7 +58,6 @@ fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { (HyperMapStringString(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringString(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringInt(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperMapStringInt(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringInt(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringInt(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringInt(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, @@ -80,7 +67,6 @@ fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { (HyperMapStringInt(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringFloat(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringFloat(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperMapStringFloat(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringFloat(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringFloat(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringFloat(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, @@ -90,7 +76,6 @@ fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { (HyperMapIntString(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntString(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntString(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperMapIntString(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntString(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntString(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntString(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, @@ -100,7 +85,6 @@ fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { (HyperMapIntInt(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntInt(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntInt(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperMapIntInt(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntInt(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntInt(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntInt(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, @@ -110,7 +94,6 @@ fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { (HyperMapIntFloat(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntFloat(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntFloat(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperMapIntFloat(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntFloat(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntFloat(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntFloat(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, @@ -120,7 +103,6 @@ fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { (HyperMapFloatString(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatString(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatString(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperMapFloatString(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatString(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatString(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatInt(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, @@ -130,7 +112,6 @@ fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { (HyperMapFloatInt(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatInt(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatInt(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperMapFloatInt(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatInt(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatFloat(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatFloat(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, @@ -140,7 +121,6 @@ fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { (HyperMapFloatFloat(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatFloat(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatFloat(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperMapFloatFloat(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (x, y) => if x != y { return false; }, } } @@ -148,8 +128,8 @@ fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { } fn main() { - let args = os::args(); - let mut client = Client::new(FromStr::from_str(format!("{}:{}", args[1], args[2]).as_slice()).unwrap()).unwrap(); + let args: Vec = std::env::args().collect(); + let mut client = Client::new(FromStr::from_str(format!("{}:{}", args[1], args[2]).as_str()).unwrap()).unwrap(); match client.put(r"kv", -2 as i64, NewHyperObject!(r"v", -2 as i64,)) { Ok(()) => (), diff --git a/test/rust/RangeSearchString.rs b/test/rust/RangeSearchString.rs index 427811af9..0afe86fd9 100644 --- a/test/rust/RangeSearchString.rs +++ b/test/rust/RangeSearchString.rs @@ -1,4 +1,5 @@ +#![feature(convert)] #[macro_use] extern crate hyperdex; use std::os; @@ -18,13 +19,7 @@ macro_rules! sloppyCompare { if $a.len() == 0 && $b.len() == 0 { true } else { - if $a.get_type_id() != $b.get_type_id() { - false - } else { - unsafe { - transmute($a) == $b - } - } + false } ); } @@ -42,25 +37,18 @@ fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { // this is dumb but I do not see a better way... fortunately the following lines are generated // by a python script match (av, bv) { - (HyperListString(x), HyperListString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperListString(x), HyperListInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperListString(x), HyperListFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperListInt(x), HyperListString(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperListInt(x), HyperListInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperListInt(x), HyperListFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperListFloat(x), HyperListString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperListFloat(x), HyperListInt(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperListFloat(x), HyperListFloat(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperSetString(x), HyperSetString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperSetString(x), HyperSetInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperSetString(x), HyperSetFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperSetInt(x), HyperSetString(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperSetInt(x), HyperSetInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperSetInt(x), HyperSetFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperSetFloat(x), HyperSetString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperSetFloat(x), HyperSetInt(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperSetFloat(x), HyperSetFloat(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperMapStringString(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringString(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringString(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringString(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, @@ -70,7 +58,6 @@ fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { (HyperMapStringString(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringString(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringInt(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperMapStringInt(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringInt(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringInt(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringInt(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, @@ -80,7 +67,6 @@ fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { (HyperMapStringInt(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringFloat(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringFloat(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperMapStringFloat(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringFloat(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringFloat(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringFloat(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, @@ -90,7 +76,6 @@ fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { (HyperMapIntString(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntString(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntString(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperMapIntString(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntString(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntString(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntString(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, @@ -100,7 +85,6 @@ fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { (HyperMapIntInt(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntInt(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntInt(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperMapIntInt(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntInt(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntInt(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntInt(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, @@ -110,7 +94,6 @@ fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { (HyperMapIntFloat(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntFloat(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntFloat(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperMapIntFloat(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntFloat(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntFloat(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntFloat(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, @@ -120,7 +103,6 @@ fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { (HyperMapFloatString(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatString(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatString(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperMapFloatString(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatString(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatString(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatInt(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, @@ -130,7 +112,6 @@ fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { (HyperMapFloatInt(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatInt(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatInt(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperMapFloatInt(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatInt(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatFloat(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatFloat(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, @@ -140,7 +121,6 @@ fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { (HyperMapFloatFloat(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatFloat(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatFloat(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperMapFloatFloat(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (x, y) => if x != y { return false; }, } } @@ -148,8 +128,8 @@ fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { } fn main() { - let args = os::args(); - let mut client = Client::new(FromStr::from_str(format!("{}:{}", args[1], args[2]).as_slice()).unwrap()).unwrap(); + let args: Vec = std::env::args().collect(); + let mut client = Client::new(FromStr::from_str(format!("{}:{}", args[1], args[2]).as_str()).unwrap()).unwrap(); match client.put(r"kv", r"A", NewHyperObject!(r"v", r"A",)) { Ok(()) => (), diff --git a/test/rust/RegexSearch.rs b/test/rust/RegexSearch.rs index bf936d119..5fa967289 100644 --- a/test/rust/RegexSearch.rs +++ b/test/rust/RegexSearch.rs @@ -1,4 +1,5 @@ +#![feature(convert)] #[macro_use] extern crate hyperdex; use std::os; @@ -18,13 +19,7 @@ macro_rules! sloppyCompare { if $a.len() == 0 && $b.len() == 0 { true } else { - if $a.get_type_id() != $b.get_type_id() { - false - } else { - unsafe { - transmute($a) == $b - } - } + false } ); } @@ -42,25 +37,18 @@ fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { // this is dumb but I do not see a better way... fortunately the following lines are generated // by a python script match (av, bv) { - (HyperListString(x), HyperListString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperListString(x), HyperListInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperListString(x), HyperListFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperListInt(x), HyperListString(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperListInt(x), HyperListInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperListInt(x), HyperListFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperListFloat(x), HyperListString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperListFloat(x), HyperListInt(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperListFloat(x), HyperListFloat(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperSetString(x), HyperSetString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperSetString(x), HyperSetInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperSetString(x), HyperSetFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperSetInt(x), HyperSetString(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperSetInt(x), HyperSetInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperSetInt(x), HyperSetFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperSetFloat(x), HyperSetString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperSetFloat(x), HyperSetInt(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperSetFloat(x), HyperSetFloat(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperMapStringString(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringString(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringString(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringString(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, @@ -70,7 +58,6 @@ fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { (HyperMapStringString(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringString(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringInt(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperMapStringInt(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringInt(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringInt(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringInt(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, @@ -80,7 +67,6 @@ fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { (HyperMapStringInt(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringFloat(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringFloat(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperMapStringFloat(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringFloat(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringFloat(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapStringFloat(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, @@ -90,7 +76,6 @@ fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { (HyperMapIntString(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntString(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntString(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperMapIntString(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntString(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntString(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntString(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, @@ -100,7 +85,6 @@ fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { (HyperMapIntInt(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntInt(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntInt(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperMapIntInt(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntInt(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntInt(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntInt(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, @@ -110,7 +94,6 @@ fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { (HyperMapIntFloat(x), HyperMapStringFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntFloat(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntFloat(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperMapIntFloat(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntFloat(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntFloat(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapIntFloat(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, @@ -120,7 +103,6 @@ fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { (HyperMapFloatString(x), HyperMapIntString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatString(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatString(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperMapFloatString(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatString(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatString(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatInt(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, @@ -130,7 +112,6 @@ fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { (HyperMapFloatInt(x), HyperMapIntInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatInt(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatInt(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperMapFloatInt(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatInt(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatFloat(x), HyperMapStringString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatFloat(x), HyperMapStringInt(y)) => if !sloppyCompare!(x, y) { return false; }, @@ -140,7 +121,6 @@ fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { (HyperMapFloatFloat(x), HyperMapIntFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatFloat(x), HyperMapFloatString(y)) => if !sloppyCompare!(x, y) { return false; }, (HyperMapFloatFloat(x), HyperMapFloatInt(y)) => if !sloppyCompare!(x, y) { return false; }, - (HyperMapFloatFloat(x), HyperMapFloatFloat(y)) => if !sloppyCompare!(x, y) { return false; }, (x, y) => if x != y { return false; }, } } @@ -148,8 +128,8 @@ fn sloppyCompareHyper(a: &HyperObject, b: &HyperObject) -> bool { } fn main() { - let args = os::args(); - let mut client = Client::new(FromStr::from_str(format!("{}:{}", args[1], args[2]).as_slice()).unwrap()).unwrap(); + let args: Vec = std::env::args().collect(); + let mut client = Client::new(FromStr::from_str(format!("{}:{}", args[1], args[2]).as_str()).unwrap()).unwrap(); match client.put(r"kv", r"foo/foo/foo", HyperObject::new()) { Ok(()) => (), diff --git a/test/sh/bindings.rust.Basic.sh b/test/sh/bindings.rust.Basic.sh index 3bef4218e..c58572705 100755 --- a/test/sh/bindings.rust.Basic.sh +++ b/test/sh/bindings.rust.Basic.sh @@ -1,5 +1,5 @@ #!/bin/sh -rustc -g -L rust_hyperdex/target -o "${HYPERDEX_BUILDDIR}"/test/rust/Basic "${HYPERDEX_SRCDIR}"/test/rust/Basic.rs +rustc -g -L rust_hyperdex/target/debug -L rust_hyperdex/target/debug/deps -o "${HYPERDEX_BUILDDIR}"/test/rust/Basic "${HYPERDEX_SRCDIR}"/test/rust/Basic.rs python2 "${HYPERDEX_SRCDIR}"/test/runner.py --space="space kv key k attribute v" --daemons=1 -- \ "${HYPERDEX_BUILDDIR}"/test/rust/Basic {HOST} {PORT} diff --git a/test/sh/bindings.rust.BasicSearch.sh b/test/sh/bindings.rust.BasicSearch.sh index 9d8467de5..663ae041e 100755 --- a/test/sh/bindings.rust.BasicSearch.sh +++ b/test/sh/bindings.rust.BasicSearch.sh @@ -1,5 +1,5 @@ #!/bin/sh -rustc -g -L rust_hyperdex/target -o "${HYPERDEX_BUILDDIR}"/test/rust/BasicSearch "${HYPERDEX_SRCDIR}"/test/rust/BasicSearch.rs +rustc -g -L rust_hyperdex/target/debug -L rust_hyperdex/target/debug/deps -o "${HYPERDEX_BUILDDIR}"/test/rust/BasicSearch "${HYPERDEX_SRCDIR}"/test/rust/BasicSearch.rs python2 "${HYPERDEX_SRCDIR}"/test/runner.py --space="space kv key k attribute v" --daemons=1 -- \ "${HYPERDEX_BUILDDIR}"/test/rust/BasicSearch {HOST} {PORT} diff --git a/test/sh/bindings.rust.CondPut.sh b/test/sh/bindings.rust.CondPut.sh index 6bb61d6c3..d87e8642e 100755 --- a/test/sh/bindings.rust.CondPut.sh +++ b/test/sh/bindings.rust.CondPut.sh @@ -1,5 +1,5 @@ #!/bin/sh -rustc -g -L rust_hyperdex/target -o "${HYPERDEX_BUILDDIR}"/test/rust/CondPut "${HYPERDEX_SRCDIR}"/test/rust/CondPut.rs +rustc -g -L rust_hyperdex/target/debug -L rust_hyperdex/target/debug/deps -o "${HYPERDEX_BUILDDIR}"/test/rust/CondPut "${HYPERDEX_SRCDIR}"/test/rust/CondPut.rs python2 "${HYPERDEX_SRCDIR}"/test/runner.py --space="space kv key k attribute v" --daemons=1 -- \ "${HYPERDEX_BUILDDIR}"/test/rust/CondPut {HOST} {PORT} diff --git a/test/sh/bindings.rust.DataTypeFloat.sh b/test/sh/bindings.rust.DataTypeFloat.sh index 81a691171..f2f0c39aa 100755 --- a/test/sh/bindings.rust.DataTypeFloat.sh +++ b/test/sh/bindings.rust.DataTypeFloat.sh @@ -1,5 +1,5 @@ #!/bin/sh -rustc -g -L rust_hyperdex/target -o "${HYPERDEX_BUILDDIR}"/test/rust/DataTypeFloat "${HYPERDEX_SRCDIR}"/test/rust/DataTypeFloat.rs +rustc -g -L rust_hyperdex/target/debug -L rust_hyperdex/target/debug/deps -o "${HYPERDEX_BUILDDIR}"/test/rust/DataTypeFloat "${HYPERDEX_SRCDIR}"/test/rust/DataTypeFloat.rs python2 "${HYPERDEX_SRCDIR}"/test/runner.py --space="space kv key k attributes float v" --daemons=1 -- \ "${HYPERDEX_BUILDDIR}"/test/rust/DataTypeFloat {HOST} {PORT} diff --git a/test/sh/bindings.rust.DataTypeInt.sh b/test/sh/bindings.rust.DataTypeInt.sh index 26a91ed3e..22cee7936 100755 --- a/test/sh/bindings.rust.DataTypeInt.sh +++ b/test/sh/bindings.rust.DataTypeInt.sh @@ -1,5 +1,5 @@ #!/bin/sh -rustc -g -L rust_hyperdex/target -o "${HYPERDEX_BUILDDIR}"/test/rust/DataTypeInt "${HYPERDEX_SRCDIR}"/test/rust/DataTypeInt.rs +rustc -g -L rust_hyperdex/target/debug -L rust_hyperdex/target/debug/deps -o "${HYPERDEX_BUILDDIR}"/test/rust/DataTypeInt "${HYPERDEX_SRCDIR}"/test/rust/DataTypeInt.rs python2 "${HYPERDEX_SRCDIR}"/test/runner.py --space="space kv key k attributes int v" --daemons=1 -- \ "${HYPERDEX_BUILDDIR}"/test/rust/DataTypeInt {HOST} {PORT} diff --git a/test/sh/bindings.rust.DataTypeListFloat.sh b/test/sh/bindings.rust.DataTypeListFloat.sh index 1f980fb36..c694c4b79 100755 --- a/test/sh/bindings.rust.DataTypeListFloat.sh +++ b/test/sh/bindings.rust.DataTypeListFloat.sh @@ -1,5 +1,5 @@ #!/bin/sh -rustc -g -L rust_hyperdex/target -o "${HYPERDEX_BUILDDIR}"/test/rust/DataTypeListFloat "${HYPERDEX_SRCDIR}"/test/rust/DataTypeListFloat.rs +rustc -g -L rust_hyperdex/target/debug -L rust_hyperdex/target/debug/deps -o "${HYPERDEX_BUILDDIR}"/test/rust/DataTypeListFloat "${HYPERDEX_SRCDIR}"/test/rust/DataTypeListFloat.rs python2 "${HYPERDEX_SRCDIR}"/test/runner.py --space="space kv key k attributes list(float) v" --daemons=1 -- \ "${HYPERDEX_BUILDDIR}"/test/rust/DataTypeListFloat {HOST} {PORT} diff --git a/test/sh/bindings.rust.DataTypeListInt.sh b/test/sh/bindings.rust.DataTypeListInt.sh index f0bbc6703..46f4a88a0 100755 --- a/test/sh/bindings.rust.DataTypeListInt.sh +++ b/test/sh/bindings.rust.DataTypeListInt.sh @@ -1,5 +1,5 @@ #!/bin/sh -rustc -g -L rust_hyperdex/target -o "${HYPERDEX_BUILDDIR}"/test/rust/DataTypeListInt "${HYPERDEX_SRCDIR}"/test/rust/DataTypeListInt.rs +rustc -g -L rust_hyperdex/target/debug -L rust_hyperdex/target/debug/deps -o "${HYPERDEX_BUILDDIR}"/test/rust/DataTypeListInt "${HYPERDEX_SRCDIR}"/test/rust/DataTypeListInt.rs python2 "${HYPERDEX_SRCDIR}"/test/runner.py --space="space kv key k attributes list(int) v" --daemons=1 -- \ "${HYPERDEX_BUILDDIR}"/test/rust/DataTypeListInt {HOST} {PORT} diff --git a/test/sh/bindings.rust.DataTypeListString.sh b/test/sh/bindings.rust.DataTypeListString.sh index de73ca456..190e9a365 100755 --- a/test/sh/bindings.rust.DataTypeListString.sh +++ b/test/sh/bindings.rust.DataTypeListString.sh @@ -1,5 +1,5 @@ #!/bin/sh -rustc -g -L rust_hyperdex/target -o "${HYPERDEX_BUILDDIR}"/test/rust/DataTypeListString "${HYPERDEX_SRCDIR}"/test/rust/DataTypeListString.rs +rustc -g -L rust_hyperdex/target/debug -L rust_hyperdex/target/debug/deps -o "${HYPERDEX_BUILDDIR}"/test/rust/DataTypeListString "${HYPERDEX_SRCDIR}"/test/rust/DataTypeListString.rs python2 "${HYPERDEX_SRCDIR}"/test/runner.py --space="space kv key k attributes list(string) v" --daemons=1 -- \ "${HYPERDEX_BUILDDIR}"/test/rust/DataTypeListString {HOST} {PORT} diff --git a/test/sh/bindings.rust.DataTypeMapFloatFloat.sh b/test/sh/bindings.rust.DataTypeMapFloatFloat.sh index 8c762d322..53f5bbf2d 100755 --- a/test/sh/bindings.rust.DataTypeMapFloatFloat.sh +++ b/test/sh/bindings.rust.DataTypeMapFloatFloat.sh @@ -1,5 +1,5 @@ #!/bin/sh -rustc -g -L rust_hyperdex/target -o "${HYPERDEX_BUILDDIR}"/test/rust/DataTypeMapFloatFloat "${HYPERDEX_SRCDIR}"/test/rust/DataTypeMapFloatFloat.rs +rustc -g -L rust_hyperdex/target/debug -L rust_hyperdex/target/debug/deps -o "${HYPERDEX_BUILDDIR}"/test/rust/DataTypeMapFloatFloat "${HYPERDEX_SRCDIR}"/test/rust/DataTypeMapFloatFloat.rs python2 "${HYPERDEX_SRCDIR}"/test/runner.py --space="space kv key k attributes map(float, float) v" --daemons=1 -- \ "${HYPERDEX_BUILDDIR}"/test/rust/DataTypeMapFloatFloat {HOST} {PORT} diff --git a/test/sh/bindings.rust.DataTypeMapFloatInt.sh b/test/sh/bindings.rust.DataTypeMapFloatInt.sh index 21af695c1..f32995d9f 100755 --- a/test/sh/bindings.rust.DataTypeMapFloatInt.sh +++ b/test/sh/bindings.rust.DataTypeMapFloatInt.sh @@ -1,5 +1,5 @@ #!/bin/sh -rustc -g -L rust_hyperdex/target -o "${HYPERDEX_BUILDDIR}"/test/rust/DataTypeMapFloatInt "${HYPERDEX_SRCDIR}"/test/rust/DataTypeMapFloatInt.rs +rustc -g -L rust_hyperdex/target/debug -L rust_hyperdex/target/debug/deps -o "${HYPERDEX_BUILDDIR}"/test/rust/DataTypeMapFloatInt "${HYPERDEX_SRCDIR}"/test/rust/DataTypeMapFloatInt.rs python2 "${HYPERDEX_SRCDIR}"/test/runner.py --space="space kv key k attributes map(float, int) v" --daemons=1 -- \ "${HYPERDEX_BUILDDIR}"/test/rust/DataTypeMapFloatInt {HOST} {PORT} diff --git a/test/sh/bindings.rust.DataTypeMapFloatString.sh b/test/sh/bindings.rust.DataTypeMapFloatString.sh index ecb0758cf..a1aab8dea 100755 --- a/test/sh/bindings.rust.DataTypeMapFloatString.sh +++ b/test/sh/bindings.rust.DataTypeMapFloatString.sh @@ -1,5 +1,5 @@ #!/bin/sh -rustc -g -L rust_hyperdex/target -o "${HYPERDEX_BUILDDIR}"/test/rust/DataTypeMapFloatString "${HYPERDEX_SRCDIR}"/test/rust/DataTypeMapFloatString.rs +rustc -g -L rust_hyperdex/target/debug -L rust_hyperdex/target/debug/deps -o "${HYPERDEX_BUILDDIR}"/test/rust/DataTypeMapFloatString "${HYPERDEX_SRCDIR}"/test/rust/DataTypeMapFloatString.rs python2 "${HYPERDEX_SRCDIR}"/test/runner.py --space="space kv key k attributes map(float, string) v" --daemons=1 -- \ "${HYPERDEX_BUILDDIR}"/test/rust/DataTypeMapFloatString {HOST} {PORT} diff --git a/test/sh/bindings.rust.DataTypeMapIntFloat.sh b/test/sh/bindings.rust.DataTypeMapIntFloat.sh index 08c359dd8..2b02c98ac 100755 --- a/test/sh/bindings.rust.DataTypeMapIntFloat.sh +++ b/test/sh/bindings.rust.DataTypeMapIntFloat.sh @@ -1,5 +1,5 @@ #!/bin/sh -rustc -g -L rust_hyperdex/target -o "${HYPERDEX_BUILDDIR}"/test/rust/DataTypeMapIntFloat "${HYPERDEX_SRCDIR}"/test/rust/DataTypeMapIntFloat.rs +rustc -g -L rust_hyperdex/target/debug -L rust_hyperdex/target/debug/deps -o "${HYPERDEX_BUILDDIR}"/test/rust/DataTypeMapIntFloat "${HYPERDEX_SRCDIR}"/test/rust/DataTypeMapIntFloat.rs python2 "${HYPERDEX_SRCDIR}"/test/runner.py --space="space kv key k attributes map(int, float) v" --daemons=1 -- \ "${HYPERDEX_BUILDDIR}"/test/rust/DataTypeMapIntFloat {HOST} {PORT} diff --git a/test/sh/bindings.rust.DataTypeMapIntInt.sh b/test/sh/bindings.rust.DataTypeMapIntInt.sh index 19645371e..92bc2725a 100755 --- a/test/sh/bindings.rust.DataTypeMapIntInt.sh +++ b/test/sh/bindings.rust.DataTypeMapIntInt.sh @@ -1,5 +1,5 @@ #!/bin/sh -rustc -g -L rust_hyperdex/target -o "${HYPERDEX_BUILDDIR}"/test/rust/DataTypeMapIntInt "${HYPERDEX_SRCDIR}"/test/rust/DataTypeMapIntInt.rs +rustc -g -L rust_hyperdex/target/debug -L rust_hyperdex/target/debug/deps -o "${HYPERDEX_BUILDDIR}"/test/rust/DataTypeMapIntInt "${HYPERDEX_SRCDIR}"/test/rust/DataTypeMapIntInt.rs python2 "${HYPERDEX_SRCDIR}"/test/runner.py --space="space kv key k attributes map(int, int) v" --daemons=1 -- \ "${HYPERDEX_BUILDDIR}"/test/rust/DataTypeMapIntInt {HOST} {PORT} diff --git a/test/sh/bindings.rust.DataTypeMapIntString.sh b/test/sh/bindings.rust.DataTypeMapIntString.sh index 76cdeaf89..61b1bfcc6 100755 --- a/test/sh/bindings.rust.DataTypeMapIntString.sh +++ b/test/sh/bindings.rust.DataTypeMapIntString.sh @@ -1,5 +1,5 @@ #!/bin/sh -rustc -g -L rust_hyperdex/target -o "${HYPERDEX_BUILDDIR}"/test/rust/DataTypeMapIntString "${HYPERDEX_SRCDIR}"/test/rust/DataTypeMapIntString.rs +rustc -g -L rust_hyperdex/target/debug -L rust_hyperdex/target/debug/deps -o "${HYPERDEX_BUILDDIR}"/test/rust/DataTypeMapIntString "${HYPERDEX_SRCDIR}"/test/rust/DataTypeMapIntString.rs python2 "${HYPERDEX_SRCDIR}"/test/runner.py --space="space kv key k attributes map(int, string) v" --daemons=1 -- \ "${HYPERDEX_BUILDDIR}"/test/rust/DataTypeMapIntString {HOST} {PORT} diff --git a/test/sh/bindings.rust.DataTypeMapStringFloat.sh b/test/sh/bindings.rust.DataTypeMapStringFloat.sh index 3d51f8ad1..928770b64 100755 --- a/test/sh/bindings.rust.DataTypeMapStringFloat.sh +++ b/test/sh/bindings.rust.DataTypeMapStringFloat.sh @@ -1,5 +1,5 @@ #!/bin/sh -rustc -g -L rust_hyperdex/target -o "${HYPERDEX_BUILDDIR}"/test/rust/DataTypeMapStringFloat "${HYPERDEX_SRCDIR}"/test/rust/DataTypeMapStringFloat.rs +rustc -g -L rust_hyperdex/target/debug -L rust_hyperdex/target/debug/deps -o "${HYPERDEX_BUILDDIR}"/test/rust/DataTypeMapStringFloat "${HYPERDEX_SRCDIR}"/test/rust/DataTypeMapStringFloat.rs python2 "${HYPERDEX_SRCDIR}"/test/runner.py --space="space kv key k attributes map(string, float) v" --daemons=1 -- \ "${HYPERDEX_BUILDDIR}"/test/rust/DataTypeMapStringFloat {HOST} {PORT} diff --git a/test/sh/bindings.rust.DataTypeMapStringInt.sh b/test/sh/bindings.rust.DataTypeMapStringInt.sh index f1adc54f8..324ed0202 100755 --- a/test/sh/bindings.rust.DataTypeMapStringInt.sh +++ b/test/sh/bindings.rust.DataTypeMapStringInt.sh @@ -1,5 +1,5 @@ #!/bin/sh -rustc -g -L rust_hyperdex/target -o "${HYPERDEX_BUILDDIR}"/test/rust/DataTypeMapStringInt "${HYPERDEX_SRCDIR}"/test/rust/DataTypeMapStringInt.rs +rustc -g -L rust_hyperdex/target/debug -L rust_hyperdex/target/debug/deps -o "${HYPERDEX_BUILDDIR}"/test/rust/DataTypeMapStringInt "${HYPERDEX_SRCDIR}"/test/rust/DataTypeMapStringInt.rs python2 "${HYPERDEX_SRCDIR}"/test/runner.py --space="space kv key k attributes map(string, int) v" --daemons=1 -- \ "${HYPERDEX_BUILDDIR}"/test/rust/DataTypeMapStringInt {HOST} {PORT} diff --git a/test/sh/bindings.rust.DataTypeMapStringString.sh b/test/sh/bindings.rust.DataTypeMapStringString.sh index 474342aad..0973d73df 100755 --- a/test/sh/bindings.rust.DataTypeMapStringString.sh +++ b/test/sh/bindings.rust.DataTypeMapStringString.sh @@ -1,5 +1,5 @@ #!/bin/sh -rustc -g -L rust_hyperdex/target -o "${HYPERDEX_BUILDDIR}"/test/rust/DataTypeMapStringString "${HYPERDEX_SRCDIR}"/test/rust/DataTypeMapStringString.rs +rustc -g -L rust_hyperdex/target/debug -L rust_hyperdex/target/debug/deps -o "${HYPERDEX_BUILDDIR}"/test/rust/DataTypeMapStringString "${HYPERDEX_SRCDIR}"/test/rust/DataTypeMapStringString.rs python2 "${HYPERDEX_SRCDIR}"/test/runner.py --space="space kv key k attributes map(string, string) v" --daemons=1 -- \ "${HYPERDEX_BUILDDIR}"/test/rust/DataTypeMapStringString {HOST} {PORT} diff --git a/test/sh/bindings.rust.DataTypeSetFloat.sh b/test/sh/bindings.rust.DataTypeSetFloat.sh index 153c3f995..198044aac 100755 --- a/test/sh/bindings.rust.DataTypeSetFloat.sh +++ b/test/sh/bindings.rust.DataTypeSetFloat.sh @@ -1,5 +1,5 @@ #!/bin/sh -rustc -g -L rust_hyperdex/target -o "${HYPERDEX_BUILDDIR}"/test/rust/DataTypeSetFloat "${HYPERDEX_SRCDIR}"/test/rust/DataTypeSetFloat.rs +rustc -g -L rust_hyperdex/target/debug -L rust_hyperdex/target/debug/deps -o "${HYPERDEX_BUILDDIR}"/test/rust/DataTypeSetFloat "${HYPERDEX_SRCDIR}"/test/rust/DataTypeSetFloat.rs python2 "${HYPERDEX_SRCDIR}"/test/runner.py --space="space kv key k attributes set(float) v" --daemons=1 -- \ "${HYPERDEX_BUILDDIR}"/test/rust/DataTypeSetFloat {HOST} {PORT} diff --git a/test/sh/bindings.rust.DataTypeSetInt.sh b/test/sh/bindings.rust.DataTypeSetInt.sh index 3b2003aa5..ab9fa4fd8 100755 --- a/test/sh/bindings.rust.DataTypeSetInt.sh +++ b/test/sh/bindings.rust.DataTypeSetInt.sh @@ -1,5 +1,5 @@ #!/bin/sh -rustc -g -L rust_hyperdex/target -o "${HYPERDEX_BUILDDIR}"/test/rust/DataTypeSetInt "${HYPERDEX_SRCDIR}"/test/rust/DataTypeSetInt.rs +rustc -g -L rust_hyperdex/target/debug -L rust_hyperdex/target/debug/deps -o "${HYPERDEX_BUILDDIR}"/test/rust/DataTypeSetInt "${HYPERDEX_SRCDIR}"/test/rust/DataTypeSetInt.rs python2 "${HYPERDEX_SRCDIR}"/test/runner.py --space="space kv key k attributes set(int) v" --daemons=1 -- \ "${HYPERDEX_BUILDDIR}"/test/rust/DataTypeSetInt {HOST} {PORT} diff --git a/test/sh/bindings.rust.DataTypeSetString.sh b/test/sh/bindings.rust.DataTypeSetString.sh index 6a10d7615..fcd8b22d2 100755 --- a/test/sh/bindings.rust.DataTypeSetString.sh +++ b/test/sh/bindings.rust.DataTypeSetString.sh @@ -1,5 +1,5 @@ #!/bin/sh -rustc -g -L rust_hyperdex/target -o "${HYPERDEX_BUILDDIR}"/test/rust/DataTypeSetString "${HYPERDEX_SRCDIR}"/test/rust/DataTypeSetString.rs +rustc -g -L rust_hyperdex/target/debug -L rust_hyperdex/target/debug/deps -o "${HYPERDEX_BUILDDIR}"/test/rust/DataTypeSetString "${HYPERDEX_SRCDIR}"/test/rust/DataTypeSetString.rs python2 "${HYPERDEX_SRCDIR}"/test/runner.py --space="space kv key k attributes set(string) v" --daemons=1 -- \ "${HYPERDEX_BUILDDIR}"/test/rust/DataTypeSetString {HOST} {PORT} diff --git a/test/sh/bindings.rust.DataTypeString.sh b/test/sh/bindings.rust.DataTypeString.sh index ca630410c..ddf6188dd 100755 --- a/test/sh/bindings.rust.DataTypeString.sh +++ b/test/sh/bindings.rust.DataTypeString.sh @@ -1,5 +1,5 @@ #!/bin/sh -rustc -g -L rust_hyperdex/target -o "${HYPERDEX_BUILDDIR}"/test/rust/DataTypeString "${HYPERDEX_SRCDIR}"/test/rust/DataTypeString.rs +rustc -g -L rust_hyperdex/target/debug -L rust_hyperdex/target/debug/deps -o "${HYPERDEX_BUILDDIR}"/test/rust/DataTypeString "${HYPERDEX_SRCDIR}"/test/rust/DataTypeString.rs python2 "${HYPERDEX_SRCDIR}"/test/runner.py --space="space kv key k attributes v" --daemons=1 -- \ "${HYPERDEX_BUILDDIR}"/test/rust/DataTypeString {HOST} {PORT} diff --git a/test/sh/bindings.rust.LengthString.sh b/test/sh/bindings.rust.LengthString.sh index 6121cbb9b..9a04c0e42 100755 --- a/test/sh/bindings.rust.LengthString.sh +++ b/test/sh/bindings.rust.LengthString.sh @@ -1,5 +1,5 @@ #!/bin/sh -rustc -g -L rust_hyperdex/target -o "${HYPERDEX_BUILDDIR}"/test/rust/LengthString "${HYPERDEX_SRCDIR}"/test/rust/LengthString.rs +rustc -g -L rust_hyperdex/target/debug -L rust_hyperdex/target/debug/deps -o "${HYPERDEX_BUILDDIR}"/test/rust/LengthString "${HYPERDEX_SRCDIR}"/test/rust/LengthString.rs python2 "${HYPERDEX_SRCDIR}"/test/runner.py --space="space kv key k" --daemons=1 -- \ "${HYPERDEX_BUILDDIR}"/test/rust/LengthString {HOST} {PORT} diff --git a/test/sh/bindings.rust.MultiAttribute.sh b/test/sh/bindings.rust.MultiAttribute.sh index ad90657e0..4e952502d 100755 --- a/test/sh/bindings.rust.MultiAttribute.sh +++ b/test/sh/bindings.rust.MultiAttribute.sh @@ -1,5 +1,5 @@ #!/bin/sh -rustc -g -L rust_hyperdex/target -o "${HYPERDEX_BUILDDIR}"/test/rust/MultiAttribute "${HYPERDEX_SRCDIR}"/test/rust/MultiAttribute.rs +rustc -g -L rust_hyperdex/target/debug -L rust_hyperdex/target/debug/deps -o "${HYPERDEX_BUILDDIR}"/test/rust/MultiAttribute "${HYPERDEX_SRCDIR}"/test/rust/MultiAttribute.rs python2 "${HYPERDEX_SRCDIR}"/test/runner.py --space="space kv key k attributes v1, v2" --daemons=1 -- \ "${HYPERDEX_BUILDDIR}"/test/rust/MultiAttribute {HOST} {PORT} diff --git a/test/sh/bindings.rust.RangeSearchInt.sh b/test/sh/bindings.rust.RangeSearchInt.sh index fb2277284..5852d5ecd 100755 --- a/test/sh/bindings.rust.RangeSearchInt.sh +++ b/test/sh/bindings.rust.RangeSearchInt.sh @@ -1,5 +1,5 @@ #!/bin/sh -rustc -g -L rust_hyperdex/target -o "${HYPERDEX_BUILDDIR}"/test/rust/RangeSearchInt "${HYPERDEX_SRCDIR}"/test/rust/RangeSearchInt.rs +rustc -g -L rust_hyperdex/target/debug -L rust_hyperdex/target/debug/deps -o "${HYPERDEX_BUILDDIR}"/test/rust/RangeSearchInt "${HYPERDEX_SRCDIR}"/test/rust/RangeSearchInt.rs python2 "${HYPERDEX_SRCDIR}"/test/runner.py --space="space kv key int k attribute int v" --daemons=1 -- \ "${HYPERDEX_BUILDDIR}"/test/rust/RangeSearchInt {HOST} {PORT} diff --git a/test/sh/bindings.rust.RangeSearchString.sh b/test/sh/bindings.rust.RangeSearchString.sh index 64793cac5..654c00c61 100755 --- a/test/sh/bindings.rust.RangeSearchString.sh +++ b/test/sh/bindings.rust.RangeSearchString.sh @@ -1,5 +1,5 @@ #!/bin/sh -rustc -g -L rust_hyperdex/target -o "${HYPERDEX_BUILDDIR}"/test/rust/RangeSearchString "${HYPERDEX_SRCDIR}"/test/rust/RangeSearchString.rs +rustc -g -L rust_hyperdex/target/debug -L rust_hyperdex/target/debug/deps -o "${HYPERDEX_BUILDDIR}"/test/rust/RangeSearchString "${HYPERDEX_SRCDIR}"/test/rust/RangeSearchString.rs python2 "${HYPERDEX_SRCDIR}"/test/runner.py --space="space kv key k attribute v" --daemons=1 -- \ "${HYPERDEX_BUILDDIR}"/test/rust/RangeSearchString {HOST} {PORT} diff --git a/test/sh/bindings.rust.RegexSearch.sh b/test/sh/bindings.rust.RegexSearch.sh index f6bec407a..cd90cc57d 100755 --- a/test/sh/bindings.rust.RegexSearch.sh +++ b/test/sh/bindings.rust.RegexSearch.sh @@ -1,5 +1,5 @@ #!/bin/sh -rustc -g -L rust_hyperdex/target -o "${HYPERDEX_BUILDDIR}"/test/rust/RegexSearch "${HYPERDEX_SRCDIR}"/test/rust/RegexSearch.rs +rustc -g -L rust_hyperdex/target/debug -L rust_hyperdex/target/debug/deps -o "${HYPERDEX_BUILDDIR}"/test/rust/RegexSearch "${HYPERDEX_SRCDIR}"/test/rust/RegexSearch.rs python2 "${HYPERDEX_SRCDIR}"/test/runner.py --space="space kv key k" --daemons=1 -- \ "${HYPERDEX_BUILDDIR}"/test/rust/RegexSearch {HOST} {PORT}