Added small test and additional interface wrapping for LabeledSymbol

release/4.3a0
Alex Cunningham 2013-11-23 19:11:43 +00:00
parent 4bac016899
commit 5b90fefddc
2 changed files with 8 additions and 0 deletions

View File

@ -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;
};

View File

@ -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)));
}