def test_example(self): input_strs = [r'""', r'"abc"', r'"aaa\"aaa"', r'"\x27"'] code_chars = sum([day8.get_num_code_chars(s) for s in input_strs]) str_chars = sum([day8.get_num_str_chars(s) for s in input_strs]) self.assertEqual(23, code_chars) self.assertEqual(11, str_chars) self.assertEqual(12, code_chars - str_chars)
def test_empty_string_in_quotes(self): input_str = r'""' result = day8.get_num_code_chars(input_str) self.assertEqual(2, result)
def test_string_with_escaped_quote(self): input_str = r'"aaa\"aaa"' print input_str result = day8.get_num_code_chars(input_str) self.assertEqual(10, result)
def test_test(self): input_str = r'"\x27"' print input_str result = day8.get_num_code_chars(input_str) self.assertEqual(6, result)
def test_quoted_chars_only(self): input_str = r'"abc"' result = day8.get_num_code_chars(input_str) self.assertEqual(5, result)