Questions tagged [table-driven]

Table-Driven algorithms lookup information (usual states) in a table to perform subsequent operations. They are essentially used for a variety of automaton algorithms such as finite-state-machines.

18 questions
128
votes
7 answers

How to test the equivalence of maps in Golang?

I have a table-driven test case like this one: func CountWords(s string) map[string]int func TestCountWords(t *testing.T) { var tests = []struct { input string want map[string]int }{ {"foo", map[string]int{"foo":1}}, {"foo bar…
andras
  • 6,339
  • 6
  • 26
  • 22
12
votes
2 answers

direct-coded vs table-driven lexer?

I'm new in compiler construction world , I want to know what are the differences between direct-coded vs table-driven lexer analyzer ? Please use simple source code example if it's possible. Thanks. Edit : in Engineering a Compiler book, the author…
Ahmed T. Ali
  • 1,021
  • 1
  • 13
  • 22
12
votes
3 answers

What are table-driven methods?

What is a "table-driven method"? As mentioned by Bill Gates in the second Windows Vista commercial at 1:05.
Jonathan
  • 2,183
  • 4
  • 20
  • 25
7
votes
5 answers

How to use Decision Tables to help your application

I learned some time ago about Decision Trees and Decision tables. I feel that Decision Tables can help with conditional If-Then-Else statements. In particular, I feel that Decision Tables have no side-effects, for example, if you didn't notice that…
Jonathan
  • 2,183
  • 4
  • 20
  • 25
4
votes
1 answer

Table driven tests with testify mock

Are there any examples of writing clean table driven tests using testify. A table driven test for input and expected output works well but having to test the output from a dependency seems to be really hard to do. The below example uses one mocked…
nitimalh
  • 919
  • 10
  • 26
3
votes
1 answer

How to write the test case of When a function having the parameters of c *gin.Context

I'm writing the test cases of the controllers for my project in golang. In the controllers there is the function name SaveProvider()having parameter c *gin.Context and I don't know how to pass the JSON to the c *gin.Context this parameter and How I…
user10031766
2
votes
1 answer

Recommend visually appealing table-driven web forms management framework?

Nearly all our work is "by hand" with some excellent in-house frameworks. However, these are for ERP-style applications and are (sometimes too) complex. Working with more business-critical applications, one focuses on function and not…
Jé Queue
  • 10,359
  • 13
  • 53
  • 61
1
vote
1 answer

Table Driven Tests with Gradle: NoClassDefFoundError TableTestingKt

I use kotlintest in a Spring Boot Project for unit and integration testing. I can run my unit tests without any troubles in IntelliJ and all of them are green. When I run my tests in gradle with ./gradlew clean test though, all my tests using the…
peach
  • 657
  • 5
  • 26
1
vote
1 answer

Table-driven lexical analyzer/scanner implementation

Actually I have two questions. If I start writing my own lexical analyzer, parser what architecture it will be? What principles should I consider (i.e. Open-Close, loose coupling)? Next question is about table-driven lexical analyzer implementation.…
lexeme
  • 2,915
  • 10
  • 60
  • 125
1
vote
2 answers

Testing antlr4 visitor rules

I've got a fairly complicated antlr4 grammar that utilizes a visitor pattern. I'd like to test parts of the visitor. What's a good way to test individual visit rules? My visitor has tons of rules like this that I want to test: @Override public…
Epsilon Prime
  • 4,576
  • 5
  • 31
  • 34
0
votes
2 answers

Is there a way to combine two Scala TableDrivenPropertyChecks Tables into one?

I want to combine two tables: one containing inputs and the other containing expected outputs into a single table that I can run through ScalaTest's TableDrivenProperyChecks framework. Below is essentially what I'm going for: import…
sahibeast
  • 341
  • 3
  • 13
0
votes
1 answer

How to test generic function with table driven tests (Go)?

We were brainstorming possible ways of testing generic functions using table driven tests. It seems pretty complicated at the first glance. What we wanted to achieve is to have a field in the test table struct that can be of whatever type that is…
0
votes
0 answers

Write a table driven query with a dynamically declared table name?

I am consistently running a report and creating tables for this report. Now other users are running thsi report as well. So I need users to be able to run stored procedure simultaniously without worry of overwriting tables. I tried using a simple…
0
votes
0 answers

Table Driven Dependence

I'm performing a re-write of an application to be dependent upon Table Driven methodologies. The candidate application processes events through conditional logic. The rewrite will remove hard-coded event dependence in favor of decision making via…
Mushy
  • 2,535
  • 10
  • 33
  • 54
0
votes
0 answers

Having trouble understanding state-table implementation with a table-driven approach

I originally was working to implement a 4-state state table in C using the usual switch and case methods, but recently stumbled upon the use of table-driven programming to more easily create it. After researching it, I still find myself confused on…
Kevin
  • 11
1
2