PuzzleSDK
ValueTest类 参考

#include <UnitTest.h>

+ 类 ValueTest 继承关系图:
+ ValueTest 的协作图:

Public 成员函数

 CREATE_FUNC (ValueTest)
 
virtual void onEnter () override
 
virtual std::string subtitle () const override
 
void constFunc (const cocos2d::Value &value) const
 
- Public 成员函数 继承自 UnitTestDemo
virtual std::string title () const override
 
- Public 成员函数 继承自 TestCase
 TestCase ()
 
 ~TestCase ()
 
virtual Type getTestType () const
 
virtual float getDuration () const
 
virtual std::string getExpectedOutput () const
 
virtual std::string getActualOutput () const
 
virtual void restartTestCallback (cocos2d::Ref *sender)
 
virtual void nextTestCallback (cocos2d::Ref *sender)
 
virtual void priorTestCallback (cocos2d::Ref *sender)
 
virtual void onBackCallback (cocos2d::Ref *sender)
 
void setTestSuite (TestSuite *testSuite)
 
TestSuitegetTestSuite () const
 
float getRunTime () const
 
void setTestCaseName (const std::string &name)
 
std::string getTestCaseName () const
 
const cocos2d::Label * getSubtitleLable () const
 
const cocos2d::MenuItemImage * getRestartTestItem () const
 

额外继承的成员函数

- Public 类型 继承自 TestCase
enum class  Type { ROBUSTNESS , UNIT , GRAPHICAL_STATIC , MANUAL }
 
- Public 属性 继承自 TestCase
CC_CONSTRUCTOR_ACCESS __pad0__: virtual bool init() override
 
- Protected 属性 继承自 TestCase
cocos2d::MenuItemImage * _priorTestItem
 
cocos2d::MenuItemImage * _restartTestItem
 
cocos2d::MenuItemImage * _nextTestItem
 
cocos2d::Label * _titleLabel
 
cocos2d::Label * _subtitleLabel
 

详细描述

在文件 UnitTest.h58 行定义.

成员函数说明

◆ constFunc()

void ValueTest::constFunc ( const cocos2d::Value &  value) const

在文件 UnitTest.cpp655 行定义.

656{
657}

◆ CREATE_FUNC()

ValueTest::CREATE_FUNC ( ValueTest  )

◆ onEnter()

void ValueTest::onEnter ( )
overridevirtual

重载 TestCase .

在文件 UnitTest.cpp575 行定义.

576{
578
579 Value v1;
580 CCASSERT(v1.getType() == Value::Type::NONE, "v1's value type should be VALUE::Type::NONE.");
581 CCASSERT(v1.isNull(), "v1 is null.");
582
583 Value v2(100);
584 CCASSERT(v2.getType() == Value::Type::INTEGER, "v2's value type should be VALUE::Type::INTEGER.");
585 CCASSERT(!v2.isNull(), "v2 is not null.");
586
587 Value v3(101.4f);
588 CCASSERT(v3.getType() == Value::Type::FLOAT, "v3's value type should be VALUE::Type::FLOAT.");
589 CCASSERT(!v3.isNull(), "v3 is not null.");
590
591 Value v4(106.1);
592 CCASSERT(v4.getType() == Value::Type::DOUBLE, "v4's value type should be VALUE::Type::DOUBLE.");
593 CCASSERT(!v4.isNull(), "v4 is not null.");
594
595 unsigned char byte = 50;
596 Value v5(byte);
597 CCASSERT(v5.getType() == Value::Type::BYTE, "v5's value type should be Value::Type::BTYE.");
598 CCASSERT(!v5.isNull(), "v5 is not null.");
599
600 Value v6(true);
601 CCASSERT(v6.getType() == Value::Type::BOOLEAN, "v6's value type is Value::Type::BOOLEAN.");
602 CCASSERT(!v6.isNull(), "v6 is not null.");
603
604 Value v7("string");
605 CCASSERT(v7.getType() == Value::Type::STRING, "v7's value type is Value::type::STRING.");
606 CCASSERT(!v7.isNull(), "v7 is not null.");
607
608 Value v8(std::string("string2"));
609 CCASSERT(v8.getType() == Value::Type::STRING, "v8's value type is Value::Type::STRING.");
610 CCASSERT(!v8.isNull(), "v8 is not null.");
611
612 auto createValueVector = [&](){
613 ValueVector ret;
614 ret.push_back(v1);
615 ret.push_back(v2);
616 ret.push_back(v3);
617 return ret;
618 };
619
620
621 Value v9(createValueVector());
622 CCASSERT(v9.getType() == Value::Type::VECTOR, "v9's value type is Value::Type::VECTOR.");
623 CCASSERT(!v9.isNull(), "v9 is not null.");
624
625 auto createValueMap = [&](){
626 ValueMap ret;
627 ret["aaa"] = v1;
628 ret["bbb"] = v2;
629 ret["ccc"] = v3;
630 return ret;
631 };
632
633 Value v10(createValueMap());
634 CCASSERT(v10.getType() == Value::Type::MAP, "v10's value type is Value::Type::MAP.");
635 CCASSERT(!v10.isNull(), "v10 is not null.");
636
637 auto createValueMapIntKey = [&](){
638 ValueMapIntKey ret;
639 ret[111] = v1;
640 ret[222] = v2;
641 ret[333] = v3;
642 return ret;
643 };
644
645 Value v11(createValueMapIntKey());
646 CCASSERT(v11.getType() == Value::Type::INT_KEY_MAP, "v11's value type is Value::Type::INT_KEY_MAP.");
647 CCASSERT(!v11.isNull(), "v11 is not null.");
648}
virtual void onEnter() override
Definition: BaseTest.cpp:430

引用了 TestCase::onEnter().

+ 函数调用图:

◆ subtitle()

std::string ValueTest::subtitle ( ) const
overridevirtual

重载 TestCase .

在文件 UnitTest.cpp650 行定义.

651{
652 return "Value Test, should not crash";
653}

该类的文档由以下文件生成: