Giter Site home page Giter Site logo

131p4_tester's Introduction

How to run:
place repo folder in project directory.
run ./check from within repo folder (run chmod +x check if necessary)

How to write your own tests:
Use existing tests as a template to create .glsl and .dat files.
Create .out file either by running your program or computing the result by hand.

To verify your .out file is correct:
1) copy and paste your .glsl file here: http://shdr.bkcore.com/
2) Add 'precision highp float;' as the first line in the file
3) Add the following main method at the bottom

void main(){
  if(_YourFunctionHere_() == _YourOuputHere_)
    gl_FragColor = vec4(0,1,0,1.0); // green
  else
    gl_FragColor = vec4(1,0,0,1.0);  // red
}

If your output is correct you will see a green monkey head. If your output is wrong, it'll be red.
Once you verify your test case is correct, create a pull request to share it.



Example (using swizzle.glsl):
/******Original test case *******/
vec2 v =  // = .5,  1.5
float test(){
   vec3 t;
   t = v.xxx + v.xxx; // t = (1, 1, 1)
   vec3 f;
   f = t;  // f = (1, 1, 1)
   f.z = -1.0;   // f = (1, 1, -1)
   t.z = 0.0;    // t = (1, 1, 0)
   t.x = t.z + t.y;        // t = (0, 1, -1)
   t.yx = t.xy + t.xy;     // t = (2, 0, -1)
   return t.x; // 2.0
}

/***** Input for online compiler  ******/

precision highp float;   // This is always required for shdr.bkcore.com
vec2 v = vec2(.5, 1.5);  // Add initializers that were declared in .dat file


float test(){
   vec3 t;
   t = v.xxx + v.xxx;
   vec3 f;
   f = t;  
   f.z = -1.0;  
   t.z = 0.0;  
   t.x = t.z + t.y;
   t.yx = t.xy + t.xy;   
   return t.x;
}

void main() {
  if(test() == 2.0) // Assert function call returns expected value
    gl_FragColor = vec4(0,1,0,1.0); // green
  else
    gl_FragColor = vec4(1,0,0,1.0);  // red
}

131p4_tester's People

Contributors

edarke avatar albertchang avatar andrewlikesfood avatar

Watchers

James Cloos avatar  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.