func ExampleToDelimiter() {
	ntd1 := gonumbers.ToDelimiter()
	fmt.Println(ntd1.Perform(1234567890))

	ntd2 := gonumbers.ToDelimiter()
	ntd2.Options(gonumbers.Separator("."), gonumbers.Delimiter(","))
	fmt.Println(ntd2.Perform(1234567890.506))

	ntd3 := gonumbers.ToDelimiter()
	ntd3.Options(gonumbers.Separator("-"), gonumbers.Delimiter(":"))
	fmt.Println(ntd3.Perform(1234567890.34))

	ntd4 := gonumbers.ToDelimiter()
	ntd4.Options(gonumbers.Separator("."), gonumbers.Delimiter(""))
	fmt.Println(ntd4.Perform(1234567890.34))

	ntd5 := gonumbers.ToDelimiter()
	ntd5.Options(gonumbers.Separator(""), gonumbers.Delimiter(""))
	fmt.Println(ntd5.Perform(1234567890.34))

	// Output:
	// 1,234,567,890
	// 1,234,567,890.506
	// 1:234:567:890-34
	// 1234567890.34
	// 123456789034
}
func Test_ToCurrency(t *testing.T) {

	for _, test := range testsNTC {
		ntc := gonumbers.ToCurrency()

		if test.addPrecision {
			ntc.Options(gonumbers.Precision(test.precision))
		}

		if test.addUnit {
			ntc.Options(gonumbers.Unit(test.unit))
		}

		if test.addSeparator {
			ntc.Options(gonumbers.Separator(test.separator))
		}

		if test.addDelimiter {
			ntc.Options(gonumbers.Delimiter(test.delimiter))
		}

		assert(t, test.out, ntc.Perform(test.in))
	}

}
func Test_ToDelimiter(t *testing.T) {

	tests := []struct {
		in           float64
		addSeparator bool
		separator    string
		addDelimiter bool
		delimiter    string
		out          string
	}{
		{in: 1234567890, out: "1,234,567,890"},
		{
			in:           1234567890.506,
			addSeparator: true,
			separator:    ".",
			addDelimiter: true,
			delimiter:    ",",
			out:          "1,234,567,890.506",
		},
		{
			in:           1234567890.34,
			addSeparator: true,
			separator:    "-",
			addDelimiter: true,
			delimiter:    ":",
			out:          "1:234:567:890-34",
		},
		{
			in:           1234567890.34,
			addSeparator: true,
			separator:    ".",
			addDelimiter: true,
			delimiter:    "",
			out:          "1234567890.34",
		},
		{
			in:           1234567890.34,
			addSeparator: true,
			separator:    "",
			addDelimiter: true,
			delimiter:    "",
			out:          "123456789034",
		},
	}

	for _, test := range tests {
		ntd := gonumbers.ToDelimiter()
		if test.addSeparator {
			ntd.Options(gonumbers.Separator(test.separator))
		}
		if test.addDelimiter {
			ntd.Options(gonumbers.Delimiter(test.delimiter))
		}
		assert(t, test.out, ntd.Perform(test.in))
	}

}
func ExampleToHumanSize() {
	nths1 := gonumbers.ToHumanSize()
	res1, err1 := nths1.Perform(333)
	if err1 != nil {
		fmt.Println(err1)
	}
	fmt.Println(res1)

	nths2 := gonumbers.ToHumanSize()
	res2, err2 := nths2.Perform(1234)
	if err2 != nil {
		fmt.Println(err2)
	}
	fmt.Println(res2)

	nths3 := gonumbers.ToHumanSize()
	res3, err3 := nths3.Perform(1234567890)
	if err3 != nil {
		fmt.Println(err3)
	}
	fmt.Println(res3)

	nths4 := gonumbers.ToHumanSize()
	nths4.Options(gonumbers.Precision(2))
	res4, err4 := nths4.Perform(1234567)
	if err4 != nil {
		fmt.Println(err4)
	}
	fmt.Println(res4)

	nths5 := gonumbers.ToHumanSize()
	nths5.Options(gonumbers.Precision(2), gonumbers.Separator(","))
	res5, err5 := nths5.Perform(1234567)
	if err5 != nil {
		fmt.Println(err5)
	}
	fmt.Println(res5)

	nths6 := gonumbers.ToHumanSize()
	nths6.Options(gonumbers.Precision(5))
	res6, err6 := nths6.Perform(524288000)
	if err6 != nil {
		fmt.Println(err6)
	}
	fmt.Println(res6)

	// Output:
	// 333 Bytes
	// 1.21 KB
	// 1.15 GB
	// 1.2 MB
	// 1,2 MB
	// 500 MB
}
func ExampleToCurrency() {
	ntc1 := gonumbers.ToCurrency()
	res1 := ntc1.Perform(1234567890.50)
	fmt.Println(res1)

	ntc2 := gonumbers.ToCurrency()
	ntc2.Options(gonumbers.Precision(2))
	res2 := ntc2.Perform(1234567890.506)
	fmt.Println(res2)

	ntc3 := gonumbers.ToCurrency()
	ntc3.Options(gonumbers.Precision(2), gonumbers.Unit("$"), gonumbers.Separator("."))
	res3 := ntc3.Perform(1234567890)
	fmt.Println(res3)

	ntc4 := gonumbers.ToCurrency()
	ntc4.Options(gonumbers.Precision(3), gonumbers.Unit("CAD$"), gonumbers.Separator("."), gonumbers.Delimiter(","))
	res4 := ntc4.Perform(1234567890.506)
	fmt.Println(res4)

	ntc5 := gonumbers.ToCurrency()
	ntc5.Options(gonumbers.Precision(2), gonumbers.Separator("."), gonumbers.Delimiter(""))
	res5 := ntc5.Perform(1234567890.50)
	fmt.Println(res5)

	ntc6 := gonumbers.ToCurrency()
	ntc6.Options(gonumbers.Precision(2), gonumbers.Separator(","), gonumbers.Delimiter("."))
	res6 := ntc6.Perform(1234567890.506)
	fmt.Println(res6)

	// Output:
	// $1,234,567,890.50
	// $1,234,567,890.51
	// $1,234,567,890.00
	// CAD$1,234,567,890.506
	// $1234567890.50
	// $1.234.567.890,51
}
func Test_ToHuman(t *testing.T) {

	tests := []struct {
		in                         float64
		out                        string
		precision                  int
		separator                  string
		addPrecision, addSeparator bool
	}{
		{in: 123, out: "123"},
		{in: 1234, out: "1.23 Thousand"},
		{in: 12345, out: "12.3 Thousand"},
		{in: 1234567, out: "1.23 Million"},
		{in: 1234567890, out: "1.23 Billion"},
		{in: 1234567890123, out: "1.23 Trillion"},
		{in: 1234567890123456, out: "1.23 Quadrillion"},
		{
			in:           489939,
			addPrecision: true,
			precision:    2,
			out:          "490 Thousand",
		},
		{
			in:           489939,
			addPrecision: true,
			precision:    4,
			out:          "489.9 Thousand",
		},
		{
			in:           489939,
			addPrecision: true,
			precision:    4,
			addSeparator: true,
			separator:    ",",
			out:          "489,9 Thousand",
		},
	}

	for _, test := range tests {
		nth := gonumbers.ToHuman()
		if test.addPrecision {
			nth.Options(gonumbers.Precision(test.precision))
		}
		if test.addSeparator {
			nth.Options(gonumbers.Separator(test.separator))
		}
		assert(t, test.out, nth.Perform(test.in))
	}

}
func ExampleToHuman() {
	nth1 := gonumbers.ToHuman()
	fmt.Println(nth1.Perform(123))

	nth2 := gonumbers.ToHuman()
	fmt.Println(nth2.Perform(1234))

	nth3 := gonumbers.ToHuman()
	fmt.Println(nth3.Perform(12345))

	nth4 := gonumbers.ToHuman()
	fmt.Println(nth4.Perform(1234567))

	nth5 := gonumbers.ToHuman()
	fmt.Println(nth5.Perform(1234567890))

	nth6 := gonumbers.ToHuman()
	fmt.Println(nth6.Perform(1234567890123))

	nth7 := gonumbers.ToHuman()
	fmt.Println(nth7.Perform(1234567890123456))

	nth8 := gonumbers.ToHuman()
	nth8.Options(gonumbers.Precision(2))
	fmt.Println(nth8.Perform(489939))

	nth9 := gonumbers.ToHuman()
	nth9.Options(gonumbers.Precision(4))
	fmt.Println(nth9.Perform(489939))

	nth10 := gonumbers.ToHuman()
	nth10.Options(gonumbers.Precision(4), gonumbers.Separator(","))
	fmt.Println(nth10.Perform(489939))

	// Output:
	// 123
	// 1.23 Thousand
	// 12.3 Thousand
	// 1.23 Million
	// 1.23 Billion
	// 1.23 Trillion
	// 1.23 Quadrillion
	// 490 Thousand
	// 489.9 Thousand
	// 489,9 Thousand
}
func Test_ToHumanSize(t *testing.T) {

	nths1 := gonumbers.ToHumanSize()
	nths1.Options(gonumbers.Prefix("ahhaha"))
	nths1_final, err1 := nths1.Perform(123)
	assert_not(t, nil, err1)
	contains(t, err1.Error(), "Prefix must be binary or si.")
	assert(t, "", nths1_final)

	tests := []struct {
		in           float64
		addPrecision bool
		precision    int
		addSeparator bool
		separator    string
		addDelimiter bool
		delimiter    string
		addPrefix    bool
		prefix       string
		out          string
	}{
		{
			in:  333,
			out: "333 Bytes",
		},
		{
			in:  1234,
			out: "1.21 KB",
		},
		{
			in:  1234567890,
			out: "1.15 GB",
		},
		{
			in:           1234567,
			addPrecision: true,
			precision:    2,
			out:          "1.2 MB",
		},
		{
			in:           524288000,
			addPrecision: true,
			precision:    5,
			out:          "500 MB",
		},
		{
			in:           1234567,
			addPrecision: true,
			precision:    2,
			addSeparator: true,
			separator:    ",",
			out:          "1,2 MB",
		},
	}

	for _, test := range tests {
		nths := gonumbers.ToHumanSize()
		if test.addPrecision {
			nths.Options(gonumbers.Precision(test.precision))
		}
		if test.addSeparator {
			nths.Options(gonumbers.Separator(test.separator))
		}
		if test.addDelimiter {
			nths.Options(gonumbers.Delimiter(test.delimiter))
		}
		if test.addPrefix {
			nths.Options(gonumbers.Prefix(test.prefix))
		}
		nths_final, err := nths.Perform(test.in)
		assert(t, nil, err)
		assert(t, test.out, nths_final)
	}

}