Changeset 18001

Show
Ignore:
Timestamp:
08/22/08 00:34:54 (5 years ago)
Author:
saturday06
Message:

_s系のテストを映した

Location:
lang/cplusplus/i3
Files:
3 modified

Legend:

Unmodified
Added
Removed
  • lang/cplusplus/i3/src/Test1.cpp

    r17736 r18001  
    3131             const char* in_encoding, 
    3232             const char* out_encoding); 
    33     } 
    34 } 
    35  
    36 #define len basic_strnlen 
    37 #define cat_s basic_strcat_s 
    38 #define cpy_s basic_strcpy_s 
    39  
    40 BOOST_AUTO_TEST_CASE(len_sdofjikm) { 
    41     BOOST_CHECK(len("0", 1) == 1); 
    42     BOOST_CHECK(len("Xo", 1) == 1); 
    43     BOOST_CHECK(len("foo", 3) == 3); 
    44     BOOST_CHECK(len("0123456789", 8) == 8); 
    45  
    46     BOOST_CHECK(len("", 1) == 0); 
    47     BOOST_CHECK(len("X", 2) == 1); 
    48     BOOST_CHECK(len("foo", 4) == 3); 
    49     BOOST_CHECK(len("0123456789", 10)); 
    50  
    51     int a0[] = {0}; 
    52     int a1[] = {1,0}; 
    53     int a2[] = {1,2,0}; 
    54     int a5[] = {1,2,3,4,5,0}; 
    55  
    56     BOOST_CHECK(len(a1, 1) == 1); 
    57     BOOST_CHECK(len(a2, 1) == 1); 
    58     BOOST_CHECK(len(a5, 2) == 2); 
    59  
    60     BOOST_CHECK(len(a0, 1) == 0); 
    61     BOOST_CHECK(len(a1, 2) == 1); 
    62     BOOST_CHECK(len(a2, 3) == 2); 
    63     BOOST_CHECK(len(a5, 6) == 5); 
    64 } 
    65  
    66  
    67 #define DEFINE_BUFFERS      \ 
    68     char buf1[1] = {8};     \ 
    69     int  ibuf1[1] = {9};    \ 
    70     char buf2[2] = {0,4};   \ 
    71     int  ibuf2[2] = {5,0};  \ 
    72     char buf10[10] = {7,8,9,10,11,0,13,14,15,16};      \ 
    73     int  ibuf10[10] = {17,18,19,20,0,22,23,24,25,26}; \ 
    74     char nebuf1[1] = {1};     \ 
    75     int  neibuf10[10] = {17,18,19,20,21,22,23,24,25,26}; \ 
    76     char ebuf1[1] = {0};     \ 
    77     int  eibuf1[1] = {0};    \ 
    78     char ebuf2[2] = {3,0};   \ 
    79     int  eibuf2[2] = {0,3};  \ 
    80     char ebuf10[10] = {0,8,9,0,11,12,13,0,15,16};      \ 
    81     int  eibuf10[10] = {9,0,19,20,21,0,23,24,25,26}; 
    82  
    83 BOOST_AUTO_TEST_CASE(cat_dofij) { 
    84     const char src1[1] = ""; 
    85     const int isrc1[1] = {0}; 
    86     const char src2[2] = "f"; 
    87     const int isrc2[2] = {60, 0}; 
    88     const char src10[10] = "abcdefghi"; 
    89     const int isrc10[10] = {60, 61, 62, 63, 64, 65, 66, 67, 68, 0}; 
    90     typedef std::basic_string<int> istring; 
    91     using std::string; 
    92     { 
    93         DEFINE_BUFFERS; 
    94         BOOST_CHECK(cat_s<char>(0, 5/*any*/, 0/*any*/)           == EINVAL); 
    95         BOOST_CHECK(cat_s<int>(0, 5/*any*/, 0/*any*/)            == EINVAL); 
    96         BOOST_CHECK(cat_s<char>(nebuf1, 5/*any*/, 0/*any*/)      == EINVAL); 
    97         BOOST_CHECK(cat_s<int>(neibuf10, 5/*any*/, 0/*any*/)     == EINVAL); 
    98         BOOST_CHECK(cat_s<char>(0, 0/*any*/, src1 /*any*/)       == EINVAL); 
    99         BOOST_CHECK(cat_s<int>(neibuf10, 1/*any*/, isrc1/*any*/) == EINVAL); 
    100  
    101         BOOST_CHECK(cat_s<char>(ebuf1/*any*/,  5/*any*/,  0)  == EINVAL); 
    102         BOOST_CHECK(cat_s<int>(eibuf2/*any*/,  5/*any*/,  0)  == EINVAL); 
    103         BOOST_CHECK(cat_s<char>(ebuf10/*any*/, 0/*any*/,  0)  == EINVAL); 
    104         BOOST_CHECK(cat_s<int>(eibuf1/*any*/,  0/*any*/,  0)  == EINVAL); 
    105     }  
    106  
    107     { 
    108         DEFINE_BUFFERS; 
    109         BOOST_CHECK(cat_s<char>(ebuf1, 0, src1)   == ERANGE); 
    110         BOOST_CHECK(cat_s<int>(eibuf1, 0, isrc1)  == ERANGE); 
    111         BOOST_CHECK(cat_s<char>(ebuf1, 1, src10)  == ERANGE); 
    112         BOOST_CHECK(cat_s<int>(eibuf1, 1, isrc10) == ERANGE); 
    113         BOOST_CHECK(cat_s<char>(buf2, 2, src10)   == ERANGE); 
    114         BOOST_CHECK(cat_s<int>(eibuf2, 2, isrc10) == ERANGE); 
    115     } 
    116     { 
    117         char dst[] = {0,1,2,3,4,5}; const char src[] = {10,10,0}; 
    118         string result = string(dst)+src;BOOST_CHECK(cat_s<char>(dst, _countof(dst), src) == 0);BOOST_CHECK(string(dst) == result); } 
    119     { 
    120         char dst[] = {1,1,0,3,4,5}; const char src[] = {10,10,0}; 
    121         string result = string(dst)+src;BOOST_CHECK(cat_s<char>(dst, _countof(dst), src) == 0);BOOST_CHECK(string(dst) == result); } 
    122     { 
    123         char dst[] = {0,1,2,0,4,5}; const char src[] = {10,0}; 
    124         string result = string(dst)+src;BOOST_CHECK(cat_s<char>(dst, _countof(dst), src) == 0);BOOST_CHECK(string(dst) == result); } 
    125     { 
    126         char dst[] = {1,1,2,3,4,0}; const char src[] = {0}; 
    127         string result = string(dst)+src;BOOST_CHECK(cat_s<char>(dst, _countof(dst), src) == 0);BOOST_CHECK(string(dst) == result); } 
    128     { 
    129         char dst[] = {0,1,2,3,0,5}; const char src[] = {10, 0}; 
    130         string result = string(dst)+src;BOOST_CHECK(cat_s<char>(dst, _countof(dst), src) == 0);BOOST_CHECK(string(dst) == result); } 
    131     { 
    132         char dst[] = {0}; const char src[] = {0}; 
    133         string result = string(dst)+src;BOOST_CHECK(cat_s<char>(dst, _countof(dst), src) == 0);BOOST_CHECK(string(dst) == result); } 
    134     { 
    135         char dst[] = {1,0,0}; const char src[] = {10,0}; 
    136         string result = string(dst)+src;BOOST_CHECK(cat_s<char>(dst, _countof(dst), src) == 0);BOOST_CHECK(string(dst) == result); } 
    137     { 
    138         char dst[] = {0,0,0,0,0}; const char src[] = {10,10,15,15,0}; 
    139         string result = string(dst)+src;BOOST_CHECK(cat_s<char>(dst, _countof(dst), src) == 0);BOOST_CHECK(string(dst) == result); } 
    140     { 
    141         char dst[] = {0,1,2,3,4,5}; const char src[] = {10,10,0}; 
    142         string result = string(dst)+src;BOOST_CHECK(cat_s<char>(dst, _countof(dst), src) == 0);BOOST_CHECK(string(dst) == result); } 
    143  
    144  
    145  
    146  
    147  
    148     { 
    149         double dst[] = {0,1,2,3,4,5}; const double src[] = {10,10,0}; 
    150         std::basic_string<double> result = std::basic_string<double>(dst)+src;BOOST_CHECK(cat_s<double>(dst, _countof(dst), src) == 0);BOOST_CHECK(std::basic_string<double>(dst) == result); } 
    151     { 
    152         double dst[] = {1,1,0,3,4,5}; const double src[] = {10,10,0}; 
    153         std::basic_string<double> result = std::basic_string<double>(dst)+src;BOOST_CHECK(cat_s<double>(dst, _countof(dst), src) == 0);BOOST_CHECK(std::basic_string<double>(dst) == result); } 
    154     { 
    155         double dst[] = {0,1,2,0,4,5}; const double src[] = {10,0}; 
    156         std::basic_string<double> result = std::basic_string<double>(dst)+src;BOOST_CHECK(cat_s<double>(dst, _countof(dst), src) == 0);BOOST_CHECK(std::basic_string<double>(dst) == result); } 
    157     { 
    158         double dst[] = {1,1,2,3,4,0}; const double src[] = {0}; 
    159         std::basic_string<double> result = std::basic_string<double>(dst)+src;BOOST_CHECK(cat_s<double>(dst, _countof(dst), src) == 0);BOOST_CHECK(std::basic_string<double>(dst) == result); } 
    160     { 
    161         double dst[] = {0,1,2,3,0,5}; const double src[] = {10, 0}; 
    162         std::basic_string<double> result = std::basic_string<double>(dst)+src;BOOST_CHECK(cat_s<double>(dst, _countof(dst), src) == 0);BOOST_CHECK(std::basic_string<double>(dst) == result); } 
    163     { 
    164         double dst[] = {0}; const double src[] = {0}; 
    165         std::basic_string<double> result = std::basic_string<double>(dst)+src;BOOST_CHECK(cat_s<double>(dst, _countof(dst), src) == 0);BOOST_CHECK(std::basic_string<double>(dst) == result); } 
    166     { 
    167         double dst[] = {1,0,0}; const double src[] = {10,0}; 
    168         std::basic_string<double> result = std::basic_string<double>(dst)+src;BOOST_CHECK(cat_s<double>(dst, _countof(dst), src) == 0);BOOST_CHECK(std::basic_string<double>(dst) == result); } 
    169     { 
    170         double dst[] = {0,0,0,0,0}; const double src[] = {10,10,15,15,0}; 
    171         std::basic_string<double> result = std::basic_string<double>(dst)+src;BOOST_CHECK(cat_s<double>(dst, _countof(dst), src) == 0);BOOST_CHECK(std::basic_string<double>(dst) == result); } 
    172     { 
    173         double dst[] = {0,1,2,3,4,5}; const double src[] = {10,10,0}; 
    174         std::basic_string<double> result = std::basic_string<double>(dst)+src;BOOST_CHECK(cat_s<double>(dst, _countof(dst), src) == 0);BOOST_CHECK(std::basic_string<double>(dst) == result); } 
    175  
    176 } 
    177  
    178 BOOST_AUTO_TEST_CASE(cpy_saaaa) { 
    179     const char src1[1] = ""; 
    180     const int isrc1[1] = {0}; 
    181     const char src2[2] = "f"; 
    182     const int isrc2[2] = {60, 0}; 
    183     const char src10[10] = "abcdefghi"; 
    184     const int isrc10[10] = {60, 61, 62, 63, 64, 65, 66, 67, 68, 0}; 
    185     typedef std::basic_string<int> istring; 
    186     using std::string; 
    187  
    188     { 
    189         DEFINE_BUFFERS; 
    190         BOOST_CHECK(cpy_s<char>(0, 5/*any*/, 0/*any*/)      == EINVAL); 
    191         BOOST_CHECK(cpy_s<int>(0, 5/*any*/, 0/*any*/)       == EINVAL); 
    192         BOOST_CHECK(cpy_s<char>(0, 0/*any*/, src1 /*any*/)  == EINVAL); 
    193         BOOST_CHECK(cpy_s<int>(0, 0/*any*/, isrc1/*any*/)   == EINVAL); 
    194         BOOST_CHECK(cpy_s<char>(buf1/*any*/, 5/*any*/,  0)  == EINVAL); 
    195         BOOST_CHECK(cpy_s<int>(ibuf2/*any*/, 5/*any*/,  0)  == EINVAL); 
    196         BOOST_CHECK(cpy_s<char>(buf10/*any*/, 0/*any*/, 0)  == EINVAL); 
    197         BOOST_CHECK(cpy_s<int>(ibuf10/*any*/, 0/*any*/, 0)  == EINVAL); 
    198     } 
    199     { 
    200         DEFINE_BUFFERS; 
    201  
    202         BOOST_CHECK(cpy_s<char>(buf1, 0, src1)   == ERANGE); 
    203         BOOST_CHECK(cpy_s<int>(ibuf1, 0, isrc1)  == ERANGE); 
    204         BOOST_CHECK(cpy_s<char>(buf1, 1, src10)  == ERANGE); 
    205         BOOST_CHECK(cpy_s<int>(ibuf1, 1, isrc10) == ERANGE); 
    206         BOOST_CHECK(cpy_s<char>(buf2, 2, src10)  == ERANGE); 
    207         BOOST_CHECK(cpy_s<int>(ibuf2, 2, isrc10) == ERANGE); 
    208     } 
    209     { 
    210         DEFINE_BUFFERS; 
    211  
    212         BOOST_CHECK(cpy_s<char>(buf2, 2, src2) == 0); 
    213         BOOST_CHECK(string(buf2) == string(src2)); 
    214         BOOST_CHECK(cpy_s<int>(ibuf2, 2, isrc2) == 0); 
    215         BOOST_CHECK(istring(ibuf2) == istring(isrc2)); 
    216  
    217         BOOST_CHECK(cpy_s<char>(buf2, 2, src1) == 0); 
    218         BOOST_CHECK(string(buf2) == string(src1)); 
    219         BOOST_CHECK(cpy_s<int>(ibuf2, 2, isrc1) == 0); 
    220         BOOST_CHECK(istring(ibuf2) == istring(isrc1)); 
    221  
    222         BOOST_CHECK(cpy_s<char>(buf1, 1, src1) == 0); 
    223         BOOST_CHECK(string(buf1) == string(src1)); 
    224         BOOST_CHECK(cpy_s<int>(ibuf1, 1, isrc1) == 0); 
    225         BOOST_CHECK(istring(ibuf1) == istring(isrc1)); 
    226  
    227         BOOST_CHECK(cpy_s<char>(buf10, 10, src10) == 0); 
    228         BOOST_CHECK(string(buf10) == string(src10)); 
    229         BOOST_CHECK(cpy_s<int>(ibuf10, 10, isrc10) == 0); 
    230         BOOST_CHECK(istring(ibuf10) == istring(isrc10)); 
    231  
    232         BOOST_CHECK(cpy_s<char>(buf10, 10, src2) == 0); 
    233         BOOST_CHECK(string(buf10) == string(src2)); 
    234         BOOST_CHECK(cpy_s<int>(ibuf10, 10, isrc2) == 0); 
    235         BOOST_CHECK(istring(ibuf10) == istring(isrc2)); 
    23633    } 
    23734} 
  • lang/cplusplus/i3/src/mol/src/Test2.cpp

    r14356 r18001  
    11#include <mol/PrecompiledHeaders.h> 
     2#include <mol/MscCrt.h> 
    23#include <boost/test/unit_test.hpp> 
    34 
     
    78//} 
    89 
     10 
     11#define len basic_strnlen 
     12#define cat_s basic_strcat_s 
     13#define cpy_s basic_strcpy_s 
     14 
     15BOOST_AUTO_TEST_CASE(len_sdofjikm) { 
     16    BOOST_CHECK(len("0", 1) == 1); 
     17    BOOST_CHECK(len("Xo", 1) == 1); 
     18    BOOST_CHECK(len("foo", 3) == 3); 
     19    BOOST_CHECK(len("0123456789", 8) == 8); 
     20 
     21    BOOST_CHECK(len("", 1) == 0); 
     22    BOOST_CHECK(len("X", 2) == 1); 
     23    BOOST_CHECK(len("foo", 4) == 3); 
     24    BOOST_CHECK(len("0123456789", 10)); 
     25 
     26    int a0[] = {0}; 
     27    int a1[] = {1,0}; 
     28    int a2[] = {1,2,0}; 
     29    int a5[] = {1,2,3,4,5,0}; 
     30 
     31    BOOST_CHECK(len(a1, 1) == 1); 
     32    BOOST_CHECK(len(a2, 1) == 1); 
     33    BOOST_CHECK(len(a5, 2) == 2); 
     34 
     35    BOOST_CHECK(len(a0, 1) == 0); 
     36    BOOST_CHECK(len(a1, 2) == 1); 
     37    BOOST_CHECK(len(a2, 3) == 2); 
     38    BOOST_CHECK(len(a5, 6) == 5); 
     39} 
     40 
     41 
     42#define DEFINE_BUFFERS      \ 
     43    char buf1[1] = {8};     \ 
     44    int  ibuf1[1] = {9};    \ 
     45    char buf2[2] = {0,4};   \ 
     46    int  ibuf2[2] = {5,0};  \ 
     47    char buf10[10] = {7,8,9,10,11,0,13,14,15,16};      \ 
     48    int  ibuf10[10] = {17,18,19,20,0,22,23,24,25,26}; \ 
     49    char nebuf1[1] = {1};     \ 
     50    int  neibuf10[10] = {17,18,19,20,21,22,23,24,25,26}; \ 
     51    char ebuf1[1] = {0};     \ 
     52    int  eibuf1[1] = {0};    \ 
     53    char ebuf2[2] = {3,0};   \ 
     54    int  eibuf2[2] = {0,3};  \ 
     55    char ebuf10[10] = {0,8,9,0,11,12,13,0,15,16};      \ 
     56    int  eibuf10[10] = {9,0,19,20,21,0,23,24,25,26}; 
     57 
     58BOOST_AUTO_TEST_CASE(cat_dofij) { 
     59    const char src1[1] = ""; 
     60    const int isrc1[1] = {0}; 
     61    const char src2[2] = "f"; 
     62    const int isrc2[2] = {60, 0}; 
     63    const char src10[10] = "abcdefghi"; 
     64    const int isrc10[10] = {60, 61, 62, 63, 64, 65, 66, 67, 68, 0}; 
     65    typedef std::basic_string<int> istring; 
     66    using std::string; 
     67    { 
     68        DEFINE_BUFFERS; 
     69        BOOST_CHECK(cat_s<char>(0, 5/*any*/, 0/*any*/)           == EINVAL); 
     70        BOOST_CHECK(cat_s<int>(0, 5/*any*/, 0/*any*/)            == EINVAL); 
     71        BOOST_CHECK(cat_s<char>(nebuf1, 5/*any*/, 0/*any*/)      == EINVAL); 
     72        BOOST_CHECK(cat_s<int>(neibuf10, 5/*any*/, 0/*any*/)     == EINVAL); 
     73        BOOST_CHECK(cat_s<char>(0, 0/*any*/, src1 /*any*/)       == EINVAL); 
     74        BOOST_CHECK(cat_s<int>(neibuf10, 1/*any*/, isrc1/*any*/) == EINVAL); 
     75 
     76        BOOST_CHECK(cat_s<char>(ebuf1/*any*/,  5/*any*/,  0)  == EINVAL); 
     77        BOOST_CHECK(cat_s<int>(eibuf2/*any*/,  5/*any*/,  0)  == EINVAL); 
     78        BOOST_CHECK(cat_s<char>(ebuf10/*any*/, 0/*any*/,  0)  == EINVAL); 
     79        BOOST_CHECK(cat_s<int>(eibuf1/*any*/,  0/*any*/,  0)  == EINVAL); 
     80    }  
     81 
     82    { 
     83        DEFINE_BUFFERS; 
     84        BOOST_CHECK(cat_s<char>(ebuf1, 0, src1)   == ERANGE); 
     85        BOOST_CHECK(cat_s<int>(eibuf1, 0, isrc1)  == ERANGE); 
     86        BOOST_CHECK(cat_s<char>(ebuf1, 1, src10)  == ERANGE); 
     87        BOOST_CHECK(cat_s<int>(eibuf1, 1, isrc10) == ERANGE); 
     88        BOOST_CHECK(cat_s<char>(buf2, 2, src10)   == ERANGE); 
     89        BOOST_CHECK(cat_s<int>(eibuf2, 2, isrc10) == ERANGE); 
     90    } 
     91    { 
     92        char dst[] = {0,1,2,3,4,5}; const char src[] = {10,10,0}; 
     93        string result = string(dst)+src;BOOST_CHECK(cat_s<char>(dst, _countof(dst), src) == 0);BOOST_CHECK(string(dst) == result); } 
     94    { 
     95        char dst[] = {1,1,0,3,4,5}; const char src[] = {10,10,0}; 
     96        string result = string(dst)+src;BOOST_CHECK(cat_s<char>(dst, _countof(dst), src) == 0);BOOST_CHECK(string(dst) == result); } 
     97    { 
     98        char dst[] = {0,1,2,0,4,5}; const char src[] = {10,0}; 
     99        string result = string(dst)+src;BOOST_CHECK(cat_s<char>(dst, _countof(dst), src) == 0);BOOST_CHECK(string(dst) == result); } 
     100    { 
     101        char dst[] = {1,1,2,3,4,0}; const char src[] = {0}; 
     102        string result = string(dst)+src;BOOST_CHECK(cat_s<char>(dst, _countof(dst), src) == 0);BOOST_CHECK(string(dst) == result); } 
     103    { 
     104        char dst[] = {0,1,2,3,0,5}; const char src[] = {10, 0}; 
     105        string result = string(dst)+src;BOOST_CHECK(cat_s<char>(dst, _countof(dst), src) == 0);BOOST_CHECK(string(dst) == result); } 
     106    { 
     107        char dst[] = {0}; const char src[] = {0}; 
     108        string result = string(dst)+src;BOOST_CHECK(cat_s<char>(dst, _countof(dst), src) == 0);BOOST_CHECK(string(dst) == result); } 
     109    { 
     110        char dst[] = {1,0,0}; const char src[] = {10,0}; 
     111        string result = string(dst)+src;BOOST_CHECK(cat_s<char>(dst, _countof(dst), src) == 0);BOOST_CHECK(string(dst) == result); } 
     112    { 
     113        char dst[] = {0,0,0,0,0}; const char src[] = {10,10,15,15,0}; 
     114        string result = string(dst)+src;BOOST_CHECK(cat_s<char>(dst, _countof(dst), src) == 0);BOOST_CHECK(string(dst) == result); } 
     115    { 
     116        char dst[] = {0,1,2,3,4,5}; const char src[] = {10,10,0}; 
     117        string result = string(dst)+src;BOOST_CHECK(cat_s<char>(dst, _countof(dst), src) == 0);BOOST_CHECK(string(dst) == result); } 
     118 
     119 
     120 
     121 
     122 
     123    { 
     124        double dst[] = {0,1,2,3,4,5}; const double src[] = {10,10,0}; 
     125        std::basic_string<double> result = std::basic_string<double>(dst)+src;BOOST_CHECK(cat_s<double>(dst, _countof(dst), src) == 0);BOOST_CHECK(std::basic_string<double>(dst) == result); } 
     126    { 
     127        double dst[] = {1,1,0,3,4,5}; const double src[] = {10,10,0}; 
     128        std::basic_string<double> result = std::basic_string<double>(dst)+src;BOOST_CHECK(cat_s<double>(dst, _countof(dst), src) == 0);BOOST_CHECK(std::basic_string<double>(dst) == result); } 
     129    { 
     130        double dst[] = {0,1,2,0,4,5}; const double src[] = {10,0}; 
     131        std::basic_string<double> result = std::basic_string<double>(dst)+src;BOOST_CHECK(cat_s<double>(dst, _countof(dst), src) == 0);BOOST_CHECK(std::basic_string<double>(dst) == result); } 
     132    { 
     133        double dst[] = {1,1,2,3,4,0}; const double src[] = {0}; 
     134        std::basic_string<double> result = std::basic_string<double>(dst)+src;BOOST_CHECK(cat_s<double>(dst, _countof(dst), src) == 0);BOOST_CHECK(std::basic_string<double>(dst) == result); } 
     135    { 
     136        double dst[] = {0,1,2,3,0,5}; const double src[] = {10, 0}; 
     137        std::basic_string<double> result = std::basic_string<double>(dst)+src;BOOST_CHECK(cat_s<double>(dst, _countof(dst), src) == 0);BOOST_CHECK(std::basic_string<double>(dst) == result); } 
     138    { 
     139        double dst[] = {0}; const double src[] = {0}; 
     140        std::basic_string<double> result = std::basic_string<double>(dst)+src;BOOST_CHECK(cat_s<double>(dst, _countof(dst), src) == 0);BOOST_CHECK(std::basic_string<double>(dst) == result); } 
     141    { 
     142        double dst[] = {1,0,0}; const double src[] = {10,0}; 
     143        std::basic_string<double> result = std::basic_string<double>(dst)+src;BOOST_CHECK(cat_s<double>(dst, _countof(dst), src) == 0);BOOST_CHECK(std::basic_string<double>(dst) == result); } 
     144    { 
     145        double dst[] = {0,0,0,0,0}; const double src[] = {10,10,15,15,0}; 
     146        std::basic_string<double> result = std::basic_string<double>(dst)+src;BOOST_CHECK(cat_s<double>(dst, _countof(dst), src) == 0);BOOST_CHECK(std::basic_string<double>(dst) == result); } 
     147    { 
     148        double dst[] = {0,1,2,3,4,5}; const double src[] = {10,10,0}; 
     149        std::basic_string<double> result = std::basic_string<double>(dst)+src;BOOST_CHECK(cat_s<double>(dst, _countof(dst), src) == 0);BOOST_CHECK(std::basic_string<double>(dst) == result); } 
     150 
     151} 
     152 
     153BOOST_AUTO_TEST_CASE(cpy_saaaa) { 
     154    const char src1[1] = ""; 
     155    const int isrc1[1] = {0}; 
     156    const char src2[2] = "f"; 
     157    const int isrc2[2] = {60, 0}; 
     158    const char src10[10] = "abcdefghi"; 
     159    const int isrc10[10] = {60, 61, 62, 63, 64, 65, 66, 67, 68, 0}; 
     160    typedef std::basic_string<int> istring; 
     161    using std::string; 
     162 
     163    { 
     164        DEFINE_BUFFERS; 
     165        BOOST_CHECK(cpy_s<char>(0, 5/*any*/, 0/*any*/)      == EINVAL); 
     166        BOOST_CHECK(cpy_s<int>(0, 5/*any*/, 0/*any*/)       == EINVAL); 
     167        BOOST_CHECK(cpy_s<char>(0, 0/*any*/, src1 /*any*/)  == EINVAL); 
     168        BOOST_CHECK(cpy_s<int>(0, 0/*any*/, isrc1/*any*/)   == EINVAL); 
     169        BOOST_CHECK(cpy_s<char>(buf1/*any*/, 5/*any*/,  0)  == EINVAL); 
     170        BOOST_CHECK(cpy_s<int>(ibuf2/*any*/, 5/*any*/,  0)  == EINVAL); 
     171        BOOST_CHECK(cpy_s<char>(buf10/*any*/, 0/*any*/, 0)  == EINVAL); 
     172        BOOST_CHECK(cpy_s<int>(ibuf10/*any*/, 0/*any*/, 0)  == EINVAL); 
     173    } 
     174    { 
     175        DEFINE_BUFFERS; 
     176 
     177        BOOST_CHECK(cpy_s<char>(buf1, 0, src1)   == ERANGE); 
     178        BOOST_CHECK(cpy_s<int>(ibuf1, 0, isrc1)  == ERANGE); 
     179        BOOST_CHECK(cpy_s<char>(buf1, 1, src10)  == ERANGE); 
     180        BOOST_CHECK(cpy_s<int>(ibuf1, 1, isrc10) == ERANGE); 
     181        BOOST_CHECK(cpy_s<char>(buf2, 2, src10)  == ERANGE); 
     182        BOOST_CHECK(cpy_s<int>(ibuf2, 2, isrc10) == ERANGE); 
     183    } 
     184    { 
     185        DEFINE_BUFFERS; 
     186 
     187        BOOST_CHECK(cpy_s<char>(buf2, 2, src2) == 0); 
     188        BOOST_CHECK(string(buf2) == string(src2)); 
     189        BOOST_CHECK(cpy_s<int>(ibuf2, 2, isrc2) == 0); 
     190        BOOST_CHECK(istring(ibuf2) == istring(isrc2)); 
     191 
     192        BOOST_CHECK(cpy_s<char>(buf2, 2, src1) == 0); 
     193        BOOST_CHECK(string(buf2) == string(src1)); 
     194        BOOST_CHECK(cpy_s<int>(ibuf2, 2, isrc1) == 0); 
     195        BOOST_CHECK(istring(ibuf2) == istring(isrc1)); 
     196 
     197        BOOST_CHECK(cpy_s<char>(buf1, 1, src1) == 0); 
     198        BOOST_CHECK(string(buf1) == string(src1)); 
     199        BOOST_CHECK(cpy_s<int>(ibuf1, 1, isrc1) == 0); 
     200        BOOST_CHECK(istring(ibuf1) == istring(isrc1)); 
     201 
     202        BOOST_CHECK(cpy_s<char>(buf10, 10, src10) == 0); 
     203        BOOST_CHECK(string(buf10) == string(src10)); 
     204        BOOST_CHECK(cpy_s<int>(ibuf10, 10, isrc10) == 0); 
     205        BOOST_CHECK(istring(ibuf10) == istring(isrc10)); 
     206 
     207        BOOST_CHECK(cpy_s<char>(buf10, 10, src2) == 0); 
     208        BOOST_CHECK(string(buf10) == string(src2)); 
     209        BOOST_CHECK(cpy_s<int>(ibuf10, 10, isrc2) == 0); 
     210        BOOST_CHECK(istring(ibuf10) == istring(isrc2)); 
     211    } 
     212} 
  • lang/cplusplus/i3/windows/i3.vcproj

    r17083 r18001  
    7272                        <Tool 
    7373                                Name="VCLinkerTool" 
    74                                 AdditionalDependencies="psapi.lib shlwapi.lib atlsd.lib mingw.lib" 
     74                                AdditionalDependencies="psapi.lib shlwapi.lib atlsd.lib libintl.lib" 
    7575                                OutputFile="$(OutDir)\$(ProjectName).$(ConfigurationName).exe" 
    7676                                LinkIncremental="2" 
     
    160160                        <Tool 
    161161                                Name="VCLinkerTool" 
    162                                 AdditionalDependencies="psapi.lib shlwapi.lib atlsd.lib mingw.lib" 
     162                                AdditionalDependencies="psapi.lib shlwapi.lib atlsd.lib libintl.lib" 
    163163                                LinkIncremental="1" 
    164164                                AdditionalLibraryDirectories="" 
     
    249249                        <Tool 
    250250                                Name="VCLinkerTool" 
    251                                 AdditionalDependencies="psapi.lib shlwapi.lib atlsd.lib mingw.lib" 
     251                                AdditionalDependencies="psapi.lib shlwapi.lib atlsd.lib libintl.lib" 
    252252                                OutputFile="$(OutDir)\$(ProjectName).$(ConfigurationName).exe" 
    253253                                LinkIncremental="2" 
     
    374374                        </File> 
    375375                        <File 
     376                                RelativePath="..\src\gui-windows\CompletionWindowCore.h" 
     377                                > 
     378                        </File> 
     379                        <File 
    376380                                RelativePath="..\src\windows\CompletionWindowCore.h" 
    377381                                > 
    378382                        </File> 
    379383                        <File 
    380                                 RelativePath="..\src\gui-windows\CompletionWindowCore.h" 
    381                                 > 
    382                         </File> 
    383                         <File 
    384384                                RelativePath="..\src\os-windows\CygwinPty.h" 
    385385                                > 
     
    406406                        </File> 
    407407                        <File 
     408                                RelativePath="..\src\gui-windows\InputWindowCore.h" 
     409                                > 
     410                        </File> 
     411                        <File 
    408412                                RelativePath="..\src\windows\InputWindowCore.h" 
    409                                 > 
    410                         </File> 
    411                         <File 
    412                                 RelativePath="..\src\gui-windows\InputWindowCore.h" 
    413413                                > 
    414414                        </File>