Login   Register  
PHP Classes
elePHPant
Icontem

File: test/test.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Richard Keizer  >  Swype for PHP  >  test/test.php  >  Download  
File: test/test.php
Role: Unit test script
Content type: text/plain
Description: Unit test script
Class: Swype for PHP
Auto-complete words entered with a Swype keyboard
Author: By
Last change:
Date: 2011-10-20 00:45
Size: 767 bytes
 

Contents

Class file image Download
<?php
  
  error_reporting
(E_ALL);
  
ini_set('display_errors'1);
  
  
  
assert_options(ASSERT_ACTIVE1);
  
assert_options(ASSERT_WARNING0);
  
assert_options(ASSERT_QUIET_EVAL1);
  
  function 
assertHandler($file$line$code) {
    echo 
"The following test failed: {$code}\n";
  }
  
  
assert_options(ASSERT_CALLBACK'assertHandler');
  
  
/*
   * Start the tests
   */
  
  
$failures 0;
  
  
$failures += !assert('file_exists("swypedecoder.class.php");');
  
$failures += !assert('file_exists("dictionary/en.words");');
  
  include_once 
'swypedecoder.class.php';
  
  
$swype = new SwypeDecoder('en');
  
$failures += !assert('in_array("welcome", $swype->unSwype("werftghjklkjhgvcvbhjkiokmmnhgfre"));');

  echo 
"There were {$failures} failed tests\n";