Clean up the code.
This commit is contained in:
parent
fa59d3ce32
commit
4690b47ae9
11 changed files with 186 additions and 184 deletions
23
tests/test.m
23
tests/test.m
|
@ -4,6 +4,9 @@
|
|||
|
||||
#import "XMPPConnection.h"
|
||||
#import "XMPPStanza.h"
|
||||
#import "XMPPIQ.h"
|
||||
#import "XMPPMessage.h"
|
||||
#import "XMPPPresence.h"
|
||||
|
||||
@interface AppDelegate: OFObject
|
||||
{
|
||||
|
@ -25,25 +28,25 @@ OF_APPLICATION_DELEGATE(AppDelegate)
|
|||
pres.to = @"alice@example.com";
|
||||
pres.from = @"bob@example.org";
|
||||
assert([[pres stringValue] isEqual: @"<presence to='alice@example.com' "
|
||||
@"from='bob@example.org'><show>chat</show>"
|
||||
@"<status>Bored</status><priority>20</priority>"
|
||||
@"</presence>"]);
|
||||
@"from='bob@example.org'><show>chat</show>"
|
||||
@"<status>Bored</status><priority>20</priority>"
|
||||
@"</presence>"]);
|
||||
|
||||
XMPPMessage *msg = [XMPPMessage messageWithType: @"chat"];
|
||||
[msg addBody: @"Hello everyone"];
|
||||
msg.to = @"jdev@conference.jabber.org";
|
||||
msg.from = @"alice@example.com";
|
||||
assert([[msg stringValue] isEqual: @"<message type='chat' "
|
||||
@"to='jdev@conference.jabber.org' "
|
||||
@"from='alice@example.com'><body>Hello everyone</body>"
|
||||
@"</message>"]);
|
||||
@"to='jdev@conference.jabber.org' "
|
||||
@"from='alice@example.com'><body>Hello everyone</body>"
|
||||
@"</message>"]);
|
||||
|
||||
XMPPIQ *iq = [XMPPIQ IQWithType: @"set" ID: @"128"];
|
||||
iq.to = @"juliet@capulet.lit";
|
||||
iq.from = @"romeo@montague.lit";
|
||||
assert([[iq stringValue] isEqual: @"<iq type='set' id='128' "
|
||||
@"to='juliet@capulet.lit' "
|
||||
@"from='romeo@montague.lit'/>"]);
|
||||
@"to='juliet@capulet.lit' "
|
||||
@"from='romeo@montague.lit'/>"]);
|
||||
|
||||
OFXMLElement *elem = [OFXMLElement elementWithName: @"iq"];
|
||||
[elem addAttributeWithName: @"from" stringValue: @"bob@localhost"];
|
||||
|
@ -53,8 +56,8 @@ OF_APPLICATION_DELEGATE(AppDelegate)
|
|||
XMPPStanza *stanza = [XMPPStanza stanzaWithElement: elem];
|
||||
assert([[elem stringValue] isEqual: [stanza stringValue]]);
|
||||
assert(([[OFString stringWithFormat: @"%@, %@, %@, %@", stanza.from,
|
||||
stanza.to, stanza.type, stanza.ID]
|
||||
isEqual: @"bob@localhost, alice@localhost, get, 42"]));
|
||||
stanza.to, stanza.type, stanza.ID]
|
||||
isEqual: @"bob@localhost, alice@localhost, get, 42"]));
|
||||
|
||||
conn = [[XMPPConnection alloc] init];
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue