VirtualBox

儲存庫 vbox 的更動 50392


忽略:
時間撮記:
2014-2-10 下午02:55:53 (11 年 以前)
作者:
vboxsync
訊息:

More test cases for %RTnaipv6 and IPv6 %RTnaddr.

檔案:
修改 1 筆資料

圖例:

未更動
新增
刪除
  • trunk/src/VBox/Runtime/testcase/tstRTStrFormat.cpp

    r50377 r50392  
    337337
    338338    RTNETADDRIPV6 Ipv6Addr;
     339
     340    /* any */
     341    memset(&Ipv6Addr, 0, sizeof(Ipv6Addr));
     342    CHECK42("%RTnaipv6", &Ipv6Addr, "::");
     343
     344    /* loopback */
     345    Ipv6Addr.au8[15] = 1;
     346    CHECK42("%RTnaipv6", &Ipv6Addr, "::1");
     347
     348    /* IPv4-compatible */
     349    Ipv6Addr.au8[12] = 1;
     350    Ipv6Addr.au8[13] = 1;
     351    Ipv6Addr.au8[14] = 1;
     352    Ipv6Addr.au8[15] = 1;
     353    CHECK42("%RTnaipv6", &Ipv6Addr, "::1.1.1.1");
     354
     355    /* IPv4-mapped */
     356    Ipv6Addr.au16[5] = RT_H2N_U16_C(0xffff);
     357    CHECK42("%RTnaipv6", &Ipv6Addr, "::ffff:1.1.1.1");
     358
     359    /* IPv4-translated */
     360    Ipv6Addr.au16[4] = RT_H2N_U16_C(0xffff);
     361    Ipv6Addr.au16[5] = RT_H2N_U16_C(0x0000);
     362    CHECK42("%RTnaipv6", &Ipv6Addr, "::ffff:0:1.1.1.1");
     363
     364    /* single zero word is not abbreviated, leading zeroes are not printed */
     365    Ipv6Addr.au16[0] = RT_H2N_U16_C(0x0000);
     366    Ipv6Addr.au16[1] = RT_H2N_U16_C(0x0001);
     367    Ipv6Addr.au16[2] = RT_H2N_U16_C(0x0000);
     368    Ipv6Addr.au16[3] = RT_H2N_U16_C(0x0001);
     369    Ipv6Addr.au16[4] = RT_H2N_U16_C(0x0000);
     370    Ipv6Addr.au16[5] = RT_H2N_U16_C(0x0001);
     371    Ipv6Addr.au16[6] = RT_H2N_U16_C(0x0000);
     372    Ipv6Addr.au16[7] = RT_H2N_U16_C(0x0001);
     373    CHECK42("%RTnaipv6", &Ipv6Addr, "0:1:0:1:0:1:0:1");
     374
     375    /* longest run is abbreviated (here: at the beginning) */
     376    Ipv6Addr.au16[0] = RT_H2N_U16_C(0x0000);
     377    Ipv6Addr.au16[1] = RT_H2N_U16_C(0x0000);
     378    Ipv6Addr.au16[2] = RT_H2N_U16_C(0x0000);
     379    Ipv6Addr.au16[3] = RT_H2N_U16_C(0x0001);
     380    Ipv6Addr.au16[4] = RT_H2N_U16_C(0x0000);
     381    Ipv6Addr.au16[5] = RT_H2N_U16_C(0x0000);
     382    Ipv6Addr.au16[6] = RT_H2N_U16_C(0x0001);
     383    Ipv6Addr.au16[7] = RT_H2N_U16_C(0x0000);
     384    CHECK42("%RTnaipv6", &Ipv6Addr, "::1:0:0:1:0");
     385
     386    /* longest run is abbreviated (here: first) */
     387    Ipv6Addr.au16[0] = RT_H2N_U16_C(0x0001);
     388    Ipv6Addr.au16[1] = RT_H2N_U16_C(0x0000);
     389    Ipv6Addr.au16[2] = RT_H2N_U16_C(0x0000);
     390    Ipv6Addr.au16[3] = RT_H2N_U16_C(0x0000);
     391    Ipv6Addr.au16[4] = RT_H2N_U16_C(0x0001);
     392    Ipv6Addr.au16[5] = RT_H2N_U16_C(0x0000);
     393    Ipv6Addr.au16[6] = RT_H2N_U16_C(0x0000);
     394    Ipv6Addr.au16[7] = RT_H2N_U16_C(0x0001);
     395    CHECK42("%RTnaipv6", &Ipv6Addr, "1::1:0:0:1");
     396
     397    /* longest run is abbreviated (here: second) */
     398    Ipv6Addr.au16[0] = RT_H2N_U16_C(0x0001);
     399    Ipv6Addr.au16[1] = RT_H2N_U16_C(0x0000);
     400    Ipv6Addr.au16[2] = RT_H2N_U16_C(0x0000);
     401    Ipv6Addr.au16[3] = RT_H2N_U16_C(0x0001);
     402    Ipv6Addr.au16[4] = RT_H2N_U16_C(0x0000);
     403    Ipv6Addr.au16[5] = RT_H2N_U16_C(0x0000);
     404    Ipv6Addr.au16[6] = RT_H2N_U16_C(0x0000);
     405    Ipv6Addr.au16[7] = RT_H2N_U16_C(0x0001);
     406    CHECK42("%RTnaipv6", &Ipv6Addr, "1:0:0:1::1");
     407
     408    /* longest run is abbreviated (here: at the end) */
     409    Ipv6Addr.au16[0] = RT_H2N_U16_C(0x0001);
     410    Ipv6Addr.au16[1] = RT_H2N_U16_C(0x0000);
     411    Ipv6Addr.au16[2] = RT_H2N_U16_C(0x0000);
     412    Ipv6Addr.au16[3] = RT_H2N_U16_C(0x0001);
     413    Ipv6Addr.au16[4] = RT_H2N_U16_C(0x0000);
     414    Ipv6Addr.au16[5] = RT_H2N_U16_C(0x0000);
     415    Ipv6Addr.au16[6] = RT_H2N_U16_C(0x0000);
     416    Ipv6Addr.au16[7] = RT_H2N_U16_C(0x0000);
     417    CHECK42("%RTnaipv6", &Ipv6Addr, "1:0:0:1::");
     418
     419    /* first of the two runs of equal length is abbreviated */
     420    Ipv6Addr.au16[0] = RT_H2N_U16_C(0x2001);
     421    Ipv6Addr.au16[1] = RT_H2N_U16_C(0x0db8);
     422    Ipv6Addr.au16[2] = RT_H2N_U16_C(0x0000);
     423    Ipv6Addr.au16[3] = RT_H2N_U16_C(0x0000);
     424    Ipv6Addr.au16[4] = RT_H2N_U16_C(0x0001);
     425    Ipv6Addr.au16[5] = RT_H2N_U16_C(0x0000);
     426    Ipv6Addr.au16[6] = RT_H2N_U16_C(0x0000);
     427    Ipv6Addr.au16[7] = RT_H2N_U16_C(0x0001);
     428    CHECK42("%RTnaipv6", &Ipv6Addr, "2001:db8::1:0:0:1");
     429
    339430    Ipv6Addr.au16[0] = RT_H2N_U16_C(0x2001);
    340431    Ipv6Addr.au16[1] = RT_H2N_U16_C(0x0db8);
     
    346437    Ipv6Addr.au16[7] = RT_H2N_U16_C(0x7334);
    347438    CHECK42("%RTnaipv6", &Ipv6Addr, "2001:db8:85a3::8a2e:370:7334");
     439
    348440    Ipv6Addr.au64[0] = UINT64_MAX;
    349441    Ipv6Addr.au64[1] = UINT64_MAX;
    350442    CHECK42("%RTnaipv6", &Ipv6Addr, "ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff");
     443
     444    RTNETADDR NetAddr;
     445    memset(&NetAddr, 0, sizeof(NetAddr));
     446
     447    /* plain IPv6 address if port is not specified */
     448    NetAddr.enmType = RTNETADDRTYPE_IPV6;
     449    NetAddr.uAddr.au16[0] = RT_H2N_U16_C(0x0001);
     450    NetAddr.uAddr.au16[7] = RT_H2N_U16_C(0x0001);
     451    NetAddr.uPort = RTNETADDR_PORT_NA;
     452    CHECK42("%RTnaddr", &NetAddr, "1::1");
     453
     454    /* square brackets around IPv6 address if port is specified */
     455    NetAddr.uPort = 1;
     456    CHECK42("%RTnaddr", &NetAddr, "[1::1]:1");
    351457
    352458    CHECK42("%RTproc", (RTPROCESS)0xffffff, "00ffffff");
注意: 瀏覽 TracChangeset 來幫助您使用更動檢視器

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette