~ubuntu-branches/ubuntu/vivid/gloox/vivid-proposed

« back to all changes in this revision

Viewing changes to src/tests/jinglecontent/jinglecontent_test.cpp

  • Committer: Package Import Robot
  • Author(s): Vincent Cheng
  • Date: 2014-03-16 17:34:43 UTC
  • mfrom: (12.1.2 experimental)
  • mto: This revision was merged to the branch mainline in revision 15.
  • Revision ID: package-import@ubuntu.com-20140316173443-4s177dovzaz5dm8o
Upload to unstable.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#define JINGLECONTENT_TEST
 
2
#include "../../gloox.h"
 
3
#include "../../jid.h"
 
4
#include "../../tag.h"
 
5
#include "../../jinglecontent.h"
 
6
using namespace gloox;
 
7
 
 
8
#include <stdio.h>
 
9
#include <locale.h>
 
10
#include <string>
 
11
#include <cstdio> // [s]print[f]
 
12
 
 
13
 
 
14
int main( int /*argc*/, char** /*argv*/ )
 
15
{
 
16
  int fail = 0;
 
17
  std::string name;
 
18
  JID jid( "foo@bar/barfoo" );
 
19
 
 
20
  // -------
 
21
  {
 
22
    name = "invalid Jingle 1";
 
23
    Jingle::Content jc;
 
24
    Tag* t = jc.tag();
 
25
    if( t )
 
26
    {
 
27
      ++fail;
 
28
      fprintf( stderr, "test '%s' failed\n", name.c_str() );
 
29
    }
 
30
    delete t;
 
31
  }
 
32
 
 
33
 
 
34
 
 
35
 
 
36
 
 
37
  // -------
 
38
//   name = "Jingle::Session::Jingle/SEFactory test";
 
39
//   StanzaExtensionFactory sef;
 
40
//   sef.registerExtension( new Jingle::Session::Jingle() );
 
41
//   Tag* f = new Tag( "iq" );
 
42
//   new Tag( f, "jingle", "xmlns", XMLNS_JINGLE );
 
43
//   IQ iq( IQ::Get, JID() );
 
44
//   sef.addExtensions( iq, f );
 
45
//   const Jingle::Session::Jingle* se = iq.findExtension<Jingle::Session::Jingle>( ExtJingle );
 
46
//   if( se == 0 )
 
47
//   {
 
48
//     ++fail;
 
49
//     fprintf( stderr, "test '%s' failed\n", name.c_str() );
 
50
//   }
 
51
//   delete f;
 
52
 
 
53
 
 
54
 
 
55
  if( fail == 0 )
 
56
  {
 
57
    printf( "Jingle::Content: OK\n" );
 
58
    return 0;
 
59
  }
 
60
  else
 
61
  {
 
62
    fprintf( stderr, "Jingle::Content: %d test(s) failed\n", fail );
 
63
    return 1;
 
64
  }
 
65
 
 
66
}