Skip to content

Commit

Permalink
Add test for GAPInfo.Date format
Browse files Browse the repository at this point in the history
  • Loading branch information
lgoettgens committed Jun 25, 2024
1 parent 1c46462 commit e5fcb1f
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion tst/testinstall/package.tst
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#@local entry,equ,pair,sml,oldTermEncoding,pkginfo,info,tmp_dir,mockpkgpath,old_warning_level,p,n,filename
#@local entry,equ,pair,sml,oldTermEncoding,pkginfo,info,tmp_dir,mockpkgpath,old_warning_level,p,n,filename,IsDateFormatValid
gap> START_TEST("package.tst");

# CompareVersionNumbers( <supplied>, <required>[, \"equal\"] )
Expand Down Expand Up @@ -516,6 +516,23 @@ new methods:
mockpkg_Property( ... )*


# Cite() expects GAPInfo.Date to be of the form "YYYY-MM-DD" or "YYYY-Mon-DD" (or "today")
gap> IsDateFormatValid := function( datestring )
> local months, val;
> if datestring = "today" then
> return true;
> fi;
> val:= SplitString( datestring, "-" );
> if Length( val ) <> 3 then
> return false;
> fi;
> months:= [ "Jan", "Feb", "Mar", "Apr", "May", "Jun",
> "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" ];
> return Int( val[1] ) in [ 1900 .. 2100 ] and ( val[2] in months or Int( val[2] ) in [ 1 .. 12 ] ) and Int( val[3] ) in [ 1 .. 31 ];
> end;;
gap> IsDateFormatValid( GAPInfo.Date );
true

# Test the Cite() command (output changed with GAPDoc 1.6.6 and again with 1.6.7)
#@if CompareVersionNumbers(InstalledPackageVersion("gapdoc"), "1.6.7")
gap> Cite("mockpkg");
Expand Down

0 comments on commit e5fcb1f

Please sign in to comment.