Skip to content

Commit 9054461

Browse files
authored
Merge pull request #34 from matlab-deep-learning/add_example_tests
Add example tests
2 parents 2eb2199 + e3f371a commit 9054461

File tree

3 files changed

+64
-0
lines changed

3 files changed

+64
-0
lines changed
Binary file not shown.
Binary file not shown.

tests/texampleTests.m

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
classdef texampleTests < matlab.unittest.TestCase
2+
% Smoke level tests for the example .mlx files
3+
4+
% Copyright 2024 The MathWorks, Inc.
5+
6+
methods (TestClassSetup)
7+
function setUpAndTearDowns(testCase)
8+
openAIEnvVar = "OPENAI_KEY";
9+
secretKey = getenv(openAIEnvVar);
10+
% Create an empty .env file because it is expected by our .mlx
11+
% example files
12+
writelines("",".env");
13+
14+
% Assign the value of the secret key to OPENAI_API_KEY using
15+
% the test fixture
16+
import matlab.unittest.fixtures.EnvironmentVariableFixture
17+
fixture = EnvironmentVariableFixture("OPENAI_API_KEY", secretKey);
18+
testCase.applyFixture(fixture);
19+
20+
testCase.addTeardown(@() iCloseAll());
21+
end
22+
end
23+
24+
methods(Test)
25+
function testAnalyzeScientificPapersUsingFunctionCalls(~)
26+
AnalyzeScientificPapersUsingFunctionCalls;
27+
end
28+
29+
function testProcessGeneratedTextinRealTimebyUsingChatGPTinStreamingMode(~)
30+
ProcessGeneratedTextinRealTimebyUsingChatGPTinStreamingMode;
31+
end
32+
33+
function testUsingDALLEToGenerateImages(~)
34+
UsingDALLEToGenerateImages;
35+
end
36+
37+
function testInformationRetrievalUsingOpenAIDocumentEmbedding(~)
38+
InformationRetrievalUsingOpenAIDocumentEmbedding;
39+
end
40+
41+
function testDescribeImagesUsingChatGPT(~)
42+
DescribeImagesUsingChatGPT;
43+
end
44+
45+
function testSummarizeLargeDocumentsUsingChatGPTandMATLAB(~)
46+
SummarizeLargeDocumentsUsingChatGPTandMATLAB;
47+
end
48+
49+
function testAnalyzeTextDataUsingParallelFunctionCallwithChatGPT(~)
50+
AnalyzeTextDataUsingParallelFunctionCallwithChatGPT;
51+
end
52+
53+
function testRetrievalAugmentedGenerationUsingChatGPTandMATLAB(~)
54+
RetrievalAugmentedGenerationUsingChatGPTandMATLAB;
55+
end
56+
end
57+
58+
end
59+
60+
function iCloseAll()
61+
% Close all opened figures
62+
allFig = findall(0, 'type', 'figure');
63+
close(allFig)
64+
end

0 commit comments

Comments
 (0)