Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unit tests and demos #30

Open
apjanke opened this issue Mar 2, 2019 · 4 comments
Open

Unit tests and demos #30

apjanke opened this issue Mar 2, 2019 · 4 comments
Assignees
Labels
bug Something isn't working
Milestone

Comments

@apjanke
Copy link
Owner

apjanke commented Mar 2, 2019

This package could use some tests (BISTs). For a bunch of stuff; there are hardly any tests at all.

Some demos would be nice too, both for demonstration purposes, and as a form of test.

@apjanke apjanke self-assigned this Mar 2, 2019
@apjanke apjanke added the bug Something isn't working label Mar 2, 2019
@apjanke apjanke added this to the 1.0 milestone Mar 2, 2019
@apjanke
Copy link
Owner Author

apjanke commented Jan 17, 2020

Actually, I maybe want to wait until I can do this in Matlab Unit Test framework style. The code for the tests is going to be too long to fit comfortably in BISTs.

@apjanke apjanke modified the milestones: 0.3.0, 1.0.0 Jan 17, 2020
@apjanke
Copy link
Owner Author

apjanke commented Jan 17, 2020

For 0.3.0, we'll do executable examples in lieu of a bunch of stuff explicitly structured as tests.

@apjanke apjanke changed the title Tests Unit Tests Jan 17, 2020
@apjanke apjanke moved this to High priority in Octave-Tablicious Jan 4, 2024
@apjanke apjanke changed the title Unit Tests Unit tests and demos Feb 4, 2024
@apjanke
Copy link
Owner Author

apjanke commented Feb 4, 2024

Ah, looks like there's a pkg test <package> command now.

Minor bummer: it requires the package to actually be installed; you can't just run it on an inst/ directory you have on your path, AFAICT.

It calls __run_test_suite__ with a special argument pointing at the directory. Maybe I can do that directly. Looks like __run_test_suite__ ({'/Users/janke/repos/octave-tablicious/inst'}, {}) works.

          printf ("Testing functions in package '%s':\n", files{i});
          installed_pkgs_dirs = {installed_pkgs_lst{i}.dir, ...
                                 installed_pkgs_lst{i}.archprefix};
          installed_pkgs_dirs = ...
            installed_pkgs_dirs (! cellfun (@isempty, installed_pkgs_dirs));
          ## For local installs installed_pkgs_dirs contains the same subdirs
          installed_pkgs_dirs = unique (installed_pkgs_dirs);
          if (! isempty (installed_pkgs_dirs))
            ## FIXME invoke another test routine once that is available.
            ## Until then __run_test_suite__.m will do the job fine enough
            __run_test_suite__ ({installed_pkgs_dirs{:}}, {});
          endif

Bigger bummer: it doesn't find any of my BISTs.

>> pkg test tablicious
Testing functions in package 'tablicious':

Integrated test scripts:


Fixed test scripts:


Summary:

  PASS                                0
  FAIL                                0

See the file /Users/janke/fntests.log for additional details.

278 (of 278) .m files have no tests.

Please help improve Octave by contributing tests for these files
(see the list in the file /Users/janke/fntests.log).

>>

@apjanke
Copy link
Owner Author

apjanke commented Feb 4, 2024

Okay, looks like oruntests() is the new version of runtests(). Probably just renamed for Matlab compatibility.

Reason the BISTs weren't being picked up is because they used #! prefixes instead of %!, and they need to be %!. Fixed in 62f6f9e.

You can now run the test suite with oruntests, and the few BISTs we have are passing. Now just need to write some more of them. Leaving this ticket open for that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: High priority
Development

No branches or pull requests

1 participant