Annotation of embedaddon/php/ext/standard/tests/strings/similar_text_basic.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: similar_text(), basic tests
3: --CREDITS--
4: Mats Lindh <mats at lindh.no>
5: #Testfest php.no
6: --INI--
7: precision=14
8: --FILE--
9: <?php
10: /* Prototype : proto int similar_text(string str1, string str2 [, float percent])
11: * Description: Calculates the similarity between two strings
12: * Source code: ext/standard/string.c
13: */
14: var_dump(similar_text("abcdefgh", "efg"));
15: var_dump(similar_text("abcdefgh", "mno"));
16: var_dump(similar_text("abcdefghcc", "c"));
17: var_dump(similar_text("abcdefghabcdef", "zzzzabcdefggg"));
18:
19: $percent = 0;
20: similar_text("abcdefgh", "efg", $percent);
21: var_dump($percent);
22: similar_text("abcdefgh", "mno", $percent);
23: var_dump($percent);
24: similar_text("abcdefghcc", "c", $percent);
25: var_dump($percent);
26: similar_text("abcdefghabcdef", "zzzzabcdefggg", $percent);
27: var_dump($percent);
28: ?>
29: ===DONE===
30: --EXPECTF--
31: int(3)
32: int(0)
33: int(1)
34: int(7)
35: float(54.545454545455)
36: float(0)
37: float(18.181818181818)
38: float(51.851851851852)
39: ===DONE===
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>