vulkan游戏引擎test的核心代码实现

1.expect.h

#include

#include

/**

 * @brief

 *

 * Expects expected to be euqal to be equal to actual

 *

 */

#define expect_should_be(expected,actual)   \

    if(actual != expected){ \

        KERROR("-->Expected %%lld,but got: %lld.File: %s:%d.",expected,actual,__FILE__,__LINE__);   \

        return false;   \

    }

    /**

     * @brief

     *

     * Expects expected to Not be euqal to actual

     *

     *

     */

#define expect_should_not_be(expected,actual)   \

    if(actual==expected)    \

    {   \

        KERROR("--> Expected %d != %d,but they are euqal.File: %s:%d.",expected,actual,__FILE__,__LINE__);  \

        return false;   \

    }


 

    /**

     * Expects expected to be actual given a tolerance of

     *

     *

     */

#define expect_float_to_be(expected,actual) \

    if (kabs(expected - actual) > 0.001f)   \

    {   \

        KERROR("-->Expected %f,but got: %f.File:%s:%d.",expected,actual,__FILE__,__LINE__); \

        return false;   \

    }


 

#define expect_to_be_true(actual)   \

    if(actual != true){ \

        KERROR("--> Expected true, but got false. File: %s:%d.",__FILE__,__LINE__); \

        return false;   \

    }


 

#define expect_to_be_false(actual)  \

    if (actual != false){   \

        KERROR("--> Expected false, but got true,File: %s%d.",__FILE__,__LINE__);   \

        return false;   \

    }


 

你可能感兴趣的:(游戏引擎,linux,算法)