From 5b90fefddc4cba766aadc01b6dcc2c63b5f97229 Mon Sep 17 00:00:00 2001 From: Alex Cunningham Date: Sat, 23 Nov 2013 19:11:43 +0000 Subject: [PATCH] Added small test and additional interface wrapping for LabeledSymbol --- gtsam.h | 2 ++ gtsam/inference/tests/testLabeledSymbol.cpp | 6 ++++++ 2 files changed, 8 insertions(+) diff --git a/gtsam.h b/gtsam.h index f7650b228..2516cb202 100644 --- a/gtsam.h +++ b/gtsam.h @@ -1516,6 +1516,8 @@ class LabeledSymbol { gtsam::LabeledSymbol upper() const; gtsam::LabeledSymbol lower() const; + gtsam::LabeledSymbol newChr(unsigned char c) const; + gtsam::LabeledSymbol newLabel(unsigned char label) const; void print(string s) const; }; diff --git a/gtsam/inference/tests/testLabeledSymbol.cpp b/gtsam/inference/tests/testLabeledSymbol.cpp index 4e56dfba0..07727c8dc 100644 --- a/gtsam/inference/tests/testLabeledSymbol.cpp +++ b/gtsam/inference/tests/testLabeledSymbol.cpp @@ -50,6 +50,9 @@ TEST( testLabeledSymbol, KeyLabeledSymbolEncoding ) { string str = "xA5"; EXPECT_LONGS_EQUAL((long)key, (long)(Key)symbol); + EXPECT_LONGS_EQUAL(5, symbol.index()); + EXPECT_LONGS_EQUAL(0x78, symbol.chr()); + EXPECT_LONGS_EQUAL(0x41, symbol.label()); EXPECT(assert_equal(str, MultiRobotKeyFormatter(symbol))); EXPECT(assert_equal(symbol, LabeledSymbol(key))); } else if(sizeof(Key) == 4) { @@ -58,6 +61,9 @@ TEST( testLabeledSymbol, KeyLabeledSymbolEncoding ) { string str = "xA5"; EXPECT_LONGS_EQUAL((long)key, (long)(Key) symbol); + EXPECT_LONGS_EQUAL(5, symbol.index()); + EXPECT_LONGS_EQUAL(0x78, symbol.chr()); + EXPECT_LONGS_EQUAL(0x41, symbol.label()); EXPECT(assert_equal(str, MultiRobotKeyFormatter(symbol))); EXPECT(assert_equal(symbol, LabeledSymbol(key))); }