Exemplo n.º 1
0
 def testHashWithFeatureOnRight(self):
     """
     The database hash function must return the expected (positive offset)
     hash when the second feature is to the right of the first.
     """
     dbParams = DatabaseParameters(landmarks=[], trigPoints=[])
     be = Backend()
     be.configure(dbParams)
     landmark = Landmark('name', 'A', 20, 0)
     trigPoint = TrigPoint('name', 'B', 30)
     distance10 = str(scaleLog(10, _DEFAULT_DISTANCE_BASE))
     self.assertEqual('A:B:' + distance10, be.hash(landmark, trigPoint))
Exemplo n.º 2
0
 def testHashWithSymbolDetail(self):
     """
     The database hash function must return the expected value when the
     landmark it is passed has a repeat count.
     """
     dbParams = DatabaseParameters(landmarks=[], trigPoints=[])
     be = Backend()
     be.configure(dbParams)
     landmark = Landmark('name', 'A', 20, 0, 5)
     trigPoint = TrigPoint('name', 'B', 30)
     distance10 = str(scaleLog(10, _DEFAULT_DISTANCE_BASE))
     self.assertEqual('A5:B:' + distance10, be.hash(landmark, trigPoint))
Exemplo n.º 3
0
 def testHashWithFeatureOnRightAndNonDefaultDistanceBase(self):
     """
     The database hash function must return the expected hash when the
     database has a non-default distance base and the second feature is to
     the right of the first.
     """
     dbParams = DatabaseParameters(landmarks=[], trigPoints=[],
                                   distanceBase=1.5)
     be = Backend()
     be.configure(dbParams)
     landmark = Landmark('name', 'A', 20, 0)
     trigPoint = TrigPoint('name', 'B', 30)
     distance10 = str(scaleLog(10, 1.5))
     self.assertEqual('A:B:' + distance10, be.hash(landmark, trigPoint))