source: utilitiespy/test/tools/comparatorTest.py@ 1230

Last change on this file since 1230 was 1230, checked in by wouter, 6 weeks ago

#388 added PriorityQueue and Comparator to utilities package, simulating java classes with same name

File size: 593 bytes
RevLine 
[1230]1from unittest.case import TestCase
2from tudelft.utilities.tools.comparator import DefaultComparator
3
4class comparatorTest(TestCase):
5 def testSimple(self):
6 c=DefaultComparator()
7
8 self.assertEqual(0, c.compare(1, 1))
9 self.assertEqual(1, c.compare(2, 1))
10 self.assertEqual(1, c.compare(11, -1))
11 self.assertEqual(0, c.compare('a', 'a'))
12 self.assertEqual(0, c.compare("a", "a"))
13
14 self.assertEqual(-1, c.compare("a", "b"))
15 self.assertEqual(-1, c.compare("a", "aha"))
16 self.assertEqual(-1, c.compare(11, 12))
17
Note: See TracBrowser for help on using the repository browser.