Skip to content

Instantly share code, notes, and snippets.

@mythz
Created May 15, 2012 02:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mythz/2698702 to your computer and use it in GitHub Desktop.
Save mythz/2698702 to your computer and use it in GitHub Desktop.
DartRedisClient test output
1. RedisConnection: Connection: constructor (0, 8, 8)
1. parses password
Expected pass
2. parses hostName
Expected host
3. parses port
Expected 133
4. parses db
Expected 7
5. parses without db
Expected [pass, host, 133, 0]
6. parses without port
Expected [pass, host, 6379, 0]
7. parses without password
Expected [null, host, 6379, 0]
8. empty ctor uses defaults
Expected [null, localhost, 6379, 0]
1. RedisClient: Connection: db SELECT (0, 3, 3)
1. SELECT: can get key from db1
Expected db1
2. SELECT: can get key from db0
Expected db0
3. SELECT: can get key from db1 connection
Expected db1
2. RedisClient: KEYS: GET, SET, GETSET RANDOMKEY RENAME RENAMENX TTL PTTL (0, 8, 8)
1. GET, SET
Expected value
2. GET unknown key is null
Expected null
3. RANDOMKEY
4. RENAME existing key
Expected value
5. RENAMENX does not rename non-existant key
6. RENAMENX does rename existing key
7. GETSET: non-existing key returns null
Expected null
8. GETSET: returns previous value
Expected A
3. RedisClient: KEYS: MSET, MSETNX, MGET, DEL, MDEL (0, 8, 8)
1. MSET/MGET can set multiple values
Expected [1, 2, 3, 4, 5]
2. DEL returns number of deleted keys
Expected 1
3. DEL returns number of multiple deleted keys
Expected 2
4. DEL delets key
Expected null
5. MDEL delets key
Expected null
6. MDEL delets key
Expected null
7. MSETNX - doesn't set map if some keys exist
8. MSETNX - sets map when all keys don't exist
4. RedisClient: KEYS: Expiring keys: SETEX, PSETEX, PERSIST EXPIRE PEXPIRE EXPIREAT PEXPIREAT (0, 16, 16)
1. TTL 10 < 10s
2. TTL 10 < 10ms
3. SETEX: doesn't expire immediately
Expected null
4. EXPIRE: doesn't expire immediately
Expected null
5. PEXPIRE: doesn't expire immediately
Expected null
6. EXPIREAT: doesn't expire immediately
Expected null
7. PEXPIREAT: doesn't expire immediately
Expected null
8. PSETEX: doesn't expire immediately
Expected null
9. PERSIST: returns un-expired value
Expected null
10. SETEX: expires after 1s
Expected null
11. EXPIRE: expires after 1s
Expected null
12. PEXPIRE: expires after 1s
Expected null
13. EXPIREAT: expires after 1s
Expected null
14. EXPIREAT: expires after 1s
Expected null
15. PSETEX: expires after 1000ms
Expected null
16. PERSIST: persist expiry key stays persisted
Expected null
5. RedisClient: ADMIN: (0, 10, 10)
1. EXIST
2. !EXIST
3. DBSIZE
Expected 1
4. INFO
5. PING
6. ECHO
Expected hello
7. TYPE
Expected string
8. STRLEN
Expected 5
9. SAVE, LASTSAVE
10. FLUSHDB
Expected 0
6. RedisClient: KEYS: Increments INCR, INCRBY, DECR, DECRBY, INCRBYFLOAT (0, 5, 5)
1. INCRBYFLOAT
Expected 0.5
2. INCR increments a non-existant key to 1
Expected 1
3. INCRBY increments existing key
Expected 11
4. DECR decrements existing key
Expected 10
5. DECRBY decrements existing key
Expected 5
7. RedisClient: KEYS: String fns for APPEND SUBSTR GETRANGE SETRANGE GETBIT SETBIT (0, 8, 8)
1. STRLEN on non-existing key
Expected 0
2. STRLEN existing key
Expected 3
3. APPEND existing key
Expected 6
4. SUBSTR
Expected CDE
5. GETRANGE
Expected CDE
6. SETBIT oldbit on new key == 0
Expected 0
7. GETBIT preceeding bits are filled with '0'
Expected 0
8. GETBIT
Expected 1
8. RedisClient: SETS: (0, 19, 19)
1. SETRANGE
Expected AB00EF
2. SMEMBERS empty set returns 0 results
Expected 0
3. smadd returns set length
Expected 4
4. SRANDMEMBER returns item from existing set
5. SCARD length of existing set
Expected 4
6. SPOP pops from existing set
7. SCARD length of existing set
Expected 3
8. SADD adds to existing set
Expected [A, B, C, D]
9. SISMEMBER false for non-member
10. SISMEMBER true for member
11. SINTER
Expected [C, D]
12. SINTERSTORE returns length
Expected 2
13. SINTERSTORE at key
Expected [C, D]
14. SUNION
Expected [A, B, C, D, E, F]
15. SUNIONSTORE returns length
Expected 6
16. SINTERSTORE at key
Expected [A, B, C, D, E, F]
17. SDIFF
Expected [A, B]
18. SDIFFSTORE returns length
Expected 2
19. SDIFFSTORE at key
Expected [A, B]
9. RedisClient: LIST: (0, 13, 13)
1. LPUSH adds multiple items
Expected [D, C, B, A]
2. RPUSH adds multiple items
Expected [A, B, C, D]
3. LRANGE
Expected [B, C]
4. LTRIM
Expected [B, C]
5. RPUSH and LPUSH on same list
Expected [A, B, C, D]
6. LINDEX
Expected D
7. LSET
Expected [A, b, C, D]
8. LREM returns occurances removed
Expected 1
9. LREM returns item from list
Expected [C, B, A]
10. LPOP
Expected C
11. RPOP
Expected A
12. RPOPLPUSH
Expected [B]
13. LLEN
Expected 4
10. RedisClient: SORTED SET: (0, 20, 20)
1. zmadd map with int,double keys and String values
Expected 5
2. ZSCORE
Expected 3.5
3. ZRANGE
Expected [A, B, C, C#, D]
4. ZRANGE with scores
Expected {A: 1, B: 2, C: 3, C#: 3.5, D: 4}
5. ZRANK
Expected 3
6. ZREVRANK
Expected 1
7. ZREM
Expected 2
8. ZREVRANGE
Expected [D, C#, A]
9. ZREVRANGE with scores
Expected {A: 1, C#: 3.5, D: 4}
10. ZRANGEBYSCORE
Expected [C#, D]
11. ZRANGEBYSCORE with scores
Expected {C#: 3.5, D: 4}
12. ZREMRANGEBYRANK count of items removed
Expected 2
13. ZREMRANGEBYRANK remaining set
Expected [A, B, C]
14. ZREMRANGEBYSCORE count of items removed
Expected 2
15. ZREMRANGEBYRANK remaining set
Expected [C, C#, D]
16. ZINTERSTORE returns new set count
Expected 2
17. ZINTERSTORE new set
Expected [C#, D]
18. ZUNIONSTORE returns new set count
Expected 6
19. ZUNIONSTORE new set
Expected [A, B, C, C#, D, E]
20. ZCARD
Expected 5
11. RedisClient: HASH: (0, 14, 14)
1. HKEYS
Expected [A, B, C, D]
2. HVALS
Expected [1, 2, 3, 4]
3. HGETALL
Expected {A: 1, B: 2, C: 3, D: 4}
4. HSETNX doesn't set existing key
5. HSETNX updates new key
6. HSET sets new key
7. HINCRBY existing key
Expected 7
8. HINCRBYFLOAT existing key
Expected 9.5
9. HGET existing key
Expected 3
10. HGET non-existing key
Expected null
11. HEXISTS existing key
12. HEXISTS non-existing key
13. HDEL existing key
Expected 1
14. HMSET count
Expected 4
1. JsonEncoder: Encoder: serialize (0, 13, 13)
1. can encode nulls
Expected
2. can encode ints
Expected 1
3. can encode negative ints
Expected -1
4. can encode doubles
Expected 1.1
5. can encode negative doubles
Expected -1.1
6. can encode empty strings
Expected
7. can encode strings
Expected A
8. can encode bools
Expected true
9. can encode empty Map
Expected {}
10. can encode empty List
Expected []
11. can encode Map
Expected {"A":1}
12. can encode List
Expected ["A"]
13. can encode Date
Expected /Date(1336536000000)/
2. JsonEncoder: Encoder: deserialize (0, 14, 14)
1. can decode nulls
Expected null
2. can decode ints
Expected 1
3. can decode negative ints
Expected -1
4. can decode doubles
Expected 1.1
5. can decode negative doubles
Expected -1.1
6. can decode empty strings
Expected null
7. can decode strings
Expected A
8. can decode true
9. can decode false
10. can decode empty Map
Expected {}
11. can decode empty List
Expected []
12. can decode Map
Expected {A: 1}
13. can decode List
Expected [A]
14. can decode UTC Date
Expected 2012-05-09 00:00:00.000Z
Tests completed in 1788ms
159 tests of 159 passed, 0 failed.
RedisClient stats:
{rewinds: 22, reads: 1482, bytesRead: 6106, bufferWrites: 1786, flushes: 169, bytesWritten: 6574}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment