}
}
}
- if (!descriptor.IncrementSubscripts(subscripts) && j + 1 < numElements) {
- io.GetIoErrorHandler().Crash(
- "FormattedCharacterIO: subscripts out of bounds");
- }
} else {
return false;
}
+ if (!descriptor.IncrementSubscripts(subscripts) && j + 1 < numElements) {
+ io.GetIoErrorHandler().Crash(
+ "FormattedCharacterIO: subscripts out of bounds");
+ }
}
return true;
}
}
}
}
- if (!descriptor.IncrementSubscripts(subscripts) && j + 1 < numElements) {
- io.GetIoErrorHandler().Crash(
- "FormattedLogicalIO: subscripts out of bounds");
- }
} else {
return false;
}
+ if (!descriptor.IncrementSubscripts(subscripts) && j + 1 < numElements) {
+ io.GetIoErrorHandler().Crash(
+ "FormattedLogicalIO: subscripts out of bounds");
+ }
}
return true;
}
}
}
+static void descrOutputTest() {
+ char buffer[9];
+ // Formatted
+ const char *format{"(2A4)"};
+ auto cookie{IONAME(BeginInternalFormattedOutput)(
+ buffer, sizeof buffer, format, std::strlen(format))};
+ StaticDescriptor<1> staticDescriptor;
+ Descriptor &desc{staticDescriptor.descriptor()};
+ SubscriptValue extent[]{2};
+ char data[2][4];
+ std::memcpy(data[0], "ABCD", 4);
+ std::memcpy(data[1], "EFGH", 4);
+ desc.Establish(TypeCode{CFI_type_char}, sizeof data[0], &data, 1, extent);
+ desc.Dump();
+ desc.Check();
+ IONAME(OutputDescriptor)(cookie, desc);
+ if (auto status{IONAME(EndIoStatement)(cookie)}) {
+ Fail() << "descrOutputTest: '" << format << "' failed, status "
+ << static_cast<int>(status) << '\n';
+ } else {
+ test("descrOutputTest(formatted)", "ABCDEFGH ",
+ std::string{buffer, sizeof buffer});
+ }
+ // List-directed
+ cookie = IONAME(BeginInternalListOutput)(buffer, sizeof buffer);
+ IONAME(OutputDescriptor)(cookie, desc);
+ if (auto status{IONAME(EndIoStatement)(cookie)}) {
+ Fail() << "descrOutputTest: list-directed failed, status "
+ << static_cast<int>(status) << '\n';
+ } else {
+ test("descrOutputTest(list)", " ABCDEFGH",
+ std::string{buffer, sizeof buffer});
+ }
+}
+
static void realTest(const char *format, double x, const char *expect) {
char buffer[800];
auto cookie{IONAME(BeginInternalFormattedOutput)(
realInTest("(DC,F18.0)", " 12,5", 0x4029000000000000);
listInputTest();
+ descrOutputTest();
return EndTests();
}