Added small test and additional interface wrapping for LabeledSymbol
parent
4bac016899
commit
5b90fefddc
2
gtsam.h
2
gtsam.h
|
|
@ -1516,6 +1516,8 @@ class LabeledSymbol {
|
||||||
|
|
||||||
gtsam::LabeledSymbol upper() const;
|
gtsam::LabeledSymbol upper() const;
|
||||||
gtsam::LabeledSymbol lower() const;
|
gtsam::LabeledSymbol lower() const;
|
||||||
|
gtsam::LabeledSymbol newChr(unsigned char c) const;
|
||||||
|
gtsam::LabeledSymbol newLabel(unsigned char label) const;
|
||||||
|
|
||||||
void print(string s) const;
|
void print(string s) const;
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -50,6 +50,9 @@ TEST( testLabeledSymbol, KeyLabeledSymbolEncoding ) {
|
||||||
string str = "xA5";
|
string str = "xA5";
|
||||||
|
|
||||||
EXPECT_LONGS_EQUAL((long)key, (long)(Key)symbol);
|
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(str, MultiRobotKeyFormatter(symbol)));
|
||||||
EXPECT(assert_equal(symbol, LabeledSymbol(key)));
|
EXPECT(assert_equal(symbol, LabeledSymbol(key)));
|
||||||
} else if(sizeof(Key) == 4) {
|
} else if(sizeof(Key) == 4) {
|
||||||
|
|
@ -58,6 +61,9 @@ TEST( testLabeledSymbol, KeyLabeledSymbolEncoding ) {
|
||||||
string str = "xA5";
|
string str = "xA5";
|
||||||
|
|
||||||
EXPECT_LONGS_EQUAL((long)key, (long)(Key) symbol);
|
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(str, MultiRobotKeyFormatter(symbol)));
|
||||||
EXPECT(assert_equal(symbol, LabeledSymbol(key)));
|
EXPECT(assert_equal(symbol, LabeledSymbol(key)));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue