Skip to content

Commit 226346a

Browse files
committed
update changelog and tests
1 parent 02ed0a1 commit 226346a

2 files changed

Lines changed: 16 additions & 3 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1313
### Fixed
1414

1515
- Set precision in `DTensor::saveToFile` properly
16-
16+
- `DTensor<T>::parseFromTextFile` throws `std::invalid_argument` if `T` is unsupported
1717

1818
<!-- ---------------------
1919
v1.5.0

test/testTensor.cu

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,9 +122,9 @@ TEST_F(TensorTest, randomTensorCreation) {
122122

123123
TEMPLATE_WITH_TYPE_T
124124
void parseTensorFromFile() {
125-
size_t n_runs = 20;
125+
size_t n_runs = 10;
126126
for (size_t i = 0; i < n_runs; i++) {
127-
size_t nR = 20, nC = 40, nM = 60;
127+
size_t nR = 20, nC = 40, nM = 6;
128128
auto r = DTensor<T>::createRandomTensor(nR, nC, nM, -1, 1);
129129
std::string fName = "myTest.dtensor";
130130
r.saveToFile(fName);
@@ -143,6 +143,19 @@ TEST_F(TensorTest, parseTensorFromFile) {
143143
parseTensorFromFile<double>();
144144
}
145145

146+
TEST_F(TensorTest, parseTensorUnsupportedDataType) {
147+
size_t nR = 20, nC = 40, nM = 60;
148+
auto r = DTensor<double>::createRandomTensor(nR, nC, nM, -1, 1);
149+
std::string fName = "myTest.dtensor";
150+
r.saveToFile(fName);
151+
try {
152+
auto a = DTensor<char>::parseFromTextFile(fName);
153+
} catch (const std::invalid_argument& _e) {
154+
return;
155+
}
156+
FAIL();
157+
}
158+
146159
/* ---------------------------------------
147160
* Move constructor
148161
* --------------------------------------- */

0 commit comments

Comments
 (0)