(x)
| 63 | return int(x[:-1], kBase) |
| 64 | |
| 65 | def Format(x): |
| 66 | original = x |
| 67 | negative = False |
| 68 | if x == 0: return "0n" |
| 69 | if x < 0: |
| 70 | negative = True |
| 71 | x = -x |
| 72 | s = "" |
| 73 | while x > 0: |
| 74 | s = kChars[x % kBase] + s |
| 75 | x = x / kBase |
| 76 | s = "0x" + s + "n" |
| 77 | if negative: |
| 78 | s = "-" + s |
| 79 | assert Parse(s) == original |
| 80 | return s |
| 81 | |
| 82 | class TestGenerator(object): |
| 83 | # Subclasses must implement these. |