GithubHelp home page GithubHelp logo

soyccan / lab0-c Goto Github PK

View Code? Open in Web Editor NEW

This project forked from sysprog21/lab0-c

1.0 0.0 0.0 107 KB

C Programming Lab: Assessing Your C Programming Skills

Home Page: http://wiki.csie.ncku.edu.tw/

License: Other

Makefile 1.78% C 74.84% Shell 14.22% Python 4.64% Batchfile 3.49% C++ 1.02%

lab0-c's Introduction

lab0-c

Assessing Your C Programming Skills

This lab will give you practice in the style of programming you will need to be able to do proficiently, especially for the later assignments in the class. The material covered should all be review for you. Some of the skills tested are:

  • Explicit memory management, as required in C.
  • Creating and manipulating pointer-based data structures.
  • Working with strings.
  • Enhancing the performance of key operations by storing redundant information in data structures.
  • Implementing robust code that operates correctly with invalid arguments, including NULL pointers.

The lab involves implementing a queue, supporting both last-in, first-out (LIFO) and first-in-first-out (FIFO) queueing disciplines. The underlying data structure is a singly-linked list, enhanced to make some of the operations more efficient.

Prerequisites

There are a few prerequisites which must be installed on your machine before you will be able to build and run the autograders.

The following command will install all required and optional dependencies on Ubuntu Linux 18.04 or later:

$ sudo apt install build-essential git clang-format cppcheck aspell colordiff valgrind

Note: Cppcheck version must be at least 1.90, otherwise it might report errors with false positives. You can get its version by executing $ cppcheck --version. Check Developer Info for building Cppcheck from source. Alternatively, you can make use of snap for latest Cppcheck:

$ sudo snap install cppcheck
$ export PATH=/snap/bin:$PATH

Running the autograders

Before running the autograders, compile your code to create the testing program qtest

$ make

Check the correctness of your code, i.e. autograders:

$ make test

Check the example usage of qtest:

$ make check

Each step about command invocation will be shown accordingly.

Check the memory issue of your code:

$ make valgrind
  • Modify ./.valgrindrc to customize arguments of Valgrind
  • Use $ make clean or $ rm /tmp/qtest.* to clean the temporary files created by target valgrind

Extra options can be recognized by make:

  • VERBOSE: control the build verbosity. If VERBOSE=1, echo eacho command in build process.
  • SANITIZER: enable sanitizer(s) directed build. At the moment, AddressSanitizer is supported.

Using qtest

qtest provides a command interpreter that can create and manipulate queues.

Run $ ./qtest -h to see the list of command-line options

When you execute $ ./qtest, it will give a command prompt cmd> . Type "help" to see a list of available commands.

Files

You will handing in these two files

  • queue.h : Modified version of declarations including new fields you want to introduce
  • queue.c : Modified version of queue code to fix deficiencies of original code

Tools for evaluating your queue code

  • Makefile : Builds the evaluation program qtest
  • README.md : This file
  • scripts/driver.py : The driver program, runs qtest on a standard set of traces

Helper files

  • console.{c,h} : Implements command-line interpreter for qtest
  • report.{c,h} : Implements printing of information at different levels of verbosity
  • harness.{c,h} : Customized version of malloc/free/strdup to provide rigorous testing framework
  • qtest.c : Code for qtest

Trace files

  • traces/trace-XX-CAT.cmd : Trace files used by the driver. These are input files for qtest.
    • They are short and simple.
    • We encourage to study them to see what tests are being performed.
    • XX is the trace number (1-15). CAT describes the general nature of the test.
  • traces/trace-eg.cmd : A simple, documented trace file to demonstrate the operation of qtest

License

lab0-cis released under the BSD 2 clause license. Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.

External source code:

lab0-c's People

Contributors

jserv avatar soyccan avatar yushuanhsieh avatar afcidk avatar naetw avatar mlouielu avatar reborn2266 avatar cjwind avatar jyun-neng avatar johnnylord avatar tfliao avatar

Stargazers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.