-
Notifications
You must be signed in to change notification settings - Fork 16
03 bank ocr only #33
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
ZakKurasov
wants to merge
35
commits into
driverdevteam:master
Choose a base branch
from
ZakKurasov:03-bank-ocr-only
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
03 bank ocr only #33
Changes from all commits
Commits
Show all changes
35 commits
Select commit
Hold shift + click to select a range
cc19506
Merge pull request #1 from driverdevteam/master
mettizik 4cb1311
WS#2 added word wrapp task for demo
mokychandrey cfbde7d
Merged remote head
mokychandrey c518474
added word wrapp to demos
mokychandrey 21dea71
added word wrapp to demos
mokychandrey aeaa1a8
decomposition
ZakKurasov 006e95b
red
ZakKurasov 870070e
green
ZakKurasov 841f346
red
ZakKurasov 7ff71ac
green
ZakKurasov 728f780
refactoring
ZakKurasov 09a815d
red
ZakKurasov 1a67462
green
ZakKurasov 7bc1b5c
red
ZakKurasov 252239e
green
ZakKurasov dbdb55d
red
ZakKurasov 9cbffdd
green
ZakKurasov fd6100c
red
ZakKurasov 510db83
green
ZakKurasov 0c08553
refactoring
ZakKurasov fc91d3d
red
ZakKurasov 2f96057
green
ZakKurasov 8eec6f5
red
ZakKurasov de73cd9
green
ZakKurasov 35be7f2
refactoring
ZakKurasov 27799d3
red
ZakKurasov b93f91d
green
ZakKurasov 51bfdc9
refactoring
ZakKurasov e5d3a9e
red
ZakKurasov cedcd2e
green
ZakKurasov 34665ea
red
ZakKurasov 3022691
green
ZakKurasov 6e46818
red
ZakKurasov a86d302
green
ZakKurasov ba8f865
acceptance
ZakKurasov File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -15,5 +15,3 @@ such: 1 | |
|
|
||
| #include <gtest/gtest.h> | ||
| #include <string> | ||
| #include <map> | ||
|
|
||
File renamed without changes.
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,77 @@ | ||
| /* | ||
| Write a function, that is given a string and a length limit, splits provided string into sequence of string, | ||
| where length of each string is not more, than provided limit. If there are spaces under provided limit - | ||
| last space should be used to wrapp this line. If there are no spaces - wrapp it on provided length limit. | ||
|
|
||
| Example: | ||
| When pos is specified, the search only includes sequences of characters that begin at or before position pos, | ||
| ignoring any possible match beginning after pos | ||
|
|
||
| split(hee, 1) -> h, e, e | ||
| split(hee, 2) -> he, e | ||
| split("ha ha", 2|3|4) -> "ha", "ha" | ||
| split("h a", 1) -> "h", "a" | ||
|
|
||
| "When pos is specified, the", | ||
| "search only includes sequences", | ||
| "of characters that begin at or", | ||
| "before position pos, ignoring", | ||
| "any possible match beginning", | ||
| "after pos." | ||
| */ | ||
|
|
||
| #include <gtest/gtest.h> | ||
| #include <string> | ||
| #include <vector> | ||
|
|
||
| using StringContainer = std::vector<std::string>; | ||
| StringContainer SplitString(const std::string& string, size_t length) | ||
| { | ||
| auto firstSpaceInSubstr = string.rfind(' ', length); | ||
| std::string::size_type offset = length; | ||
| if (firstSpaceInSubstr != std::string::npos) | ||
| { | ||
| offset = firstSpaceInSubstr + 1; | ||
| } | ||
|
|
||
| StringContainer result {{ string.substr(0, offset) }}; | ||
|
|
||
| if (length < string.size()) | ||
| { | ||
| result.push_back(string.substr(offset)); | ||
| } | ||
| return result; | ||
| } | ||
|
|
||
| TEST(SplitString, OnePartForOneSymbol) | ||
| { | ||
| StringContainer parts = {"a"}; | ||
| EXPECT_EQ(parts, SplitString("a", 1)); | ||
| } | ||
|
|
||
| TEST(SplitString, AbFirstForAbbaAnd2) | ||
| { | ||
| EXPECT_EQ("Ab", SplitString("Abba", 2).at(0)); | ||
| } | ||
|
|
||
| TEST(SplitString, BaSecondForAbbba) | ||
| { | ||
| EXPECT_EQ("ba", SplitString("Abba", 2).at(1)); | ||
| } | ||
|
|
||
| TEST(SplitString, AbForAbAnd4) | ||
| { | ||
| EXPECT_EQ("Ab", SplitString("Ab", 4).at(0)); | ||
| } | ||
|
|
||
| TEST(SplitString, SplitAb_AbBeforeSpaceReturnsAbAndAb) | ||
| { | ||
| StringContainer parts = {"Ab", "Ab"}; | ||
| EXPECT_EQ(parts, SplitString("Ab Ab", 2)); | ||
| } | ||
|
|
||
| TEST(SplitString, SplitAb_AbAtSpaceReturnsAbAndAb) | ||
| { | ||
| StringContainer parts = {"Ab", "Ab"}; | ||
| EXPECT_EQ(parts, SplitString("Ab Ab", 3)); | ||
| } |
This file contains hidden or 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
This file contains hidden or 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
This file was deleted.
Oops, something went wrong.
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5,5 +5,4 @@ SUBDIRS += \ | |
| 02_ternary_numbers \ | ||
| 03_bank_ocr \ | ||
| 04_weather_client \ | ||
| 05_word_wrapp \ | ||
| 06_coffee | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Определять на этапе планирования интерфейсы функций не очень гуд - таким образом снижается эффект от очень важной фичи TDD проектирования кода исходя из потребностей. И если в данном случае, это не является проблемой в виду 4-х функций, на бОльших системах это может снижать удобство использования интерфейсов