matcher

package
v1.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 5, 2021 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultTolerance = 0.0001

DefaultTolerance 상수는 float 값을 비교할 때 사용하는 기본 tolerance 값입니다

Variables

This section is empty.

Functions

This section is empty.

Types

type JsonMatcher

type JsonMatcher struct {
	ResultString string
	Result       bool
	// contains filtered or unexported fields
}

func Json

func Json(jsonString string) JsonMatcher

Json 함수는 json 문자열로 Matcher를 생성해서 반환합니다.

func (JsonMatcher) Eq

func (m JsonMatcher) Eq(target string, value interface{}, tolerance float64) JsonMatcher

Eq 함수는 앞서 Json(jsonString)으로 생성한 Json string에 대해서 전달된 target으로 프로퍼티를 찾아 전달된 value 값과 비교합니다. 이때 부동소수점 비교할 때 두 값의 차이가 tolerance 값보다 작은 경우 같다고 판단합니다. 이 값을 고르기 힘들다면 DefaultTolerance 상수를 사용해도 됩니다

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL