@@ -99,15 +99,15 @@ using torch::executor::testing::ProgramTestFriend;
99
99
TEST_F (ProgramTest, DataParsesWithMinimalVerification) {
100
100
// Parse the Program from the data.
101
101
Result<Program> program =
102
- Program::Load (add_loader_.get (), Program::Verification::Minimal);
102
+ Program::load (add_loader_.get (), Program::Verification::Minimal);
103
103
104
104
// Should have succeeded.
105
105
EXPECT_EQ (program.error (), Error::Ok);
106
106
}
107
107
108
108
TEST_F (ProgramTest, DataParsesWithInternalConsistencyVerification) {
109
109
// Parse the Program from the data.
110
- Result<Program> program = Program::Load (
110
+ Result<Program> program = Program::load (
111
111
add_loader_.get (), Program::Verification::InternalConsistency);
112
112
113
113
// Should have succeeded.
@@ -139,7 +139,7 @@ TEST_F(ProgramTest, BadMagicFailsToLoad) {
139
139
// Parse the Program from the data. Use minimal verification to show that
140
140
// even this catches the header problem.
141
141
Result<Program> program =
142
- Program::Load (&data_loader, Program::Verification::Minimal);
142
+ Program::load (&data_loader, Program::Verification::Minimal);
143
143
144
144
// Should fail.
145
145
ASSERT_EQ (program.error (), Error::InvalidProgram);
@@ -152,7 +152,7 @@ TEST_F(ProgramTest, BadMagicFailsToLoad) {
152
152
{
153
153
// Parse the Program from the data again.
154
154
Result<Program> program =
155
- Program::Load (&data_loader, Program::Verification::Minimal);
155
+ Program::load (&data_loader, Program::Verification::Minimal);
156
156
157
157
// Should now succeed.
158
158
ASSERT_EQ (program.error (), Error::Ok);
@@ -170,7 +170,7 @@ TEST_F(ProgramTest, VerificationCatchesTruncation) {
170
170
BufferDataLoader half_data_loader (full_data->data (), full_data_len / 2 );
171
171
172
172
// Loading with full verification should fail.
173
- Result<Program> program = Program::Load (
173
+ Result<Program> program = Program::load (
174
174
&half_data_loader, Program::Verification::InternalConsistency);
175
175
ASSERT_EQ (program.error (), Error::InvalidProgram);
176
176
}
@@ -195,7 +195,7 @@ TEST_F(ProgramTest, VerificationCatchesCorruption) {
195
195
196
196
// Should fail to parse corrupted data when using full verification.
197
197
Result<Program> program =
198
- Program::Load (&data_loader, Program::Verification::InternalConsistency);
198
+ Program::load (&data_loader, Program::Verification::InternalConsistency);
199
199
ASSERT_EQ (program.error (), Error::InvalidProgram);
200
200
}
201
201
@@ -216,14 +216,14 @@ TEST_F(ProgramTest, UnalignedProgramDataFails) {
216
216
217
217
// Should refuse to accept unaligned data.
218
218
Result<Program> program =
219
- Program::Load (&data_loader, Program::Verification::Minimal);
219
+ Program::load (&data_loader, Program::Verification::Minimal);
220
220
ASSERT_NE (program.error (), Error::Ok);
221
221
}
222
222
223
223
TEST_F (ProgramTest, LoadSegmentWithNoSegments) {
224
224
// Load a program with no segments.
225
225
Result<Program> program =
226
- Program::Load (add_loader_.get (), kDefaultVerification );
226
+ Program::load (add_loader_.get (), kDefaultVerification );
227
227
EXPECT_EQ (program.error (), Error::Ok);
228
228
229
229
// Loading a segment should fail.
@@ -305,7 +305,7 @@ TEST_F(ProgramTest, HeaderNotPresent) {
305
305
TEST_F (ProgramTest, getMethods) {
306
306
// Parse the Program from the data.
307
307
Result<Program> program_res =
308
- Program::Load (multi_loader_.get (), kDefaultVerification );
308
+ Program::load (multi_loader_.get (), kDefaultVerification );
309
309
EXPECT_EQ (program_res.error (), Error::Ok);
310
310
311
311
Program program (std::move (program_res.get ()));
@@ -319,3 +319,10 @@ TEST_F(ProgramTest, getMethods) {
319
319
EXPECT_TRUE (res2.ok ());
320
320
EXPECT_EQ (strcmp (res2.get (), " forward2" ), 0 );
321
321
}
322
+
323
+ // Test that the deprecated Load method (capital 'L') still works.
324
+ TEST_F (ProgramTest, DEPRECATEDLoad) {
325
+ // Parse the Program from the data.
326
+ Result<Program> program_res = Program::Load (multi_loader_.get ());
327
+ EXPECT_EQ (program_res.error (), Error::Ok);
328
+ }
0 commit comments