Coder Social home page Coder Social logo

macchiato's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

macchiato's Issues

Arbitrary typed value supplier should view sample

Implement arbitrary.prototype.sample method

本家 QuickCheck の様に sample :: Show a => Gen a -> IO () を実装する。
console.log に吐き出してもかまわないのだけど、戻りの値も欲しいので、返り値は生成したすべての値を配列で返す実装にする

arbitrary.sample( optional_count )

usage

// default, return 10 sample values ( in array )
var sample_integers = arbitrary('integer').sample();
// #=> [ 0, -1, 3, -4, 0, 10, -2, -1, 5, 9 ]

// if call it with number argument, it return values specified quantity
var sample_5_booleans = arbitrary('bool').sample( 5 );
// #=> [ true, false, true, true, true ]

JsDoc draft

/**
 * @param {number=} opt_count
 * @return {Array}
 */
arbitrary.prototype.sample = function( opt_count ){
  // ...
};

wtf. use Array.isArray ( or implement )

Problem

Now, macchiato utility function map each use isList in internal.
isList function is kind of this mistake. ↓ :-(

if (o instanceof Array)
{
  // Oh frabjous day!
}

Sadly, this code doesn't work as expected.
from Determining with absolute accuracy whether or not a JavaScript object is an array by mozila

To fix, should use Array.isArray

if(!Array.isArray) {    
  Array.isArray = function (vArg) {    
    return Object.prototype.toString.call(vArg) === "[object Array]";    
  };    
} 

from isArray - MDN

Build script by Makefile or ShellScript

Write Makefile or ShellScript.

What Builder should do?

  1. Generate dist/macchiato.min.js for web front end
  2. Generate dist/macchiato.js for Node.js
  3. Auto test runner (ext :: make test-node, make test-web)

Dependency Injection pattern for test logger

Problem

Now, Macchiato test view object depends on TestView object. TestView object depends on static html page ( and its dom ).

Solution

Add these object

  1. TestViewControl
  2. WebTestView
  3. ConsoleTestView

TestViewControl switch TestView entity either WebTestView (testing on web html) or ConsoleTestView (testing on node.js).

test property more easy to write (shorthand property)

Original is Very Simple

in QuickCheck, test property is very easy, and simple to write

prop_commutative :: Int -> Int -> Bool
prop_commutative x y =
  x + y == y + x

Verbosely...

now, macchiato.js test property declaration is more verbosely than QuickCheck.

macchiato.stock({
  'commuative with 2 numbers':
    arbitrary('number', 'number').property(function (x, y) {
      return x + y === y + x;
    })
});

More Easy

I design new short hand test property declaration now.

// test target function
macchiato.stock({
  '[(number, number) -> (x, y)] => commutative' : function (x, y) {
    return x + y === y + x;
  }
});

in case test a method return boolean,

macchiato.stock({
  '[[integer] -> arr] => is array list' : Array.isArray
});

Label Syntax

label = /^\[(value)\]\s*=>\s*(.*)$/
value = /(type)\s*\->\s*(param)(\s*,\s*(cond)+)?/
types = params = /\w+(\s*,\s*\w+)*/ # types :: "number, string", params :: "x, y",
cond = /(state|operate)/ # condition well boolean expression
state = /(\w+)\.(\w+\(\s*\w*\s*\))/ # state :: "Array.isArray(x)", ""
operate = /(\w+)\s*(op)\s*(\w+)/ # operate :: "x > y", "x && y"
op = /((<)|(>)|(==)|(!=)|(===)|(!==)|(&&)|(\|\|)/ # operator signature

Design bases, dependency, architecture

Write article to wiki, about macchiato architecture, design bases, and dependency tree.
基本的な設計をwikiにまとめること。オブジェクト間のメッセージパッシングの関係性などの設計をやる

Design basic API, and Extension API

Write article to wiki about macchiato basic API and extension API.
macchiato の基本的な API と拡張プラグインのためのAPI の仕様を作る

Dependency Injection pattern for test logger

Problem

Now, Macchiato test view object depends on TestView object. TestView object depends on static html page ( and its dom ).

Solution

Add these object

  1. TestViewControl
  2. WebTestView
  3. ConsoleTestView

TestViewControl switch TestView entity either WebTestView (testing on web html) or ConsoleTestView (testing on node.js).

Write README

Write README for end-users, and developers.
README 書こう

What should to write README? README に何を書くか

  • For end user エンドユーザ向け
    • How to Install インストール
    • How to Use 基本的な使い方
      • Write test テストの書き方
      • Run test テストを実行
      • Check test result テストログの読み方
  • For custom user, developer カスタマイズプラグイン作者, macchiato 自体の開発者向け
    • Customize, using extension API プラグイン拡張の作り方, 利用の仕方など
    • How to Build script スクリプトのビルド

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.