about summary refs log tree commit diff stats
path: root/README.md
Commit message (Collapse)AuthorAgeFilesLines
* Update README.mdJames Booth2015-11-301-1/+1
|
* Update README.mdJames Booth2015-11-301-1/+1
|
* Update README.mdJames Booth2015-11-301-1/+3
|
* Update README.mdJames Booth2014-02-231-1/+1
|
* Update README.mdJames Booth2013-08-281-1/+1
|
* Update README.mdJames Booth2013-08-281-0/+2
|
* Update README.mdJames Booth2012-12-311-2/+2
|
* Update README.mdJames Booth2012-11-051-1/+1
|
* Update README.mdJames Booth2012-08-191-100/+1
|
* Update README.mdJames Booth2012-08-171-0/+1
|
* Update README.mdJames Booth2012-08-171-0/+6
|
* Update READMEJames Booth2012-07-201-4/+10
|
* Update README.mdJames Booth2012-07-191-1/+1
|
* Update masterJames Booth2012-07-101-0/+2
|
* Updated readmeJames Booth2012-07-081-0/+4
|
* Updated READMEJames Booth2012-07-041-2/+10
|
* Update masterJames Booth2012-07-051-0/+2
|
* Update masterJames Booth2012-06-191-17/+13
|
* Using markup for READMEJames Booth2012-06-191-0/+87
cc4c6c453074f85960'>^
9bd2315d ^
f7843def ^

9bd2315d ^
f7843def ^

9bd2315d ^
f7843def ^
51bd4ed3 ^
9bd2315d ^

f7843def ^
9bd2315d ^
f7843def ^
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51










                                                                 

                                                                  

 
                                                             

                                       
                              
 
                                                            
                                                     
 

                                                     

 
                                                                                      

                                       

                               
 

                                                             
                                                     
 
                                                      

 
                                       

                                       
                               
 
                                                             

                                                     
 
                         
 
#include <stdarg.h>
#include <string.h>
#include <stddef.h>
#include <setjmp.h>
#include <cmocka.h>
#include <stdlib.h>

#include "chat_session.h"

void returns_false_when_chat_session_does_not_exist(void **state)
{
    ChatSession *session = chat_session_get("somejid@server.org");
    assert_null(session);
}

void creates_chat_session_on_recipient_activity(void **state)
{
    char *barejid = "myjid@server.org";
    char *resource = "tablet";

    chat_session_recipient_active(barejid, resource, FALSE);
    ChatSession *session = chat_session_get(barejid);

    assert_non_null(session);
    assert_string_equal(session->resource, resource);
}

void replaces_chat_session_on_recipient_activity_with_different_resource(void **state)
{
    char *barejid = "myjid@server.org";
    char *resource1 = "tablet";
    char *resource2 = "mobile";

    chat_session_recipient_active(barejid, resource1, FALSE);
    chat_session_recipient_active(barejid, resource2, FALSE);
    ChatSession *session = chat_session_get(barejid);

    assert_string_equal(session->resource, resource2);
}

void removes_chat_session(void **state)
{
    char *barejid = "myjid@server.org";
    char *resource1 = "laptop";

    chat_session_recipient_active(barejid, resource1, FALSE);
    chat_session_remove(barejid);
    ChatSession *session = chat_session_get(barejid);

    assert_null(session);
}