def test_single(self): map = ResultMap() self.assertEqual(map.add("Magnum", "namespaceMagnum.html", suffix_length=11, flags=ResultFlag.NAMESPACE), 0) serialized = map.serialize() self.compare(serialized, """ 0: Magnum [suffix_length=11, type=NAMESPACE] -> namespaceMagnum.html """) self.assertEqual(len(serialized), 36)
def test_multiple(self): map = ResultMap() self.assertEqual( map.add("Math", "namespaceMath.html", flags=ResultFlag.NAMESPACE), 0) self.assertEqual( map.add("Math::Vector", "classMath_1_1Vector.html", flags=ResultFlag.CLASS), 1) self.assertEqual( map.add("Math::Range", "classMath_1_1Range.html", flags=ResultFlag.CLASS), 2) self.assertEqual( map.add("Math::min()", "namespaceMath.html#abcdef2875", flags=ResultFlag.FUNC), 3) self.assertEqual( map.add("Math::max(int, int)", "namespaceMath.html#abcdef1234", suffix_length=8, flags=ResultFlag.FUNC | ResultFlag.DEPRECATED | ResultFlag.DELETED), 4) self.assertEqual(map.add("Rectangle", "", alias=2), 5) self.assertEqual( map.add("Rectangle::Rect()", "", suffix_length=2, alias=2), 6) serialized = map.serialize() self.compare( serialized, """ 0: Math [type=NAMESPACE] -> namespaceMath.html 1: ::Vector [prefix=0[:0], type=CLASS] -> classMath_1_1Vector.html 2: ::Range [prefix=0[:0], type=CLASS] -> classMath_1_1Range.html 3: ::min() [prefix=0[:18], type=FUNC] -> #abcdef2875 4: ::max(int, int) [prefix=0[:18], suffix_length=8, deprecated, deleted, type=FUNC] -> #abcdef1234 5: Rectangle [alias=2] -> 6: ::Rect() [alias=2, prefix=5[:0], suffix_length=2] -> """) self.assertEqual(len(serialized), 203)
def test_empty(self): map = ResultMap() serialized = map.serialize() self.compare(serialized, "") self.assertEqual(len(serialized), 4)