예제 #1
0
파일: LCSTest.php 프로젝트: aleen42/LCS_PHP
 public function testString()
 {
     $lcs = new LCS();
     /**
      * Test Case 1
      */
     $str1 = "-9pks63ebel";
     $str2 = "-9pk63ebel2";
     $lcs->Calculate($str1, $str2);
     $this->assertEquals('9pk63ebel', $lcs->__get('commonString'));
     /**
      * Test Case 1
      */
     $str1 = "-ACCGGTCGAGTGCGCGGAAGCCGGCCGAA";
     $str2 = "-GTCGTTCGGAATGCCGTTGCTCTGTAAA";
     $lcs->Calculate($str1, $str2);
     $this->assertEquals('GTCGTCGGAAGCCGGCCGAA', $lcs->__get('commonString'));
 }
예제 #2
0
파일: test.php 프로젝트: aleen42/LCS_PHP
<?php

/**
 * Created by PhpStorm.
 * User: aleen42
 * Date: 9/25/15
 * Time: 12:22 PM
 */
require_once 'LCS.php';
$str1 = "-9pks63ebel";
$str2 = "-9pk63ebel2";
$lcs = new LCS();
$lcs->Calculate($str1, $str2);
echo "Longest Common String: ";
echo $lcs->__get('commonString');
echo '<br />';
echo 'Match Rate: ' . ($lcs->__get('length') - 1) / (strlen($str1) - 1) * 100 . '%';