Skip to content

Commit

Permalink
Add test for encoding amf3 booleans
Browse files Browse the repository at this point in the history
  • Loading branch information
njoyce committed Aug 1, 2010
1 parent 26ef90a commit 568f854
Show file tree
Hide file tree
Showing 6 changed files with 676 additions and 600 deletions.
2 changes: 1 addition & 1 deletion cpyamf/amf0.c

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1,260 changes: 663 additions & 597 deletions cpyamf/amf3.c

Large diffs are not rendered by default.

6 changes: 6 additions & 0 deletions cpyamf/amf3.pyx
Expand Up @@ -687,6 +687,12 @@ cdef class Encoder(codec.Encoder):
cdef inline int writeUndefined(self, n) except -1:
return self.writeType(TYPE_UNDEFINED)

cdef inline int writeBoolean(self, n) except -1:
if n is True:
return self.writeType(TYPE_BOOL_TRUE)

return self.writeType(TYPE_BOOL_FALSE)

cpdef int serialiseString(self, s) except -1:
"""
Similar to L{writeString} but does not encode a type byte.
Expand Down
2 changes: 1 addition & 1 deletion cpyamf/codec.c

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion cpyamf/util.c

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions pyamf/tests/test_amf3.py
Expand Up @@ -278,6 +278,10 @@ def test_dict(self):
'\n\x0b\x01', ('\x03c\x06\x03g', '\x03b\x06\x03f', '\x03a\x06\x03e',
'\x03d\x06\x03h'), '\x01')

def test_boolean(self):
self.assertEncoded(True, '\x03')
self.assertEncoded(False, '\x02')

def test_mixed_array(self):
x = pyamf.MixedArray()
x.update({0:u'hello', 'spam': u'eggs'})
Expand Down

0 comments on commit 568f854

Please sign in to comment.