znt/module/ai/test/model/isassoc.php

27 lines
933 B
PHP
Executable file
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/usr/bin/env php
<?php
/**
title=测试 aiModel::isAssoc();
timeout=0
cid=15054
- 步骤1索引数组 @0
- 步骤2关联数组 @1
- 步骤3空数组 @0
- 步骤4混合键数组 @1
- 步骤5非连续数字键 @1
*/
include dirname(__FILE__, 5) . '/test/lib/init.php';
include dirname(__FILE__, 2) . '/lib/model.class.php';
$aiTest = new aiModelTest();
r($aiTest->isAssocTest(array(0, 1, 2))) && p() && e('0'); // 步骤1索引数组
r($aiTest->isAssocTest(array('name' => 'test', 'id' => 1))) && p() && e('1'); // 步骤2关联数组
r($aiTest->isAssocTest(array())) && p() && e('0'); // 步骤3空数组
r($aiTest->isAssocTest(array(0 => 'a', 'key' => 'b'))) && p() && e('1'); // 步骤4混合键数组
r($aiTest->isAssocTest(array(1 => 'first', 3 => 'third'))) && p() && e('1'); // 步骤5非连续数字键