reSIProcate/stack  9694
testEmptyHfv.cxx
Go to the documentation of this file.
00001 #include "resip/stack/SipMessage.hxx"
00002 #include "resip/stack/HeaderTypes.hxx"
00003 
00004 #include "rutil/Log.hxx"
00005 
00006 #include <iostream>
00007 
00008 using namespace std;
00009 using namespace resip;
00010 
00011 
00012 #define RESIPROCATE_SUBSYSTEM Subsystem::SIP
00013 
00014 
00015 int main()
00016 {
00017    Log::initialize(Log::Cout, Log::Debug ,"testEmptyHfv");   
00018    resip::Data msg("INVITE sip:foo@bar SIP/2.0\r\n"
00019                      "Via:\r\n"
00020                      "From:\r\n"
00021                      "To:\r\n"
00022                      "CSeq:\r\n"
00023                      "Call-ID:\r\n"
00024                      "Max-Forwards:\r\n"
00025                    "Content-Length:\r\n\r\n\r\n");
00026                      
00027    resip::SipMessage* sip=resip::SipMessage::make(msg);
00028    
00029    assert(sip);
00030    
00031    try
00032    {
00033       if(sip->exists(resip::h_From))
00034       {
00035          sip->header(resip::h_From);
00036          cerr << sip->header(resip::h_From).uri();         
00037          cerr << "test failed" << endl;
00038          
00039          assert(0);         
00040          return -1;         
00041       }
00042    }
00043    catch(resip::BaseException& e)
00044    {
00045       cerr << "Caught: " << e << "as expected, PASSED" << endl;
00046    }
00047 
00048 }