当前位置: 首页>>代码示例>>C++>>正文


C++ Obj::recordLevel方法代码示例

本文整理汇总了C++中Obj::recordLevel方法的典型用法代码示例。如果您正苦于以下问题:C++ Obj::recordLevel方法的具体用法?C++ Obj::recordLevel怎么用?C++ Obj::recordLevel使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Obj的用法示例。


在下文中一共展示了Obj::recordLevel方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: main

int main(int argc, char *argv[])
{
    int test = argc > 1 ? atoi(argv[1]) : 0;
    int verbose = argc > 2;
    int veryVerbose = argc > 3;
    int veryVeryVerbose = argc > 4;

    cout << "TEST " << __FILE__ << " CASE " << test << endl;;

    switch (test) { case 0:  // Zero is always the leading case.
      case 13: {
        // --------------------------------------------------------------------
        // TESTING USAGE EXAMPLE
        //   The usage example provided in the component header file must
        //   compile, link, and run on all platforms as shown.
        //
        // Plan:
        //   Incorporate usage example from header into driver, remove leading
        //   comment characters, and replace 'assert' with 'ASSERT'.  Suppress
        //   all 'cout' statements in non-verbose mode, and add streaming to
        //   a buffer to test programmatically the printing examples.
        //
        // Testing:
        //   USAGE EXAMPLE
        // --------------------------------------------------------------------

        if (verbose) cout << "\nTesting Usage Examples"
                          << "\n======================" << endl;

        ball::ThresholdAggregate levels(192, 160, 128, 96);
        ASSERT(192 == levels.recordLevel());
        ASSERT(160 == levels.passLevel());
        ASSERT(128 == levels.triggerLevel());
        ASSERT(96  == levels.triggerAllLevel());

        levels.setLevels(160, 128, 96, 64);
        ASSERT(160 == levels.recordLevel());
        ASSERT(128 == levels.passLevel());
        ASSERT(96  == levels.triggerLevel());
        ASSERT(64  == levels.triggerAllLevel());

      } break;
      case 12: {
        // --------------------------------------------------------------------
        // TESTING HASH FUNCTION (VALUE):
        //
        // Concerns:
        //   (1) All fields must be incorporated in the hash value.
        //   (2) The hash value must be the same across all platforms for a
        //       given input.
        //
        // Plan:
        //   Specifying a set of test vectors consisting of distinct valid
        //   test values having subtle difference and hash sizes including
        //   powers of two and primes.  For each value and hash size, verify
        //   that the 'hash' function returns expected value.
        //
        //   7 is the smallest hash table size and 1610612741 is largest size
        //   (that can fit into an int) used by stlport hashtable.
        //
        // Testing:
        //   static int hash(const ball::ThresholdAggregate&, int size);
        // --------------------------------------------------------------------

        if (verbose) cout << "\nTesting hash function"
                          << "\n====================="
                          << endl;

        static const struct {
            int d_line;            // line number
            int d_recordLevel;     // record level
            int d_passLevel;       // pass level
            int d_triggerLevel;    // trigger level
            int d_triggerAllLevel; // trigger all level
            int d_size;            // hash size
            int d_hash;            // hash value
        } HDATA[] = {
            ///line record pass  trigger trAll    hash         hash
            ///no.  level  level  level  level    size         value
            ///---- ------ -----  ------ -----    ----         -----
            {  L_,  0,     0,     0,     0,       256,         233         },
            {  L_,  1,     0,     0,     0,       256,         168         },
            {  L_,  0,     1,     0,     0,       256,         19          },
            {  L_,  0,     0,     1,     0,       256,         217         },
            {  L_,  0,     0,     0,     1,       256,         214         },
            {  L_,  16,    32,    48,    64,      256,         225         },
            {  L_,  64,    48,    32,    16,      256,         176         },
            {  L_,  16,    32,    64,    48,      256,         234         },
            {  L_,  16,    48,    32,    64,      256,         31          },
            {  L_,  32,    16,    48,    64,      256,         27          },
            {  L_,  255,   0,     0,     0,       256,         116         },
            {  L_,  0,     255,   0,     0,       256,         8           },
            {  L_,  0,     0,     255,   0,       256,         191         },
            {  L_,  0,     0,     0,     255,     256,         143         },
            {  L_,  255,   255,   255,   255,     256,         89          },
            {  L_,  0,     0,     0,     0,       65536,       48105       },
            {  L_,  1,     0,     0,     0,       65536,       53928       },
            {  L_,  0,     1,     0,     0,       65536,       19731       },
            {  L_,  0,     0,     1,     0,       65536,       40409       },
            {  L_,  0,     0,     0,     1,       65536,       36566       },
//.........这里部分代码省略.........
开发者ID:SuperV1234,项目名称:bde,代码行数:101,代码来源:ball_thresholdaggregate.t.cpp


注:本文中的Obj::recordLevel方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。