|
257 | 257 | # invertible lenses below: no need for extensive testing, simply forwarded to InverseFunctions
|
258 | 258 | inv, +, exp, sqrt, @optic(2 + _), @optic(_ * 3), @optic(log(2, _)),
|
259 | 259 | # non-invertible lenses, indirectly forwarded to InverseFunctions
|
260 |
| - @optic(mod(_, 21)), @optic(fld(_, 3)), @optic(rem(_, 21)), @optic(div(_, 3)), |
| 260 | + @optic(mod(_, 21)), @optic(fld(_, 3)), @optic(rem(_, 21)), @optic(div(_, 3)), @optic(mod(_, 1:22)), |
261 | 261 | ]
|
262 | 262 | x = 5
|
263 | 263 | test_getset_laws(o, x, 10, 20; cmp=isapprox)
|
|
272 | 272 | @test set(0+0im, abs, 10) == 10
|
273 | 273 | @test set(0+1e-100im, abs, 10) == 10im
|
274 | 274 | @test_throws DomainError @set(abs(x) = -10)
|
| 275 | + test_getset_laws(abs2, 1+2im, 3, 4, cmp=(≈)) |
275 | 276 |
|
276 | 277 | # composition
|
277 | 278 | o = @optic 1/(1 + exp(-_))
|
|
362 | 363 | test_getset_laws(@optic(lstrip(==(' '), _)), " abc ", "def", "")
|
363 | 364 | test_getset_laws(@optic(rstrip(==(' '), _)), " abc ", "def", "")
|
364 | 365 | test_getset_laws(@optic(strip(==(' '), _)), " abc ", "def", "")
|
| 366 | + test_getset_laws(chomp, "abc", "def", "") |
| 367 | + test_getset_laws(chomp, "abc\n", "def", "") |
| 368 | + test_getset_laws(chomp, "abc\n\n", "def\n", "") |
365 | 369 |
|
366 | 370 | if VERSION >= v"1.8"
|
367 | 371 | test_getset_laws(@optic(chopprefix(_, "def")), "def abc", "xyz", "")
|
|
0 commit comments