wxMaxima
Loading...
Searching...
No Matches
Data Structures | Macros | Typedefs | Functions
test_EvalQueueCommands.cpp File Reference

Command-level behavior of the EvaluationQueue: how a GroupCell's input is broken into the individual commands that are sent to maxima one at a time, and how the queue advances from cell to cell. More...

#include <wx/app.h>
#include <wx/bitmap.h>
#include <wx/dcmemory.h>
#include <wx/frame.h>
#include <wx/log.h>
#include <functional>
#include <vector>
#include "Configuration.h"
#include "EvaluationQueue.h"
#include "worksheet/Worksheet.h"
#include "cells/EditorCell.h"
#include "cells/GroupCell.h"
#include "cells/TextCell.h"
#include <cstdlib>
#include <unistd.h>
#include <catch2/catch.hpp>
Include dependency graph for test_EvalQueueCommands.cpp:

Data Structures

class  TestApp
 

Typedefs

using PromptReaction = std::function< void(const wxString &)>
 A "prompt" reaction: given the command just read, update lisp mode the way maxima's prompt would (MAXIMA> after to_lisp(), %-prompt after (to-maxima)).
 

Functions

 SCENARIO ("A single maxima statement is one command")
 
 SCENARIO ("Several ;/$-terminated statements in one cell are separate commands")
 
 SCENARIO ("Commands are drawn from the cells in queue order")
 
 SCENARIO ("A cell without a runnable command still becomes the working cell once")
 
 SCENARIO ("A :lisp reader-macro line is a single lisp command")
 
 SCENARIO ("While maxima is already in lisp mode, a form stays one command")
 
 SCENARIO ("CommandsLeftInCell counts down as commands are consumed")
 
 SCENARIO ("A lone to_lisp() is terminated and sent by itself", "[redesign]")
 
 SCENARIO ("to_lisp() then lisp forms in one cell is driven per-command by the " "prompt", "[redesign]")
 
 wxDECLARE_APP (TestApp)
 
int main (int argc, char **argv)
 

Detailed Description

Command-level behavior of the EvaluationQueue: how a GroupCell's input is broken into the individual commands that are sent to maxima one at a time, and how the queue advances from cell to cell.

This is the GUI-free safety net for the "lazy, purely prompt-driven" queue: each command is tokenized in the lisp/maxima mode current when its turn comes; only the last command of a cell is terminated, and only in maxima mode; and in lisp mode each top-level form is sent as its own command (maxima's lisp REPL prints a prompt per form). Scenarios tagged "[redesign]" pin the behaviors that motivated that rewrite (a lone to_lisp() terminated by the queue itself; a to_lisp() followed by lisp forms split into per-command sends).

The queue is driven exactly the way the live code drives it: read the current command with GetCommand(), let a "prompt" possibly flip lisp mode, then RemoveFirst() to advance - so a future prompt-driven queue can be exercised here without a Worksheet, a socket, or maxima.