ソフトウェア | バージョン | 備考 |
---|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Doctest | |
from collections import deque | |
from typing import Any | |
import unittest | |
import doctest | |
class Stack: | |
def __init__(self, maxlen: int = 256) -> None: | |
self.capacity = maxlen |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 探索アルゴリズム | |
Describe "線形探索" { | |
It "シーケンスaからkeyと等価な要素を線形探索(while文)" { | |
SearchWhile @(6, 4, 3, 2, 1, 2, 8) 2 | Should Be 3 | |
SearchWhile @(12.7, 3.14, 6.4, 7.2, 7.2, 'End') 6.4 | Should Be 2 | |
SearchWhile @(4, 7, 5.6, 2, 3.14, 1) 5.6 | Should Be 2 | |
SearchWhile @('DTS', 'AAC', 'FLAC') 'DTS' | Should Be 0 | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# https://qiita.com/opengl-8080/items/bb0f5e4f1c7ce045cc57 | |
# データ構造と配列 | |
Describe "TestTotal" { | |
It "5人の点数を読み込んで合計点・平均点を返す" { | |
Total 32 68 72 54 92 | Should Be '318,63.6' | |
} | |
} | |
function Total { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# アルゴリズムとは | |
## 3値の最大値 | |
Describe "Max3" { | |
Context "3つの整数値を読み込んで最大値を求めて表示" { | |
$testCase = @( | |
@{ a = 3; b = 2; c = 1; expectedResult = 3 } | |
@{ a = 3; b = 2; c = 2; expectedResult = 3 } | |
@{ a = 3; b = 1; c = 2; expectedResult = 3 } | |
@{ a = 3; b = 2; c = 3; expectedResult = 3 } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from collections import deque | |
from typing import Any | |
import unittest | |
import doctest | |
# 固定長スタッククラス | |
class TestFixedStack(unittest.TestCase): | |
def test_push(self): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Doctest | |
import unittest | |
import doctest | |
class TestPl(unittest.TestCase): | |
def test_売上総利益(self): | |
f = PL(FY27) | |
self.assertEqual(f['売上総利益'](), 75) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const assert = require("assert"); | |
const PL = (PL) => { | |
const 売上総利益 = (() => { | |
const 売上総利益 = PL.filter(o => Object.keys(o).some(v => ['売上高', '売上原価'].includes(v))) | |
return 売上総利益.reduce((a,v) => parseInt(Object.values(a)) + parseInt(Object.values(v))) | |
})() | |
const 営業利益 = (() => { | |
const 販管費 =(() => { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
assert(add(2, 2) == 5); | |
function add($a, $b) { | |
$sum = $a + $b; | |
return $sum; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 探索アルゴリズム | |
from __future__ import annotations | |
from enum import Enum | |
import hashlib | |
import copy | |
from typing import Any, Sequence | |
import unittest | |
import doctest |