Skip to content
This repository has been archived by the owner on Oct 16, 2022. It is now read-only.
/ vscode-tasks Public archive

Tasks for automating C and Python programming in vscode-editor

License

Notifications You must be signed in to change notification settings

2trvl/vscode-tasks

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

vscode-tasks

This repository contains tasks for automating C and Python programming in vscode-editor.

Table of contents

  1. Installing
  2. Keybindings
  3. Features
  4. How to use the test site?
  5. Test site log example

Installing

Windows

  • install any Python 3.5+ version along with pip and add it to PATH
  • install MinGW compiler and add it to PATH
  • install cmake and Visual Studio with Clang compiler and add it to PATH
  • with vscode open press [ctrl+shift+p]
    • print "Preferences: Open Keyboard Shortcuts (JSON)" and press [enter], copy to the opened file all strings from .vscode/keybindings.json
  • with your terminal open as administrator run this commands:
    • python -m pip install --upgrade pip
    • pip install pyinstaller

Linux

  • with vscode open press [ctrl+shift+p]
    • print "Preferences: Open Keyboard Shortcuts (JSON)" and press [enter], copy to the opened file all strings from .vscode/keybindings.json
  • with your terminal open
    • install package named "pyinstaller" through python 3 pip (for example in ArchLinux: "sudo pip install pyinstaller", in Ubuntu: "sudo apt install python3-pip; sudo pip3 install pyinstaller")

Keybindings

  • [f2] - show build tasks
  • [f3] - show run tasks
  • [numpad2] - focus on the integrated terminal
  • [numpad8] - focus on the code area

important: to use numpad2 and numpad8 disable num lock

Features

  • Compile
    • clang (placed in ./cdist)
    • clang with cmake
    • python in one .exe (via pyinstaller, placed in ./pydist)
  • Run
    • compiled clang
    • python code (through the interpreter)
  • Test
    • clang
    • python code

How to use the test site?

  • Сreate test file with name <YourFileBasename>.test
    • for example: code.c --> code.c.test, where code.c.test is a file with tests for code.c
  • On each new line, write inputs without spaces, separating them ";" (for example: if the program accepts 3 numbers separated by spaces in one input, let these numbers be 1, 2 and 3, and the result should be 5, then you need to write "1 2 3 | 5")
    • important: after the last input don't put ";", instead ";" put "|" and write the expected outputs without spaces, separating them ";", after last output don't put ";"
    • another example for program, which accepts 3 names in 3 inputs and prints a greeting for them, you need to write in .test file this string "Pavel;Linus;Richard | Hello, Pavel, Linus, Richard!"
  • if you still have questions, then see the files:
    • ./test/code.c and ./test/code.c.test
    • ./test/B.py and ./test/B.py.test

Test site log example

Reading /home/trvlx/Desktop/vscode-tasks/test/B.py.test
Inputs:  [['abrakadabrabrakadabra'], ['acacacaca'], ['abcabc'], ['abababab'], ['abcd'], ['tatbt'], ['abrabrab']]
Outputs:  ['YES\nabrakadabra', 'YES\nacaca', 'NO', 'YES\nababab', 'NO', 'NO', 'YES\nabrab'] 

1 test: True (expected: "YES\nabrakadabra", received: "YES\nabrakadabra", time elapsed: 0.11915707588195801)
2 test: True (expected: "YES\nacaca", received: "YES\nacaca", time elapsed: 0.03830456733703613)
3 test: True (expected: "NO", received: "NO", time elapsed: 0.021285533905029297)
4 test: True (expected: "YES\nababab", received: "YES\nababab", time elapsed: 0.0199582576751709)
5 test: True (expected: "NO", received: "NO", time elapsed: 0.020659685134887695)
6 test: True (expected: "NO", received: "NO", time elapsed: 0.01970815658569336)
7 test: True (expected: "YES\nabrab", received: "YES\nabrab", time elapsed: 0.019896268844604492)

7 of 7 tests
all-time elapsed: 0.259307861328125

About

Tasks for automating C and Python programming in vscode-editor

Topics

Resources

License

Stars

Watchers

Forks