Skip to content

Commit

Permalink
fix, actually heed the iterator in dateseq with 3 arguments
Browse files Browse the repository at this point in the history
  • Loading branch information
hroptatyr committed May 14, 2018
1 parent b82b418 commit c426f49
Show file tree
Hide file tree
Showing 7 changed files with 65 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/dseq.c
Expand Up @@ -659,11 +659,13 @@ cannot mix dates and times as arguments");
#define _DAISY ((dt_dttyp_t)DT_DAISY)
tgttyp = clo.fst.typ;
if ((dt_sandwich_p(clo.fst) || dt_sandwich_only_d_p(clo.fst)) &&
clo.fst.d.typ == DT_YMD && clo.fst.d.ymd.m == 0) {
clo.fst.d.typ == DT_YMD && clo.fst.d.ymd.m == 0 &&
argi->nargs < 3U) {
/* iterate year-wise */
clo.ite->d = dt_make_ddur(DT_DURYR, 1);
} else if ((dt_sandwich_p(clo.fst) || dt_sandwich_only_d_p(clo.fst)) &&
clo.fst.d.typ == DT_YMD && clo.fst.d.ymd.d == 0) {
clo.fst.d.typ == DT_YMD && clo.fst.d.ymd.d == 0 &&
argi->nargs < 3U) {
/* iterate month-wise */
clo.ite->d = dt_make_ddur(DT_DURMO, 1);
} else if (dt_sandwich_only_d_p(clo.fst) &&
Expand Down
5 changes: 5 additions & 0 deletions test/Makefile.am
Expand Up @@ -95,6 +95,11 @@ dt_tests += dseq.53.clit
dt_tests += dseq.54.clit
dt_tests += dseq.55.clit
dt_tests += dseq.56.clit
dt_tests += dseq.57.clit
dt_tests += dseq.58.clit
dt_tests += dseq.59.clit
dt_tests += dseq.60.clit
dt_tests += dseq.61.clit

dt_tests += dconv.001.clit
dt_tests += dconv.002.clit
Expand Down
10 changes: 10 additions & 0 deletions test/dseq.57.clit
@@ -0,0 +1,10 @@
#!/usr/bin/clitoris ## -*- shell-script -*-

$ dseq 2012-01-01 +2y 2018-01-01
2012-01-01
2014-01-01
2016-01-01
2018-01-01
$

## dseq.57.clit ends here
10 changes: 10 additions & 0 deletions test/dseq.58.clit
@@ -0,0 +1,10 @@
#!/usr/bin/clitoris ## -*- shell-script -*-

$ dseq 2012-01-00 +2y 2018-01-00
2012-01-00
2014-01-00
2016-01-00
2018-01-00
$

## dseq.58.clit ends here
10 changes: 10 additions & 0 deletions test/dseq.59.clit
@@ -0,0 +1,10 @@
#!/usr/bin/clitoris ## -*- shell-script -*-

$ dseq 2012-00-00 +2y 2018-00-00
2012-00-00
2014-00-00
2016-00-00
2018-00-00
$

## dseq.59.clit ends here
13 changes: 13 additions & 0 deletions test/dseq.60.clit
@@ -0,0 +1,13 @@
#!/usr/bin/clitoris ## -*- shell-script -*-

$ dseq 2012-01-01 +2mo 2013-01-01
2012-01-01
2012-03-01
2012-05-01
2012-07-01
2012-09-01
2012-11-01
2013-01-01
$

## dseq.60.clit ends here
13 changes: 13 additions & 0 deletions test/dseq.61.clit
@@ -0,0 +1,13 @@
#!/usr/bin/clitoris ## -*- shell-script -*-

$ dseq 2012-01-00 +2mo 2013-01-00
2012-01-00
2012-03-00
2012-05-00
2012-07-00
2012-09-00
2012-11-00
2013-01-00
$

## dseq.61.clit ends here

0 comments on commit c426f49

Please sign in to comment.