Coder Social home page Coder Social logo

tmc-tests's Introduction

tmc-tests's People

Contributors

keinos avatar

Watchers

 avatar  avatar

tmc-tests's Issues

検証データの複数受付。REG-002, REG-003 がプロトコルに準拠していない

確認スクリプトのプロトコルの「入力」要件によると、複数の検証データの同時受付は禁止されていますが、REG-002 および REG-003 は複数受付も処理しています。

確認コマンドによってデータの渡し方が異なることになるので、他の確認コマンドの実装前に統一した方がいいと思われます。

REG-002

TMC-TESTS/REG-002

Lines 37 to 46 in 11c8b02

if ($is_stdin) {
while ($name_file = fgets(STDIN)) {
$result = (is_uniformed_filename($name_file) && $result);
}
} else {
$name_files = explode(PHP_EOL, $name_files);
foreach ($name_files as $name_file) {
$result = (is_uniformed_filename($name_file) && $result);
}
}

REG-003

TMC-TESTS/REG-003

Lines 27 to 33 in 11c8b02

if ($is_stdin) {
while ($input_line = fgets(STDIN)) {
$input_lines[] = $input_line;
}
} else {
$input_lines = explode(PHP_EOL, $argument);
}

REG-002: 無効な(存在しない)日付でもパスする

2月30日などの存在しない無効な日付でもパスします。

$ ./REG-002 TMC-20190230.json
$ echo $?
0

有効な放送日は検知できなくても、少なくとも実在する日付であるかのチェックは必要かと思われます。

提案

function validateDate($date, $format = 'Ymd')
{
    $d = DateTime::createFromFormat($format, $date);
    return $d && $d->format($format) == $date;
}

ヘルプが実装されていません。REG-001〜003

引数なしの確認コマンド呼び出しの場合は、ヘルプを表示しないといけないのですが、REG-001, REG-002, REG-003 には実装されていません。

エラーのみで、必要な引数(入力)情報がわかりません。

$ ./REG-001 || echo $?
Argument missing.
1
$ ./REG-002 || echo $?
Argument missing.
2
$ ./REG-003 || echo $?
Argument missing.
3

REG-000: 標準入力受付しない

サンプル(テンプレート)の REG-000 が標準入力で検証データを受け付けません。

$ ./REG-000 'Hello World!'
$ echo $?
0
$ echo 'Hello World!' | ./REG-000 -
NG (Bad argument. Must be \'Hello World!\'. Given: \'-\')
$ echo $?
1

テストも検証していません。(引数渡しのみテストしています)

public function testReg000()
{
$path_dir_reg = '..';
$name_file_reg = 'REG-000';
$path_file_reg = $path_dir_reg . '/' . $name_file_reg;
$message = 'Hello World!';
$lastline = exec("${path_file_reg} '${message}' 2>&1", $output, $return_var);
$this->assertTrue($return_var === 0, $lastline);
$message = 'Hello World! ';
$lastline = exec("${path_file_reg} '${message}' 2>&1", $output, $return_var);
$this->assertTrue($return_var === 1, $lastline);
$message = 'Hell World!';
$lastline = exec("${path_file_reg} '${message}' 2>&1", $output, $return_var);
$this->assertTrue($return_var === 1, $lastline);
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.