代写 ECE297 Communication and Design
100%原创包过,高质代写&免费提供Turnitin报告--24小时客服QQ&微信:120591129
ECE297 Communication and Design Winter 2016
ECE297 Milestone 1
Using the libstreetsdatabase API
“There is more to life than increasing its speed.”
–Mahatma Ghandi
Assigned on Thursday Jan. 14th TA mark for style, unit tests, SVN use, etc. = 3/8
Due on Monday Feb 1st Autotester = 5/8
Total marks = 8/100
1 Objectives
This milestone focuses on using and extending an application programming interface (API).
We have given you an API (StreetsDatabaseAPI.h) that allows you to query a geographic
information database (data file) for basic information such as street names and intersection
locations. This StreetsDatabaseAPI.h is made up of several functions, and each function
gives you information about streets or intersections that exist in a libstreetsdatabase file.
We’ll be testing your code with the data files for several cities, including Toronto, New York,
Moscow and Cairo. In this milestone you will learn to use this API, and you will be asked to
implement further functions that will be useful for your project; essentially you are creating
a new, richer API. To make some of the functions in your new API fast, you will also need
to create and load some data structures of your own to allow fast look-ups. We strongly
encourage you to make use of the STL container classes such as vectors and maps that you
recently learned about in the course tutorials to build your data structures quickly. Some of
the tests we have released for this milestone test the speed of your new API; based on the
results of these tests you can see where you need to optimize for speed.
After completing this milestone you should be able to:
1 Query the libstreetsdatabase using functions in the provided map API.
2 Extend the map API with functions that return useful map information.
3 Use STL data structures such as vectors and maps.
4 Create and use unit tests to test your code.
2 Problem Statement
In this milestone you will load a skeleton C++ project in Netbeans and put it under re-
vision control. This will be the C++ project on which you implement all of your ECE297
Page 1 of 23
ECE297 Communication and Design Winter 2016
milestones. You will then start using some of the functions (such as getStreetName) in
StreetsDatabaseAPI.h that is provided with the project – this API allows you to access
the data loaded from a large binary file that describes all the streets and intersections in a
city. You will then be asked to implement your own functions that perform useful libstreets-
database queries. For example, you will implement a function that returns all intersections
along a given street. Finally, you will test your code using the autotester, and submit it
using the submit script. Note that you will be using SVN throughout the milestone to
work effectively with your teammates.
3 Walkthrough
Even though your ECE297 project is divided up into milestones, all of the milestones are part
of one project. You will be creating a simple mapping application similar to Google/Bing
Maps. It is important to realize that everything you code in milestone 1, you will use in
milestone 2. And everything you do in milestone 2 will be used in milestone 3, and so on.
!
Your project is divided into milestones, but you will use your solutions to
the milestones in all subsequent milestones.
This is also why you started off by learning how to use SVN. To build up on your project
code efficiently, it is important to keep it under revision control and to commit often. This
will allow you to divide tasks easily among your team members and keep track of all changes
made to your project code. Note that your grade will depend on many things:
1. Code correctness and performance will be mostly automatically graded.
2. Coding style and commenting. You will get feedback on this through your TA.
3. Your use of SVN. This will be checked by your TA.
4. Your creation of unit tests for some functions. This will be checked by your TA.
Page 1 of 1
7/8/2014file:///C:/Users/Mohamed/Desktop/light-bulb-7.svg
An effective team project is well-commented and uses revision control (such
as SVN) to effectively divide work and maintain a history of code changes.
In the following two subsections (3.1 and 3.2), we’ll outline how to initialize the repository.
Note that Section 3.1 is only done by one team member, while Section 3.2 must be done by
all team members.
3.1 Set-up Project with Netbeans and SVN (1 team member)
You will download the compressed project from the course website and open it in Netbeans.
You will then create a repository under “/groups/ECE297S/cd-XXX” where XXX is team
number assigned to you. This will allow you to import your project into the repository you
created and maintain the project code under revision control.
Page 2 of 23
ECE297 Communication and Design Winter 2016
If you need a refresher on revision control tasks read “ECE297 Quickstart
Guide: SVN”.
Perform the following steps to set up your project with Netbeans and SVN on the UG
machines. Note that screenshots of the following steps are provided in Appendix A. Also
note that only one of your 3 team members will perform the following steps to set up the
repository.
1. Download mapper.zip from the [code] link for milestone 1 on the course website and
save it in your home directory.
2. Open the project in Netbeans and save it in your home directory. You will notice that
the project you just opened is divided into three parts:
libstreetsdatabase: This library provides the functions for accessing the lib-
streetsdatabase; it has been written for you. Look at the file StreetsDatabaseAPI.h;
it shows the interfaces to all the functions that you will need for this milestone from
that library.
libstreetmap: This is the library that you will be creating throughout your
ECE297 project. You will notice that it contains “m1.h” and “m1.cpp” – these
are the header and a possible implementation file (you can create more .cpp files)
that you will be working on in milestone 1 (this milestone).
mapper: This project contains your “main.cpp” file; this is where your program
starts executing. You can call the functions from libstreetsdatabase and libstreetmap
here.
libstreetmap
m1.h
libstreetsdatabase
StreetsDatabaseAPI.h
uses
functions
from
parses
data in
toronto.streets.bin
Figure 1: Project API layers.
3. Create a repository (using svnadmin) under “/groups/ECE297S/cd-XXX”.
Page 3 of 23
ECE297 Communication and Design Winter 2016
1 > svnadmin create /groups/ECE297S/cd-XXX/mapper_repo
4. Set repository permissions so your group can commit to the repository
1 > chmod -R g+rw /groups/ECE297S/cd-XXX/mapper_repo
!
After creating the repository with svnadmin and setting up revision
control, do NOT touch the repository location or modify any files there
as that will probably lead to loss of data in the repository.
5. Import your opened projects (mapper, libstreetmap and libstreetsdatabase) into your
repository. Make sure you only include the files that you want to keep under revision
control (see Fig. 13 for files that you should exclude from revision control).
3.2 Checkout Project (All 3 team members)
Now that the project is stored in a repository, you or any of your team members can get a
copy of the project using svn checkout. If you are the team member who did Section 3.1,
delete your working copy of the project (your working copy is the version of the project that
you have in your home directory) – we’ll checkout a fresh version to make sure everything is
working fine. Now all three team members should go in their home directories and run the
following command to checkout a working copy of the project.
1 > svn checkout svn+ssh://ugZZZ.eecg.utoronto.ca/groups/ECE297S/cd-XXX/mapper_repo
Note that ugZZZ must be replaced by a machine in the range ug132-ug180 or ug201-ug249
as described here. Also note that in milestone 0, and in the svn tutorial we used a different
protocol (file://) to access the repository. The “file://” protocol is suitable for accessing
repositories on the same filesystem; however, by using the “svn+ssh” protocol here, we are
able to access this repository from any computer inside or outside the EECG network. You
will have to provide your eecg username and password as shown in the following figure.
At this point, all three team members should have a working copy of the mapper project
in their home directories. Make sure the project compiles and runs properly on Netbeans
for all three user accounts before you proceed past this point.
3.3 Understand StreetsDatabaseAPI.h
Fig. 3 shows how a map is represented internally in the libstreetsdatabase. Each Intersection
is a graph node and each Street Segment is a graph edge (which connects two Intersection
nodes). Note that multiple Street Segments make up one Street – for example, the dotted
Street Segments are all part of one Street (College St.).
Page 4 of 23
ECE297 Communication and Design Winter 2016
Figure 2: SVN checkout dialog box in Netbeans.
Page 1 of 1
7/8/2014file:///C:/Users/Mohamed/Desktop/light-bulb-7.svg
In the libstreetsdatabase graph, each graph node is an Intersection, and
each graph edge (between 2 nodes) is a Street Segment.
The provided StreetsDatabaseAPI has an unsigned integer id for each of the intersections;
from 0 to getNumberOfIntersections()-1 – which is the total number of intersections. Sim-
ilarly, each Street Segment has an unsigned integer id from 0 to getNumberOfStreetSegments()-1
and each Street has an unsigned integer id from 0 to getNumberOfStreets()-1. Addition-
ally, each Intersection has a name, and each Street has a name. Note that it is possible for
two Streets to have the same name; there is more than one Main Street in Greater Toronto
for example. Intersection names are formed from the names of the streets that meet at
that intersection, and it is possible to have two intersections with the same name. Street
Segments do not have unique names associated with them.
Page 1 of 1
7/8/2014file:///C:/Users/Mohamed/Desktop/light-bulb-7.svg
Each Intersection, Street Segment, or Street has a unique unsigned integer
ID. Only Intersections and Streets have names, and they may not be unique.
Listing 1 shows “StreetsDatabaseAPI.h” which is included in your Netbeans Project
under libstreetsdatabase – this contains the libstreetsdatabase API functions that you can
use to retrieve information about the map-graph of Toronto. All function prototypes are
commented; this is the best kind of documentation as it always remains with the code.
Study the API and the comments, and try out the different functions to understand what
each function does and how it works.
Note that in addition to Streets, Street Segments and Intersections, the StreetsDatabaseAPI
also provides ’Points of Interest’ which are simply interesting landmarks, such as Union Sta-
tion or a Tim Horton’s store. Each ’Point of Interest’ has a location, name and a type
(another string) only. There are also function calls to obtain natural features like the bound-
aries of parks and lakes and function calls to obtain the unique OSMid (identifier) for each
item in the database, but we will not use that part of the StreetsDatabaseAPI until milestone
Page 5 of 23
ECE297 Communication and Design Winter 2016
Intersection
Street Segment
a) Snapshot of Bathurst/College area from Google Maps
b) Map-database graph representation of Bathurst/College area
College
Street
Street
Segment
Inter-
section
Figure 3: libstreetsdatabase contains a graph of intersections and street segments. You can query
StreetsDatabaseAPI to find information about the graph. For example, you can find which street
segments are at each intersection. Note that multiple Street Segments make up one Street – for
example, the dotted Street Segments are all part of one Street (College St.).
2.
1
1 The OSMid values allow you to use another API, in “OSMDatabaseAPI.h”, that contains even more information
from the map database, but we will not use that API in this milestone and its use is optional even in later milestones.
Page 6 of 23
ECE297 Communication and Design Winter 2016
1 #pragma once //protects against multiple inclusions of this header file
2
3 #include <string >
4 #include "LatLon.h"
5
6 #include "Feature.h"
7 #include "OSMEntityType.h"
8
9 // The ID in the global OSM database of a particular data item
10 // You can use this ID to look up more detailed info about a data item
11 // from the "layer -1" OSMDatabaseAPI.h
12 typedef unsigned long long OSMID;
13
14 // Structure used to return information about a StreetSegment ,
15 // which is the portion of a street between two intersections.
16 struct StreetSegmentInfo {
17 OSMID wayOSMID; // OSM ID of the source way
18 unsigned from, to; // intersection ID this segment runs from/to
19 bool oneWay; // if true, then can only travel in from->to direction
20 unsigned curvePointCount; // number of curve points between the ends
21 // will be 0 for straight StreetSegments
22 float speedLimit; // speed limit in km/hr
23 unsigned streetID; // index of street to which this segment belongs
24 };
25
26 // load the layer -2 streets database. This is the easier to use API
27 // that provides higher -level information than the raw OSM data.
28 // To access the raw OSM data, use the layer -1 API in OSMDatabaseAPI.h
29 bool loadStreetsDatabaseBIN(std::string);
30 void closeStreetDatabase();
31
32 // aggregate queries
33 unsigned getNumberOfStreets();
34 unsigned getNumberOfStreetSegments();
35 unsigned getNumberOfIntersections();
36 unsigned getNumberOfPointsOfInterest();
37 unsigned getNumberOfFeatures();
38
39 //------------------------------------------------
40 // Intersection information
41 std::string getIntersectionName(unsigned intersectionID);
42 LatLon getIntersectionPosition(unsigned intersectionID);
43 OSMID getIntersectionOSMNodeID(unsigned intersectionID);
44
45 //number of street segments at an intersection
46 unsigned getIntersectionStreetSegmentCount(unsigned intersectionID);
47
48 // find the street segments at an intersection. idx is from
49 // 0..streetSegmentCount -1 (at this intersection)
50 unsigned getIntersectionStreetSegment(unsigned intersectionID , unsigned idx);
51
52
53 //------------------------------------------------
54 // Street segment information
55
56 //find the street to which this segment belongs
57 StreetSegmentInfo getStreetSegmentInfo(unsigned streetSegmentID);
58
Page 7 of 23
ECE297 Communication and Design Winter 2016
59 //fetch the latlon of the idx’th curve point
60 LatLon getStreetSegmentCurvePoint(unsigned streetSegmentID , unsigned idx);
61
62
63 //------------------------------------------------
64 // Street information
65 std::string getStreetName(unsigned streetID);
66
67 //------------------------------------------------
68 // Points of interest
69 std::string getPointOfInterestType(unsigned pointOfInterestID);
70 std::string getPointOfInterestName(unsigned pointOfInterestID);
71 LatLon getPointOfInterestPosition(unsigned pointOfInterestID);
72 OSMID getPointOfInterestOSMNodeID(unsigned pointOfInterestID);
73
74 //------------------------------------------------
75 // Natural features
76 const std::string& getFeatureName(unsigned featureID);
77 FeatureType getFeatureType(unsigned featureID);
78 OSMID getFeatureOSMID(unsigned featureID);
79 OSMEntityType getFeatureOSMEntityType(unsigned featureID);
80 unsigned getFeaturePointCount(unsigned featureID);
81 LatLon getFeaturePoint(unsigned featureID , unsigned idx);
Listing 1: libstreetsdatabase API.
Page 8 of 23
ECE297 Communication and Design Winter 2016
3.4 Map Files
The map file for Toronto is located at the path /cad2/ece297s/public/maps/toronto.
streets.bin on the ugxxx machines. The .bin file which can be loaded using the lib-
streetsdatabase API. Maps for several other cities are also located in the /cad2/ece297s/
public/maps directory 2 .
3.5 Implement Your Own Functions
Listing 2 shows the header file for the extended API that you are going to implement in this
milestone. Only the function prototypes are provided; you are to create the implementation
.cpp files (you can use any set of .cpp files you wish) in which you implement each of the
functions in “m1.h”, plus any helper functions or classes you require. Each function prototype
is commented to indicate how to use the function and what it does; use this to guide your
implementation.
Page 1 of 1
7/8/2014file:///C:/Users/Mohamed/Desktop/light-bulb-7.svg
Comments in a header “.h” file, typically indicate how to use the function.
While comments in the implementation “.cpp” file should indicate both
how to use the function, and detailed comments about the implementation.
1 #pragma once //protects against multiple inclusions of this header file
2
3 #include <string >
4 #include <vector >
5 #include "StreetsDatabaseAPI.h"
6
7 //use these defines if you need earth radius or conversion from degrees to radians
8 #define EARTH_RADIUS_IN_METERS 6372797.560856
9 #define DEG_TO_RAD 0.017453292519943295769236907684886
10
11 //function to load map streets.bin file
12 bool load_map(std::string map_name);
13
14 //close the loaded map
15 void close_map();
16
17 //function to return street id(s) for a street name
18 //return a 0-length vector if no street with this name exists.
19 std::vector <unsigned > find_street_ids_from_name(std::string street_name);
20
21 //function to return the street segments for a given intersection
22 std::vector <unsigned > find_intersection_street_segments(unsigned intersection_id);
23
24 //function to return street names at an intersection (include duplicate street
names in returned vector)
25 std::vector <std::string > find_intersection_street_names(unsigned intersection_id);
26
2 You can generate .bin files for additional cities using the osm2bin utility, which converts an OpenStreetMap
.osm file to the streets.bin format used by libstreetsdatabase.
Page 9 of 23
ECE297 Communication and Design Winter 2016
27 //can you get from intersection1 to intersection2 using a single street segment (
hint: check for 1-way streets too)
28 //corner case: an intersection is considered to be connected to itself
29 bool are_directly_connected(unsigned intersection_id1 , unsigned intersection_id2);
30
31 //find all intersections reachable by traveling down one street segment
32 //from given intersection (hint: you can’t travel the wrong way on a 1-way street)
33 //the returned vector should NOT contain duplicate intersections
34 std::vector <unsigned > find_adjacent_intersections(unsigned intersection_id);
35
36 //for a given street , return all the street segments
37 std::vector <unsigned > find_street_street_segments(unsigned street_id);
38
39 //for a given street , find all the intersections
40 std::vector <unsigned > find_all_street_intersections(unsigned street_id);
41
42 //function to return all intersection ids for two intersecting streets
43 //this function will typically return one intersection id between two street names
44 //but duplicate street names are allowed , so more than 1 intersection id may exist
for 2 street names
45 std::vector <unsigned > find_intersection_ids_from_street_names(std::string
street_name1 , std::string street_name2);
46
47 //find distance between two coordinates
48 double find_distance_between_two_points(LatLon point1 , LatLon point2);
49
50 //find the length of a given street segment
51 double find_street_segment_length(unsigned street_segment_id);
52
53 //find the length of a whole street
54 double find_street_length(unsigned street_id);
55
56 //find the travel time to drive a street segment (time(minutes) = distance(km)/
speed_limit(km/hr) * 60
57 double find_street_segment_travel_time(unsigned street_segment_id);
58
59 //find the nearest point of interest to a given position
60 unsigned find_closest_point_of_interest(LatLon my_position);
61
62 //find the nearest intersection (by ID) to a given position
63 unsigned find_closest_intersection(LatLon my_position);
Listing 2: Milestone 1 API “m1.h”.
3.5.1 Computing Distance from Latitude/Longitude
In this and the following subsections, some of the functions in StreetsDatabaseAPI.h are
clarified.
Locations in libstreetsdatabase are represented as latitude and longitude, in degrees.
There are many ways to compute the distance between two latitude/longitude (lat/lon)
points, some more accurate than others. We will be using Pythagoras’ theorem on an
equirectangular projection 3 .
3 A map projection is a translation from lat/lon to (x,y) coordinates. The projection basically draws out planet
(which is almost spherical) on a rectangular coordinate system. You are encouraged to read more about map-making
Page 10 of 23
ECE297 Communication and Design Winter 2016
Figure 4: Projecting part of the surface of the earth to a flat plane. Source: host-
ing.soonet.ca/eliris/gpsgis/Lec2Geodesy.html.
To compute (x,y) coordinates from lat/lon, do the following:
(x,y) = (lon · cos(lat avg ), lat) (1)
Where lat avg is the average latitude of the area being mapped. The equation above
accounts for the fact that the distance between lines of latitude is the same everywhere
on earth, while the distance between lines of longitude depends on how far away from the
equator you are. At the equator (latitude = 0 degrees) the distance between two lines of
longitude is equal to that between two lines of latitude. At the North or South Pole (latitude
= 90 or -90 degrees, respectively) all the lines of longitude converge to a point so there is no
distance between them.
If we will use the (x,y) projection above to draw our map (as we will in milestone 2), then
lat avg is the mid-latitude of the map we’re drawing, that is the average between the min/max
latitudes of Toronto for our purpose
lat min +lat max
2
. However, if we are using the projection to
find the distance between two points (lon 1 ,lat 1 ) and (lon 2 ,lat 2 ) then it is more accurate to
compute lat avg as
lat 1 +lat 2
2
. This is the lat avg that you should be using to compute distance,
and the autotester uses the same equation to verify your answers.
To find the distance between two points, we convert (lon,lat), in radians, to (x,y), then
use Pythagoras’ theorem and multiply by the radius of the earth R:
d = R ·
q
(y 2 − y 1 ) 2 + (x 2 − x 1 ) 2 (2)
We have defined a constant for the radius of the Earth in m1.h so you can implement the
formula above precisely and match the autotester.
3.5.2 Curve Points
Not all street segments are perfectly straight lines between two intersections; some city
blocks (street segments) are curved or even winding. Curve points are properties of street
segments that allow the StreetsDatabaseAPI to represent such curved or winding roads
between intersections. As Fig. 6 shows, some street segments have no curve points (they
and more accurate projections: http://en.wikipedia.org/wiki/List_of_map_projections.
Page 11 of 23
ECE297 Communication and Design Winter 2016
Figure 5: Parallels of latitude and lines of longitude. Source: blog.eogn.com/2014/09/16/convert-
an-address-to-latitude-and-longitude/.
are perfectly straight); the distance one must travel along the street segment between the
two intersections can therefore be computed from the (Latitude/Longitude) locations of the
two intersections. Other street segments have curve points, and each one is represented as a
Latitude/Longitude pair. Therefore, to find the distance along such a street segment these
curve points must be taken into account to find the correct driving distance.
3.6 Unit Testing
An important part of any software project is verifying that the code is correct. One popular
and effective approach is called Unit Testing. With unit testing you verify the correctness
of small ‘units’ of your code, such as individual functions or classes. Testing at such a low
level is beneficial since errors are much easier to detect and debug since they are isolated to
a small subset of your program.
~ 30mins
To learn more about Unit Testing see the “ECE297 Quick Start Guide:
Unit Testing”
The public functionality tests are included in the file ‘libstreetmap/tests/m1 unittests.cpp’.
You can run unit tests on your project from the command-line using ‘make test’, or from
with-in Netbeans as described in the “ECE297 Quick Start Guide: Unit Testing”.
If your project passes all unit tests the output will indicate success:
Page 12 of 23
ECE297 Communication and Design Winter 2016
Intersection 1 Intersection 2
Street segment
(0 curve points)
Street segment
(2 curve points)
Intersection 2
Intersection 1
(a)
(b)
Figure 6: A street segment exists between two intersections; in (a) the street segment has no
curve points, while in (b) the street segment has 2 curve points. Note that you can get the
latitude/longitude of each curve point or intersection.
1 > ls #In the project directory
2 Makefile libstreetmap libstreetsdatabase main nbproject
代写 ECE297 Communication and Design
3
4 > make test
5 #Output trimmed...
6 Success: 15 tests passed.
7 Test time: 0.07 seconds.
Listing 3: Unit testing usage
If your project fails unit tests the output will indicate the error and where it occurred:
1 > ls #In the project directory
2 Makefile libstreetmap libstreetsdatabase main nbproject
3
4 > make test #We have a bug in our program so this will error
5 #Output trimmed...
6 libstreetmap/tests/m1_unittests.cpp:514: error: Failure in
directly_connected_functionality: !are_directly_connected(1358, 2709)
7 FAILURE: 1 out of 15 tests failed (1 failures).
8 Test time: 0.09 seconds.
9 make: *** [test] Error 1
Listing 4: Unit testing usage
Any files defining new unit tests added to the ‘libstreetmap/tests’ folder will be run by
‘make test’.
Page 13 of 23
ECE297 Communication and Design Winter 2016
3.6.1 Adding a Unit Test
You are required to extend the unit tests included in the project by adding several new unit
tests. Note that your unit tests need not be limited to the external API defined in m1.h;
you are also encouraged to create unit tests for functions you created for internal use which
are not exposed in m1.h.
4
The external API function std::vector<unsigned>find_street_ids_from_name(std::
stringstreet_name) in m1.h does not have a public unit test. You are therfore required to
write unit tests to verify the correctness of this function. You will need to show your new
unit tests to your TA so he or she can assess their quality. To receive full marks, your unit
tests for this function should:
Test the function returns the right answer for hand-generated corner cases. What are
the different cases this function could encounter, and do you have a test for each?
Test at least some of the functionality of this routine with many automatically generated
calls (thousands). How can you automatically call this routine with many different street
names? How can you automatically check the answer is reasonable?
Test the speed of the function. To get reliable time measurements, your unit tests should
call the function enough times that the test takes at least 250 ms. The average time per
function call should be no more than 250 ns per call (i.e. no more than 250 ms for 1,000,000
calls).
The unit tests we have provided in this milestone will only test your API with valid
input. Integer ids will always be within the valid range for that id type, e.g. the argument
will be between 0 and getNumberOfIntersections() -1 for intersection ids. You may wish
to make your API test for invalid input (e.g. intersection ids that are out of range) and
take some appropriate action (like printing an error message) since this will make your API
more robust, and you will be building code that uses your API in the later milestones in this
program. If you add error handling to your API, you can add some unit tests to verify the
error handling, and this would be a good practice.
3.7 Grading
3.7.1 Using the Autotester
After implementing the API functions (and testing with your unit test) use the autotester to
check for both correctness and run-time performance. The autotester will give you testing
information about each function; for example, how many of the testcases pass or fail, and how
fast the function runs compared to the speed target. To get full marks you need to implement
all functions, pass all testcases and meet the speed targets. Note that the autotester only
exercises the public testcases which are not exhaustive. For grading, we will be testing your
code with more (private) testcases as well so make sure your implementation handles any
corner cases. Note that while you can use your main function to test your code, the main
function will not be graded.
4 If you add other unit tests also show then to your TA, and they will be considered when assigning grades.
Page 14 of 23
ECE297 Communication and Design Winter 2016
!
Use the autotester to test your implementation with public testcases for
correctness and performance. Additional private testcases will also be used
for grading.
The autotester can be run using the ‘ece297exercise 1’ command:
1 > ls #In the main project directory
2 build libstreetmap.a libstreetsdatabase.a Makefile nbproject
3 libstreetmap libstreetsdatabase main mapper
4
5 > ece297exercise 1 #Runs the autotester
6 Running Tester: UnitTests
7 Building UnitTests
8 OK
9 Running UnitTests
10 #Output trimmed...
11 Test Summary: PASS ( 0 of 31 failed)
12 UnitTests PASS ( 0 of 31 failed)
Listing 5: Exercise example
The ece297exercise command runs the program executable in your current directory.
For speed tests, you should make sure you are running the Release Configuration of your
program (i.e. that you built the Release Configuration before running ece297exercise), as
that is the fastest version of your program and that is how we will test your submission. As
well, note that if your machine is heavily loaded by either you or other students running
multiple CPU-intensive programs at the same time it can slow down your program. We will
test your submission on an unloaded machine.
3.7.2 Submitting Your Code
Submit your project using the ‘ece297submit 1’ command:
1 > ls #In the main project directory (must be under SVN)
2 build libstreetmap.a libstreetsdatabase.a Makefile nbproject
3 libstreetmap libstreetsdatabase main mapper
4
5 > ece297submit 1 #Submits the project
6 #Output trimmed...
7 Committing Submission
8 Verified submitted file exists and matches size
9 Successfully committed submission.
Listing 6: Submission example
3.7.3 Grading Scheme
You are required to implement all the functions that are specified in “m1.h”, as well as the
unit tests described earlier. In doing so you should also make sure that you comment your
code well and commit to your SVN repository often; you should also use informative SVN
commit messages as your TA will look at the SVN log. There are 8 marks assigned to this
milestone and are divided as follows:
Page 15 of 23
ECE297 Communication and Design Winter 2016
5 marks: These marks will be graded automatically by the automarker and will check
your code functionality (3 marks) and runtime (2 marks).
3 marks: The unit tests that you write will be checked by your TA, and you should
be able to describe them and answer questions about their design. Effective use of SVN,
code style and commenting will be also checked by your TA. Finally, you should be able
to answer questions about how your code works and why it is structured the way it is.
Note that different team members may receive different marks from the TA based on the
clarity of their answers to questions, their contribution to the milestone as shown by SVN
logs, and their knowledge of the code.
Page 16 of 23
ECE297 Communication and Design Winter 2016
A Screenshots of Initial Repository Setup
Figure 7: Import Project from Zip.
Figure 8: Select the compressed project path, and the path to which you will extract your project.
This can be anywhere in your home directory.
Page 17 of 23
ECE297 Communication and Design Winter 2016
Figure 9: View of the imported projects and files.
Page 18 of 23
ECE297 Communication and Design Winter 2016
Figure 10: Select all three projects then right-click and import into SVN repository.
Page 19 of 23
ECE297 Communication and Design Winter 2016
Figure 11: Specify repository path.
Figure 12: Write import message.
Page 20 of 23
ECE297 Communication and Design Winter 2016
Figure 13: Select the files to keep under revision control. Exclude the folders “private”, “dist” and
“build” – these contain files that are generated every time you compile your project.
Figure 14: View of Projects after import – notice the small cylinder-icon which indicates there are
uncommited changes in the working copy.
Page 21 of 23
ECE297 Communication and Design Winter 2016
Figure 15: Compile your project (make sure it compiles fine) then invoke the svn status command
(right-click→Show Changes).
Page 22 of 23
ECE297 Communication and Design Winter 2016
Figure 16: You will find some files in the folder “private” that say “locally new” – we want to
exclude those files from revision control because they are user-specific and should not be kept
under revision control. Right-click→Ignore.
Page 23 of 23
代写 ECE297 Communication and Design