Coder Social home page Coder Social logo

testml-lang / testml Goto Github PK

View Code? Open in Web Editor NEW
12.0 6.0 10.0 11.86 MB

TestML - Multilingual Data Driven Testing

Home Page: https://testml-lang.github.io/testml/

Shell 11.37% Makefile 9.67% Vim Script 0.11% CoffeeScript 18.87% C++ 0.51% Perl 21.64% Python 9.44% Dockerfile 0.56% Go 6.87% Ruby 9.22% Raku 11.74%

testml's Issues

Compiler: method name with _ compiles wrong

Bridge method names with _ in them do compile, but totally incorrectly.

Either need to forbid _ in method name and give a nice error message, or allow
them to mean same thing as -. It might be nice to only allow -; then testml
tests will look consistent.

Old TestML versions only allowed _ and not -.

Materials for the C++ impl

https://stackoverflow.com/questions/26575303/create-function-call-dynamically-in-c
https://en.cppreference.com/w/cpp/utility/integer_sequence

struct FnHolder {
  virtual json call(std::vector<json>);
};
template <typename Ret, typename...Arg>
struct FnHolderImpl : FnHolder {
  template<typename T>
  T fromjson(json);
  template<>
  std::string frojson(json); /* this typechecks etc */
  // here other impls

  template<typename T>
  json tojson(T); /* ....yada yada with all the impls */

  Ret (*_func)(Arg...);
  FnHolderImpl(Ret (*func)(Arg...)) : _func(func) {} // store func for later
  json call(std::vector<json> args) {
    if (args.size() != sizeof...(Arg))
       throw error;
    std::vector<std::any> xs = { fromjson<Arg>(fetch_back(args))... };
    Ret value = _func(any_ref_cast<Arg>().do_cast(fetch_back(xs)));
    return tojson(value);
  }
};
std::unordered_map<std::string /*name*/, FnHolder*> container;
template <typename Ret, typename...Arg>
void register(std::string name, Ret (*func)(Arg...)) {
  container[name] = new FnHolderImpl(func);
}

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.