;================================================================
; test/unit_test 单元测试
; unit_test_func_mahjong_tile.erb 单张麻将牌相关
;================================================================


;;;单元测试 @mj_id_to_value
;;;@return 1通过 0未通过
@unit_test_func_mj_id_to_value()
    #DIM DYNAMIC i
    FOR i, 0, VARSIZE("MJ_ENUM_TILE")
        SIF mj_id_to_value(MJ_ENUM_TILE:i) == 0
            RETURN 0
    NEXT
    RETURN 1


;;;单元测试 @mj_code_to_value
;;;@return 1通过 0未通过
@unit_test_func_mj_code_to_value()
    #DIM DYNAMIC i
    FOR i, 0, VARSIZE("MJ_ENUM_TILE_CODE")
        SIF mj_code_to_value(MJ_ENUM_TILE_CODE:i) != MJ_ENUM_TILE_VALUE:i
            RETURN 0
    NEXT
    RETURN 1


;;;单元测试 @mj_to_code
;;;@return 1通过 0未通过
@unit_test_func_mj_to_code()
    #DIM DYNAMIC i
    FOR i, 0, VARSIZE("MJ_ENUM_TILE")
        SIF mj_to_code(MJ_ENUM_TILE:i) == ""
            RETURN 0
    NEXT
    FOR i, 0, VARSIZE("MJ_ENUM_TILE_VALUE")
        SIF mj_to_code(MJ_ENUM_TILE_VALUE:i) != MJ_ENUM_TILE_CODE:i
            RETURN 0
    NEXT
    RETURN 1


;;;单元测试 @mj_humanize
;;;@return 1通过 0未通过
@unit_test_func_mj_humanize()
    #DIM DYNAMIC i
    FOR i, 0, VARSIZE("MJ_ENUM_TILE")
        SIF mj_humanize(mj_to_code(MJ_ENUM_TILE:i)) == ""
            RETURN 0
    NEXT
    RETURN 1
