"Fossies" - the Fresh Open Source Software Archive

Member "dateutils-0.4.6/test/basic_get_dom_wday.c" (19 Mar 2019, 764 Bytes) of package /linux/privat/dateutils-0.4.6.tar.xz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file.

    1 #if defined HAVE_CONFIG_H
    2 # include "config.h"
    3 #endif  /* HAVE_CONFIG_H */
    4 #include "strops.h"
    5 #include "strops.c"
    6 #include "token.h"
    7 #include "token.c"
    8 #include "date-core.h"
    9 #include "date-core.c"
   10 #include "dt-locale.h"
   11 #include "dt-locale.c"
   12 
   13 static unsigned int
   14 super(void)
   15 {
   16     unsigned int res = 0;
   17 
   18     for (int y = 1917; y < 2199; y++) {
   19         for (int m = 1; m <= 12; m ++) {
   20             for (int d = 1; d <= 28; d++) {
   21                 dt_dow_t w = __get_dom_wday(y, m, d);
   22                 res += y * m * (w == DT_SUNDAY ? 0 : w) + d;
   23             }
   24         }
   25     }
   26     return res;
   27 }
   28 
   29 int
   30 main(void)
   31 {
   32     unsigned int supersum = 0;
   33 
   34     for (size_t i = 0; i < 512; i++) {
   35         supersum += super();
   36     }
   37     printf("super %u\n", supersum);
   38     if (supersum != 1486417920U) {
   39         return 1;
   40     }
   41     return 0;
   42 }
   43 
   44 /* basic_get_wday.c ends here */