Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 53 lines (43 sloc) 1.589 kB
522946b @timburks Character Literals for Nu.
authored
1 ;; test_characters.nu
2 ;; tests for Nu character literals.
3 ;;
29db4cd @timburks Company name changed.
authored
4 ;; Copyright (c) 2007 Tim Burks, Radtastical Inc.
522946b @timburks Character Literals for Nu.
authored
5
6 (class TestCharacters is NuTestCase
7
045f219 @timburks Replace "cmethod" and "imethod" with "+" and "-".
authored
8 (- (id) testRegularCharacters is
9 (set a 'a')
10 (set Z 'Z')
11 (set LPAREN '(')
12 (set RPAREN ')')
13 (set SEMICOLON ';')
14 (set HASH '#')
15 (set golden "aZ();#")
16 (assert_equal (golden characterAtIndex:0) a)
17 (assert_equal (golden characterAtIndex:1) Z)
18 (assert_equal (golden characterAtIndex:2) LPAREN)
19 (assert_equal (golden characterAtIndex:3) RPAREN)
20 (assert_equal (golden characterAtIndex:4) SEMICOLON)
21 (assert_equal (golden characterAtIndex:5) HASH))
522946b @timburks Character Literals for Nu.
authored
22
045f219 @timburks Replace "cmethod" and "imethod" with "+" and "-".
authored
23 (- (id) testEscapedCharacters is
24 (assert_equal 10 '\n')
25 (assert_equal 13 '\r')
26 (assert_equal 12 '\f')
27 (assert_equal 8 '\b')
28 (assert_equal 7 '\a')
29 (assert_equal 27 '\e')
30 (assert_equal 32 '\s'))
522946b @timburks Character Literals for Nu.
authored
31
045f219 @timburks Replace "cmethod" and "imethod" with "+" and "-".
authored
32 (- (id) testOctalEscapedCharacters is
9adda50 @timburks reenabled more unit tests for iOS.
authored
33 (assert_equal 0 '\000')
045f219 @timburks Replace "cmethod" and "imethod" with "+" and "-".
authored
34 (assert_equal 1 '\001')
35 (assert_equal 255 '\377'))
522946b @timburks Character Literals for Nu.
authored
36
045f219 @timburks Replace "cmethod" and "imethod" with "+" and "-".
authored
37 (- (id) testHexEscapedCharacters is
9adda50 @timburks reenabled more unit tests for iOS.
authored
38 (assert_equal 0 '\x00')
045f219 @timburks Replace "cmethod" and "imethod" with "+" and "-".
authored
39 (assert_equal 1 '\x01')
40 (assert_equal 255 '\xfF'))
522946b @timburks Character Literals for Nu.
authored
41
9adda50 @timburks reenabled more unit tests for iOS.
authored
42 (- (id) testUnicodeEscapedCharacters is
43 (assert_equal 0 '\u0000')
44 (assert_equal 1 '\u0001')
45 (assert_equal 65535 '\uFfFf')
46 (assert_equal 255 '\u00ff'))
58e2c33 @timburks Parse four-character alphanumeric character strings as integers.
authored
47
045f219 @timburks Replace "cmethod" and "imethod" with "+" and "-".
authored
48 (- (id) testFourCharacterIntegers is
49 (assert_equal 1886604404 'psLt')
50 (assert_equal 1886601524 'psA4')))
58e2c33 @timburks Parse four-character alphanumeric character strings as integers.
authored
51
522946b @timburks Character Literals for Nu.
authored
52
Something went wrong with that request. Please try again.