tests and tweaks, and add chunkBackInto

This commit is contained in:
alex 2025-06-27 22:51:47 +01:00
parent ff5b11f5ed
commit f44caf9096
2 changed files with 30 additions and 9 deletions

View file

@ -1278,7 +1278,7 @@ describe('Pattern', () => {
fastcat('a', 'b', 'a', 'b', 'c', 'c', 'd', 'd')
)
})
})
});
describe('into', () => {
it('applies a function to subcycles of a pattern', () => {
sameFirst(
@ -1286,12 +1286,19 @@ describe('Pattern', () => {
fastcat('a', 'a', 'b', 'b', 'c', 'd', 'c', 'd')
)
})
}),
describe('chunkinto', () => {
it('chunks into subcycles', () => {
sameFirst(fastcat('a', 'b', 'c').chunkInto(3, fast(2)).fast(3),
fastcat(fastcat('a', 'a'), 'b', 'c', 'a', fastcat('b', 'b'), 'c', 'a', 'b', fastcat('c', 'c'))
)
})
});
describe('chunkinto', () => {
it('chunks into subcycles', () => {
sameFirst(fastcat('a', 'b', 'c').chunkInto(3, fast(2)).fast(3),
fastcat(fastcat('a', 'a'), 'b', 'c', 'a', fastcat('b', 'b'), 'c', 'a', 'b', fastcat('c', 'c'))
)
})
});
describe('chunkbackinto', () => {
it('chunks into subcycles backwards', () => {
sameFirst(fastcat('a', 'b', 'c').chunkBackInto(3, fast(2)).fast(3),
fastcat('a', 'b', fastcat('c', 'c'), 'a', fastcat('b', 'b'), 'c', fastcat('a', 'a'), 'b', 'c')
)
})
});
});