Skip to content

Conversation

@ajani2001
Copy link

No description provided.


@JsName("Counter_test")
@Test
fun `Counter test`() { // TODO: find an appropriate place for this test
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Что тестирует этот тест?

И чёт кажись счётчикам таки нужен отдельный тип/класс с операциями ограниченными до inc/dec


@JsName("qbit_should_accumulate_concurrent_increments_of_counter")
@Test
fun `qbit should accumulate concurrent increments of counter`() {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Это тест по хорошему должен быть в ПРе со счётчиками, не?

import kotlinx.serialization.Serializable

@Serializable
class Register<T>(
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Мне тут не нравится всё

  1. Нельзя использовать изменяемые структуры данных
  2. почему АПИ позволяет создание сразу "переполненого регистра"?
  3. У меня точно было это в голове и кажись мы где-то в чатиках обсуждали, что регистры должны быть обычными типами данных, на которые в схеме навешана функция свёртки списка в одно значение
  4. Я щяс чёт ваще не вижу, чтобы этот тип добавлял какую-то ценность относительно списков

}

fun <T : Any> ofValue(value: T?): DataType<T>? = when (value) {
fun <T : Any> ofValue(value: T?): DataType<T>? = when (value) { // TODO REFACTOR
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Рефактор что, как, зачем?


fun isListOfVals(list: List<Any>?) =
list == null || list.isEmpty() || list.firstOrNull()?.let { DataType.ofValue(it)?.value() } ?: true
list == null || list.isEmpty() || list.firstOrNull()?.let { DataType.ofValue(it)?.value() } ?: true // TODO REFACTOR
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Тот же вопрос

(elementDescriptor.getElementDescriptor(0).getElementDescriptor(0).kind is PrimitiveKind ||
elementDescriptor.getElementDescriptor(0).getElementDescriptor(0).kind == StructureKind.LIST) // ByteArray

private fun isRefRegister(elementDescriptor: SerialDescriptor, value: Any) = // TODO REFACTOR
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Как?

elementDescriptor.kind == StructureKind.LIST && value is List<*>

private fun isValueRegister(elementDescriptor: SerialDescriptor, value: Any) =
value is Register<*> && //TODO DEDUPLICATE
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

С чем?

private fun isScalarRef(elementDescriptor: SerialDescriptor) =
elementDescriptor.kind == StructureKind.CLASS
private fun isScalarRef(elementDescriptor: SerialDescriptor, value: Any) =
elementDescriptor.kind == StructureKind.CLASS && value !is Register<*>
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

!is Register<*> надо где-то заныкать в виде isNotIntrinsic

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants