All Projects → Apelsinka223 → Test_match

Apelsinka223 / Test_match

Licence: mit
Recursive matching

Programming Languages

elixir
2628 projects

Projects that are alternatives of or similar to Test match

DeepCD
[ICCV17] DeepCD: Learning Deep Complementary Descriptors for Patch Representations
Stars: ✭ 39 (+95%)
Mutual labels:  matching
allot
Parse placeholder and wildcard text commands
Stars: ✭ 51 (+155%)
Mutual labels:  matching
Matchering
🎚️ Open Source Audio Matching and Mastering
Stars: ✭ 398 (+1890%)
Mutual labels:  matching
re-blossom
A Reason implementation of the blossom maximum-matching algorithm
Stars: ✭ 15 (-25%)
Mutual labels:  matching
matchering-cli
🎚️ Simple Matchering 2.0 Command Line Application
Stars: ✭ 28 (+40%)
Mutual labels:  matching
Ndt omp
Multi-threaded and SSE friendly NDT algorithm
Stars: ✭ 291 (+1355%)
Mutual labels:  matching
snowman
Welcome to Snowman App – a Data Matching Benchmark Platform.
Stars: ✭ 25 (+25%)
Mutual labels:  matching
Gms Feature Matcher
GMS: Grid-based Motion Statistics for Fast, Ultra-robust Feature Correspondence (CVPR 17 & IJCV 20)
Stars: ✭ 797 (+3885%)
Mutual labels:  matching
mods-light-zmq
MODS with external deep descriptors/detectors
Stars: ✭ 46 (+130%)
Mutual labels:  matching
Competitive Programming Repository
Competitive Programming templates that I used during the past few years.
Stars: ✭ 367 (+1735%)
Mutual labels:  matching
aho-corasick-node
A Node implementation of the Aho-Corasick string matching algorithm based on DoubleArray Trie.
Stars: ✭ 16 (-20%)
Mutual labels:  matching
granblue-automation-android
Educational application written in Kotlin aimed at automating user-defined workflows for the mobile game, "Granblue Fantasy", using MediaProjection, AccessibilityService, and OpenCV.
Stars: ✭ 26 (+30%)
Mutual labels:  matching
Matchzoo
Facilitating the design, comparison and sharing of deep text matching models.
Stars: ✭ 3,568 (+17740%)
Mutual labels:  matching
dir-glob
Convert directories to glob compatible strings
Stars: ✭ 41 (+105%)
Mutual labels:  matching
Awesome Local Global Descriptor
My personal note about local and global descriptor
Stars: ✭ 466 (+2230%)
Mutual labels:  matching
fuzzywuzzyR
fuzzy string matching in R
Stars: ✭ 32 (+60%)
Mutual labels:  matching
Matchingnetworks
This repo provides pytorch code which replicates the results of the Matching Networks for One Shot Learning paper on the Omniglot and MiniImageNet dataset
Stars: ✭ 256 (+1180%)
Mutual labels:  matching
Ts Pattern
🎨 A complete Pattern Matching library for TypeScript, with smart type inference.
Stars: ✭ 854 (+4170%)
Mutual labels:  matching
Shape based matching
try to implement halcon shape based matching, refer to machine vision algorithms and applications, page 317 3.11.5, written by halcon engineers
Stars: ✭ 496 (+2380%)
Mutual labels:  matching
Matchzoo Py
Facilitating the design, comparison and sharing of deep text matching models.
Stars: ✭ 362 (+1710%)
Mutual labels:  matching

Hex.pm Downloads Build Status Coverage Status Inline docs

RecursiveMatch

Module for matching

What difference between Kernel.match?/2 and RecursiveMatch.match_r/3?

When you use Kernel.match?/2

  • can't use functions as pattern
  • can't match not strict equality (only ===, no ==)

RecursiveMatch.match_r/3 allows you:

  • use functions as patterns
  • match not strictly (with option strict: false)
  • ignore order of lists item (with option ignore_order: true)

What is for assert_match/3 and refute_match/3?

It is same as assert RecursiveMatch.match_r, but with detailed fail message.
ExUnit has no special message for match_r/3 and even no special message for match?/2 is not detailed enough, it has no diff in fail message.

assert_match/3 provides diff in test fail message

Installation

If available in Hex, the package can be installed by adding test_match to your list of dependencies in mix.exs:

Requires elixir ~> 1.5

def deps do
  [
    {:test_match, "~> 2.0"}
  ]
end

Usage

defmodule YourModule do
  import RecursiveMatch

  def function1 do
    ...
  end
  
  def function2 do
    ...
    match_r 1, 2 
    match_r a, b
    match_r :_, b
    match_r function1(), 1
    match_r [1, 2], [2, 1], ignore_order: true # true
    match_r 1, 1.0, strict: true               # false
    match_r {1, 2}, {2, 1}, ignore_order: true # false, nope :)
    ...
  end
end

defmodule YourModuleTest do
  use ExUnit.Case
  import RecursiveMatch

  test "some test" do
    ...
    assert_match 1, 2 # false
    assert_match :_, b
    assert_match a, b
    assert_match [1, 2], [2, 1], ignore_order: true
    refute_match 1, 1.0
    assert_match 1, 1.0, strict: false          
    refute_match a, c
    assert_match YourModule.function1(), 1
    ...
  end
end

Options

  • strict: when true compare using ===, when false compare using ==, default true
  • ignore_order, when true - ignore order of items in lists, default false
  • message: Custom message on fail

Documentation can be generated with ExDoc and published on HexDocs. Once published, the docs can be found at https://hexdocs.pm/test_match.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].