Code Monkey home page Code Monkey logo

cexpect's People

Stargazers

 avatar  avatar

Watchers

 avatar

cexpect's Issues

A couple of minor nitpicks and low hanging fruits

[] It might be useful to try to guard against mutliple header file inclusion. E.g. include the content of each header file within #ifndef _FILENAME_H_ #define _FILENAME_H_ #endif blocks

[] It is not great (although for example Postgres does it some) use sizeof(type) in alloc functions. Especially if that type is char then some critique might follow. It is a bit more accepted to write type *var = allocfunc(nelems * sizeof(*var));

[] exit(func(foo)) is not really great since you probably want to be explicit of the exit status regardless of platform and or shell running it. One of the ways to write this is along the lines of

     if (func(foo))
          exit(EXIT_FAILURE);
     else
         exit(EXIT_SUCCESS);

[] Also the main function in the examples does not have a return value. Although the framework is expected to exit a return value will be asked from most compilers.

[] Use of sprintf is generally discouraged in preference to the safer snprintf which takes a size argument.

  • In the expression "%s", (expected_value ? "true" : "false") the parenthesis means something else, and although most compilers will not complain and do the right thing, they can and should be omitted.

Implement matchers for all standard C data types

Pulling from this list:

https://en.wikipedia.org/wiki/C_character_classification

Implement matchers in the form of:

expect(test, 'a', is_char_equal_to('a)); // passing
expect(test, 'b', is_char_equal_to('a)); // failing

  • char
  • signed char
  • unsigned char
  • unsigned ints
  • short
  • short int
  • signed short
  • signed short int
  • unsigned short
  • unsigned short int
  • int signed
  • signed int
  • unsigned
  • unsigned int
  • long
  • long int
  • signed long
  • signed long int
  • unsigned long
  • unsigned long int
  • long long
  • long long int
  • signed long long
  • signed long long int
  • unsigned long long
  • unsigned long long int
  • float
  • double
  • long double

Implement a not() matcher that inverts a matcher

Given an empty list:

List * make_list()

When I make an expectation using a not matcher and the is_list_empty() matcher:

expect(test, list, not(is_list_empty()));

Then the test should fail.

Note: I'm not exactly sure what the expected and actual messages should be. This might require some pre-refactoring to do well.

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.