ReactOS Fundraising Campaign 2012
 
€ 4,410 / € 30,000

Information | Donate

Home | Info | Community | Development | myReactOS | Contact Us

  1. Home
  2. Community
  3. Development
  4. myReactOS
  5. Fundraiser 2012

  1. Main Page
  2. Alphabetical List
  3. Data Structures
  4. Directories
  5. File List
  6. Data Fields
  7. Globals
  8. Related Pages

ReactOS Development > Doxygen

test_udp.c
Go to the documentation of this file.
00001 #include "test_udp.h"
00002 
00003 #include "lwip/udp.h"
00004 #include "lwip/stats.h"
00005 
00006 #if !LWIP_STATS || !UDP_STATS || !MEMP_STATS
00007 #error "This tests needs UDP- and MEMP-statistics enabled"
00008 #endif
00009 
00010 /* Helper functions */
00011 static void
00012 udp_remove_all(void)
00013 {
00014   struct udp_pcb *pcb = udp_pcbs;
00015   struct udp_pcb *pcb2;
00016 
00017   while(pcb != NULL) {
00018     pcb2 = pcb;
00019     pcb = pcb->next;
00020     udp_remove(pcb2);
00021   }
00022   fail_unless(lwip_stats.memp[MEMP_UDP_PCB].used == 0);
00023 }
00024 
00025 /* Setups/teardown functions */
00026 
00027 static void
00028 udp_setup(void)
00029 {
00030   udp_remove_all();
00031 }
00032 
00033 static void
00034 udp_teardown(void)
00035 {
00036   udp_remove_all();
00037 }
00038 
00039 
00040 /* Test functions */
00041 
00042 START_TEST(test_udp_new_remove)
00043 {
00044   struct udp_pcb* pcb;
00045   LWIP_UNUSED_ARG(_i);
00046 
00047   fail_unless(lwip_stats.memp[MEMP_UDP_PCB].used == 0);
00048 
00049   pcb = udp_new();
00050   fail_unless(pcb != NULL);
00051   if (pcb != NULL) {
00052     fail_unless(lwip_stats.memp[MEMP_UDP_PCB].used == 1);
00053     udp_remove(pcb);
00054     fail_unless(lwip_stats.memp[MEMP_UDP_PCB].used == 0);
00055   }
00056 }
00057 END_TEST
00058 
00059 
00061 Suite *
00062 udp_suite(void)
00063 {
00064   TFun tests[] = {
00065     test_udp_new_remove,
00066   };
00067   return create_suite("UDP", tests, sizeof(tests)/sizeof(TFun), udp_setup, udp_teardown);
00068 }

Generated on Sun May 27 2012 04:36:11 for ReactOS by doxygen 1.7.6.1

ReactOS is a registered trademark or a trademark of ReactOS Foundation in the United States and other countries.