COMP1511实验编程代写、C++程序语言调试、代写c/c++编程设计 代做Python程序|代做留学生Prolog

- 首页 >> Database作业
COMP1511 20T3 - Assignment 2 - CSpotify
version: 1.4 last updated: 2020-11-11 020000
Introduction
We consider music streaming to be a normal thing that we use regularly . . . but it wasn't always this way. In the late 1990s, a new file
format called the MP3 appeared. Its ability to compress audio coupled with the rise of the internet lead to a new era in the music industry.
Napster (and a new generation of music pirates) brought this into the spotlight when they launched in 1999.
Nowadays, with services like Spotify, we have access to a massive library of music (and other audio) content from nearly any device with
an internet connection.
In this assignment, you'll be looking at some of the coding work that goes into organisation of music with things like song information,
playlists and personal music libraries. CSpotify is our implementation of a song library using linked lists as the primary data structure.
Your Goal
The assignment is divided into two parts:
Part A - Implementation (5 Stages)
Your task here is to write the functions that will manage your music Library of Playlists which contain Tracks. All of these
functions are contained inside the file cspotify.c.
Part B - Testing
Your task here is to write functions in test_cspotify.c to check that your code works.
Please note that you do not need to scan in any inputs from the user, this is already completed for you in the given starter code.
The Overall Picture - Your Library
The Library is the overall struct which contains all the objects you will need for the assignment. The Library contains a list of
Playlists. In each of the Playlists, there is a list of Tracks. At the start of the program, the Library starts off as an empty Library
containing no Playlists and hence no Tracks.
As you progress through Stage 1 of the assignment to manage Playlists to your Library, your Library might start to look like this,
where there are Playlists in the Library but not Tracks in any of the Playlists:
Note: You should refer to cspotify.h for more technical and detailed instructions in regards to each functionʼs
implementation.
2020/11/13 COMP1511 20T3 - Assignment 2 - CSpotify
https://cgi.cse.unsw.edu.au/~cs1511/20T3/assignments/ass2/index.html 2/15
Stage 2 will then allow you to navigate around your Library Playlists and add Tracks to each Library, resulting in a Library that could
look like this:
Each Track will store information about the title, artist and the trackLength in addition to a next pointer.
Stage 3 will focus on removing certain objects from your Library.
Stage 4 and 5 will be more challenging manipulations of your Library.
The assignment breaks up the above further into smaller tasks to help you build and navigate around your Library. It is strongly
recommended that you begin from Stage 1 and progress in the given order.
2020/11/13 COMP1511 20T3 - Assignment 2 - CSpotify
https://cgi.cse.unsw.edu.au/~cs1511/20T3/assignments/ass2/index.html 3/15
Getting Started
Starter Code
The starter code consists of the following files:
main.c contains the main function for the assignment. It will scan the program's input, then call the functions you will write.
You must not change this file.
cspotify.h contains the definitions of all the functions you will be writing. It also contains useful constants and type definitions.
You must not change this file.
cspotify.c contains empty functions which you will need to implement. It already contains some functions. It is strongly recommended
that you use these.
This file is where you will write your own code.
test_main.c contains a main function and other functions that allow you to run the tests you create in test_cspotify.c.
You must not change this file.
test_cspotify.h contains the prototypes of the testing functions in test_cspotify.c.
You must not change this file.
test_cspotify.c contains an alternative main function as well as template code that you will modify to make your own tests.
This file is where you will write your own test cases.
capture.h contains the definition of a function that allows you to capture the output of your own code, to use in testing. It can only be
used in test_cspotify.c, and will not be available in cspotify.c .
You must not change this file.
capture.c contains the implementation of functions that allow you to capture the output of your own code, to use in testing.
You must not change this file.
To run your code interactively, you should use the command:
$ dcc -o cspotify cspotify.c main.c
$ ./cspotify
To run your tests (written in test_cspotify.c), you should use the command:
$ dcc -o test_cspotify cspotify.c test_cspotify.c capture.c test_main.c
$ ./test_cspotify
Allowed C Features
In this assignment, there are two restrictions on C Features:
You must follow the rules explained in the Style Guide.
You may not use the function fnmatch, or import fnmatch.h.
It is recommended to only use features that have been taught in COMP1511. Course work in Week 8 will have a particular focus on
assistance for this assignment and you will not need any of the subject material from Weeks 9 or 10.
If you choose to disregard this advice, you must still follow the Style Guide. You also may be unable to get help from course staff if you
use features not taught in COMP1511.
Reference Implementation
If you have questions about what behaviour your program should exhibit, we have provided a sample solution for you to use.
$ 1511 cspotify
Download the starter code (cspotify.zip) here or copy it to your CSE account using the following command:
$ 1511 setup_cspotify
2020/11/13 COMP1511 20T3 - Assignment 2 - CSpotify
https://cgi.cse.unsw.edu.au/~cs1511/20T3/assignments/ass2/index.html 4/15
Stage One
When you execute your program, you can assume that the Library has already been created for you to perform the following operations.
Stage 1 involves managing the Playlists in your Library as well as printing out the state of the Library. You will need to implement or
modify the following functions:
create_library (This is already implemented for you, you may need to modify it)
add_playlist
print_library
rename_playlist
Add a playlist
In cspotify.c you have been given the function stub (a stub is an unimplemented function):
// Add a new Playlist to the Library.
int add_playlist(Library library, char playlistName[MAX_LEN]) {
return SUCCESS;
}
This function will be given a Library and a Playlist name. You will need to insert a new Playlist node at the end of the linked list of
Playlists in the Library. If the Library has no Playlists, your new Playlist will become the first Playlist in the Library. If this is the
case, you will need to make this Playlist “selected”.
You can assume you will never receive a Playlist name which already exists in the Library
You may receive invalid inputs so the function will return either:
ERROR_INVALID_INPUTS if the given Playlist name is invalid (i.e. not alphanumeric).
SUCCESS if a new Playlist is successfully added.
You will need to create a Playlist node (using malloc) before it is inserted into the Library.
Please note that until you implement the next function in this stage for printing out the Library, you will not be able to see whether your
Playlist has been added successfully into the Library.
Print Out the Library
In cspotify.c you have been given the function stub (a stub is an unimplemented function):
// Print out the Library.
void print_library(Library library) {
}
You will need to use the following helper functions already provided to you in the same file: print_playlist, print_selected_playlist
and print_track.
This function will be given a Library. The function should go through each Playlist in the Library and print out the information in the
order they are in inside the Library. You should use the above helper functions to print the Library out, instead of calling printf
yourself. Note that the word static on these functions will make that function only accessible in the current file. We often use static on
helper functions that are not part of the header file and aren't used by any other parts of the program. static will not significantly
change how you will use or define this function.
Command: A
Example: A RoadTrip
Description: Adds a new Playlist named "Roadtrip" at the end of the Library of Playlists.
The message which appears right after running any command simply acknowledges the function has been called and/or depends
on your return values. It does not necessarily indicate the success of your implementation of this function.
Command: P
Example: P
Description: Prints out the Library.
2020/11/13 COMP1511 20T3 - Assignment 2 - CSpotify
https://cgi.cse.unsw.edu.au/~cs1511/20T3/assignments/ass2/index.html 5/15
You may see that both print_playlist and print_selected_playlist above take in an int number, this is the position in which they are
in in the Library of Playlists assuming that the first Playlist is at position 0.
The function should not return anything.
At this stage, you will only need to use print_playlist and print_selected_playlist to help you print out information in the Library.
print_track is not needed until Stage 2 has been implemented. After implementing stage 2, you should come back and make sure that
the Tracks in each Playlist are also printed out.
Rename a Playlist
In cspotify.c you have been given the function stub (a stub is an unimplemented function):
// Rename the name of an existing Playlist.
int rename_playlist(Library library, char playlistName[MAX_LEN],
char newPlaylistName[MAX_LEN]) {
return SUCCESS;
}
This function will be given a Library, a Playlist name and a new Playlist name. Your task is to find the playlistName in the Library of
Playlists and change its name to the name given in newPlaylistName.
You may receive invalid inputs so the function will return either:
ERROR_NOT_FOUND if the given Playlist name is not found otherwise,
ERROR_INVALID_INPUTS if the new Playlist name is invalid (i.e. not alphanumeric).
SUCCESS if a new Playlist is successfully added.
Stage Two
Stage 2 involves navigating around a Library of Playlists and adding Tracks. You will need to implement the following functions:
select_next_playlist
select_previous_playlist
add_track
playlist_length
Select the Next Playlist
In cspotify.c you have been given the function stub (a stub is an unimplemented function):
// Selects the next Playlist in the Library.
void select_next_playlist(Library library) {

}
Command: R
Example: R Roadtrip SleepMusic
Description: Renames the existing Playlist "Roadtrip" to "SleepMusic".
Run the tests for this stage with:
$ 1511 autotest-stage 01 ass2_cspotify
Check the style of your code with:
$ 1511 style cspotify.c
Please note, the files you test must be named correctly, or this test will not work properly.
To pass all the tests for this stage, you will need to add tests in test_cspotify.c See Writing your own automated tests for
more info.
Command: S
Example: S
Description: Selects the next Playlist in the Library.
2020/11/13 COMP1511 20T3 - Assignment 2 - CSpotify
https://cgi.cse.unsw.edu.au/~cs1511/20T3/assignments/ass2/index.html 6/15
This function will be given a Library. In Stage 1, by default the first Playlist added into the Library was selected. For this function, you
will need to change the selected Playlist in the Library to the Playlist after the currently selected Playlist.
If the currently selected Playlist is the last Playlist in the Library, make the first Playlist in the Library become the new selected
Playlist.
The function should not return anything.
Select the Previous Playlist
In cspotify.c you have been given the function stub (a stub is an unimplemented function):
// Selects the previous Playlist in the Library.
void select_previous_playlist(Library library) {

}
This function is very similar to selecting the next Playlist. Given a Library, you will need to change the Playlist that is selected to the
Playlist before the currently selected Playlist.
If the currently selected Playlist is the first Playlist in the Library, make the last Playlist in the Library become the new selected
Playlist.
The function should not return anything.
Add a Track
In cspotify.c you have been given the function stub (a stub is an unimplemented function):
// Add a new Track to the selected Playlist.
int add_track(Library library, char title[MAX_LEN], char artist[MAX_LEN],
int trackLengthInSec, int position) {
return SUCCESS;
}
This function will be given a Library, Track title, the artist of the Track, the Track length in seconds as well as a position number.
Your task is to go through the selected Playlist and add a new Track node at the position specified by position. If position is 0, the
node should be inserted at the front of the Playlist. If the position has a value equal to the number of Tracks in the Playlist, the node
should be inserted at the end of the Playlist.
It is possible that the same Track can be added to the same Playlist multiple times. You may receive invalid inputs so the function will
return one of the following:
ERROR_NOT_FOUND if there are no Playlists in the Library, otherwise,
ERROR_INVALID_INPUTS if the given title/artist/position/track length is invalid. (see cspotify.h for more details)
SUCCESS if a new Playlist is successfully added.
You will also need to make changes to your print_library function in Stage 1 so that it will now also print out the Tracks you add to a
Playlist.
Calculate the Length of the Playlist
Command: W
Example: W
Description: Selects the previous Playlist in the Library.
Command: a <artist> <trackLengthInSec> <position><br>Example: a PrettySavage BLACKPINK 350 0<br>Description: Adds a new Track at the 0th position in the selected Playlist. Specifically, this is a Track titled "PrettySavage" by<br>the artist "BLACKPINK" and has a Track length of 350 seconds.<br>Command: T<br>Example: T<br>Description: Calculates the total length of the selected Playlist in minutes and seconds.<br>2020/11/13 COMP1511 20T3 - Assignment 2 - CSpotify<br>https://cgi.cse.unsw.edu.au/~cs1511/20T3/assignments/ass2/index.html 7/15<br>In cspotify.c you have been given the function stub (a stub is an unimplemented function):<br>// Calculate the total length of the selected Playlist in minutes and seconds.<br>void playlist_length(Library library, int *playlistMinutes, int *playlistSeconds) {<br>}<br>For this function, you are given a Library and two uninitialised int variables passed into the function by reference (i.e. the two int<br>pointers you receive in this function are pointing to the memory location of two int variables).<br>Your task is to go through and calculate the length of the currently selected Playlist in your Library. The total number of minutes in the<br>Playlist should be stored inside the memory pointed to by the playlistMinutes pointer. The total number of seconds in the Playlist<br>should be stored in the memory pointed to by the playlistSeconds pointer.<br>The function should not return anything.<br>Stage Three<br>Stage 3 involves removing objects from your Library and the Library itself. You will be freeing memory which has been malloced. You<br>will need to implement the following functions:<br>delete_track<br>delete_playlist<br>delete_library<br>Delete a Given Track<br>In cspotify.c you have been given the function stub (a stub is an unimplemented function):<br>// Delete the first instance of the given track in the selected Playlist<br>// of the Library.<br>void delete_track(Library library, char track[MAX_LEN]) {<br>}<br>Calling this function should delete the first instance which matches the given Track name within the selected Playlist.<br>The function should not return anything.<br>Delete the Selected Playlist<br>In cspotify.c you have been given the function stub (a stub is an unimplemented function):<br>Run the tests for this stage with:<br>$ 1511 autotest-stage 03 ass2_cspotify<br>Check the style of your code with:<br>$ 1511 style cspotify.c<br>Please note, the files you test must be named correctly, or this test will not work properly.<br>To pass all the tests for this stage, you will need to add tests in test_cspotify.c See Writing your own automated tests for<br>more info.<br>Command: d <track><br>Example: d LovesickGirls<br>Description: Deletes the first instance of the Track titled "LovesickGirls" in the selected Playlist of the Library.<br>Command: D<br>Example: D<br>Description: Deletes the selected Playlist and select the next Playlist in the Library.<br>2020/11/13 COMP1511 20T3 - Assignment 2 - CSpotify<br>https://cgi.cse.unsw.edu.au/~cs1511/20T3/assignments/ass2/index.html 8/15<br>// Delete the selected Playlist and select the next Playlist in the Library.<br>void delete_playlist(Library library) {<br>}<br>Calling this function should delete the entire selected Playlist as well as all the Tracks within this Playlist. You should ensure that the<br>next Playlist in the Library is selected once the currently selected Playlist is removed. If there is no next Playlist, select the first<br>Playlist in the Library.<br>The function should not return anything.<br>Delete the Entire Library<br>In cspotify.c you have been given the function stub (a stub is an unimplemented function):<br>// Delete an entire Library and its associated Playlists and Tracks.<br>void delete_library(Library library) {<br>}<br>Calling this function should delete the entire given Library including its Playlists and Tracks within each Playlist.<br>The function should not return anything.<br>Stage Four<br>Stage 4 consists of more involved manipulations of the Library. You will need to implement the following functions:<br>cut_and_paste_track<br>soundex_search<br>Cut and Paste Track<br>In cspotify.c you have been given the function stub (a stub is an unimplemented function):<br>Command: X<br>Example: X<br>Description: Deletes an entire Library and its associated Playlists and Tracks.<br>Run the tests for this stage with:<br>$ 1511 autotest-stage 04 ass2_cspotify<br>Check the style of your code with:<br>$ 1511 style cspotify.c<br>Please note, the files you test must be named correctly, or this test will not work properly.<br>To pass all the tests for this stage, you will need to add tests in test_cspotify.c See Writing your own automated tests for<br>more info.<br>This stage has very few tests in the autotest! They do not necessarily cover every edge case. You should test it with other<br>inputs, and compare your solution against the reference solution.<br>Command: c <trackName> <destPlaylist><br>Example: c WakaWaka Fun<br>Description: Moves the Track title "WakaWaka" from the currently selected Playlist to an existing destination Playlist named<br>"Fun".<br>2020/11/13 COMP1511 20T3 - Assignment 2 - CSpotify<br>https://cgi.cse.unsw.edu.au/~cs1511/20T3/assignments/ass2/index.html 9/15<br>// Cut the given track in selected Playlist and paste it into the given<br>// destination Playlist.<br>int cut_and_paste_track(Library library, char trackTitle[MAX_LEN],<br> char destPlaylist[MAX_LEN]) {<br> return SUCCESS;<br>}<br>This function will take in a Library, a Track title and a destination Playlist. It should remove the first Track instance which matches the<br>given trackName from the selected Playlist and add it into the end of the Playlist with the given destination Playlist name. The<br>function should return one of the error codes (see cspotify.h for more details) or SUCCESS.<br>Soundex Search<br>What is Soundex?<br>Soundex is a phonetic algorithm which allows strings to be encoded so that words which sound similar will have the same encoding<br>despite small differences in spelling.<br>This becomes very useful in searching for music. For example, when searching for artists, mispelling the artist names will still allow you to<br>search for the artist.<br>In cspotify.c you have been given the function stub (a stub is an unimplemented function):<br>// Search the given Library for tracks where its artist<br>// match the given searchTerm<br>void soundex_search(Library library, char artist[MAX_LEN]) {<br><br>}<br>This function will take in a Library and a search term. Your task is to go through the given Library and print out all Tracks with artists<br>that have the same Soundex encoding as the given search term. You will again, need to use the given help function print_track instead<br>of calling printf yourself to print out the matching Tracks.<br>The specific version of the Soundex algorithm which will be used is specified in cspotify.h<br>The function should not return anything.<br>Stage Five<br>Stage 5 consists of more involved manipulations of the Library. You will need to implement the following functions:<br>add_filtered_playlist<br>reorder_playlist<br>Add Filtered Playlist<br>Command: s <searchTerm><br>Example: s Robert<br>Description: Prints out all Tracks with artists that have the same Soundex Encoding as the given search term.<br>Run the tests for this stage with:<br>$ 1511 autotest-stage 04 ass2_cspotify<br>Check the style of your code with:<br>$ 1511 style cspotify.c<br>Please note, the files you test must be named correctly, or this test will not work properly.<br>To pass all the tests for this stage, you will need to add tests in test_cspotify.c See Writing your own automated tests for<br>more info.<br>This stage has very few tests in the autotest! They do not necessarily cover every edge case. You should test it with other<br>inputs, and compare your solution against the reference solution.<br>2020/11/13 COMP1511 20T3 - Assignment 2 - CSpotify<br>https://cgi.cse.unsw.edu.au/~cs1511/20T3/assignments/ass2/index.html 10/15<br>In cspotify.c you have been given the function stub (a stub is an unimplemented function):<br>// Move all Tracks with artists that have the same Soundex Encoding as<br>// the given artist to a new Playlist.<br>int add_filtered_playlist(Library library, char artist[MAX_LEN]) {<br> return SUCCESS;<br>}<br>This function will take in a Library and an artist. It should go through the entire Library and move all Tracks with artists that have the<br>same Soundex Encoding as the given artist into a new Playlist named with the given artist. The function should return one of the error<br>codes (see cspotify.h for more details) or SUCCESS.<br>Reorder Playlist<br>In cspotify.c you have been given the function stub (a stub is an unimplemented function):<br>// Reorder the selected Playlist in the given order specified by the order array.<br>void reorder_playlist(Library library, int order[MAX_LEN], int length) {<br>}<br>This function differs slightly in the way in which the command is executed. Once the above command is executed, the program will<br>prompt you to enter a series of integers.<br>This function will take in a Library, an order array and length. It should reorder the Tracks in the selected Playlist based on the order in<br>the given array. More details about this function has been given in cspotify.h.<br>Testing<br>It is important to test your program thoroughly to make sure it can manage different situations.<br>Writing your own Automated Tests<br>As you implement functions in cspotify.c, you will encounter autotests in that require you to implement the functions in<br>test_cspotify.c.<br>You are given a file test_main.c. This is not the same as the interactive program in main.c. Instead, it runs the series of automatic tests<br>on the functionality provided by cspotify.h and cspotify.c. You should not change this main function.<br>Your main function will call other functions that look like this:<br>Command: F <artist><br>Example: F Taylor<br>Description: Move all Tracks with artists that have the same Soundex Encoding as "Taylor" to a new Playlist.<br>Command: r <length><br>Example: r 5<br>Description: Reorders the selected Playlist of 5 Tracks in an order which will be specified in the input following this command.<br>Run the tests for this stage with:<br>$ 1511 autotest-stage 05 ass2_cspotify<br>Check the style of your code with:<br>$ 1511 style cspotify.c<br>Please note, the files you test must be named correctly, or this test will not work properly.<br>2020/11/13 COMP1511 20T3 - Assignment 2 - CSpotify<br>https://cgi.cse.unsw.edu.au/~cs1511/20T3/assignments/ass2/index.html 11/15<br>// Test function for 'add_playlist'<br>int test_add_playlist(void) {<br> // Test 1: Does add_playlist return SUCCESS and add<br> // when adding one Playlist with a valid name?<br> Library testLibrary = create_library();<br> int result = add_playlist(testLibrary, "Favourites");<br> if (result != SUCCESS) {<br> printf("DOES NOT MEET SPEC\n");<br> return;<br> }<br> char printText[10000];<br> CAPTURE(print_library(testLibrary), printText, 10000);<br> if (!string_contains(printText, "Favourites")) {<br> printf("DOES NOT MEET SPEC\n");<br> return;<br> }<br> // Test 2: Does add_playlist return ERROR_INVALID_INPUTS<br> // and not add the playlist into the Library<br> // when trying to add a Playlist with an invalid name?<br> // TODO: Add your test for Test 2<br> // Test 3: ???<br> // TODO: Add your own test, and explain it.<br> printf("MEETS SPEC\n");<br>}<br>Your job is to fill in the spaces where it says "TODO" with a series of C statements that check whether the functions in cspotify.c work.<br>As you can see in Test 1, some of these functions have already been partially implemented to show you what you should do<br>Some functions will ask you to specifically test something (in this case, to make sure add_playlist returns the correct amount if you call<br>it many times).<br>Some functions will ask you to decide on your own test. You should describe what you are testing, and then write a test for that situation.<br>Note that you can only test functions by checking their outputs, and their output to the terminal. You cannot access the fields of a struct,<br>nor can you redefine the structs from cspotify.c in test_cspotify.c. Doing so may cause you to lose marks.<br>You can test your tests yourself, by compiling it against your cspotify.c.<br>This is what you will see when you compile the starter code/tests.<br>$ dcc -o test_cspotify test_cspotify.c cspotify.c capture.c test_main.c<br>$ ./test_cspotify<br>*~~~~~~~~~~~~~~~~~~~~~~~{ CSpotify Tests }~~~~~~~~~~~~~~~~~~~~~~~*<br>Stage 1 - Test add_playlist: DOES NOT MEET SPEC<br>Stage 1 - Test rename_playlist: DOES NOT MEET SPEC<br>Stage 2 - Test add_track: MEETS SPEC<br>Stage 2 - Test playlist_length: MEETS SPEC<br>Stage 3 - Test delete_playlist: MEETS SPEC<br>Stage 4 - Test soundex_search: MEETS SPEC<br>Your extra tests: MEETS SPEC<br>If you want to see exactly what program the autotests will run, you can use the commands:<br>$ 1511 build_test_cspotify test_cspotify.c -o test_cspotify<br>$ ./test_cspotify INVALID_INPUTS<br>$ ./test_cspotify RENAME_FAILS<br>$ ./test_cspotify NONE<br>$ ./test_cspotify MANY_TRACKS<br>$ ./test_cspotify NO_MINUTES<br>$ ./test_cspotify NO_DELETE_FIRST<br>The above commands will each run a different broken solution, so you can see if your program functions correctly.<br>Capture<br>You may notice that we have given you two extra files -- capture.c and capture.h. These files define the CAPTURE macro. Macros are not<br>covered in this course and as a result, you do not need to understand these files.<br>2020/11/13 COMP1511 20T3 - Assignment 2 - CSpotify<br>https://cgi.cse.unsw.edu.au/~cs1511/20T3/assignments/ass2/index.html 12/15<br>You can use them to capture what a function prints and put it into a string. This is useful if you use it with for example, the print_library<br>function, since you can then test the output for the Library is as you expect.<br>The header of capture.h describes how to use it.<br>// This file contains the `CAPTURE()` macro. To use this macro,<br>// you should define a large, empty string. Lets say your string is:<br>// char str[MAX_LENGTH];<br>// Then you can do the following:<br>// CAPTURE(my_function(), str, MAX_LENGTH)<br>// Which will put the output of `my_function()` into str.<br>Autotests<br>As usual autotest is available with some simple tests - but your own tests in test_cspotify.c may be more useful at pinpointing exactly<br>which functions are and aren't working.<br>$ 1511 autotest cspotify<br>If you wish to use autotest to view only a specific stage of the assignment, you can use autotest-stage. The following example shows how<br>to autotest stage 1 but you can replace the stage number with any stage you would like to test.<br>$ 1511 autotest-stage 01 cspotify<br>Frequently Asked Questions<br>How many tests do I need to complete to get full marks?<br>You only need to complete the tests marked with "TODO"; except the extra_tests which are optional. For each function, this means you<br>will need to write two tests (note that this desn't include tests we have provided you). You do not need to write tests for stage five,<br>though we encourage you to do so for your own learning and enjoyment!<br>Why can't I access structs from cspotify.c inside of test_cspotify.c?<br>The way C works is if the struct definition is not present in the current .c file then the code there is not able to access the members of<br>that struct. You can create a pointer variable which points to that struct, but you will not be able to access it's members with ->. This is a<br>good thing, and is intended.<br>This design feature is because it allows us to implement Abstract Data-Types (ADTs). The objective of using ADTs is so that the code of<br>one file can not access the “inner workings” of a variable that it uses, but is restricted to calling functions from a .h file with that variable.<br>This may sound counter productive at first, why would you want to limit access to a variable? Actually there are several advantages:<br>.<br>Access Control: This is a useful concept when you have multiple programmers working together. It allows you to police the things<br>that happens to your Library. If you are the creator of the data type (the Library) you can prevent other people (who may not<br>know what their doing) from changing pointers (perhaps accidentally) in your data structure and in general ruining things.<br>.<br>Abstraction: It presents a simple interface (defined in the .h file) to use the code of your Library. If you are the user of the data<br>type someone else has created, it is really helpful to be presented with a simpler interface which hides the details of the underlying<br>data structures, so they don't have to learn as many things to be able to use your data type.<br>.<br>Decoupling: All test_cspotify.c files will conform to a common interface. Perhaps the way the other students in this course<br>organised the members in their structs might be different to the way you're doing it. Tests which don't directly interact with the<br>Library's members are interchangeable in this sense, one student's tests could be paired up with another student's Library and<br>there wouldn't be any compatibility issues there.<br>So, to fix your error, try to design tests which don't stab -> into the Library, just call the functions in cspotify.h and check their outputs<br>are correct/they did the correct things.<br>(Answer adapted from a forum post by Dean Wunder)<br>Can I define structs from cspotify.c in test_cspotify.c?<br>Tests have been added in the autotest which are dedicated to testing some of the tests you write in test_cspotify.c. The<br>autotests will run the tests you write in test_cspotify.c with a deliberately incorrect cspotify.c solution. Your tests should be<br>able to detect the issue in the broken code and output "DOES NOT MEET SPEC" in particular scenarios.<br>2020/11/13 COMP1511 20T3 - Assignment 2 - CSpotify<br>https://cgi.cse.unsw.edu.au/~cs1511/20T3/assignments/ass2/index.html 13/15<br>Unfortunately no, See above.<br>Why do I keep getting the Incomplete definition of type ... error?<br>See above.<br>Look out for this space! More may be added to clarify any questions thr </div> <!--content_text--> </article> <!--content--> </div> <!--Container End--> <aside id="sitebar"> <div class="sitebar_list"> <h4 class="sitebar_title">联系我们</h4> <div class="tagcloud nr"> <ul> <li>QQ: 99515681</li> <li>微信:codehelp</li> <li>邮箱:99515681@qq.com </li> <li>工作时间:8:30-23:00 </li> </ul> </div> </div> <div class="sitebar_list2"> <h4 class="sitebar_title2">Database作业辅导</h4> <ul class="sitebar_list_ul"> <li><a href="/contents/11/5236.html" target="_blank" title="代做COMP291201编程、代写Python,c++程序语言、Java编程实验代写 代做Python程序|代写Database"> 代做COMP291201编程、代写Python,c++程序语言、Java编程实验代</a> </li> <li><a href="/contents/11/5235.html" target="_blank" title="LP101留学生程序代写、代做c++程序实验、c/c++编程语言调试 帮做Java程序|帮做C/C++编程"> LP101留学生程序代写、代做c++程序实验、c/c++编程语言调试 帮做</a> </li> <li><a href="/contents/11/5234.html" target="_blank" title="代写MAT00027I编程、代做program程序设计、代写Java实验编程 代做数据库SQL|帮做C/C++编程"> 代写MAT00027I编程、代做program程序设计、代写Java实验编程 代</a> </li> <li><a href="/contents/11/5233.html" target="_blank" title="ELE00107M程序代做、C++语言编程调试、Programming课程程序代写 调试Matlab程序|代做R语言程序"> ELE00107M程序代做、C++语言编程调试、Programming课程程序代写 </a> </li> <li><a href="/contents/11/5240.html" target="_blank" title="代做COMP291201编程、代写Python,c++程序语言、Java编程实验代写 "> 代做COMP291201编程、代写Python,c++程序语言、Java编程实验代</a> </li> </ul> </div> <div class="sitebar_list2"> <h4 class="sitebar_title2"> Algorithm 作业</h4> <ul class="sitebar_list_ul"> <li><a href="/contents/12/4203.html" target="_blank" title="代写HW 2留学生作业、代做Java程序语言作业、代写data课程作业、Java实验作业代做 代写R语言编程|代写Web开发"> 代写HW 2留学生作业、代做Java程序语言作业、代写data课程作业、</a> </li> <li><a href="/contents/12/4202.html" target="_blank" title="TIC2401作业代写、代做Computer Systems作业、Python,Java,c++编程作业代写 代做留学生Processing|代写Python编"> TIC2401作业代写、代做Computer Systems作业、Python,Java,c++</a> </li> <li><a href="/contents/12/4201.html" target="_blank" title="data留学生作业代做、代写Java,c/c++程序语言作业、Python编程设计作业调试 代做留学生Prolog|代写留学生 Statistics统计、回归、"> data留学生作业代做、代写Java,c/c++程序语言作业、Python编程</a> </li> <li><a href="/contents/12/4206.html" target="_blank" title="代写HW 2留学生作业、代做Java程序语言作业、代写data课程作业、Java实验作业代做 "> 代写HW 2留学生作业、代做Java程序语言作业、代写data课程作业、</a> </li> <li><a href="/contents/12/4205.html" target="_blank" title="TIC2401作业代写、代做Computer Systems作业、Python,Java,c++编程作业代写 "> TIC2401作业代写、代做Computer Systems作业、Python,Java,c++</a> </li> </ul> </div> <div class="sitebar_list2"> <h4 class="sitebar_title2">Web作业</h4> <ul class="sitebar_list_ul"> <li><a href="/contents/13/4354.html" target="_blank" title="159.341作业代做、代写C/C++语言作业、代做C/C++程序设计作业、代写data留学生作业 调试Matlab程序|代做SPSS"> 159.341作业代做、代写C/C++语言作业、代做C/C++程序设计作业、</a> </li> <li><a href="/contents/13/4353.html" target="_blank" title="代写CSC3002作业、Computer Science作业代做、代写c++语言作业、代做C++程序设计作业 代做Database|代写Database"> 代写CSC3002作业、Computer Science作业代做、代写c++语言作业、</a> </li> <li><a href="/contents/13/4352.html" target="_blank" title="ECOM151作业代写、Data Applications作业代做、代写R编程设计作业、代做R程序语言作业 代做SPSS|代做SPSS"> ECOM151作业代写、Data Applications作业代做、代写R编程设计作</a> </li> <li><a href="/contents/13/4351.html" target="_blank" title="HW3留学生作业代做、R程序设计作业调试、R语言作业代写、代做data课程作业 代做Database|帮做Java程序"> HW3留学生作业代做、R程序设计作业调试、R语言作业代写、代</a> </li> <li><a href="/contents/13/4350.html" target="_blank" title="Data Bootcamp作业代做、代写Python程序语言作业、代做data课程作业、Python实验作业代写 调试Matlab程序|帮做Java程序"> Data Bootcamp作业代做、代写Python程序语言作业、代做data课程</a> </li> </ul> </div> <div class="sitebar_list2"> <h4 class="sitebar_title2">其他</h4> <ul class="sitebar_list_ul"> <li><a href="/contents/14/4669.html" target="_blank" title="翻转课堂理念下的中国古代文学教学——以“三言”学习为例"> 翻转课堂理念下的中国古代文学教学——以“三言”学习为例</a> </li> <li><a href="/contents/14/4670.html" target="_blank" title="韩国三大古典小说与中国古代文学的关联及其渊源"> 韩国三大古典小说与中国古代文学的关联及其渊源</a> </li> <li><a href="/contents/14/4671.html" target="_blank" title="中国古代文学的对外传播方式研究——以《红楼梦》的域外传播为例"> 中国古代文学的对外传播方式研究——以《红楼梦》的域外传播为例</a> </li> <li><a href="/contents/14/4673.html" target="_blank" title="论人文精神教育在高校古代文学教学的实施策略"> 论人文精神教育在高校古代文学教学的实施策略</a> </li> <li><a href="/contents/14/4672.html" target="_blank" title="基于OBE教育理念的中国古代文学教学改革与思考"> 基于OBE教育理念的中国古代文学教学改革与思考</a> </li> <li><a href="/contents/14/4674.html" target="_blank" title="俄罗斯古代文学中的宗教意识表现"> 俄罗斯古代文学中的宗教意识表现</a> </li> </ul> </div> </aside> <div class="clear"></div> </div> <!--main--> <footer id="dibu" > <div class="dibu-main"> <div class="bleft"> <ul class="menu"> </ul> <div class="bottom bootom2">版权所有 © 2019 <a href="http://www.3daixie.com" title="代写留学生作业网, 留学生作业代写网">留学生作业代写网</a> <a href="http://www.3daixie.com" title="代写留学生作业网, 留学生作业代写网">代写留学生作业网</a><br> 本站所有信息来源于网络,仅供学习使用,版权和著作权归原作者所有,如有不愿意被转载的请通知我们删除。 </div> </div> </div> </div> </footer> <span style="display:none"> <script type="text/javascript">var cnzz_protocol = (("https:" == document.location.protocol) ? "https://" : "http://");document.write(unescape("%3Cspan id='cnzz_stat_icon_1275934042'%3E%3C/span%3E%3Cscript src='" + cnzz_protocol + "s5.cnzz.com/z_stat.php%3Fid%3D1275934042%26show%3Dpic1' type='text/javascript'%3E%3C/script%3E"));</script> </span> <!--dibu--> </body> </html>