From af299337dae375967bb8d15ebe96fb2a52bf22f8 Mon Sep 17 00:00:00 2001 From: Thomas Lambert <t.lambert@uliege.be> Date: Tue, 24 May 2022 10:40:05 +0200 Subject: [PATCH] fix(xf2mat): issue with autosave --- +af_tools/xf2mat.m | 3 ++- CHANGELOG.md | 16 +++++++++++++--- tests/test_xf2mat.m | 15 +++++++++++++++ 3 files changed, 30 insertions(+), 4 deletions(-) diff --git a/+af_tools/xf2mat.m b/+af_tools/xf2mat.m index b0080d4..7ec4c2e 100644 --- a/+af_tools/xf2mat.m +++ b/+af_tools/xf2mat.m @@ -262,6 +262,7 @@ end % -------------------------------------------------------------------------------------------------- function filename = genfilename(Polar) + % GENFILENAME Generates a proper filename for the saved file import af_tools.utils.appendextension @@ -269,7 +270,7 @@ function filename = genfilename(Polar) order = floor(log10(Polar.reynolds)); reBase = round(Polar.reynolds ./ 10.^order); - if nbFiles == 1 + if length(Polar.reynolds) == 1 reStr = sprintf('-Re_%de%d', reBase, order); else reStr = sprintf('-Re_%de%d-%de%d', reBase(1), order(1), reBase(end), order(end)); diff --git a/CHANGELOG.md b/CHANGELOG.md index eaaf910..1f8403c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,8 +9,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added -- Unit tests for **utils.selig** and **utils.lednicer** - ### Changed ### Deprecated @@ -19,6 +17,17 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed +## [2.0.1] - 2022-05-24 + +### Added + +- Unit tests for **utils.selig** and **utils.lednicer** +- **xf2mat**: test for autosave + +### Fixed + +- **xf2mat**: bug with autosave + ## [2.0.0] - 2022-04-24 ### Added @@ -75,7 +84,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Initial release -[Unreleased]: https://gitlab.uliege.be/am-dept/matlab_airfoil_toolbox/-/compare/v2.0.0...master +[Unreleased]: https://gitlab.uliege.be/am-dept/matlab_airfoil_toolbox/-/compare/v2.0.1...master +[2.0.1]: https://gitlab.uliege.be/am-dept/matlab_airfoil_toolbox/-/compare/v2.0.0...v2.0.1 [2.0.0]: https://gitlab.uliege.be/am-dept/matlab_airfoil_toolbox/-/compare/v1.2.0...v2.0.0 [1.2.0]: https://gitlab.uliege.be/am-dept/matlab_airfoil_toolbox/-/compare/v1.1.0...v1.2.0 [1.1.0]: https://gitlab.uliege.be/am-dept/matlab_airfoil_toolbox/-/compare/v1.0.0...v1.1.0 diff --git a/tests/test_xf2mat.m b/tests/test_xf2mat.m index 813e10f..a9e0b37 100644 --- a/tests/test_xf2mat.m +++ b/tests/test_xf2mat.m @@ -212,3 +212,18 @@ function test_correctOutputValues(testCase) verifyEqual(testCase, Polar.airfoil, {'NACA_2412'}); end + +function test_autosave(testCase) + % Verify if file is properly saved + + testdir = [pwd, '/test_utils']; + + Polar = af_tools.xf2mat(testdir, 'xfoil-naca2412_re1e6', 'autosave', true); + savedPolar = load('NACA_2412-Re_1e6.mat'); + savedPolar = savedPolar.Polar; + + verifyEqual(testCase, Polar, savedPolar); + + % Cleanup + delete NACA_2412-Re_1e6.mat; +end -- GitLab