You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
TEST: Create unit tests for all classes where possible (#38)
* ENH: Add unit tests for 8 high-priority classes with no/minimal coverage
Add comprehensive Catch2 unit tests for:
- Matrix3X1<T>: construction, dot, cross, magnitude, normalize, sortAscending, cosTheta, operators (20 tests)
- Matrix3X3<T>: construction, multiply, transpose, determinant, invert, adjoint, col/row, DirectStructureMatrix (23 tests)
- ArrayHelpers<T,K>: splat, multiply, scalarMultiply, scalarDivide, sum, sumofSquares, maxval, absValue, power (13 tests)
- EbsdDataArray<T>: CreateArray, FromStdVector, CopyFromPointer, get/set, components, resize, erase, deepCopy, copyFromArray (23 tests)
- EbsdStringUtils: split (single/multi delimiter, consecutive), specific_split, replace, ltrim, rtrim, trimmed, chop, number, simplified (18 tests)
- EbsdTransform: IdentifyStandardTransformation for TSL, HKL, HEDM, and unknown parameters (6 tests)
- EbsdLibRandom: seeded deterministic output, range checks for real1/real2/real3/res53/int31, init_by_array (9 tests)
- OrientationMath: MetricTensor, RootTensor, Miller-Bravais conversions with round-trip verification (12 tests)
Also documents newly discovered Bug #5: EbsdDataArray::eraseTuples() does not update m_NumTuples.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* ENH: Add unit tests for 9 medium-priority classes (#13-#21)
Add 80 new test cases across 9 test files covering ColorTable/ColorUtilities,
LambertUtilities, ModifiedLambertProjection, ComputeStereographicProjection,
TexturePreset, AngPhase/CtfPhase/EspritPhase, LaueOps subclasses,
ModifiedLambertProjection3D, and OrientationTransformation known-value tests.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* ENH: Add unit tests for 6 low-priority classes (#23-#28) and fix ToolTipGenerator bug
Add 44 new test cases covering ToolTipGenerator, PoleFigureData, CanvasUtilities,
ModifiedLambertProjectionArray, PoleFigureUtilities, and TiffWriter. Fix bug in
ToolTipGenerator::generateHTML() and rowToHTML() where both methods returned an
empty string instead of the stringstream content.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* BUG: Replace M_PI with ebsdlib::constants::k_PiD in LambertUtilitiesTest
M_PI is not defined on Windows without _USE_MATH_DEFINES. Use the
project's own constant to ensure cross-platform compilation.
---------
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
I would like to add more unit testing to the EbsdLib library. Can we put together a TODO.md file stored in the "Code_Review" directory that lists all the candidate classes to create unit tests for?
7
+
8
+
### Phase 2
9
+
I would also like to write documentation for this library
10
+
11
+
### Phase 3
12
+
I would also like to write more example code that shows how to use the library
13
+
14
+
How should we get stated with these tasks?
15
+
16
+
## Directory Structure
17
+
-`Source/Ebsdlib/` - Core library
18
+
-`Source/Apps/` - various test applications
19
+
-`src/Test/` - Test files
20
+
-`cmake/` - CMake configuration
21
+
22
+
23
+
## Directories to Ignore
24
+
-`scripts/` - Build/utility scripts
25
+
-`conda/` - Conda packaging
26
+
27
+
## Coding Standards
28
+
29
+
### C++ Style (from .clang-format)
30
+
- C++20 standard
31
+
- Allman brace style (braces on new lines for classes, control statements, enums, functions, namespaces, structs, before else)
32
+
- 200 column limit
33
+
- 2-space indentation, no tabs
34
+
- Pointer alignment left (`int* ptr` not `int *ptr`)
Copy file name to clipboardExpand all lines: Code_Review/TODO.md
+29-23Lines changed: 29 additions & 23 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -59,6 +59,12 @@ There are **12 active test files** compiled into a single `EbsdLibUnitTest` exec
59
59
**Severity:** MEDIUM - Tests pass even with wildly incorrect values
60
60
**Issue:** The tolerance check uses `delta < 1.0E6` (one million) instead of `1.0E-6` (one millionth). This means the round-trip conversion tests will pass even if values are off by up to a million, making the tests effectively useless for catching conversion errors.
61
61
62
+
### Bug 5: `EbsdDataArray::eraseTuples()` - Does not update `m_NumTuples`
**Severity:** MEDIUM - `getNumberOfTuples()` returns stale value after eraseTuples
66
+
**Issue:** The `eraseTuples()` method updates `m_Size`, `m_MaxId`, and `m_Array` but never updates `m_NumTuples`. After calling `eraseTuples()`, `getNumberOfTuples()` returns the original tuple count instead of the new (reduced) count. `getSize()` correctly returns the new total element count.
67
+
62
68
---
63
69
64
70
## Classes Requiring Unit Tests
@@ -70,7 +76,7 @@ These classes have zero or near-zero test coverage and contain non-trivial logic
70
76
#### 1. `EbsdDataArray<T>` - Core data container
71
77
72
78
-**File:**`Source/EbsdLib/Core/EbsdDataArray.hpp`
73
-
-**Status:**No tests
79
+
-**Status:****DONE** - `Source/Test/EbsdDataArrayTest.cpp` (23 test cases)
74
80
-**Why:** Core template class used by virtually every reader and computation. Wraps raw arrays with lifecycle management.
75
81
-**Recommended tests:**
76
82
- Construction (default, sized, from existing pointer)
@@ -85,7 +91,7 @@ These classes have zero or near-zero test coverage and contain non-trivial logic
85
91
#### 2. `Matrix3X1<T>` - 3x1 vector operations
86
92
87
93
-**File:**`Source/EbsdLib/Math/Matrix3X1.hpp`
88
-
-**Status:**Only `cosTheta` tested (in QuaternionTest)
94
+
-**Status:****DONE** - `Source/Test/Matrix3X1Test.cpp` (20 test cases)
89
95
-**Why:** Core math class with known bugs (see Bugs #1 and #2)
90
96
-**Recommended tests:**
91
97
- Construction and element access
@@ -99,7 +105,7 @@ These classes have zero or near-zero test coverage and contain non-trivial logic
99
105
#### 3. `Matrix3X3<T>` - 3x3 matrix operations
100
106
101
107
-**File:**`Source/EbsdLib/Math/Matrix3X3.hpp`
102
-
-**Status:**Exercised in TextureTest but no assertions on results
108
+
-**Status:****DONE** - `Source/Test/Matrix3X3Test.cpp` (23 test cases)
103
109
-**Why:** Used in orientation math, coordinate transforms; currently only smoke-tested
104
110
-**Recommended tests:**
105
111
- Construction and element access
@@ -145,7 +151,7 @@ These classes have zero or near-zero test coverage and contain non-trivial logic
145
151
#### 7. `OrientationMath` - Crystallographic math
146
152
147
153
-**File:**`Source/EbsdLib/Core/OrientationMath.h`
148
-
-**Status:**No direct tests (indirectly exercised by ConvertToFundamentalZoneTest)
154
+
-**Status:****DONE** - `Source/Test/OrientationMathTest.cpp` (12 test cases)
149
155
-**Why:** Static methods for misorientation calculations, widely used
150
156
-**Recommended tests:**
151
157
-`axisAngletoMatrix()`, `quatsToMatrix()`
@@ -156,7 +162,7 @@ These classes have zero or near-zero test coverage and contain non-trivial logic
-**Status:****DONE** - `Source/Test/ToolTipGeneratorTest.cpp` (8 test cases). Also fixed bug where `generateHTML()` and `rowToHTML()` returned empty strings.
285
291
-**Recommended tests:**`addTitle()`, `addValue()`, output HTML correctness
0 commit comments