init
commit
5194d8cbde
Binary file not shown.
|
@ -0,0 +1,8 @@
|
||||||
|
# Default ignored files
|
||||||
|
/shelf/
|
||||||
|
/workspace.xml
|
||||||
|
# Editor-based HTTP Client requests
|
||||||
|
/httpRequests/
|
||||||
|
# Datasource local storage ignored files
|
||||||
|
/dataSources/
|
||||||
|
/dataSources.local.xml
|
|
@ -0,0 +1,2 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<module classpath="CMake" type="CPP_MODULE" version="4" />
|
|
@ -0,0 +1,4 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="CMakeWorkspace" PROJECT_DIR="$PROJECT_DIR$" />
|
||||||
|
</project>
|
|
@ -0,0 +1,8 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="ProjectModuleManager">
|
||||||
|
<modules>
|
||||||
|
<module fileurl="file://$PROJECT_DIR$/.idea/COSC3P95_A1Q2.iml" filepath="$PROJECT_DIR$/.idea/COSC3P95_A1Q2.iml" />
|
||||||
|
</modules>
|
||||||
|
</component>
|
||||||
|
</project>
|
|
@ -0,0 +1,6 @@
|
||||||
|
cmake_minimum_required(VERSION 3.0)
|
||||||
|
project(COSC3P95_A1Q2)
|
||||||
|
|
||||||
|
set(CMAKE_CXX_STANDARD 20)
|
||||||
|
|
||||||
|
add_executable(COSC3P95_A1Q2 main.cpp)
|
Binary file not shown.
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,137 @@
|
||||||
|
/**
|
||||||
|
* Email: bt19ex@brocku.ca
|
||||||
|
* Student Number: 6920201
|
||||||
|
* Licence: GPL3.0 see https://www.gnu.org/licenses/gpl-3.0.en.html for more detail
|
||||||
|
* Basic random test case generator and tester with partially formatted output. Requires terminal unicode and ANSI escape code support for full effect.
|
||||||
|
*
|
||||||
|
* Please use Linux to run this software, tested on Debian stable using CLion 2023.2.2 // GCC version 12.2
|
||||||
|
* This should work on any linux distro with a C++20 compiler.
|
||||||
|
* CMake is optional as this file can be compiled via g++
|
||||||
|
* An compile command would be:
|
||||||
|
* `g++ -O3 -o main.run -Wall -Wpedantic -Wextra -Werror main.cpp && ./main.run`
|
||||||
|
* If you use CMake please make sure CMAKE_BUILD_TYPE is release otherwise the program will take a long time to run.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#include <iostream>
|
||||||
|
#include <random>
|
||||||
|
#include <vector>
|
||||||
|
#include <cstdint>
|
||||||
|
#include <algorithm>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Config Variables
|
||||||
|
* ---------------------------------------
|
||||||
|
*/
|
||||||
|
static constexpr size_t DEFAULT_TEST_COUNT = 10; // Default: 10 tests
|
||||||
|
static constexpr size_t MAX_RAM_USAGE = 1ul * 1024ul * 1024ul; // Default: 1mb per test
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Do not change anything below this line!
|
||||||
|
* ---------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
static constexpr auto maxSize = MAX_RAM_USAGE / sizeof(std::int32_t);
|
||||||
|
static const auto maxChars = std::to_string(maxSize).size();
|
||||||
|
|
||||||
|
struct failPoint
|
||||||
|
{
|
||||||
|
size_t i, j;
|
||||||
|
};
|
||||||
|
|
||||||
|
// fp has no meaning if the test doesn't fail.
|
||||||
|
bool validateTest(const std::vector<std::int32_t>& in, failPoint& fp)
|
||||||
|
{
|
||||||
|
// empty sets are sorted. if you have a problem with this take it up with god
|
||||||
|
if (in.empty())
|
||||||
|
return true;
|
||||||
|
for (size_t i = 0; i < in.size(); i++)
|
||||||
|
{
|
||||||
|
for (size_t j = i; j < in.size(); j++)
|
||||||
|
{
|
||||||
|
// if any value after the current value is less, then we have failed to sort.
|
||||||
|
if (in[i] > in[j])
|
||||||
|
{
|
||||||
|
fp = {i, j};
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::vector<std::int32_t> generateRandomData()
|
||||||
|
{
|
||||||
|
// setup random numbers
|
||||||
|
static std::random_device dev;
|
||||||
|
static std::mt19937_64 engine(dev());
|
||||||
|
// don't want the int array to be too big otherwise we'll run out of ram. you can change this for your machine but im on my laptop rn
|
||||||
|
// if it mattered I'd test it on my desktop with 4gb array allocations, but it doesn't
|
||||||
|
std::uniform_int_distribution dist(std::numeric_limits<std::int32_t>::min(), std::numeric_limits<std::int32_t>::max());
|
||||||
|
std::uniform_int_distribution dist_size(0ul, maxSize);
|
||||||
|
// pick a random size
|
||||||
|
size_t size = dist_size(engine);
|
||||||
|
// populate the array
|
||||||
|
std::vector<std::int32_t> ret;
|
||||||
|
for (size_t i = 0; i < size; i++)
|
||||||
|
ret.push_back(dist(engine));
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
template<typename T>
|
||||||
|
void runTest(T t, std::string name)
|
||||||
|
{
|
||||||
|
auto data = generateRandomData();
|
||||||
|
// little extra formatting goes a long way =3
|
||||||
|
name += "; Data Size: ";
|
||||||
|
auto dataSizeStr = std::to_string(data.size());
|
||||||
|
name += dataSizeStr;
|
||||||
|
|
||||||
|
// run the sort on the data
|
||||||
|
t(data);
|
||||||
|
|
||||||
|
// add padding for nice output :P
|
||||||
|
std::string padding;
|
||||||
|
for (size_t i = 0; i < maxChars - dataSizeStr.size(); i++)
|
||||||
|
padding += ' ';
|
||||||
|
|
||||||
|
failPoint fp{};
|
||||||
|
// input and output arrays cannot be shown due to their potential size. Instead, the software will output the failure value and locations.
|
||||||
|
// sometimes they are neighbours sometimes they are far apart. it depends on the randomness
|
||||||
|
if (validateTest(data, fp))
|
||||||
|
std::cout << "\033[36m[\033[32m✓\033[36m]:\033[0m Test '" << name << "'" << padding << "\t\033[32mPASSED\033[0m" << std::endl;
|
||||||
|
else
|
||||||
|
std::cout << "\033[36m[\033[31mX\033[36m]:\033[0m Test '" << name << "'" << padding << "\t\033[31mFAILED\t\t" << "Value '" << data[fp.i]
|
||||||
|
<< "' @ " << fp.i << " is greater than '" << data[fp.j] << "' @ " << fp.j << "\033[0m" << std::endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
void brettSort(std::vector<std::int32_t>& v)
|
||||||
|
{
|
||||||
|
if (v.empty())
|
||||||
|
return;
|
||||||
|
static std::random_device dev;
|
||||||
|
static std::mt19937_64 engine(dev());
|
||||||
|
// since the STL won't fail (it's pretty good as long as you follow the rules)
|
||||||
|
std::sort(v.begin(), v.end());
|
||||||
|
// we can add some errors (sometimes) that will cause our test to fail (also sometimes)!
|
||||||
|
std::uniform_int_distribution<int> dist(0, (int) v.size() - 1);
|
||||||
|
std::uniform_real_distribution realDist(0.0, 1.0);
|
||||||
|
int p1 = dist(engine);
|
||||||
|
int p2 = dist(engine);
|
||||||
|
if (!v.empty() && realDist(engine) > 0.85)
|
||||||
|
v[p1] = v[p2];
|
||||||
|
}
|
||||||
|
|
||||||
|
int main(int argc, char** argv)
|
||||||
|
{
|
||||||
|
std::cout << "You can provide a test count via ./program [test count]" << std::endl;
|
||||||
|
auto testCount = DEFAULT_TEST_COUNT;
|
||||||
|
if (argc > 1)
|
||||||
|
testCount = std::stoi(argv[1]);
|
||||||
|
std::cout << "Running " << testCount << " tests" << std::endl;
|
||||||
|
// the brett sort should fail at some point
|
||||||
|
for (size_t i = 0; i < testCount; i++)
|
||||||
|
runTest(brettSort, "brettSort");
|
||||||
|
return 0;
|
||||||
|
}
|
Binary file not shown.
|
@ -0,0 +1,134 @@
|
||||||
|
<mxfile host="Electron" modified="2023-10-11T20:50:58.356Z" agent="Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) draw.io/22.0.2 Chrome/114.0.5735.289 Electron/25.8.4 Safari/537.36" etag="GeafdJRvFsd9HXY3d6Qt" version="22.0.2" type="device">
|
||||||
|
<diagram id="C5RBs43oDa-KdzZeNtuy" name="Page-1">
|
||||||
|
<mxGraphModel dx="462" dy="2013" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="827" pageHeight="1169" math="0" shadow="0">
|
||||||
|
<root>
|
||||||
|
<mxCell id="WIyWlLk6GJQsqaUBKTNV-0" />
|
||||||
|
<mxCell id="WIyWlLk6GJQsqaUBKTNV-1" parent="WIyWlLk6GJQsqaUBKTNV-0" />
|
||||||
|
<mxCell id="YqphevozqqffcnETHiAa-3" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;" edge="1" parent="WIyWlLk6GJQsqaUBKTNV-1" source="WIyWlLk6GJQsqaUBKTNV-3" target="YqphevozqqffcnETHiAa-0">
|
||||||
|
<mxGeometry relative="1" as="geometry" />
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="WIyWlLk6GJQsqaUBKTNV-3" value="Start(data, limit, exceptions&gt;" style="rounded=1;whiteSpace=wrap;html=1;fontSize=12;glass=0;strokeWidth=1;shadow=0;" parent="WIyWlLk6GJQsqaUBKTNV-1" vertex="1">
|
||||||
|
<mxGeometry x="125" y="-30" width="190" height="40" as="geometry" />
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="YqphevozqqffcnETHiAa-7" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;entryX=0;entryY=0.5;entryDx=0;entryDy=0;" edge="1" parent="WIyWlLk6GJQsqaUBKTNV-1" source="WIyWlLk6GJQsqaUBKTNV-6" target="YqphevozqqffcnETHiAa-6">
|
||||||
|
<mxGeometry relative="1" as="geometry" />
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="YqphevozqqffcnETHiAa-8" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;" edge="1" parent="WIyWlLk6GJQsqaUBKTNV-1" source="WIyWlLk6GJQsqaUBKTNV-6" target="YqphevozqqffcnETHiAa-6">
|
||||||
|
<mxGeometry relative="1" as="geometry" />
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="YqphevozqqffcnETHiAa-14" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;entryX=0.5;entryY=0;entryDx=0;entryDy=0;" edge="1" parent="WIyWlLk6GJQsqaUBKTNV-1" source="WIyWlLk6GJQsqaUBKTNV-6" target="YqphevozqqffcnETHiAa-12">
|
||||||
|
<mxGeometry relative="1" as="geometry" />
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="WIyWlLk6GJQsqaUBKTNV-6" value="index &lt; len(data)" style="rhombus;whiteSpace=wrap;html=1;shadow=0;fontFamily=Helvetica;fontSize=12;align=center;strokeWidth=1;spacing=6;spacingTop=-4;" parent="WIyWlLk6GJQsqaUBKTNV-1" vertex="1">
|
||||||
|
<mxGeometry x="160" y="160" width="120" height="90" as="geometry" />
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="YqphevozqqffcnETHiAa-4" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;" edge="1" parent="WIyWlLk6GJQsqaUBKTNV-1" source="YqphevozqqffcnETHiAa-0" target="YqphevozqqffcnETHiAa-2">
|
||||||
|
<mxGeometry relative="1" as="geometry" />
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="YqphevozqqffcnETHiAa-0" value="index = 0" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="WIyWlLk6GJQsqaUBKTNV-1">
|
||||||
|
<mxGeometry x="160" y="40" width="120" height="30" as="geometry" />
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="YqphevozqqffcnETHiAa-1" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=1;exitDx=0;exitDy=0;" edge="1" parent="WIyWlLk6GJQsqaUBKTNV-1" source="YqphevozqqffcnETHiAa-0" target="YqphevozqqffcnETHiAa-0">
|
||||||
|
<mxGeometry relative="1" as="geometry" />
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="YqphevozqqffcnETHiAa-5" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;" edge="1" parent="WIyWlLk6GJQsqaUBKTNV-1" source="YqphevozqqffcnETHiAa-2" target="WIyWlLk6GJQsqaUBKTNV-6">
|
||||||
|
<mxGeometry relative="1" as="geometry" />
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="YqphevozqqffcnETHiAa-2" value="filtered_data = 0" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="WIyWlLk6GJQsqaUBKTNV-1">
|
||||||
|
<mxGeometry x="160" y="90" width="120" height="30" as="geometry" />
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="YqphevozqqffcnETHiAa-6" value="return filtered_data" style="rounded=1;whiteSpace=wrap;html=1;" vertex="1" parent="WIyWlLk6GJQsqaUBKTNV-1">
|
||||||
|
<mxGeometry x="370" y="175" width="120" height="60" as="geometry" />
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="YqphevozqqffcnETHiAa-9" value="False" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" vertex="1" parent="WIyWlLk6GJQsqaUBKTNV-1">
|
||||||
|
<mxGeometry x="300" y="170" width="60" height="30" as="geometry" />
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="YqphevozqqffcnETHiAa-11" value="True" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" vertex="1" parent="WIyWlLk6GJQsqaUBKTNV-1">
|
||||||
|
<mxGeometry x="210" y="250" width="60" height="30" as="geometry" />
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="YqphevozqqffcnETHiAa-23" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;entryX=0.5;entryY=0;entryDx=0;entryDy=0;" edge="1" parent="WIyWlLk6GJQsqaUBKTNV-1" source="YqphevozqqffcnETHiAa-12" target="YqphevozqqffcnETHiAa-17">
|
||||||
|
<mxGeometry relative="1" as="geometry" />
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="YqphevozqqffcnETHiAa-12" value="item = data[index]" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="WIyWlLk6GJQsqaUBKTNV-1">
|
||||||
|
<mxGeometry x="160" y="300" width="120" height="30" as="geometry" />
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="YqphevozqqffcnETHiAa-24" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;" edge="1" parent="WIyWlLk6GJQsqaUBKTNV-1" source="YqphevozqqffcnETHiAa-17" target="YqphevozqqffcnETHiAa-21">
|
||||||
|
<mxGeometry relative="1" as="geometry" />
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="YqphevozqqffcnETHiAa-35" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;entryX=0;entryY=0.5;entryDx=0;entryDy=0;" edge="1" parent="WIyWlLk6GJQsqaUBKTNV-1" source="YqphevozqqffcnETHiAa-17" target="YqphevozqqffcnETHiAa-34">
|
||||||
|
<mxGeometry relative="1" as="geometry" />
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="YqphevozqqffcnETHiAa-17" value="item in exceptions" style="rhombus;whiteSpace=wrap;html=1;" vertex="1" parent="WIyWlLk6GJQsqaUBKTNV-1">
|
||||||
|
<mxGeometry x="155" y="370" width="130" height="80" as="geometry" />
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="YqphevozqqffcnETHiAa-37" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;" edge="1" parent="WIyWlLk6GJQsqaUBKTNV-1" source="YqphevozqqffcnETHiAa-21" target="YqphevozqqffcnETHiAa-36">
|
||||||
|
<mxGeometry relative="1" as="geometry" />
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="YqphevozqqffcnETHiAa-39" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;entryX=0.5;entryY=0;entryDx=0;entryDy=0;" edge="1" parent="WIyWlLk6GJQsqaUBKTNV-1" source="YqphevozqqffcnETHiAa-21" target="YqphevozqqffcnETHiAa-38">
|
||||||
|
<mxGeometry relative="1" as="geometry" />
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="YqphevozqqffcnETHiAa-21" value="item &gt; limit" style="rhombus;whiteSpace=wrap;html=1;" vertex="1" parent="WIyWlLk6GJQsqaUBKTNV-1">
|
||||||
|
<mxGeometry x="150" y="470" width="140" height="80" as="geometry" />
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="YqphevozqqffcnETHiAa-41" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;entryX=0.5;entryY=0;entryDx=0;entryDy=0;" edge="1" parent="WIyWlLk6GJQsqaUBKTNV-1" source="YqphevozqqffcnETHiAa-25" target="YqphevozqqffcnETHiAa-27">
|
||||||
|
<mxGeometry relative="1" as="geometry" />
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="YqphevozqqffcnETHiAa-25" value="add modified_item&nbsp;to filtered_data" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="WIyWlLk6GJQsqaUBKTNV-1">
|
||||||
|
<mxGeometry x="160" y="700" width="120" height="60" as="geometry" />
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="YqphevozqqffcnETHiAa-29" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;entryX=0;entryY=0.5;entryDx=0;entryDy=0;" edge="1" parent="WIyWlLk6GJQsqaUBKTNV-1" source="YqphevozqqffcnETHiAa-27" target="WIyWlLk6GJQsqaUBKTNV-6">
|
||||||
|
<mxGeometry relative="1" as="geometry">
|
||||||
|
<mxPoint x="50" y="200" as="targetPoint" />
|
||||||
|
<Array as="points">
|
||||||
|
<mxPoint x="20" y="830" />
|
||||||
|
<mxPoint x="20" y="205" />
|
||||||
|
</Array>
|
||||||
|
</mxGeometry>
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="YqphevozqqffcnETHiAa-27" value="index = index + 1" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="WIyWlLk6GJQsqaUBKTNV-1">
|
||||||
|
<mxGeometry x="160" y="800" width="120" height="60" as="geometry" />
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="YqphevozqqffcnETHiAa-32" value="False" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" vertex="1" parent="WIyWlLk6GJQsqaUBKTNV-1">
|
||||||
|
<mxGeometry x="150" y="440" width="60" height="30" as="geometry" />
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="YqphevozqqffcnETHiAa-33" value="False" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" vertex="1" parent="WIyWlLk6GJQsqaUBKTNV-1">
|
||||||
|
<mxGeometry x="150" y="555" width="60" height="30" as="geometry" />
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="YqphevozqqffcnETHiAa-43" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;entryX=1;entryY=0.5;entryDx=0;entryDy=0;" edge="1" parent="WIyWlLk6GJQsqaUBKTNV-1" source="YqphevozqqffcnETHiAa-34" target="YqphevozqqffcnETHiAa-25">
|
||||||
|
<mxGeometry relative="1" as="geometry">
|
||||||
|
<Array as="points">
|
||||||
|
<mxPoint x="530" y="410" />
|
||||||
|
<mxPoint x="530" y="730" />
|
||||||
|
</Array>
|
||||||
|
</mxGeometry>
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="YqphevozqqffcnETHiAa-34" value="modified_item&nbsp;= item + "_EXCEPTION"" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="WIyWlLk6GJQsqaUBKTNV-1">
|
||||||
|
<mxGeometry x="370" y="380" width="120" height="60" as="geometry" />
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="YqphevozqqffcnETHiAa-42" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;entryX=1;entryY=0.5;entryDx=0;entryDy=0;" edge="1" parent="WIyWlLk6GJQsqaUBKTNV-1" source="YqphevozqqffcnETHiAa-36" target="YqphevozqqffcnETHiAa-25">
|
||||||
|
<mxGeometry relative="1" as="geometry">
|
||||||
|
<Array as="points">
|
||||||
|
<mxPoint x="530" y="510" />
|
||||||
|
<mxPoint x="530" y="730" />
|
||||||
|
</Array>
|
||||||
|
</mxGeometry>
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="YqphevozqqffcnETHiAa-36" value="modified_item&nbsp;= item * 2" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="WIyWlLk6GJQsqaUBKTNV-1">
|
||||||
|
<mxGeometry x="370" y="480" width="120" height="60" as="geometry" />
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="YqphevozqqffcnETHiAa-40" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;" edge="1" parent="WIyWlLk6GJQsqaUBKTNV-1" source="YqphevozqqffcnETHiAa-38" target="YqphevozqqffcnETHiAa-25">
|
||||||
|
<mxGeometry relative="1" as="geometry" />
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="YqphevozqqffcnETHiAa-38" value="modified_item = item / limit" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="WIyWlLk6GJQsqaUBKTNV-1">
|
||||||
|
<mxGeometry x="160" y="610" width="120" height="60" as="geometry" />
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="YqphevozqqffcnETHiAa-44" value="True" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" vertex="1" parent="WIyWlLk6GJQsqaUBKTNV-1">
|
||||||
|
<mxGeometry x="300" y="370" width="60" height="30" as="geometry" />
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="YqphevozqqffcnETHiAa-45" value="True" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" vertex="1" parent="WIyWlLk6GJQsqaUBKTNV-1">
|
||||||
|
<mxGeometry x="300" y="470" width="60" height="30" as="geometry" />
|
||||||
|
</mxCell>
|
||||||
|
</root>
|
||||||
|
</mxGraphModel>
|
||||||
|
</diagram>
|
||||||
|
</mxfile>
|
Binary file not shown.
After Width: | Height: | Size: 63 KiB |
|
@ -0,0 +1,88 @@
|
||||||
|
# Brett Terpstra
|
||||||
|
# bt19ex@brocku.ca 6920201
|
||||||
|
|
||||||
|
|
||||||
|
# functional version of the code to test against
|
||||||
|
def workingProcessString(input_str):
|
||||||
|
output_str = ""
|
||||||
|
for char in input_str:
|
||||||
|
if char.isupper():
|
||||||
|
output_str += char.lower()
|
||||||
|
elif char.isnumeric():
|
||||||
|
output_str += char
|
||||||
|
else:
|
||||||
|
output_str += char.upper()
|
||||||
|
return output_str
|
||||||
|
|
||||||
|
# the failing version of the code
|
||||||
|
def processString(input_str):
|
||||||
|
output_str = ""
|
||||||
|
for char in input_str:
|
||||||
|
if char.isupper():
|
||||||
|
output_str += char.lower()
|
||||||
|
elif char.isnumeric():
|
||||||
|
output_str += char * 2
|
||||||
|
else:
|
||||||
|
output_str += char.upper()
|
||||||
|
return output_str
|
||||||
|
|
||||||
|
# function to test an input string
|
||||||
|
def processTest(input):
|
||||||
|
# fancy output.
|
||||||
|
print(f"-------------------[ {input} ]-------------------")
|
||||||
|
parts_to_test = []
|
||||||
|
failing_strings = []
|
||||||
|
passing_strings = []
|
||||||
|
# simple recursion emulation with a while loop
|
||||||
|
parts_to_test.append(input)
|
||||||
|
while parts_to_test:
|
||||||
|
# process the front of the queue
|
||||||
|
s = parts_to_test[0]
|
||||||
|
o1 = workingProcessString(s)
|
||||||
|
o2 = processString(s)
|
||||||
|
# only make substrings that make sense, recursion base case. Append these to the queue
|
||||||
|
if len(s) > 1:
|
||||||
|
h1, h2 = s[:len(s)//2], s[len(s)//2:]
|
||||||
|
parts_to_test.append(h1)
|
||||||
|
parts_to_test.append(h2)
|
||||||
|
# remove the front element from the queue
|
||||||
|
parts_to_test.pop(0)
|
||||||
|
# append to the tracking lists for later printing and sorting
|
||||||
|
if o1 != o2:
|
||||||
|
failing_strings.append(s)
|
||||||
|
else:
|
||||||
|
passing_strings.append(s)
|
||||||
|
# sort the failures in order of largest to smallest
|
||||||
|
sorted_failings = sorted(failing_strings, key=lambda x: -len(x))
|
||||||
|
# I don't know what kind of output you were looking for so I printed every bit of information I have
|
||||||
|
if len(passing_strings) > 0:
|
||||||
|
print(f"For input {input} we found {len(passing_strings)} passing strings:")
|
||||||
|
for p in passing_strings:
|
||||||
|
print(f"\t{p}")
|
||||||
|
print()
|
||||||
|
|
||||||
|
if len(sorted_failings) > 0:
|
||||||
|
print(f"For input {input} we found {len(sorted_failings)} failing strings:")
|
||||||
|
for f in sorted_failings:
|
||||||
|
print(f"\t{f}")
|
||||||
|
print()
|
||||||
|
|
||||||
|
# printing the smallest is probably the most important
|
||||||
|
# since it'll tell us the place of the bug
|
||||||
|
smallest = len(sorted_failings[len(sorted_failings)-1])
|
||||||
|
print(f"For input {input} the smallest erroring strings are:")
|
||||||
|
for f in sorted_failings:
|
||||||
|
if len(f) == smallest:
|
||||||
|
print(f"\t{f}")
|
||||||
|
print()
|
||||||
|
else:
|
||||||
|
print("No failing strings found!")
|
||||||
|
|
||||||
|
processTest("abcdefG1")
|
||||||
|
print()
|
||||||
|
processTest("CCDDEExy")
|
||||||
|
print()
|
||||||
|
processTest("1234567b")
|
||||||
|
print()
|
||||||
|
processTest("8665")
|
||||||
|
|
|
@ -0,0 +1,90 @@
|
||||||
|
-------------------[ abcdefG1 ]-------------------
|
||||||
|
For input abcdefG1 we found 11 passing strings:
|
||||||
|
abcd
|
||||||
|
ab
|
||||||
|
cd
|
||||||
|
ef
|
||||||
|
a
|
||||||
|
b
|
||||||
|
c
|
||||||
|
d
|
||||||
|
e
|
||||||
|
f
|
||||||
|
G
|
||||||
|
|
||||||
|
For input abcdefG1 we found 4 failing strings:
|
||||||
|
abcdefG1
|
||||||
|
efG1
|
||||||
|
G1
|
||||||
|
1
|
||||||
|
|
||||||
|
For input abcdefG1 the smallest erroring strings are:
|
||||||
|
1
|
||||||
|
|
||||||
|
|
||||||
|
-------------------[ CCDDEExy ]-------------------
|
||||||
|
For input CCDDEExy we found 15 passing strings:
|
||||||
|
CCDDEExy
|
||||||
|
CCDD
|
||||||
|
EExy
|
||||||
|
CC
|
||||||
|
DD
|
||||||
|
EE
|
||||||
|
xy
|
||||||
|
C
|
||||||
|
C
|
||||||
|
D
|
||||||
|
D
|
||||||
|
E
|
||||||
|
E
|
||||||
|
x
|
||||||
|
y
|
||||||
|
|
||||||
|
No failing strings found!
|
||||||
|
|
||||||
|
-------------------[ 1234567b ]-------------------
|
||||||
|
For input 1234567b we found 1 passing strings:
|
||||||
|
b
|
||||||
|
|
||||||
|
For input 1234567b we found 14 failing strings:
|
||||||
|
1234567b
|
||||||
|
1234
|
||||||
|
567b
|
||||||
|
12
|
||||||
|
34
|
||||||
|
56
|
||||||
|
7b
|
||||||
|
1
|
||||||
|
2
|
||||||
|
3
|
||||||
|
4
|
||||||
|
5
|
||||||
|
6
|
||||||
|
7
|
||||||
|
|
||||||
|
For input 1234567b the smallest erroring strings are:
|
||||||
|
1
|
||||||
|
2
|
||||||
|
3
|
||||||
|
4
|
||||||
|
5
|
||||||
|
6
|
||||||
|
7
|
||||||
|
|
||||||
|
|
||||||
|
-------------------[ 8665 ]-------------------
|
||||||
|
For input 8665 we found 7 failing strings:
|
||||||
|
8665
|
||||||
|
86
|
||||||
|
65
|
||||||
|
8
|
||||||
|
6
|
||||||
|
6
|
||||||
|
5
|
||||||
|
|
||||||
|
For input 8665 the smallest erroring strings are:
|
||||||
|
8
|
||||||
|
6
|
||||||
|
6
|
||||||
|
5
|
||||||
|
|
|
@ -0,0 +1,88 @@
|
||||||
|
Running with test cases:
|
||||||
|
1: data = [], limit = 0, exceptions=[]
|
||||||
|
2: data = [55, 12, 66], limit = 18, exceptions=[55]
|
||||||
|
3: data = [12], limit = 18, exceptions=[]
|
||||||
|
4: data = [69], limit = 420, exceptions=[69]
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Running tests for mutation 1
|
||||||
|
----------------------------
|
||||||
|
Unmodified function returned [] while the modified function returned [] on test case 1
|
||||||
|
TEST CASE 1 PASSED
|
||||||
|
Unmodified function returned ['55_EXCEPTION', 0.6666666666666666, 132] while the modified function returned ['55_EXCEPTION', 0.6666666666666666, 68] on test case 2
|
||||||
|
TEST CASE 2 FAILED
|
||||||
|
Unmodified function returned [0.6666666666666666] while the modified function returned [0.6666666666666666] on test case 3
|
||||||
|
TEST CASE 3 PASSED
|
||||||
|
Unmodified function returned ['69_EXCEPTION'] while the modified function returned ['69_EXCEPTION'] on test case 4
|
||||||
|
TEST CASE 4 PASSED
|
||||||
|
|
||||||
|
|
||||||
|
Running tests for mutation 2
|
||||||
|
----------------------------
|
||||||
|
Unmodified function returned [] while the modified function returned [] on test case 1
|
||||||
|
TEST CASE 1 PASSED
|
||||||
|
Unmodified function returned ['55_EXCEPTION', 0.6666666666666666, 132] while the modified function returned [110, '12_EXCEPTION', '66_EXCEPTION'] on test case 2
|
||||||
|
TEST CASE 2 FAILED
|
||||||
|
Unmodified function returned [0.6666666666666666] while the modified function returned ['12_EXCEPTION'] on test case 3
|
||||||
|
TEST CASE 3 FAILED
|
||||||
|
Unmodified function returned ['69_EXCEPTION'] while the modified function returned [0.16428571428571428] on test case 4
|
||||||
|
TEST CASE 4 FAILED
|
||||||
|
|
||||||
|
|
||||||
|
Running tests for mutation 3
|
||||||
|
----------------------------
|
||||||
|
Unmodified function returned [] while the modified function returned [] on test case 1
|
||||||
|
TEST CASE 1 PASSED
|
||||||
|
Unmodified function returned ['55_EXCEPTION', 0.6666666666666666, 132] while the modified function returned [0.6666666666666666, 132] on test case 2
|
||||||
|
TEST CASE 2 FAILED
|
||||||
|
Unmodified function returned [0.6666666666666666] while the modified function returned [] on test case 3
|
||||||
|
TEST CASE 3 FAILED
|
||||||
|
Unmodified function returned ['69_EXCEPTION'] while the modified function returned [] on test case 4
|
||||||
|
TEST CASE 4 FAILED
|
||||||
|
|
||||||
|
|
||||||
|
Running tests for mutation 4
|
||||||
|
----------------------------
|
||||||
|
Unmodified function returned [] while the modified function returned [] on test case 1
|
||||||
|
TEST CASE 1 PASSED
|
||||||
|
Unmodified function returned ['55_EXCEPTION', 0.6666666666666666, 132] while the modified function returned ['55_EXCEPTION', '12_EXCEPTION', '66_EXCEPTION'] on test case 2
|
||||||
|
TEST CASE 2 FAILED
|
||||||
|
Unmodified function returned [0.6666666666666666] while the modified function returned ['12_EXCEPTION'] on test case 3
|
||||||
|
TEST CASE 3 FAILED
|
||||||
|
Unmodified function returned ['69_EXCEPTION'] while the modified function returned ['69_EXCEPTION'] on test case 4
|
||||||
|
TEST CASE 4 PASSED
|
||||||
|
|
||||||
|
|
||||||
|
Running tests for mutation 5
|
||||||
|
----------------------------
|
||||||
|
Unmodified function returned [] while the modified function returned [] on test case 1
|
||||||
|
TEST CASE 1 PASSED
|
||||||
|
Unmodified function returned ['55_EXCEPTION', 0.6666666666666666, 132] while the modified function returned ['55_EXCEPTION', 6.0, 132] on test case 2
|
||||||
|
TEST CASE 2 FAILED
|
||||||
|
Unmodified function returned [0.6666666666666666] while the modified function returned [6.0] on test case 3
|
||||||
|
TEST CASE 3 FAILED
|
||||||
|
Unmodified function returned ['69_EXCEPTION'] while the modified function returned ['69_EXCEPTION'] on test case 4
|
||||||
|
TEST CASE 4 PASSED
|
||||||
|
|
||||||
|
|
||||||
|
Running tests for mutation 6
|
||||||
|
----------------------------
|
||||||
|
Unmodified function returned [] while the modified function returned [] on test case 1
|
||||||
|
TEST CASE 1 PASSED
|
||||||
|
Unmodified function returned ['55_EXCEPTION', 0.6666666666666666, 132] while the modified function returned ['55_EXCEPTION', 0.6666666666666666, 132] on test case 2
|
||||||
|
TEST CASE 2 PASSED
|
||||||
|
Unmodified function returned [0.6666666666666666] while the modified function returned [0.6666666666666666] on test case 3
|
||||||
|
TEST CASE 3 PASSED
|
||||||
|
Unmodified function returned ['69_EXCEPTION'] while the modified function returned ['69_EXCEPTION'] on test case 4
|
||||||
|
TEST CASE 4 PASSED
|
||||||
|
|
||||||
|
|
||||||
|
Ranked Results:
|
||||||
|
---------------
|
||||||
|
1. mutation 2 with 3/4 failed tests
|
||||||
|
2. mutation 3 with 3/4 failed tests
|
||||||
|
3. mutation 4 with 2/4 failed tests
|
||||||
|
4. mutation 5 with 2/4 failed tests
|
||||||
|
5. mutation 1 with 1/4 failed tests
|
||||||
|
6. mutation 6 with 0/4 failed tests
|
Binary file not shown.
After Width: | Height: | Size: 56 KiB |
Binary file not shown.
After Width: | Height: | Size: 87 KiB |
Binary file not shown.
After Width: | Height: | Size: 106 KiB |
Binary file not shown.
After Width: | Height: | Size: 105 KiB |
|
@ -0,0 +1,74 @@
|
||||||
|
\relax
|
||||||
|
\providecommand\hyper@newdestlabel[2]{}
|
||||||
|
\providecommand\HyperFirstAtBeginDocument{\AtBeginDocument}
|
||||||
|
\HyperFirstAtBeginDocument{\ifx\hyper@anchor\@undefined
|
||||||
|
\global\let\oldnewlabel\newlabel
|
||||||
|
\gdef\newlabel#1#2{\newlabelxx{#1}#2}
|
||||||
|
\gdef\newlabelxx#1#2#3#4#5#6{\oldnewlabel{#1}{{#2}{#3}}}
|
||||||
|
\AtEndDocument{\ifx\hyper@anchor\@undefined
|
||||||
|
\let\newlabel\oldnewlabel
|
||||||
|
\fi}
|
||||||
|
\fi}
|
||||||
|
\global\let\hyper@last\relax
|
||||||
|
\gdef\HyperFirstAtBeginDocument#1{#1}
|
||||||
|
\providecommand\HyField@AuxAddToFields[1]{}
|
||||||
|
\providecommand\HyField@AuxAddToCoFields[2]{}
|
||||||
|
\@writefile{toc}{\contentsline {section}{\numberline {1}Question 1}{1}{section.0.1}\protected@file@percent }
|
||||||
|
\@writefile{toc}{\contentsline {subsection}{\numberline {1.1}Soundness vs Completeness}{1}{subsection.0.1.1}\protected@file@percent }
|
||||||
|
\@writefile{toc}{\contentsline {subsubsection}{Soundness}{1}{section*.2}\protected@file@percent }
|
||||||
|
\@writefile{toc}{\contentsline {subsubsection}{Completeness}{2}{section*.3}\protected@file@percent }
|
||||||
|
\@writefile{toc}{\contentsline {subsection}{\numberline {1.2}Positive = Find bug}{2}{subsection.0.1.2}\protected@file@percent }
|
||||||
|
\@writefile{toc}{\contentsline {subsubsection}{True Positive}{2}{section*.4}\protected@file@percent }
|
||||||
|
\@writefile{toc}{\contentsline {subsubsection}{True Negative}{2}{section*.5}\protected@file@percent }
|
||||||
|
\@writefile{toc}{\contentsline {subsubsection}{False Positive}{2}{section*.6}\protected@file@percent }
|
||||||
|
\@writefile{toc}{\contentsline {subsubsection}{False Negative}{2}{section*.7}\protected@file@percent }
|
||||||
|
\@writefile{toc}{\contentsline {subsection}{\numberline {1.3}Positive = Not find bug}{2}{subsection.0.1.3}\protected@file@percent }
|
||||||
|
\@writefile{toc}{\contentsline {subsubsection}{True Positive}{2}{section*.8}\protected@file@percent }
|
||||||
|
\@writefile{toc}{\contentsline {subsubsection}{True Negative}{2}{section*.9}\protected@file@percent }
|
||||||
|
\@writefile{toc}{\contentsline {subsubsection}{False Positive}{2}{section*.10}\protected@file@percent }
|
||||||
|
\@writefile{toc}{\contentsline {subsubsection}{False Negative}{2}{section*.11}\protected@file@percent }
|
||||||
|
\@writefile{toc}{\contentsline {section}{\numberline {2}Question 2}{3}{section.0.2}\protected@file@percent }
|
||||||
|
\@writefile{toc}{\contentsline {subsection}{\numberline {2.1}A}{3}{subsection.0.2.1}\protected@file@percent }
|
||||||
|
\@writefile{toc}{\contentsline {subsubsection}{Source}{3}{section*.12}\protected@file@percent }
|
||||||
|
\@writefile{toc}{\contentsline {subsubsection}{Explanation}{3}{section*.13}\protected@file@percent }
|
||||||
|
\@writefile{lol}{\contentsline {lstlisting}{\numberline {1}Test case generator code}{4}{lstlisting.0.1}\protected@file@percent }
|
||||||
|
\@writefile{lol}{\contentsline {lstlisting}{\numberline {2}Sort algorithm fail generator}{4}{lstlisting.0.2}\protected@file@percent }
|
||||||
|
\@writefile{toc}{\contentsline {subsubsection}{Sample Output}{5}{section*.14}\protected@file@percent }
|
||||||
|
\@writefile{lof}{\contentsline {figure}{\numberline {1}{\ignorespaces Sample output of the random test generator.}}{5}{figure.0.1}\protected@file@percent }
|
||||||
|
\newlabel{fig:screenshot001}{{1}{5}{Sample output of the random test generator}{figure.0.1}{}}
|
||||||
|
\@writefile{toc}{\contentsline {subsection}{\numberline {2.2}B}{5}{subsection.0.2.2}\protected@file@percent }
|
||||||
|
\@writefile{toc}{\contentsline {subsubsection}{(2.B) Explanation}{6}{section*.15}\protected@file@percent }
|
||||||
|
\@writefile{toc}{\contentsline {section}{\numberline {3}Question 3}{7}{section.0.3}\protected@file@percent }
|
||||||
|
\@writefile{toc}{\contentsline {subsection}{\numberline {3.1}A}{7}{subsection.0.3.1}\protected@file@percent }
|
||||||
|
\@writefile{lof}{\contentsline {figure}{\numberline {2}{\ignorespaces Direct translation of the code, logic errors and all.}}{7}{figure.0.2}\protected@file@percent }
|
||||||
|
\newlabel{fig:Q3A1COSC3P95}{{2}{7}{Direct translation of the code, logic errors and all}{figure.0.2}{}}
|
||||||
|
\@writefile{toc}{\contentsline {subsection}{\numberline {3.2}B}{8}{subsection.0.3.2}\protected@file@percent }
|
||||||
|
\@writefile{toc}{\contentsline {section}{\numberline {4}Question 4}{8}{section.0.4}\protected@file@percent }
|
||||||
|
\@writefile{toc}{\contentsline {subsection}{\numberline {4.1}A}{8}{subsection.0.4.1}\protected@file@percent }
|
||||||
|
\@writefile{lof}{\contentsline {figure}{\numberline {3}{\ignorespaces 12 Statements in the function}}{8}{figure.0.3}\protected@file@percent }
|
||||||
|
\newlabel{fig:screenshot003}{{3}{8}{12 Statements in the function}{figure.0.3}{}}
|
||||||
|
\@writefile{toc}{\contentsline {subsubsection}{Test 1}{9}{section*.16}\protected@file@percent }
|
||||||
|
\@writefile{toc}{\contentsline {subsubsection}{Test 2}{9}{section*.17}\protected@file@percent }
|
||||||
|
\@writefile{toc}{\contentsline {subsubsection}{Test 3}{9}{section*.18}\protected@file@percent }
|
||||||
|
\@writefile{lof}{\contentsline {figure}{\numberline {4}{\ignorespaces Test 3 Graphical Results}}{9}{figure.0.4}\protected@file@percent }
|
||||||
|
\newlabel{fig:screenshot004}{{4}{9}{Test 3 Graphical Results}{figure.0.4}{}}
|
||||||
|
\@writefile{toc}{\contentsline {subsubsection}{Test 4}{11}{section*.19}\protected@file@percent }
|
||||||
|
\@writefile{lof}{\contentsline {figure}{\numberline {5}{\ignorespaces Test 4 Graphical Results}}{11}{figure.0.5}\protected@file@percent }
|
||||||
|
\newlabel{fig:screenshot005}{{5}{11}{Test 4 Graphical Results}{figure.0.5}{}}
|
||||||
|
\@writefile{toc}{\contentsline {subsection}{\numberline {4.2}B}{11}{subsection.0.4.2}\protected@file@percent }
|
||||||
|
\@writefile{lol}{\contentsline {lstlisting}{\numberline {3}Mutation 1}{11}{lstlisting.0.3}\protected@file@percent }
|
||||||
|
\@writefile{lol}{\contentsline {lstlisting}{\numberline {4}Mutation 2}{12}{lstlisting.0.4}\protected@file@percent }
|
||||||
|
\@writefile{lol}{\contentsline {lstlisting}{\numberline {5}Mutation 3}{12}{lstlisting.0.5}\protected@file@percent }
|
||||||
|
\@writefile{lol}{\contentsline {lstlisting}{\numberline {6}Mutation 4}{12}{lstlisting.0.6}\protected@file@percent }
|
||||||
|
\@writefile{lol}{\contentsline {lstlisting}{\numberline {7}Mutation 5}{13}{lstlisting.0.7}\protected@file@percent }
|
||||||
|
\@writefile{lol}{\contentsline {lstlisting}{\numberline {8}Mutation 6}{13}{lstlisting.0.8}\protected@file@percent }
|
||||||
|
\@writefile{toc}{\contentsline {subsubsection}{C}{13}{section*.20}\protected@file@percent }
|
||||||
|
\@writefile{toc}{\contentsline {subsubsection}{D}{16}{section*.21}\protected@file@percent }
|
||||||
|
\@writefile{toc}{\contentsline {paragraph}{Branch Static Analysis}{16}{section*.22}\protected@file@percent }
|
||||||
|
\@writefile{toc}{\contentsline {paragraph}{Path Static Analysis}{17}{section*.23}\protected@file@percent }
|
||||||
|
\@writefile{toc}{\contentsline {paragraph}{Statement Static Analysis}{17}{section*.24}\protected@file@percent }
|
||||||
|
\@writefile{toc}{\contentsline {section}{\numberline {5}Question 5}{17}{section.0.5}\protected@file@percent }
|
||||||
|
\@writefile{toc}{\contentsline {subsection}{\numberline {5.1}A}{17}{subsection.0.5.1}\protected@file@percent }
|
||||||
|
\@writefile{toc}{\contentsline {subsection}{\numberline {5.2}B}{18}{subsection.0.5.2}\protected@file@percent }
|
||||||
|
\@writefile{toc}{\contentsline {section}{\numberline {6}Question 6}{22}{section.0.6}\protected@file@percent }
|
||||||
|
\gdef \@abspage@last{23}
|
|
@ -0,0 +1,475 @@
|
||||||
|
This is pdfTeX, Version 3.141592653-2.6-1.40.24 (TeX Live 2022/Debian) (preloaded format=pdflatex 2023.10.9) 12 OCT 2023 20:38
|
||||||
|
entering extended mode
|
||||||
|
restricted \write18 enabled.
|
||||||
|
%&-line parsing enabled.
|
||||||
|
**template_Report.tex
|
||||||
|
(./template_Report.tex
|
||||||
|
LaTeX2e <2022-11-01> patch level 1
|
||||||
|
L3 programming layer <2023-01-16>
|
||||||
|
(/usr/share/texlive/texmf-dist/tex/latex/base/report.cls
|
||||||
|
Document Class: report 2022/07/02 v1.4n Standard LaTeX document class
|
||||||
|
(/usr/share/texlive/texmf-dist/tex/latex/base/size10.clo
|
||||||
|
File: size10.clo 2022/07/02 v1.4n Standard LaTeX file (size option)
|
||||||
|
)
|
||||||
|
\c@part=\count185
|
||||||
|
\c@chapter=\count186
|
||||||
|
\c@section=\count187
|
||||||
|
\c@subsection=\count188
|
||||||
|
\c@subsubsection=\count189
|
||||||
|
\c@paragraph=\count190
|
||||||
|
\c@subparagraph=\count191
|
||||||
|
\c@figure=\count192
|
||||||
|
\c@table=\count193
|
||||||
|
\abovecaptionskip=\skip48
|
||||||
|
\belowcaptionskip=\skip49
|
||||||
|
\bibindent=\dimen140
|
||||||
|
)
|
||||||
|
(/usr/share/texlive/texmf-dist/tex/latex/graphics/graphicx.sty
|
||||||
|
Package: graphicx 2021/09/16 v1.2d Enhanced LaTeX Graphics (DPC,SPQR)
|
||||||
|
|
||||||
|
(/usr/share/texlive/texmf-dist/tex/latex/graphics/keyval.sty
|
||||||
|
Package: keyval 2022/05/29 v1.15 key=value parser (DPC)
|
||||||
|
\KV@toks@=\toks16
|
||||||
|
)
|
||||||
|
(/usr/share/texlive/texmf-dist/tex/latex/graphics/graphics.sty
|
||||||
|
Package: graphics 2022/03/10 v1.4e Standard LaTeX Graphics (DPC,SPQR)
|
||||||
|
|
||||||
|
(/usr/share/texlive/texmf-dist/tex/latex/graphics/trig.sty
|
||||||
|
Package: trig 2021/08/11 v1.11 sin cos tan (DPC)
|
||||||
|
)
|
||||||
|
(/usr/share/texlive/texmf-dist/tex/latex/graphics-cfg/graphics.cfg
|
||||||
|
File: graphics.cfg 2016/06/04 v1.11 sample graphics configuration
|
||||||
|
)
|
||||||
|
Package graphics Info: Driver file: pdftex.def on input line 107.
|
||||||
|
|
||||||
|
(/usr/share/texlive/texmf-dist/tex/latex/graphics-def/pdftex.def
|
||||||
|
File: pdftex.def 2022/09/22 v1.2b Graphics/color driver for pdftex
|
||||||
|
))
|
||||||
|
\Gin@req@height=\dimen141
|
||||||
|
\Gin@req@width=\dimen142
|
||||||
|
)
|
||||||
|
(/usr/share/texlive/texmf-dist/tex/latex/float/float.sty
|
||||||
|
Package: float 2001/11/08 v1.3d Float enhancements (AL)
|
||||||
|
\c@float@type=\count194
|
||||||
|
\float@exts=\toks17
|
||||||
|
\float@box=\box51
|
||||||
|
\@float@everytoks=\toks18
|
||||||
|
\@floatcapt=\box52
|
||||||
|
)
|
||||||
|
(/usr/share/texlive/texmf-dist/tex/latex/enumitem/enumitem.sty
|
||||||
|
Package: enumitem 2019/06/20 v3.9 Customized lists
|
||||||
|
\labelindent=\skip50
|
||||||
|
\enit@outerparindent=\dimen143
|
||||||
|
\enit@toks=\toks19
|
||||||
|
\enit@inbox=\box53
|
||||||
|
\enit@count@id=\count195
|
||||||
|
\enitdp@description=\count196
|
||||||
|
)
|
||||||
|
(/usr/share/texlive/texmf-dist/tex/latex/hyperref/hyperref.sty
|
||||||
|
Package: hyperref 2022-11-13 v7.00u Hypertext links for LaTeX
|
||||||
|
|
||||||
|
(/usr/share/texlive/texmf-dist/tex/generic/ltxcmds/ltxcmds.sty
|
||||||
|
Package: ltxcmds 2020-05-10 v1.25 LaTeX kernel commands for general use (HO)
|
||||||
|
)
|
||||||
|
(/usr/share/texlive/texmf-dist/tex/generic/iftex/iftex.sty
|
||||||
|
Package: iftex 2022/02/03 v1.0f TeX engine tests
|
||||||
|
)
|
||||||
|
(/usr/share/texlive/texmf-dist/tex/generic/pdftexcmds/pdftexcmds.sty
|
||||||
|
Package: pdftexcmds 2020-06-27 v0.33 Utility functions of pdfTeX for LuaTeX (HO
|
||||||
|
)
|
||||||
|
|
||||||
|
(/usr/share/texlive/texmf-dist/tex/generic/infwarerr/infwarerr.sty
|
||||||
|
Package: infwarerr 2019/12/03 v1.5 Providing info/warning/error messages (HO)
|
||||||
|
)
|
||||||
|
Package pdftexcmds Info: \pdf@primitive is available.
|
||||||
|
Package pdftexcmds Info: \pdf@ifprimitive is available.
|
||||||
|
Package pdftexcmds Info: \pdfdraftmode found.
|
||||||
|
)
|
||||||
|
(/usr/share/texlive/texmf-dist/tex/latex/kvsetkeys/kvsetkeys.sty
|
||||||
|
Package: kvsetkeys 2022-10-05 v1.19 Key value parser (HO)
|
||||||
|
)
|
||||||
|
(/usr/share/texlive/texmf-dist/tex/generic/kvdefinekeys/kvdefinekeys.sty
|
||||||
|
Package: kvdefinekeys 2019-12-19 v1.6 Define keys (HO)
|
||||||
|
)
|
||||||
|
(/usr/share/texlive/texmf-dist/tex/generic/pdfescape/pdfescape.sty
|
||||||
|
Package: pdfescape 2019/12/09 v1.15 Implements pdfTeX's escape features (HO)
|
||||||
|
)
|
||||||
|
(/usr/share/texlive/texmf-dist/tex/latex/hycolor/hycolor.sty
|
||||||
|
Package: hycolor 2020-01-27 v1.10 Color options for hyperref/bookmark (HO)
|
||||||
|
)
|
||||||
|
(/usr/share/texlive/texmf-dist/tex/latex/letltxmacro/letltxmacro.sty
|
||||||
|
Package: letltxmacro 2019/12/03 v1.6 Let assignment for LaTeX macros (HO)
|
||||||
|
)
|
||||||
|
(/usr/share/texlive/texmf-dist/tex/latex/auxhook/auxhook.sty
|
||||||
|
Package: auxhook 2019-12-17 v1.6 Hooks for auxiliary files (HO)
|
||||||
|
)
|
||||||
|
(/usr/share/texlive/texmf-dist/tex/latex/hyperref/nameref.sty
|
||||||
|
Package: nameref 2022-05-17 v2.50 Cross-referencing by name of section
|
||||||
|
|
||||||
|
(/usr/share/texlive/texmf-dist/tex/latex/refcount/refcount.sty
|
||||||
|
Package: refcount 2019/12/15 v3.6 Data extraction from label references (HO)
|
||||||
|
)
|
||||||
|
(/usr/share/texlive/texmf-dist/tex/generic/gettitlestring/gettitlestring.sty
|
||||||
|
Package: gettitlestring 2019/12/15 v1.6 Cleanup title references (HO)
|
||||||
|
|
||||||
|
(/usr/share/texlive/texmf-dist/tex/latex/kvoptions/kvoptions.sty
|
||||||
|
Package: kvoptions 2022-06-15 v3.15 Key value format for package options (HO)
|
||||||
|
))
|
||||||
|
\c@section@level=\count197
|
||||||
|
)
|
||||||
|
\@linkdim=\dimen144
|
||||||
|
\Hy@linkcounter=\count198
|
||||||
|
\Hy@pagecounter=\count199
|
||||||
|
|
||||||
|
(/usr/share/texlive/texmf-dist/tex/latex/hyperref/pd1enc.def
|
||||||
|
File: pd1enc.def 2022-11-13 v7.00u Hyperref: PDFDocEncoding definition (HO)
|
||||||
|
Now handling font encoding PD1 ...
|
||||||
|
... no UTF-8 mapping file for font encoding PD1
|
||||||
|
)
|
||||||
|
(/usr/share/texlive/texmf-dist/tex/generic/intcalc/intcalc.sty
|
||||||
|
Package: intcalc 2019/12/15 v1.3 Expandable calculations with integers (HO)
|
||||||
|
)
|
||||||
|
(/usr/share/texlive/texmf-dist/tex/generic/etexcmds/etexcmds.sty
|
||||||
|
Package: etexcmds 2019/12/15 v1.7 Avoid name clashes with e-TeX commands (HO)
|
||||||
|
)
|
||||||
|
\Hy@SavedSpaceFactor=\count266
|
||||||
|
|
||||||
|
(/usr/share/texlive/texmf-dist/tex/latex/hyperref/puenc.def
|
||||||
|
File: puenc.def 2022-11-13 v7.00u Hyperref: PDF Unicode definition (HO)
|
||||||
|
Now handling font encoding PU ...
|
||||||
|
... no UTF-8 mapping file for font encoding PU
|
||||||
|
)
|
||||||
|
Package hyperref Info: Hyper figures OFF on input line 4162.
|
||||||
|
Package hyperref Info: Link nesting OFF on input line 4167.
|
||||||
|
Package hyperref Info: Hyper index ON on input line 4170.
|
||||||
|
Package hyperref Info: Plain pages OFF on input line 4177.
|
||||||
|
Package hyperref Info: Backreferencing OFF on input line 4182.
|
||||||
|
Package hyperref Info: Implicit mode ON; LaTeX internals redefined.
|
||||||
|
Package hyperref Info: Bookmarks ON on input line 4410.
|
||||||
|
\c@Hy@tempcnt=\count267
|
||||||
|
|
||||||
|
(/usr/share/texlive/texmf-dist/tex/latex/url/url.sty
|
||||||
|
\Urlmuskip=\muskip16
|
||||||
|
Package: url 2013/09/16 ver 3.4 Verb mode for urls, etc.
|
||||||
|
)
|
||||||
|
LaTeX Info: Redefining \url on input line 4748.
|
||||||
|
\XeTeXLinkMargin=\dimen145
|
||||||
|
|
||||||
|
(/usr/share/texlive/texmf-dist/tex/generic/bitset/bitset.sty
|
||||||
|
Package: bitset 2019/12/09 v1.3 Handle bit-vector datatype (HO)
|
||||||
|
|
||||||
|
(/usr/share/texlive/texmf-dist/tex/generic/bigintcalc/bigintcalc.sty
|
||||||
|
Package: bigintcalc 2019/12/15 v1.5 Expandable calculations on big integers (HO
|
||||||
|
)
|
||||||
|
))
|
||||||
|
\Fld@menulength=\count268
|
||||||
|
\Field@Width=\dimen146
|
||||||
|
\Fld@charsize=\dimen147
|
||||||
|
Package hyperref Info: Hyper figures OFF on input line 6027.
|
||||||
|
Package hyperref Info: Link nesting OFF on input line 6032.
|
||||||
|
Package hyperref Info: Hyper index ON on input line 6035.
|
||||||
|
Package hyperref Info: backreferencing OFF on input line 6042.
|
||||||
|
Package hyperref Info: Link coloring OFF on input line 6047.
|
||||||
|
Package hyperref Info: Link coloring with OCG OFF on input line 6052.
|
||||||
|
Package hyperref Info: PDF/A mode OFF on input line 6057.
|
||||||
|
|
||||||
|
(/usr/share/texlive/texmf-dist/tex/latex/base/atbegshi-ltx.sty
|
||||||
|
Package: atbegshi-ltx 2021/01/10 v1.0c Emulation of the original atbegshi
|
||||||
|
package with kernel methods
|
||||||
|
)
|
||||||
|
\Hy@abspage=\count269
|
||||||
|
\c@Item=\count270
|
||||||
|
\c@Hfootnote=\count271
|
||||||
|
)
|
||||||
|
Package hyperref Info: Driver (autodetected): hpdftex.
|
||||||
|
|
||||||
|
(/usr/share/texlive/texmf-dist/tex/latex/hyperref/hpdftex.def
|
||||||
|
File: hpdftex.def 2022-11-13 v7.00u Hyperref driver for pdfTeX
|
||||||
|
|
||||||
|
(/usr/share/texlive/texmf-dist/tex/latex/base/atveryend-ltx.sty
|
||||||
|
Package: atveryend-ltx 2020/08/19 v1.0a Emulation of the original atveryend pac
|
||||||
|
kage
|
||||||
|
with kernel methods
|
||||||
|
)
|
||||||
|
\Fld@listcount=\count272
|
||||||
|
\c@bookmark@seq@number=\count273
|
||||||
|
|
||||||
|
(/usr/share/texlive/texmf-dist/tex/latex/rerunfilecheck/rerunfilecheck.sty
|
||||||
|
Package: rerunfilecheck 2022-07-10 v1.10 Rerun checks for auxiliary files (HO)
|
||||||
|
|
||||||
|
(/usr/share/texlive/texmf-dist/tex/generic/uniquecounter/uniquecounter.sty
|
||||||
|
Package: uniquecounter 2019/12/15 v1.4 Provide unlimited unique counter (HO)
|
||||||
|
)
|
||||||
|
Package uniquecounter Info: New unique counter `rerunfilecheck' on input line 2
|
||||||
|
85.
|
||||||
|
)
|
||||||
|
\Hy@SectionHShift=\skip51
|
||||||
|
)
|
||||||
|
(/usr/share/texlive/texmf-dist/tex/latex/xcolor/xcolor.sty
|
||||||
|
Package: xcolor 2022/06/12 v2.14 LaTeX color extensions (UK)
|
||||||
|
|
||||||
|
(/usr/share/texlive/texmf-dist/tex/latex/graphics-cfg/color.cfg
|
||||||
|
File: color.cfg 2016/01/02 v1.6 sample color configuration
|
||||||
|
)
|
||||||
|
Package xcolor Info: Driver file: pdftex.def on input line 227.
|
||||||
|
|
||||||
|
(/usr/share/texlive/texmf-dist/tex/latex/graphics/mathcolor.ltx)
|
||||||
|
Package xcolor Info: Model `cmy' substituted by `cmy0' on input line 1353.
|
||||||
|
Package xcolor Info: Model `hsb' substituted by `rgb' on input line 1357.
|
||||||
|
Package xcolor Info: Model `RGB' extended on input line 1369.
|
||||||
|
Package xcolor Info: Model `HTML' substituted by `rgb' on input line 1371.
|
||||||
|
Package xcolor Info: Model `Hsb' substituted by `hsb' on input line 1372.
|
||||||
|
Package xcolor Info: Model `tHsb' substituted by `hsb' on input line 1373.
|
||||||
|
Package xcolor Info: Model `HSB' substituted by `hsb' on input line 1374.
|
||||||
|
Package xcolor Info: Model `Gray' substituted by `gray' on input line 1375.
|
||||||
|
Package xcolor Info: Model `wave' substituted by `hsb' on input line 1376.
|
||||||
|
)
|
||||||
|
(/usr/share/texlive/texmf-dist/tex/generic/ulem/ulem.sty
|
||||||
|
\UL@box=\box54
|
||||||
|
\UL@hyphenbox=\box55
|
||||||
|
\UL@skip=\skip52
|
||||||
|
\UL@hook=\toks20
|
||||||
|
\UL@height=\dimen148
|
||||||
|
\UL@pe=\count274
|
||||||
|
\UL@pixel=\dimen149
|
||||||
|
\ULC@box=\box56
|
||||||
|
Package: ulem 2019/11/18
|
||||||
|
\ULdepth=\dimen150
|
||||||
|
)
|
||||||
|
(/usr/share/texlive/texmf-dist/tex/latex/listings/listings.sty
|
||||||
|
\lst@mode=\count275
|
||||||
|
\lst@gtempboxa=\box57
|
||||||
|
\lst@token=\toks21
|
||||||
|
\lst@length=\count276
|
||||||
|
\lst@currlwidth=\dimen151
|
||||||
|
\lst@column=\count277
|
||||||
|
\lst@pos=\count278
|
||||||
|
\lst@lostspace=\dimen152
|
||||||
|
\lst@width=\dimen153
|
||||||
|
\lst@newlines=\count279
|
||||||
|
\lst@lineno=\count280
|
||||||
|
\lst@maxwidth=\dimen154
|
||||||
|
|
||||||
|
(/usr/share/texlive/texmf-dist/tex/latex/listings/lstmisc.sty
|
||||||
|
File: lstmisc.sty 2020/03/24 1.8d (Carsten Heinz)
|
||||||
|
\c@lstnumber=\count281
|
||||||
|
\lst@skipnumbers=\count282
|
||||||
|
\lst@framebox=\box58
|
||||||
|
)
|
||||||
|
(/usr/share/texlive/texmf-dist/tex/latex/listings/listings.cfg
|
||||||
|
File: listings.cfg 2020/03/24 1.8d listings configuration
|
||||||
|
))
|
||||||
|
Package: listings 2020/03/24 1.8d (Carsten Heinz)
|
||||||
|
|
||||||
|
(/usr/share/texlive/texmf-dist/tex/latex/listings/lstlang1.sty
|
||||||
|
File: lstlang1.sty 2020/03/24 1.8d listings language file
|
||||||
|
)
|
||||||
|
(/usr/share/texlive/texmf-dist/tex/latex/listings/lstlang1.sty
|
||||||
|
File: lstlang1.sty 2020/03/24 1.8d listings language file
|
||||||
|
)
|
||||||
|
(/usr/share/texlive/texmf-dist/tex/latex/listings/lstmisc.sty
|
||||||
|
File: lstmisc.sty 2020/03/24 1.8d (Carsten Heinz)
|
||||||
|
)
|
||||||
|
Package Listings Info: Made | a short reference for \lstinline on input line 47
|
||||||
|
.
|
||||||
|
|
||||||
|
(/usr/share/texlive/texmf-dist/tex/latex/l3backend/l3backend-pdftex.def
|
||||||
|
File: l3backend-pdftex.def 2023-01-16 L3 backend support: PDF output (pdfTeX)
|
||||||
|
\l__color_backend_stack_int=\count283
|
||||||
|
\l__pdf_internal_box=\box59
|
||||||
|
)
|
||||||
|
(./template_Report.aux)
|
||||||
|
\openout1 = `template_Report.aux'.
|
||||||
|
|
||||||
|
LaTeX Font Info: Checking defaults for OML/cmm/m/it on input line 62.
|
||||||
|
LaTeX Font Info: ... okay on input line 62.
|
||||||
|
LaTeX Font Info: Checking defaults for OMS/cmsy/m/n on input line 62.
|
||||||
|
LaTeX Font Info: ... okay on input line 62.
|
||||||
|
LaTeX Font Info: Checking defaults for OT1/cmr/m/n on input line 62.
|
||||||
|
LaTeX Font Info: ... okay on input line 62.
|
||||||
|
LaTeX Font Info: Checking defaults for T1/cmr/m/n on input line 62.
|
||||||
|
LaTeX Font Info: ... okay on input line 62.
|
||||||
|
LaTeX Font Info: Checking defaults for TS1/cmr/m/n on input line 62.
|
||||||
|
LaTeX Font Info: ... okay on input line 62.
|
||||||
|
LaTeX Font Info: Checking defaults for OMX/cmex/m/n on input line 62.
|
||||||
|
LaTeX Font Info: ... okay on input line 62.
|
||||||
|
LaTeX Font Info: Checking defaults for U/cmr/m/n on input line 62.
|
||||||
|
LaTeX Font Info: ... okay on input line 62.
|
||||||
|
LaTeX Font Info: Checking defaults for PD1/pdf/m/n on input line 62.
|
||||||
|
LaTeX Font Info: ... okay on input line 62.
|
||||||
|
LaTeX Font Info: Checking defaults for PU/pdf/m/n on input line 62.
|
||||||
|
LaTeX Font Info: ... okay on input line 62.
|
||||||
|
|
||||||
|
(/usr/share/texlive/texmf-dist/tex/context/base/mkii/supp-pdf.mkii
|
||||||
|
[Loading MPS to PDF converter (version 2006.09.02).]
|
||||||
|
\scratchcounter=\count284
|
||||||
|
\scratchdimen=\dimen155
|
||||||
|
\scratchbox=\box60
|
||||||
|
\nofMPsegments=\count285
|
||||||
|
\nofMParguments=\count286
|
||||||
|
\everyMPshowfont=\toks22
|
||||||
|
\MPscratchCnt=\count287
|
||||||
|
\MPscratchDim=\dimen156
|
||||||
|
\MPnumerator=\count288
|
||||||
|
\makeMPintoPDFobject=\count289
|
||||||
|
\everyMPtoPDFconversion=\toks23
|
||||||
|
) (/usr/share/texlive/texmf-dist/tex/latex/epstopdf-pkg/epstopdf-base.sty
|
||||||
|
Package: epstopdf-base 2020-01-24 v2.11 Base part for package epstopdf
|
||||||
|
Package epstopdf-base Info: Redefining graphics rule for `.eps' on input line 4
|
||||||
|
85.
|
||||||
|
|
||||||
|
(/usr/share/texlive/texmf-dist/tex/latex/latexconfig/epstopdf-sys.cfg
|
||||||
|
File: epstopdf-sys.cfg 2010/07/13 v1.3 Configuration of (r)epstopdf for TeX Liv
|
||||||
|
e
|
||||||
|
))
|
||||||
|
Package hyperref Info: Link coloring OFF on input line 62.
|
||||||
|
|
||||||
|
(./template_Report.out) (./template_Report.out)
|
||||||
|
\@outlinefile=\write3
|
||||||
|
\openout3 = `template_Report.out'.
|
||||||
|
|
||||||
|
\c@lstlisting=\count290
|
||||||
|
LaTeX Font Info: External font `cmex10' loaded for size
|
||||||
|
(Font) <12> on input line 64.
|
||||||
|
LaTeX Font Info: External font `cmex10' loaded for size
|
||||||
|
(Font) <8> on input line 64.
|
||||||
|
LaTeX Font Info: External font `cmex10' loaded for size
|
||||||
|
(Font) <6> on input line 64.
|
||||||
|
[1
|
||||||
|
|
||||||
|
{/var/lib/texmf/fonts/map/pdftex/updmap/pdftex.map}] (./template_Report.toc
|
||||||
|
LaTeX Font Info: External font `cmex10' loaded for size
|
||||||
|
(Font) <7> on input line 1.
|
||||||
|
LaTeX Font Info: External font `cmex10' loaded for size
|
||||||
|
(Font) <5> on input line 1.
|
||||||
|
)
|
||||||
|
\tf@toc=\write4
|
||||||
|
\openout4 = `template_Report.toc'.
|
||||||
|
|
||||||
|
|
||||||
|
pdfTeX warning (ext4): destination with the same identifier (name{page.1}) has
|
||||||
|
been already used, duplicate ignored
|
||||||
|
<to be read again>
|
||||||
|
\relax
|
||||||
|
l.77 \subsection
|
||||||
|
{Positive = Find bug} [1
|
||||||
|
|
||||||
|
] [2] [3]
|
||||||
|
Package hyperref Info: bookmark level for unknown lstlisting defaults to 0 on i
|
||||||
|
nput line 114.
|
||||||
|
LaTeX Font Info: Font shape `OT1/cmtt/bx/n' in size <9> not available
|
||||||
|
(Font) Font shape `OT1/cmtt/m/n' tried instead on input line 117.
|
||||||
|
<screenshot001.png, id=124, 810.77907pt x 252.945pt>
|
||||||
|
File: screenshot001.png Graphic file (type png)
|
||||||
|
<use screenshot001.png>
|
||||||
|
Package pdftex.def Info: screenshot001.png used on input line 148.
|
||||||
|
(pdftex.def) Requested size: 345.0pt x 107.63335pt.
|
||||||
|
[4]
|
||||||
|
LaTeX Font Info: Trying to load font information for OMS+cmr on input line 1
|
||||||
|
57.
|
||||||
|
|
||||||
|
(/usr/share/texlive/texmf-dist/tex/latex/base/omscmr.fd
|
||||||
|
File: omscmr.fd 2022/07/10 v2.5l Standard LaTeX font definitions
|
||||||
|
)
|
||||||
|
LaTeX Font Info: Font shape `OMS/cmr/m/n' in size <10> not available
|
||||||
|
(Font) Font shape `OMS/cmsy/m/n' tried instead on input line 157.
|
||||||
|
|
||||||
|
Overfull \hbox (16.23405pt too wide) in paragraph at lines 158--159
|
||||||
|
[]$\OML/cmm/m/it/10 <$\OT1/cmr/m/n/10 Array[]Expression$\OML/cmm/m/it/10 >$ $\O
|
||||||
|
MS/cmsy/m/n/10 !$ $\OML/cmm/m/it/10 <$\OT1/cmr/m/n/10 Integral[]t$\OML/cmm/m/it
|
||||||
|
/10 >$ $\OMS/cmsy/m/n/10 j$ $\OML/cmm/m/it/10 <$\OT1/cmr/m/n/10 Integral[]t$\OM
|
||||||
|
L/cmm/m/it/10 >$ \OT1/cmr/m/n/10 "," $\OML/cmm/m/it/10 <$\OT1/cmr/m/n/10 Array[
|
||||||
|
]Expression$\OML/cmm/m/it/10 >$
|
||||||
|
[]
|
||||||
|
|
||||||
|
[5 <./screenshot001.png (PNG copy)>]
|
||||||
|
Overfull \hbox (23.69508pt too wide) in paragraph at lines 171--172
|
||||||
|
\OT1/cmr/m/n/10 Al-ter-na-tive would be: $\OML/cmm/m/it/10 <$\OT1/cmr/m/n/10 Va
|
||||||
|
lue$\OML/cmm/m/it/10 >$ $\OMS/cmsy/m/n/10 !$ \OT1/cmr/m/n/10 -$\OML/cmm/m/it/10
|
||||||
|
<$\OT1/cmr/m/n/10 Value$\OML/cmm/m/it/10 >$ $\OMS/cmsy/m/n/10 j$ $\OML/cmm/m/i
|
||||||
|
t/10 <$\OT1/cmr/m/n/10 Integer$\OML/cmm/m/it/10 >$ $\OMS/cmsy/m/n/10 j$ $\OML/c
|
||||||
|
mm/m/it/10 <$\OT1/cmr/m/n/10 Value$\OML/cmm/m/it/10 >$$<$\OT1/cmr/m/n/10 Intege
|
||||||
|
r$\OML/cmm/m/it/10 >$\OT1/cmr/m/n/10 ,
|
||||||
|
[]
|
||||||
|
|
||||||
|
<Q3A1COSC3P95.drawio.png, id=172, 527.9725pt x 894.34125pt>
|
||||||
|
File: Q3A1COSC3P95.drawio.png Graphic file (type png)
|
||||||
|
<use Q3A1COSC3P95.drawio.png>
|
||||||
|
Package pdftex.def Info: Q3A1COSC3P95.drawio.png used on input line 179.
|
||||||
|
(pdftex.def) Requested size: 276.00105pt x 467.51651pt.
|
||||||
|
[6] [7 <./Q3A1COSC3P95.drawio.png>]
|
||||||
|
<screenshot003.png, id=191, 560.0925pt x 485.56406pt>
|
||||||
|
File: screenshot003.png Graphic file (type png)
|
||||||
|
<use screenshot003.png>
|
||||||
|
Package pdftex.def Info: screenshot003.png used on input line 197.
|
||||||
|
(pdftex.def) Requested size: 276.00105pt x 239.28433pt.
|
||||||
|
[8 <./screenshot003.png (PNG copy)>]
|
||||||
|
Underfull \hbox (badness 10000) in paragraph at lines 204--208
|
||||||
|
|
||||||
|
[]
|
||||||
|
|
||||||
|
<screenshot004.png, id=197, 611.28375pt x 542.77782pt>
|
||||||
|
File: screenshot004.png Graphic file (type png)
|
||||||
|
<use screenshot004.png>
|
||||||
|
Package pdftex.def Info: screenshot004.png used on input line 214.
|
||||||
|
(pdftex.def) Requested size: 241.49895pt x 214.43216pt.
|
||||||
|
|
||||||
|
Underfull \hbox (badness 10000) in paragraph at lines 209--217
|
||||||
|
|
||||||
|
[]
|
||||||
|
|
||||||
|
|
||||||
|
Underfull \hbox (badness 10000) in paragraph at lines 209--217
|
||||||
|
|
||||||
|
[]
|
||||||
|
|
||||||
|
[9 <./screenshot004.png (PNG copy)>] [10]
|
||||||
|
<screenshot005.png, id=210, 608.2725pt x 525.46312pt>
|
||||||
|
File: screenshot005.png Graphic file (type png)
|
||||||
|
<use screenshot005.png>
|
||||||
|
Package pdftex.def Info: screenshot005.png used on input line 226.
|
||||||
|
(pdftex.def) Requested size: 241.49895pt x 208.61803pt.
|
||||||
|
|
||||||
|
Underfull \hbox (badness 10000) in paragraph at lines 221--229
|
||||||
|
|
||||||
|
[]
|
||||||
|
|
||||||
|
(/usr/share/texlive/texmf-dist/tex/latex/listings/lstlang1.sty
|
||||||
|
File: lstlang1.sty 2020/03/24 1.8d listings language file
|
||||||
|
) [11 <./screenshot005.png (PNG copy)>] [12] (./results.txt [13] [14] [15]) [16
|
||||||
|
]
|
||||||
|
Underfull \hbox (badness 10000) in paragraph at lines 353--356
|
||||||
|
|
||||||
|
[]
|
||||||
|
|
||||||
|
[17] (./delta_debugger.py [18] [19]) (./delta_debugging_results.txt [20]
|
||||||
|
[21]) [22] (./template_Report.aux)
|
||||||
|
Package rerunfilecheck Info: File `template_Report.out' has not changed.
|
||||||
|
(rerunfilecheck) Checksum: CD3A6676666652EE2197328EB8D98EEF;1669.
|
||||||
|
)
|
||||||
|
Here is how much of TeX's memory you used:
|
||||||
|
11863 strings out of 476091
|
||||||
|
180324 string characters out of 5794081
|
||||||
|
2247330 words of memory out of 5000000
|
||||||
|
31635 multiletter control sequences out of 15000+600000
|
||||||
|
519044 words of font info for 56 fonts, out of 8000000 for 9000
|
||||||
|
1141 hyphenation exceptions out of 8191
|
||||||
|
75i,7n,76p,1210b,2159s stack positions out of 10000i,1000n,20000p,200000b,200000s
|
||||||
|
{/usr/share/texmf/fonts/enc/dvips/cm-super/cm-super-ts1.enc}</usr/share/texli
|
||||||
|
ve/texmf-dist/fonts/type1/public/amsfonts/cm/cmbx10.pfb></usr/share/texlive/tex
|
||||||
|
mf-dist/fonts/type1/public/amsfonts/cm/cmbx12.pfb></usr/share/texlive/texmf-dis
|
||||||
|
t/fonts/type1/public/amsfonts/cm/cmitt10.pfb></usr/share/texlive/texmf-dist/fon
|
||||||
|
ts/type1/public/amsfonts/cm/cmmi10.pfb></usr/share/texlive/texmf-dist/fonts/typ
|
||||||
|
e1/public/amsfonts/cm/cmr10.pfb></usr/share/texlive/texmf-dist/fonts/type1/publ
|
||||||
|
ic/amsfonts/cm/cmr12.pfb></usr/share/texlive/texmf-dist/fonts/type1/public/amsf
|
||||||
|
onts/cm/cmr5.pfb></usr/share/texlive/texmf-dist/fonts/type1/public/amsfonts/cm/
|
||||||
|
cmsy10.pfb></usr/share/texlive/texmf-dist/fonts/type1/public/amsfonts/cm/cmti10
|
||||||
|
.pfb></usr/share/texlive/texmf-dist/fonts/type1/public/amsfonts/cm/cmtt9.pfb></
|
||||||
|
usr/share/texmf/fonts/type1/public/cm-super/sfrm1000.pfb>
|
||||||
|
Output written on template_Report.pdf (23 pages, 582164 bytes).
|
||||||
|
PDF statistics:
|
||||||
|
789 PDF objects out of 1000 (max. 8388607)
|
||||||
|
728 compressed objects within 8 object streams
|
||||||
|
473 named destinations out of 1000 (max. 500000)
|
||||||
|
162 words of extra memory for PDF output out of 10000 (max. 10000000)
|
||||||
|
|
|
@ -0,0 +1,16 @@
|
||||||
|
\item $MAX\_RAM\_USAGE$: The Max number of bytes a vector used in the test can consume, this is a rough estimate used to put an upper bound on the number of integers in the test. Each test invocation vector is independent and memory is cleared between cycles. This was not designed with buffer reuse or any amount of efficiency so keep that in mind when setting this value too high. The default of 1MiB is fine for this assignment (fails about 15\% of the time).
|
||||||
|
\end{itemize}
|
||||||
|
To make sure there are demonstrable bugs, the sorting code intentionally creates errors within the sorted array. To actually sort the values I used the C++ standard algorithm $std::sort$
|
||||||
|
\begin{lstlisting}[language=c++]
|
||||||
|
|
||||||
|
\end{lstlisting}
|
||||||
|
\subsubsection{Sample Output}
|
||||||
|
\begin{figure}[H]
|
||||||
|
\centering
|
||||||
|
\includegraphics[width=1.0\linewidth]{screenshot001}
|
||||||
|
\caption{Sample output of the random test generator.}
|
||||||
|
\label{fig:screenshot001}
|
||||||
|
\end{figure}
|
||||||
|
\subsection{B}
|
||||||
|
|
||||||
|
\end{document}
|
|
@ -0,0 +1,17 @@
|
||||||
|
\BOOKMARK [1][-]{section.0.1}{\376\377\000Q\000u\000e\000s\000t\000i\000o\000n\000\040\0001}{}% 1
|
||||||
|
\BOOKMARK [2][-]{subsection.0.1.1}{\376\377\000S\000o\000u\000n\000d\000n\000e\000s\000s\000\040\000v\000s\000\040\000C\000o\000m\000p\000l\000e\000t\000e\000n\000e\000s\000s}{section.0.1}% 2
|
||||||
|
\BOOKMARK [2][-]{subsection.0.1.2}{\376\377\000P\000o\000s\000i\000t\000i\000v\000e\000\040\000=\000\040\000F\000i\000n\000d\000\040\000b\000u\000g}{section.0.1}% 3
|
||||||
|
\BOOKMARK [2][-]{subsection.0.1.3}{\376\377\000P\000o\000s\000i\000t\000i\000v\000e\000\040\000=\000\040\000N\000o\000t\000\040\000f\000i\000n\000d\000\040\000b\000u\000g}{section.0.1}% 4
|
||||||
|
\BOOKMARK [1][-]{section.0.2}{\376\377\000Q\000u\000e\000s\000t\000i\000o\000n\000\040\0002}{}% 5
|
||||||
|
\BOOKMARK [2][-]{subsection.0.2.1}{\376\377\000A}{section.0.2}% 6
|
||||||
|
\BOOKMARK [2][-]{subsection.0.2.2}{\376\377\000B}{section.0.2}% 7
|
||||||
|
\BOOKMARK [1][-]{section.0.3}{\376\377\000Q\000u\000e\000s\000t\000i\000o\000n\000\040\0003}{}% 8
|
||||||
|
\BOOKMARK [2][-]{subsection.0.3.1}{\376\377\000A}{section.0.3}% 9
|
||||||
|
\BOOKMARK [2][-]{subsection.0.3.2}{\376\377\000B}{section.0.3}% 10
|
||||||
|
\BOOKMARK [1][-]{section.0.4}{\376\377\000Q\000u\000e\000s\000t\000i\000o\000n\000\040\0004}{}% 11
|
||||||
|
\BOOKMARK [2][-]{subsection.0.4.1}{\376\377\000A}{section.0.4}% 12
|
||||||
|
\BOOKMARK [2][-]{subsection.0.4.2}{\376\377\000B}{section.0.4}% 13
|
||||||
|
\BOOKMARK [1][-]{section.0.5}{\376\377\000Q\000u\000e\000s\000t\000i\000o\000n\000\040\0005}{}% 14
|
||||||
|
\BOOKMARK [2][-]{subsection.0.5.1}{\376\377\000A}{section.0.5}% 15
|
||||||
|
\BOOKMARK [2][-]{subsection.0.5.2}{\376\377\000B}{section.0.5}% 16
|
||||||
|
\BOOKMARK [1][-]{section.0.6}{\376\377\000Q\000u\000e\000s\000t\000i\000o\000n\000\040\0006}{}% 17
|
Binary file not shown.
Binary file not shown.
|
@ -0,0 +1,393 @@
|
||||||
|
\documentclass[]{report}
|
||||||
|
|
||||||
|
|
||||||
|
\usepackage{graphicx}
|
||||||
|
\usepackage{float}
|
||||||
|
\usepackage{enumitem}
|
||||||
|
\usepackage{hyperref}
|
||||||
|
\usepackage{xcolor}
|
||||||
|
\usepackage[normalem]{ulem}
|
||||||
|
\usepackage{listings}
|
||||||
|
|
||||||
|
\definecolor{commentsColor}{rgb}{0.497495, 0.497587, 0.497464}
|
||||||
|
\definecolor{keywordsColor}{rgb}{0.000000, 0.000000, 0.635294}
|
||||||
|
\definecolor{stringColor}{rgb}{0.558215, 0.000000, 0.135316}
|
||||||
|
|
||||||
|
\lstset{
|
||||||
|
columns=flexible,
|
||||||
|
breaklines=true,
|
||||||
|
backgroundcolor=\color{white}, % choose the background color
|
||||||
|
basicstyle=\small\ttfamily, % the size of the fonts that are used for the code
|
||||||
|
breakatwhitespace=false, % sets if automatic breaks should only happen at whitespace
|
||||||
|
breaklines=true, % sets automatic line breaking
|
||||||
|
captionpos=b, % sets the caption-position to bottom
|
||||||
|
commentstyle=\color{commentsColor}\textit, % comment style
|
||||||
|
deletekeywords={...}, % if you want to delete keywords from the given language
|
||||||
|
escapeinside={\%*}{*)}, % if you want to add LaTeX within your code
|
||||||
|
extendedchars=true, % lets you use non-ASCII characters; for 8-bits encodings only, does not work with UTF-8
|
||||||
|
frame=tb, % adds a frame around the code
|
||||||
|
keepspaces=true, % keeps spaces in text, useful for keeping indentation of code (possibly needs columns=flexible)
|
||||||
|
keywordstyle=\color{keywordsColor}\bfseries, % keyword style
|
||||||
|
language=C++, % the language of the code (can be overrided per snippet)
|
||||||
|
otherkeywords={*,...}, % if you want to add more keywords to the set
|
||||||
|
numbers=left, % where to put the line-numbers; possible values are (none, left, right)
|
||||||
|
numbersep=5pt, % how far the line-numbers are from the code
|
||||||
|
numberstyle=\tiny\color{commentsColor}, % the style that is used for the line-numbers
|
||||||
|
rulecolor=\color{black}, % if not set, the frame-color may be changed on line-breaks within not-black text (e.g. comments (green here))
|
||||||
|
showspaces=false, % show spaces everywhere adding particular underscores; it overrides 'showstringspaces'
|
||||||
|
keepspaces=true,
|
||||||
|
showstringspaces=false, % underline spaces within strings only
|
||||||
|
showtabs=false, % show tabs within strings adding particular underscores
|
||||||
|
stepnumber=1, % the step between two line-numbers. If it's 1, each line will be numbered
|
||||||
|
stringstyle=\color{stringColor}, % string literal style
|
||||||
|
tabsize=2, % sets default tabsize to 2 spaces
|
||||||
|
title=\lstname, % show the filename of files included with \lstinputlisting; also try caption instead of title
|
||||||
|
columns=fixed % Using fixed column width (for e.g. nice alignment)
|
||||||
|
}
|
||||||
|
\lstMakeShortInline|
|
||||||
|
|
||||||
|
|
||||||
|
\usepackage{float}
|
||||||
|
|
||||||
|
\renewcommand{\thesection}{\arabic{section}}
|
||||||
|
\renewcommand{\lstlistingname}{Algorithm}% Listing -> Algorithm
|
||||||
|
\renewcommand{\lstlistlistingname}{List of \lstlistingname s}% List of Listings -> List of Algorithms
|
||||||
|
|
||||||
|
% Title Page
|
||||||
|
\title{\textbf{COSC 3P95 Assignment 1}}
|
||||||
|
\author{\textbf{Brett Terpstra}\\
|
||||||
|
bt19ex@brocku.ca - 692021}
|
||||||
|
|
||||||
|
|
||||||
|
\begin{document}
|
||||||
|
\maketitle
|
||||||
|
\tableofcontents
|
||||||
|
|
||||||
|
\section{Question 1}
|
||||||
|
Explain the difference between "sound" and "complete" analysis in software analysis. Then,
|
||||||
|
define what true positive, true negative, false positive, and false negative mean. How would
|
||||||
|
these terms change if the goal of the analysis changes, particularly when "positive" means
|
||||||
|
finding a bug, and then when "positive" means not finding a bug.\\
|
||||||
|
\noindent\rule{\textwidth}{1pt}
|
||||||
|
\subsection{Soundness vs Completeness}
|
||||||
|
\subsubsection{Soundness}
|
||||||
|
Soundness is the ability for the analysis to not report false positives. So having a high soundness means that you can be sure that the bugs that were found are actually bugs in the program.
|
||||||
|
\subsubsection{Completeness}
|
||||||
|
Completeness refers to the ability to find all the bugs in the software by an analysis. So if you can be sure that your analysis is complete, you can be sure that if all bugs are fixed there will be no more bugs. (unless fixing it adds more bugs.) Of course in pratice it's nearly impossible for any tool to be fully complete.
|
||||||
|
\subsection{Positive = Find bug}
|
||||||
|
\subsubsection{True Positive}
|
||||||
|
When the program reports a bug and the bug actually exists
|
||||||
|
\subsubsection{True Negative}
|
||||||
|
When a program doesn't report a bug and there is no bug to be found.
|
||||||
|
\subsubsection{False Positive}
|
||||||
|
When a bug is said to be found but none actually exists.
|
||||||
|
\subsubsection{False Negative}
|
||||||
|
When a bug isn't found but does actually exist. That is to say, the program fails to report the bug.
|
||||||
|
\subsection{Positive = Not find bug}
|
||||||
|
You literally invert the logic. It's pretty basic stuff here? Is this subpart just busy work? Take the logical not of each sentence and that's the answer. This results in confusing statements and shouldn't be used in practice.
|
||||||
|
\subsubsection{True Positive}
|
||||||
|
When the program does not report a bug, there is not a bug present.
|
||||||
|
\subsubsection{True Negative}
|
||||||
|
When a program reports a bug, there is a bug to be found.
|
||||||
|
\subsubsection{False Positive}
|
||||||
|
When a bug is not found but one actually exists.
|
||||||
|
\subsubsection{False Negative}
|
||||||
|
When a bug is found, but does doesn't actually exist.
|
||||||
|
|
||||||
|
\section{Question 2}
|
||||||
|
\subsection{A}
|
||||||
|
Using your preferred programming language, implement a random test case generator for a
|
||||||
|
sorting algorithm program that sorts integers in ascending order. The test case generator
|
||||||
|
should be designed to produce arrays of integers with random lengths, and values for each
|
||||||
|
sorting method.\\
|
||||||
|
\noindent\rule{\textwidth}{1pt}
|
||||||
|
\subsubsection{Source}
|
||||||
|
Please find the source code in the ZIP attachment for the submission of this assignment. Compiling instructions are found within the source file. Any C++20 compiler with support for |.contains| and |std::find\_if()| will work.
|
||||||
|
\subsubsection{Explanation}
|
||||||
|
Since we are only testing random int32s of random sizes I took a very simplistic approach. For our convenience there are two global config variables you can change:
|
||||||
|
\begin{itemize}
|
||||||
|
\item |DEFAULT_TEST_COUNT|: Number of tests to run, defaults 10, and can be provided at runtime via the optional command line argument:\\ |./main.run [TEST\_COUNT]|
|
||||||
|
\item |MAX_RAM_USAGE|: The Max number of bytes a vector used in the test can consume, this is a rough estimate used to put an upper bound on the number of integers in the test. Each test invocation vector is independent and memory is cleared between cycles. This was not designed with buffer reuse or any amount of efficiency so keep that in mind when setting this value too high. The default of 1MiB is fine for this assignment (fails about 15\% of the time).
|
||||||
|
\end{itemize}
|
||||||
|
To cover all possible test cases I generate values in the range |[INTEGER_MIN, INTEGER_MAX]| which populate a vector of size |[0, MAX_SIZE]|
|
||||||
|
\newpage
|
||||||
|
\begin{lstlisting}[caption={Test case generator code}]
|
||||||
|
std::vector<std::int32_t> generateRandomData() {
|
||||||
|
// setup random numbers
|
||||||
|
static std::random_device dev;
|
||||||
|
static std::mt19937_64 engine(dev());
|
||||||
|
// we will generate numbers from integer min to integer max to cover the full possible test cases
|
||||||
|
std::uniform_int_distribution dist(std::numeric_limits<std::int32_t>::min(), std::numeric_limits<std::int32_t>::max());
|
||||||
|
// put a upper limit on the size of the array
|
||||||
|
std::uniform_int_distribution dist_size(0ul, maxSize);
|
||||||
|
// pick a random size
|
||||||
|
size_t size = dist_size(engine);
|
||||||
|
// populate the array
|
||||||
|
std::vector<std::int32_t> ret;
|
||||||
|
for (size_t i = 0; i < size; i++)
|
||||||
|
ret.push_back(dist(engine));
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
\end{lstlisting}
|
||||||
|
To make sure there are demonstrable bugs, the sorting code intentionally creates errors within the sorted array. To actually sort the values I used the C++ standard algorithm |std::sort| which won't fail. I did this because the standard sort is \underline{\textit{fast}} and creating a sorting algorithm which fails some of the time but not others is easier said than done.
|
||||||
|
\begin{lstlisting}[caption={Sort algorithm fail generator}]
|
||||||
|
[...]
|
||||||
|
std::uniform_int_distribution<int> dist(0, (int) v.size() - 1);
|
||||||
|
std::uniform_real_distribution realDist(0.0, 1.0);
|
||||||
|
int p1 = dist(engine);
|
||||||
|
int p2 = dist(engine);
|
||||||
|
if (!v.empty() && realDist(engine) > 0.85)
|
||||||
|
v[p1] = v[p2];
|
||||||
|
[...]
|
||||||
|
\end{lstlisting}
|
||||||
|
This method of creating a failure also has the benefit of sometimes not failing, so it could execute, but the array may still be valid. It also shows that out of order pairs which are not neighbours will cause a failure condition that is detected. It should be noted that the validation will only report the first instance of an out of order number. This was done purely for performance. The report is generated as a tuple |{i, j}| where |i| is the failed number index and |j| is the first value index which causes the failure.
|
||||||
|
\subsubsection{Sample Output}
|
||||||
|
I took the liberty of automatically formatting the output because I like when things look pretty :3
|
||||||
|
\begin{figure}[H]
|
||||||
|
\centering
|
||||||
|
\includegraphics[width=1.0\linewidth]{screenshot001}
|
||||||
|
\caption{Sample output of the random test generator.}
|
||||||
|
\label{fig:screenshot001}
|
||||||
|
\end{figure}
|
||||||
|
\subsection{B}
|
||||||
|
Provide a context-free grammar to generate all the possible test-cases.\\
|
||||||
|
\noindent\rule{\textwidth}{1pt}
|
||||||
|
\begin{center}
|
||||||
|
\begin{enumerate}[label=(\arabic*)]
|
||||||
|
\item $<$Array$>$ $\rightarrow$ "\{" $<$Array\_Expression$>$ "\}" $\vert$ "\{\}"
|
||||||
|
\item $<$Array\_Expression$>$ $\rightarrow$ $<$Integral\_t$>$ $\vert$ $<$Integral\_t$>$ "," $<$Array\_Expression$>$
|
||||||
|
\item $<$Integral\_t$>$ $\rightarrow$ $<$Value$>$ $\vert$ -$<$Value$>$
|
||||||
|
\item $<$Value$>$ $\rightarrow$ $<$Integer$>$ $\vert$ $<$Value$>$$<$Integer$>$
|
||||||
|
\item $<$Integer$>$ $\rightarrow$ "0" $\vert$ "1" $\vert$ "2" $\vert$ ... $\vert$ "9"
|
||||||
|
\end{enumerate}
|
||||||
|
\end{center}
|
||||||
|
\newpage
|
||||||
|
\subsubsection{(2.B) Explanation}
|
||||||
|
I tried to be as explicit as possible based on my understanding of formal context free grammars (very limited, mostly with regard to simple compilers). I'm sure it could be simplified down, but the derivation of the grammar should generate a valid C++ initializer list.\\
|
||||||
|
My reasoning on each:
|
||||||
|
\begin{enumerate}[label=(\arabic*)]
|
||||||
|
\item Construct the actual array object itself. Can have any number of values in it or be an empty array.
|
||||||
|
\item The contents of an array can either be a single integral type (termination / base case) or an integral type with more array content after it, which recursively expands to any number of integers.
|
||||||
|
\item Needed this to make sure the negative sign is placed first and only once. Alternative would be: $<$Value$>$ $\rightarrow$ -$<$Value$>$ $\vert$ $<$Integer$>$ $\vert$ $<$Value$>$$<$Integer$>$, but that could (in theory) result in |-------1| which is why I included the integral\_t step.
|
||||||
|
\item Integers can be one of 10 characters so we recursively concat any number of $<$Integer$>$ together to create our value. The examples in the slides don't do this, but it would not make sense without this step.
|
||||||
|
\item The base characters for creating integer values.
|
||||||
|
\end{enumerate}
|
||||||
|
\section{Question 3}
|
||||||
|
\subsection{A}
|
||||||
|
\begin{figure}[H]
|
||||||
|
\centering
|
||||||
|
\includegraphics[width=0.80\linewidth]{Q3A1COSC3P95.drawio.png}
|
||||||
|
\caption{Direct translation of the code, logic errors and all.}
|
||||||
|
\label{fig:Q3A1COSC3P95}
|
||||||
|
\end{figure}
|
||||||
|
|
||||||
|
\subsection{B}
|
||||||
|
Explain and provide detailed steps for “random testing” the above code. No need to run any
|
||||||
|
code, just present the coding strategy or describe your testing method in detail.\\
|
||||||
|
\noindent\rule{\textwidth}{1pt}
|
||||||
|
I don't like the lack of static types in python. So, to remedy this I will assume items are numbers which can be trivially concatenated with strings. First start by generating a list of N random integers where N is also selected randomly from the whole numbers set. Second, pick a random subset of those integers, these will be your exception types. Randomly select an integer to act as the limit. Run the function and check the output to make sure it is what is expected. Repeat this until the number of tests you want have completed.
|
||||||
|
\section{Question 4}
|
||||||
|
\subsection{A}
|
||||||
|
Develop 4 distinct test cases to test the above code, with code coverage ranging from 30%
|
||||||
|
to 100\%. For each test-case calculate and mention its code coverage.\\
|
||||||
|
\noindent\rule{\textwidth}{1pt}
|
||||||
|
Using statement coverage since it was not specified which type of code coverage to use.
|
||||||
|
\begin{figure}[H]
|
||||||
|
\centering
|
||||||
|
\includegraphics[width=0.8\linewidth]{screenshot003}
|
||||||
|
\caption{12 Statements in the function}
|
||||||
|
\label{fig:screenshot003}
|
||||||
|
\end{figure}
|
||||||
|
\subsubsection{Test 1}
|
||||||
|
To get 30\% code coverage we can input with empty data. This will run statements, 1,2,3, and 12 for a total of 33.3\% coverage. The values of limit and exceptions doesn't matter in this case.
|
||||||
|
\subsubsection{Test 2}
|
||||||
|
|data = {55, 12, 66}|\\
|
||||||
|
|limit = 18|\\
|
||||||
|
|exceptions = {55}|\\\\
|
||||||
|
As statements 1,2,3 and 12 all run no matter what we add 4 to the base coverage. Since we have items in data statement 4 and 5 get executed. Since 55 is in exceptions statement 6 also gets executed. value 12 is less than limit so statement 7 and 9 gets executed. Since 66 is above the limit so does statement 8 also runs. 10 and 11 will run for all 3 values resulting in 12/12 coverage or 100\%.
|
||||||
|
\subsubsection{Test 3}
|
||||||
|
|data = {12}|\\
|
||||||
|
|limit = 18|\\
|
||||||
|
|exceptions = {}|\\\\
|
||||||
|
\begin{figure}[H]
|
||||||
|
\centering
|
||||||
|
\includegraphics[width=0.7\linewidth]{screenshot004}
|
||||||
|
\caption{Test 3 Graphical Results}
|
||||||
|
\label{fig:screenshot004}
|
||||||
|
\end{figure}
|
||||||
|
Thus this test produces 10/12 or 83\% code coverage.
|
||||||
|
\newpage
|
||||||
|
\subsubsection{Test 4}
|
||||||
|
|data = {69}|\\
|
||||||
|
|limit = 420|\\
|
||||||
|
|exceptions = {69}|\\
|
||||||
|
\begin{figure}[H]
|
||||||
|
\centering
|
||||||
|
\includegraphics[width=0.7\linewidth]{screenshot005}
|
||||||
|
\caption{Test 4 Graphical Results}
|
||||||
|
\label{fig:screenshot005}
|
||||||
|
\end{figure}
|
||||||
|
This test produces 66\% code coverage.
|
||||||
|
\subsection{B}
|
||||||
|
Generate 6 modified (mutated) versions of the above code.\\
|
||||||
|
\noindent\rule{\textwidth}{1pt}
|
||||||
|
|
||||||
|
Method call mutations not possible due to the lack of external function calls by the given function.
|
||||||
|
(existing calls not possible to modify due to lack of viable alternatives)
|
||||||
|
\begin{lstlisting}[language=python,caption={Mutation 1}]
|
||||||
|
def filterData1(data, limit, exceptions):
|
||||||
|
filtered_data = []
|
||||||
|
index = 0
|
||||||
|
while index < len(data):
|
||||||
|
item = data[index]
|
||||||
|
if item in exceptions:
|
||||||
|
modified_item = str(item) + "_EXCEPTION"
|
||||||
|
elif item > limit:
|
||||||
|
modified_item = item + 2 # Arithmetic mutation
|
||||||
|
else:
|
||||||
|
modified_item = item / limit
|
||||||
|
filtered_data.append(modified_item)
|
||||||
|
index += 1
|
||||||
|
return filtered_data
|
||||||
|
\end{lstlisting}
|
||||||
|
\begin{lstlisting}[language=python,caption={Mutation 2}]
|
||||||
|
def filterData2(data, limit, exceptions):
|
||||||
|
filtered_data = []
|
||||||
|
index = 0
|
||||||
|
while index < len(data):
|
||||||
|
item = data[index]
|
||||||
|
if item not in exceptions: # Boolean mutation
|
||||||
|
modified_item = str(item) + "_EXCEPTION"
|
||||||
|
elif item > limit:
|
||||||
|
modified_item = item * 2
|
||||||
|
else:
|
||||||
|
modified_item = item / limit
|
||||||
|
filtered_data.append(modified_item)
|
||||||
|
index += 1
|
||||||
|
return filtered_data
|
||||||
|
\end{lstlisting}
|
||||||
|
\begin{lstlisting}[language=python,caption={Mutation 3}]
|
||||||
|
def filterData3(data, limit, exceptions):
|
||||||
|
filtered_data = []
|
||||||
|
index = 1 # statement mutation
|
||||||
|
while index < len(data):
|
||||||
|
item = data[index]
|
||||||
|
if item in exceptions:
|
||||||
|
modified_item = str(item) + "_EXCEPTION"
|
||||||
|
elif item > limit:
|
||||||
|
modified_item = item * 2
|
||||||
|
else:
|
||||||
|
modified_item = item / limit
|
||||||
|
filtered_data.append(modified_item)
|
||||||
|
index += 1
|
||||||
|
return filtered_data
|
||||||
|
\end{lstlisting}
|
||||||
|
\begin{lstlisting}[language=python,caption={Mutation 4}]
|
||||||
|
def filterData4(data, limit, exceptions):
|
||||||
|
filtered_data = []
|
||||||
|
index = 0
|
||||||
|
while index < len(data):
|
||||||
|
item = data[index]
|
||||||
|
if item in data: # Variable mutation
|
||||||
|
modified_item = str(item) + "_EXCEPTION"
|
||||||
|
elif item > limit:
|
||||||
|
modified_item = item * 2
|
||||||
|
else:
|
||||||
|
modified_item = item / limit
|
||||||
|
filtered_data.append(modified_item)
|
||||||
|
index += 1
|
||||||
|
return filtered_data
|
||||||
|
\end{lstlisting}
|
||||||
|
\begin{lstlisting}[language=python,caption={Mutation 5}]
|
||||||
|
def filterData5(data, limit, exceptions):
|
||||||
|
filtered_data = []
|
||||||
|
index = 0
|
||||||
|
while index < len(data):
|
||||||
|
item = data[index]
|
||||||
|
if item in exceptions:
|
||||||
|
modified_item = str(item) + "_EXCEPTION"
|
||||||
|
elif item > limit:
|
||||||
|
modified_item = item * 2
|
||||||
|
else:
|
||||||
|
modified_item = item / 2 # Statement mutation
|
||||||
|
filtered_data.append(modified_item)
|
||||||
|
index += 1
|
||||||
|
return filtered_data
|
||||||
|
\end{lstlisting}
|
||||||
|
\begin{lstlisting}[language=python,caption={Mutation 6}]
|
||||||
|
def filterData6(data, limit, exceptions):
|
||||||
|
filtered_data = []
|
||||||
|
index = 0
|
||||||
|
while index < len(data): # Boolean mutation
|
||||||
|
item = data[index]
|
||||||
|
if item in exceptions:
|
||||||
|
modified_item = str(item) + "_EXCEPTION"
|
||||||
|
elif item > limit:
|
||||||
|
modified_item = item * 2
|
||||||
|
else:
|
||||||
|
modified_item = item / limit
|
||||||
|
filtered_data.append(modified_item)
|
||||||
|
index += 1
|
||||||
|
return filtered_data
|
||||||
|
\end{lstlisting}
|
||||||
|
\subsubsection{C}
|
||||||
|
Assess the effectiveness of the test cases from part A by using mutation analysis in
|
||||||
|
conjunction with the mutated codes from part B. Rank the test-cases and explain your answer.\\
|
||||||
|
\noindent\rule{\textwidth}{1pt}
|
||||||
|
I made a script to all \textbf{24} cases for me :/
|
||||||
|
Ranked results are at the bottom.
|
||||||
|
\lstinputlisting{results.txt}
|
||||||
|
The first test case always passes because it's a trivial example. Most mutations will not cause it to fail. Other than that the results stand for themselves.
|
||||||
|
\subsubsection{D}
|
||||||
|
Discuss how you would use path, branch, and statement static analysis to evaluate/analyse
|
||||||
|
the above code.\\
|
||||||
|
\noindent\rule{\textwidth}{1pt}
|
||||||
|
\paragraph{Branch Static Analysis}
|
||||||
|
Easy sweep and mark the code for branches, identifying the test cases in a type of tree (the tree would include code which modifies any variables used in the conditionals otherwise we don't care!) then preorder traverse the tree resulting in every test case being covered, in the correct order of execution. Print a warning to the user if any syntactic or common logical errors are found (since this is static we are not actually executing the code but looking at it for errors). Note: the left subtree would but the true case, the right subtree would be the false case, assuming |else| is present.
|
||||||
|
\paragraph{Path Static Analysis}
|
||||||
|
I put this second because you could do the exact same thing as branch analysis but instead of doing preorder, which covers all code paths, you pick a path you want to follow and execute through it. You would also want to record every statement (in order of function call from init/main) instead of just what is relevant to the conditions. As with the branch analysis we don't actually execute the path but rather look at the code for errors. (Clang tidy ftw)
|
||||||
|
\paragraph{Statement Static Analysis}
|
||||||
|
Parse through the file line by line looking at all the statements in the code printing errors as we find them. I'm not sure if you are looking for how we would actually detect that, other than syntax errors that question has a complicated answer. Even finding syntax errors can be hard, although you would only have to parse the AST and if you find an unexpected token it's pretty clear the programmer made an error.
|
||||||
|
|
||||||
|
\section{Question 5}
|
||||||
|
The code snippet below aims to switch uppercase characters to their lowercase counterparts
|
||||||
|
and vice versa. Numeric characters are supposed to remain unchanged. The function contains
|
||||||
|
at least one known bug that results in incorrect output for specific inputs.\\
|
||||||
|
\begin{lstlisting}[language=python]
|
||||||
|
def processString(input_str):
|
||||||
|
output_str = ""
|
||||||
|
for char in input_str:
|
||||||
|
if char.isupper():
|
||||||
|
output_str += char.lower()
|
||||||
|
elif char.isnumeric():
|
||||||
|
output_str += char * 2
|
||||||
|
else:
|
||||||
|
output_str += char.upper()
|
||||||
|
return output_str
|
||||||
|
\end{lstlisting}
|
||||||
|
\subsection{A}
|
||||||
|
Identify the bug(s) in the code. You can either manually review the code (a form of
|
||||||
|
static analysis) or run it with diverse input values (a form of manual random testing).
|
||||||
|
If you are unable to pinpoint the bug using these methods, you may utilize a random
|
||||||
|
testing tool or implement random test case generator in code. Provide a detailed
|
||||||
|
explanation of the bug, identify the line of code causing it, and describe your
|
||||||
|
strategy for finding it.\\
|
||||||
|
\noindent\rule{\textwidth}{1pt}
|
||||||
|
\begin{itemize}
|
||||||
|
\item Bug on line 7: numbers should remain the same. This code not only is trying to double the value but it won't even do that! |char * 2| in python will add 2 characters of that number to the output string. Found via inspection and by running the program; at first I thought char * 2 would double the integer version of the char but I was wrong. It is a good thing I tested it in python as well.
|
||||||
|
\item This is the only bug determined by visual analysis and python tests.
|
||||||
|
\end{itemize}
|
||||||
|
\subsection{B}
|
||||||
|
Implement Delta Debugging, in your preferred programming language to minimize
|
||||||
|
the input string that reveals the bug. Test your Delta Debugging code for the
|
||||||
|
following input values provided.
|
||||||
|
\lstinputlisting[language=python]{delta_debugger.py}
|
||||||
|
(This file is included in the zip for this assignment. I'm not completely sure why I pasted this here but not the C++. Something Something tired Something Something Python being cleaner than C++)\\
|
||||||
|
And some test results running on my computer:
|
||||||
|
\lstinputlisting{delta_debugging_results.txt}
|
||||||
|
I would've preferred C++ but trying to run the python function from C++ in a cross-platform way isn't something I think you or I want to deal with. This python code is a simple but clean implementation of delta debugging which finds a set of minimal strings which cause errors within the provided function. From the results of the delta debugging program it appears my static analysis was correct in there being only one bug. This delta debugging implementation uses a binary search method where the input string is recursively split in half until either a minimal error string is found or the string can no longer be split. A string is known to error if the result of the incorrect function does not match a known correct output which is generated at runtime. Since there is no hard way to pre-generate valid and invalid strings we must assume the output of my 'correct' function is in fact valid. The actual implementation of this concept uses a while loop with a queue to do the recursion; a queue was used because using a stack is unnecessary. If I had implemented this with C++ I would have used a stack like structure as |std::vector| has a |pop_back| function.
|
||||||
|
|
||||||
|
\section{Question 6}
|
||||||
|
|
||||||
|
|
||||||
|
\end{document}
|
|
@ -0,0 +1,40 @@
|
||||||
|
\contentsline {section}{\numberline {1}Question 1}{1}{section.0.1}%
|
||||||
|
\contentsline {subsection}{\numberline {1.1}Soundness vs Completeness}{1}{subsection.0.1.1}%
|
||||||
|
\contentsline {subsubsection}{Soundness}{1}{section*.2}%
|
||||||
|
\contentsline {subsubsection}{Completeness}{2}{section*.3}%
|
||||||
|
\contentsline {subsection}{\numberline {1.2}Positive = Find bug}{2}{subsection.0.1.2}%
|
||||||
|
\contentsline {subsubsection}{True Positive}{2}{section*.4}%
|
||||||
|
\contentsline {subsubsection}{True Negative}{2}{section*.5}%
|
||||||
|
\contentsline {subsubsection}{False Positive}{2}{section*.6}%
|
||||||
|
\contentsline {subsubsection}{False Negative}{2}{section*.7}%
|
||||||
|
\contentsline {subsection}{\numberline {1.3}Positive = Not find bug}{2}{subsection.0.1.3}%
|
||||||
|
\contentsline {subsubsection}{True Positive}{2}{section*.8}%
|
||||||
|
\contentsline {subsubsection}{True Negative}{2}{section*.9}%
|
||||||
|
\contentsline {subsubsection}{False Positive}{2}{section*.10}%
|
||||||
|
\contentsline {subsubsection}{False Negative}{2}{section*.11}%
|
||||||
|
\contentsline {section}{\numberline {2}Question 2}{3}{section.0.2}%
|
||||||
|
\contentsline {subsection}{\numberline {2.1}A}{3}{subsection.0.2.1}%
|
||||||
|
\contentsline {subsubsection}{Source}{3}{section*.12}%
|
||||||
|
\contentsline {subsubsection}{Explanation}{3}{section*.13}%
|
||||||
|
\contentsline {subsubsection}{Sample Output}{5}{section*.14}%
|
||||||
|
\contentsline {subsection}{\numberline {2.2}B}{5}{subsection.0.2.2}%
|
||||||
|
\contentsline {subsubsection}{(2.B) Explanation}{6}{section*.15}%
|
||||||
|
\contentsline {section}{\numberline {3}Question 3}{7}{section.0.3}%
|
||||||
|
\contentsline {subsection}{\numberline {3.1}A}{7}{subsection.0.3.1}%
|
||||||
|
\contentsline {subsection}{\numberline {3.2}B}{8}{subsection.0.3.2}%
|
||||||
|
\contentsline {section}{\numberline {4}Question 4}{8}{section.0.4}%
|
||||||
|
\contentsline {subsection}{\numberline {4.1}A}{8}{subsection.0.4.1}%
|
||||||
|
\contentsline {subsubsection}{Test 1}{9}{section*.16}%
|
||||||
|
\contentsline {subsubsection}{Test 2}{9}{section*.17}%
|
||||||
|
\contentsline {subsubsection}{Test 3}{9}{section*.18}%
|
||||||
|
\contentsline {subsubsection}{Test 4}{11}{section*.19}%
|
||||||
|
\contentsline {subsection}{\numberline {4.2}B}{11}{subsection.0.4.2}%
|
||||||
|
\contentsline {subsubsection}{C}{13}{section*.20}%
|
||||||
|
\contentsline {subsubsection}{D}{16}{section*.21}%
|
||||||
|
\contentsline {paragraph}{Branch Static Analysis}{16}{section*.22}%
|
||||||
|
\contentsline {paragraph}{Path Static Analysis}{17}{section*.23}%
|
||||||
|
\contentsline {paragraph}{Statement Static Analysis}{17}{section*.24}%
|
||||||
|
\contentsline {section}{\numberline {5}Question 5}{17}{section.0.5}%
|
||||||
|
\contentsline {subsection}{\numberline {5.1}A}{17}{subsection.0.5.1}%
|
||||||
|
\contentsline {subsection}{\numberline {5.2}B}{18}{subsection.0.5.2}%
|
||||||
|
\contentsline {section}{\numberline {6}Question 6}{22}{section.0.6}%
|
Loading…
Reference in New Issue