Yi Xie
    • Create new note
    • Create a note from template
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Write
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
    • Invite by email
      Invitee

      This note has no invitees

    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Note Insights New
    • Engagement control
    • Make a copy
    • Transfer ownership
    • Delete this note
    • Save as template
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Note Insights Versions and GitHub Sync Sharing URL Create Help
Create Create new note Create a note from template
Menu
Options
Engagement control Make a copy Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Write
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
  • Invite by email
    Invitee

    This note has no invitees

  • Publish Note

    Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

    Your note will be visible on your profile and discoverable by anyone.
    Your note is now live.
    This note is visible on your profile and discoverable online.
    Everyone on the web can find and read all notes of this public team.
    See published notes
    Unpublish note
    Please check the box to agree to the Community Guidelines.
    View profile
    Engagement control
    Commenting
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Suggest edit
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    Emoji Reply
    Enable
    Import from Dropbox Google Drive Gist Clipboard
       Owned this note    Owned this note      
    Published Linked with GitHub
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    # CS50 Nuggets testing ## Server The `server.c` is the core program of this project, and is tested by the following steps, all testing using the given compiled player : * Testing with differernt invalid command line arguments to see if the program is able to catch those errors. Include all the possible situation: invalid number of arguments, invalid path for the maps. * Testing with different maps and one player without seed to check if the game start correctly. * Testing with different maps, one player and a spectator without seed, to check if the player is able to move using the keystroke in the spec. * Testing the same map, one player with seed to check the gold collection: 1. player is able to collect gold at the pile 2. the gold pile is back to the room spot after the player collect the gold 3. player can collect all the gold, and game exit normally after all gold is collected * Testing with all differents maps, random number of bots, and spectat any bad game logic, such as location switch ## Player The `player` directory has `player.c`, which is mainly tested through integration testing for functionalities. Unit testing wise, the following are done: * Testing the client with wrong number of arguments, and the `player.c` file will print a usage line if wrong number of arguments is provided. * Testing the client with correct number of arguments, but invalid port string or host. In this case,the client will print error message about failed server address initialization and exits 1. * Testing the client with screen smaller than the grid size requirement. In this case, the client will prompt user to enlarge screen and press ENTER after screen is large enough. Note that pressing ENTER while screen is not large enough will not result in the game proceeding, and neither does pressing keys other than ENTER. * Testing with valgrind to ensure no memory leaks. The only leak allowed was the "still reachable" leaks from the ncurses library, which is ignored per spec. ## Grid The `grid` directory has `gridtest.c`, which can be compiled by the `make test` target. `gridtest.c` is a simple unit test. It is limited in many ways as full interaction with the `grid` is impossible without the `server` and the `client`. A more extensive test will be performed in integration testing. With `maps/main.txt`, we test the following functionalities: * test `grid_load` with invalid file name. * test `grid_load` with `maps/main.txt`. * test `grid_toString` by printing the result. * test `grid_nrow` and `grid_ncol` * test `grid_update` and `grid_getchar` with out of bounds row and col values. * test `grid_update` and `grid_getchar` by checking if the character has been properly updated at the given spot. * test wrapper functions for `grid_getchar`. (`grid_isRock`, `grid_canMoveTo`, `grid_isRock`, `grid_isPlayer`, `grid_isEmptyRoomSpot`) * test `grid_setVisibility`. Print out the visible portion of the grid for the given location. Tested with various points including passages. ## Integration testing The integration testing has been done by combining all the modules we have and testing with different keystrokes, maps, seeds, and player behaviors. 1. We begin our integration testing by using the `main.txt` map which is standard size, and relatively low challenge for visibility. We then initiate only one player to collect gold. In this circumstance, we test the player's keystroke and movements, as well as the validity of visibility. We allow the player to use all 16 allowed movement keystrokes and observed the movement pattern. In addition, we check whether player is able to follow the visibility protocals and has view blocked by the wall and passageway. Furthermore, we observe whether player movement is hindered by wall and rock. 2. We further test our game system by allowing multiple players. In this case, on the basis of basic movement patterns, we also observe the behavior when players overstep on each other. We make sure that they correctly switch places, not only on their own displays, but on the spectator's display as well. In addition, we test with unknown keystrokes, and observe that the server sends back an error message, and player simply logs the error and ignores it. However, we do observe the situation that `down arrow` can be recognized as `[B` in Unix code, and ncurses thus parses the down arrow and sends the message to server, which server will parse the bracket and capital B separately, thus resulting in the same effect as a single capital B will have on the movement. We consider this to be an odd case and would not affect overall gameplay, and may be a limitation to Unix code. 3. After basic movement pattern has been proven correct, we observe the gold messages to ensure that it correctly displays on each player's screen respectively, as well as a special spectator's message. We allow players to move, collect gold, and quit halfway through the game, to ensure that "players are not allowed to rejoin or be replaced" per spec, and we tested that spectator can be replaced, which kicks out the previous spectator, per spec. In addition, we observed the end game summary table and ensured that it prints out correctly for each player, and includes info about the player who quited as well. 4. Furthermore, we vary our testing on different maps, and with different seeds. We ensured that seeds worked, as player are dropped to the same locations every time, the gold pile randomized to the same number if it's collected in the same order. We tried maps with harder visibility such as `challenge.txt` and observed game behavior. 5. Lastly, we ran with valgrind on the player side, and the server side to ensure no memory leak besides those caused by ncurses, which turned out to be the case.

    Import from clipboard

    Paste your markdown or webpage here...

    Advanced permission required

    Your current role can only read. Ask the system administrator to acquire write and comment permission.

    This team is disabled

    Sorry, this team is disabled. You can't edit this note.

    This note is locked

    Sorry, only owner can edit this note.

    Reach the limit

    Sorry, you've reached the max length this note can be.
    Please reduce the content or divide it to more notes, thank you!

    Import from Gist

    Import from Snippet

    or

    Export to Snippet

    Are you sure?

    Do you really want to delete this note?
    All users will lose their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template has been removed or transferred.
    Upgrade
    All
    • All
    • Team
    No template.

    Create a template

    Upgrade

    Delete template

    Do you really want to delete this template?
    Turn this template into a regular note and keep its content, versions, and comments.

    This page need refresh

    You have an incompatible client version.
    Refresh to update.
    New version available!
    See releases notes here
    Refresh to enjoy new features.
    Your user state has changed.
    Refresh to load new user state.

    Sign in

    Forgot password

    or

    By clicking below, you agree to our terms of service.

    Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    Help

    • English
    • 中文
    • Français
    • Deutsch
    • 日本語
    • Español
    • Català
    • Ελληνικά
    • Português
    • italiano
    • Türkçe
    • Русский
    • Nederlands
    • hrvatski jezik
    • język polski
    • Українська
    • हिन्दी
    • svenska
    • Esperanto
    • dansk

    Documents

    Help & Tutorial

    How to use Book mode

    Slide Example

    API Docs

    Edit in VSCode

    Install browser extension

    Contacts

    Feedback

    Discord

    Send us email

    Resources

    Releases

    Pricing

    Blog

    Policy

    Terms

    Privacy

    Cheatsheet

    Syntax Example Reference
    # Header Header 基本排版
    - Unordered List
    • Unordered List
    1. Ordered List
    1. Ordered List
    - [ ] Todo List
    • Todo List
    > Blockquote
    Blockquote
    **Bold font** Bold font
    *Italics font* Italics font
    ~~Strikethrough~~ Strikethrough
    19^th^ 19th
    H~2~O H2O
    ++Inserted text++ Inserted text
    ==Marked text== Marked text
    [link text](https:// "title") Link
    ![image alt](https:// "title") Image
    `Code` Code 在筆記中貼入程式碼
    ```javascript
    var i = 0;
    ```
    var i = 0;
    :smile: :smile: Emoji list
    {%youtube youtube_id %} Externals
    $L^aT_eX$ LaTeX
    :::info
    This is a alert area.
    :::

    This is a alert area.

    Versions and GitHub Sync
    Get Full History Access

    • Edit version name
    • Delete

    revision author avatar     named on  

    More Less

    Note content is identical to the latest version.
    Compare
      Choose a version
      No search result
      Version not found
    Sign in to link this note to GitHub
    Learn more
    This note is not linked with GitHub
     

    Feedback

    Submission failed, please try again

    Thanks for your support.

    On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

    Please give us some advice and help us improve HackMD.

     

    Thanks for your feedback

    Remove version name

    Do you want to remove this version name and description?

    Transfer ownership

    Transfer to
      Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

        Link with GitHub

        Please authorize HackMD on GitHub
        • Please sign in to GitHub and install the HackMD app on your GitHub repo.
        • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
        Learn more  Sign in to GitHub

        Push the note to GitHub Push to GitHub Pull a file from GitHub

          Authorize again
         

        Choose which file to push to

        Select repo
        Refresh Authorize more repos
        Select branch
        Select file
        Select branch
        Choose version(s) to push
        • Save a new version and push
        • Choose from existing versions
        Include title and tags
        Available push count

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Danger Zone

        Unlink
        You will no longer receive notification when GitHub file changes after unlink.

        Syncing

        Push failed

        Push successfully