Example #1
0
    def test_line_parsing(self):
        """
        Test that workload lines are parsed correctly
        """

        parser  = TracesParser(TRACES)
        value = parser.parse("  53    r1  B   read  ")
        self.assertEqual(value, TraceAccess(53, "r1", "B", "read"))

        value = parser.parse("2424.32 r9  write")
        self.assertEqual(value, TraceAccess(2424, "r9", None, "write"))
Example #2
0
    def test_line_parsing(self):
        """
        Test that workload lines are parsed correctly
        """

        parser = TracesParser(TRACES)
        value = parser.parse("  53    r1  B   read  ")
        self.assertEqual(value, TraceAccess(53, "r1", "B", "read"))

        value = parser.parse("2424.32 r9  write")
        self.assertEqual(value, TraceAccess(2424, "r9", None, "write"))
Example #3
0
    def test_line_parse_failure(self):
        """
        Test that invalid lines raise an exception
        """
        parser  = TracesParser(TRACES)

        with self.assertRaises(WorkloadException):
            value = parser.parse("abcdefg")

        with self.assertRaises(WorkloadException):
            value = parser.parse("23  r2   A     touch")

        with self.assertRaises(WorkloadException):
            value = parser.parse("")
Example #4
0
    def test_line_parse_failure(self):
        """
        Test that invalid lines raise an exception
        """
        parser = TracesParser(TRACES)

        with self.assertRaises(WorkloadException):
            value = parser.parse("abcdefg")

        with self.assertRaises(WorkloadException):
            value = parser.parse("23  r2   A     touch")

        with self.assertRaises(WorkloadException):
            value = parser.parse("")